From 3b1bd416386af55d37810527404524cf394108e8 Mon Sep 17 00:00:00 2001 From: mr Date: Mon, 12 Aug 2024 09:30:07 +0200 Subject: [PATCH] check is true --- models/workflow/workflow.go | 11 +++-------- models/workflow/workflow_schedule.go | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/models/workflow/workflow.go b/models/workflow/workflow.go index dbe9dc6..c40ba30 100644 --- a/models/workflow/workflow.go +++ b/models/workflow/workflow.go @@ -2,16 +2,11 @@ package oclib import ( "encoding/json" - "fmt" "slices" - "time" - "cloud.o-forge.io/core/oc-lib/dbs" "cloud.o-forge.io/core/oc-lib/models/resources" "cloud.o-forge.io/core/oc-lib/models/resources/workflow/graph" "cloud.o-forge.io/core/oc-lib/models/utils" - "cloud.o-forge.io/core/oc-lib/models/workflow_execution" - "go.mongodb.org/mongo-driver/bson/primitive" ) type AbstractWorkflow struct { @@ -37,8 +32,8 @@ func (d *Workflow) GetName() string { } func (d *Workflow) CheckBooking() bool { - fmt.Println("CheckBooking", d.Schedule) - if d.Schedule != nil && d.Schedule.Start != nil { + return true + /*if d.Schedule != nil && d.Schedule.Start != nil { sd := primitive.NewDateTimeFromTime(d.Schedule.Start.Add(time.Minute * -1)) var f dbs.Filters if d.Schedule.End == nil { @@ -60,7 +55,7 @@ func (d *Workflow) CheckBooking() bool { res, _, _ := (&workflow_execution.WorkflowExecution{}).GetAccessor().Search(&f, "") return len(res) == 0 } - return true + return true*/ } func (d *Workflow) GetAccessor() utils.Accessor { diff --git a/models/workflow/workflow_schedule.go b/models/workflow/workflow_schedule.go index 18d0712..0d12a26 100644 --- a/models/workflow/workflow_schedule.go +++ b/models/workflow/workflow_schedule.go @@ -5,7 +5,7 @@ import "time" type WorkflowSchedule struct { Id string `json:"id"` Name string `json:"name" bson:"name" validate:"required"` - Start *time.Time `json:"start" bson:"start" validate:"required"` + Start *time.Time `json:"start" bson:"start" validate:"required,ltfield=End"` End *time.Time `json:"end,omitempty" bson:"end,omitempty"` Cron string `json:"cron,omitempty" bson:"cron,omitempty"` // ss mm hh dd MM dw task }