check booking
This commit is contained in:
parent
47cd936131
commit
f45ad91687
@ -22,10 +22,10 @@ func New() *workflowMongoAccessor {
|
||||
return &workflowMongoAccessor{}
|
||||
}
|
||||
|
||||
func (wfa *workflowMongoAccessor) CheckBooking(data *Workflow) bool {
|
||||
func (wfa *workflowMongoAccessor) CheckBooking(start *time.Time) bool {
|
||||
accessor := (&workflow_execution.WorkflowExecution{}).GetAccessor()
|
||||
s := data.Schedule.Start.Add(time.Duration(-10) * time.Second)
|
||||
e := data.Schedule.Start.Add(time.Duration(10) * time.Second)
|
||||
s := start.Add(time.Duration(-10) * time.Second)
|
||||
e := start.Add(time.Duration(10) * time.Second)
|
||||
sd := primitive.NewDateTimeFromTime(s)
|
||||
ed := primitive.NewDateTimeFromTime(e)
|
||||
f := dbs.Filters{
|
||||
@ -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 {
|
||||
return 200, nil
|
||||
}
|
||||
if !wfa.CheckBooking(realData) {
|
||||
if !wfa.CheckBooking(realData.Schedule.Start) {
|
||||
return 409, errors.New("the booking is already taken.")
|
||||
}
|
||||
if delete {
|
||||
|
Loading…
Reference in New Issue
Block a user