check booking
This commit is contained in:
parent
e0eefd9c30
commit
47cd936131
@ -22,7 +22,7 @@ func New() *workflowMongoAccessor {
|
|||||||
return &workflowMongoAccessor{}
|
return &workflowMongoAccessor{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wfa *workflowMongoAccessor) checkBooking(data *Workflow) bool {
|
func (wfa *workflowMongoAccessor) CheckBooking(data *Workflow) bool {
|
||||||
accessor := (&workflow_execution.WorkflowExecution{}).GetAccessor()
|
accessor := (&workflow_execution.WorkflowExecution{}).GetAccessor()
|
||||||
s := data.Schedule.Start.Add(time.Duration(-10) * time.Second)
|
s := data.Schedule.Start.Add(time.Duration(-10) * time.Second)
|
||||||
e := data.Schedule.Start.Add(time.Duration(10) * time.Second)
|
e := data.Schedule.Start.Add(time.Duration(10) * time.Second)
|
||||||
@ -96,7 +96,7 @@ func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delet
|
|||||||
if r.Schedule.Start == realData.Schedule.Start && r.Schedule.End == realData.Schedule.End && r.Schedule.Cron == realData.Schedule.Cron {
|
if r.Schedule.Start == realData.Schedule.Start && r.Schedule.End == realData.Schedule.End && r.Schedule.Cron == realData.Schedule.Cron {
|
||||||
return 200, nil
|
return 200, nil
|
||||||
}
|
}
|
||||||
if !wfa.checkBooking(realData) {
|
if !wfa.CheckBooking(realData) {
|
||||||
return 409, errors.New("the booking is already taken.")
|
return 409, errors.New("the booking is already taken.")
|
||||||
}
|
}
|
||||||
if delete {
|
if delete {
|
||||||
|
Loading…
Reference in New Issue
Block a user