package model import ( "time" "go.mongodb.org/mongo-driver/bson/primitive" ) type JobConfig struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id"` Name string `bson:"name" json:"name"` HandlerKey string `bson:"handlerKey" json:"handlerKey"` Enabled bool `bson:"enabled" json:"enabled"` ScheduleType string `bson:"scheduleType" json:"scheduleType"` ScheduleValue string `bson:"scheduleValue" json:"scheduleValue"` DefaultParams string `bson:"defaultParams" json:"defaultParams"` LastStatus string `bson:"lastStatus" json:"lastStatus"` LastRunAt *time.Time `bson:"lastRunAt,omitempty" json:"lastRunAt,omitempty"` NextRunAt *time.Time `bson:"nextRunAt,omitempty" json:"nextRunAt,omitempty"` CreatedAt time.Time `bson:"createdAt" json:"createdAt"` UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` } func NewJobConfig(name, handlerKey string) JobConfig { now := time.Now() return JobConfig{ Name: name, HandlerKey: handlerKey, LastStatus: "idle", CreatedAt: now, UpdatedAt: now, } }