check booking

This commit is contained in:
mr 2024-08-08 09:47:00 +02:00
parent e0eefd9c30
commit 47cd936131

View File

@ -22,7 +22,7 @@ func New() *workflowMongoAccessor {
return &workflowMongoAccessor{}
}
func (wfa *workflowMongoAccessor) checkBooking(data *Workflow) bool {
func (wfa *workflowMongoAccessor) CheckBooking(data *Workflow) 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)
@ -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) {
return 409, errors.New("the booking is already taken.")
}
if delete {