Skip to content
This repository has been archived by the owner on Oct 3, 2019. It is now read-only.

Commit

Permalink
#37 mudando estrutura de load
Browse files Browse the repository at this point in the history
Co-authored-by: Ezequiel De Oliveira <ezequiel1de1oliveira@gmail.com>
Co-authored-by: Beatriz Hanae <beatriz.hanae@gmail.com>

Signer-off-by: Beatriz Hanae <beatriz.hanae@gmail.com>
Signed-off-by: Ezequiel de Oliveira <ezequiel1de1oliveira@gmail.com>
  • Loading branch information
EzequielDeOliveira committed May 12, 2018
1 parent 6140404 commit 7e89823
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions Schedule/Server/schedule.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<<<<<<< 7fe9fcc541f4cc63357480dbbef16a2f0d9f0e08
var seneca = require('seneca');
var currentWeekNumber = require('current-week-number');

Expand Down Expand Up @@ -103,48 +102,6 @@ seneca()
hoursForWeek = JSON.stringify(hoursForWeek);
respond(null,{hoursForWeek});
});
=======
require('seneca')()
.use("entity")
.use('mongo-store',{
name:'dataBaseSchedules',
host:'mongo',
port:27017
})
.use('seneca-amqp-transport')
.listen({
type:'amqp',
pin:'role:schedule',
port: 5672,
username: 'guest',
password: 'guest',
url: 'amqp://rabbitmq',
})

.add('role:schedule,cmd:create', function create (msg,respond) {
var schedule = this.make('schedule')
schedule.date = msg.date
schedule.start_time = msg.start_time
schedule.end_time = msg.end_time
schedule.sector = msg.sector
schedule.employee = msg.employee
schedule.specialty = msg.specialty
schedule.amount_of_hours = msg.amount_of_hours

schedule.list$({date:schedule.date, employee:schedule.employee}, function(err,list){
list.forEach(function(time){
if (Date.parse(schedule.start_time) >= Date.parse(time.start_time) && Date.parse(schedule.start_time) <= Date.parse(time.end_time)) {
respond(null, {success:false, message: 'Este funcionário possui uma escala em conflito com o horário selecionado'})
}else if (Date.parse(schedule.end_time) >= Date.parse(time.start_time) && Date.parse(schedule.end_time) <= Date.parse(time.end_time)) {
respond(null, {success:false, message: 'Este funcionário possui uma escala em conflito com o horário selecionado'})
}else if(Date.parse(schedule.start_time) <= Date.parse(time.start_time) && Date.parse(schedule.end_time) >= Date.parse(time.end_time)){
respond(null, {success:false, message: 'Este funcionário possui uma escala em conflito com o horário selecionado'})
}
})
})
schedule.save$(function(err,schedule){
respond(null,schedule)
>>>>>>> #30 Adicionando atributos corretos de acordo com a issue
})

.add('role:schedule, cmd:error', function error(msg, respond){
Expand Down

0 comments on commit 7e89823

Please sign in to comment.