check is true

This commit is contained in:
mr 2024-08-12 09:30:07 +02:00
parent f8cf8156bd
commit 3b1bd41638
2 changed files with 4 additions and 9 deletions

View File

@ -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 {

View File

@ -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
}