feat: delay start time

This commit is contained in:
Methapon2001 2024-07-18 17:16:13 +07:00
parent 00efbdc6a2
commit e2424298cf

View file

@ -252,7 +252,9 @@ export class BackupController extends Controller {
}
@Post("schedule")
async createSchedule(@Body() body: { name: string; schedule: string; timezone?: string }) {
async createSchedule(
@Body() body: { name: string; schedule: string; timezone?: string; startAt?: Date },
) {
if (!/^[a-zA-Z0-9\-]+$/.test(body.name)) {
throw new HttpError(HttpStatus.BAD_REQUEST, "Invalid name.");
}
@ -271,6 +273,7 @@ export class BackupController extends Controller {
is_flow: true,
script_path: WINDMILL_BACKUP_FLOW_PATH,
timezone: body.timezone || "Asia/Bangkok",
paused_until: body.startAt,
args: {
backup_name: body.name,
prefix_timestamp: true,
@ -302,7 +305,8 @@ export class BackupController extends Controller {
@Put("schedule/{id}")
async updateSchedule(
@Path() id: string,
@Body() body: { name: string; schedule: string; enabled?: boolean; timezone?: string },
@Body()
body: { name: string; schedule: string; enabled?: boolean; timezone?: string; startAt?: Date },
) {
if (!/^[a-zA-Z0-9\-]+$/.test(body.name)) {
throw new HttpError(HttpStatus.BAD_REQUEST, "Invalid name.");
@ -320,6 +324,7 @@ export class BackupController extends Controller {
summary: body.name,
schedule: body.schedule,
timezone: body.timezone || "Asia/Bangkok",
paused_until: body.startAt,
args: {
backup_name: body.name,
prefix_timestamp: true,