package usecase import ( "haixun-backend/internal/library/clock" "haixun-backend/internal/model/job/domain/entity" ) const schedulePayloadKey = "_schedule" // buildScheduleRunPayload clones the schedule template payload and injects scheduler metadata. // Persisted timestamps use UTC unix nanoseconds; timezone is the cron interpretation zone. func buildScheduleRunPayload(schedule *entity.Schedule, triggeredAtUTC int64) map[string]any { payload := map[string]any{} for key, value := range schedule.PayloadTemplate { payload[key] = value } payload[schedulePayloadKey] = map[string]any{ "id": schedule.ID.Hex(), "timezone": schedule.Timezone, "cron": schedule.Cron, "triggered_at": triggeredAtUTC, "storage_tz": clock.StorageTimezone, } return payload }