feat: delay start time
This commit is contained in:
parent
00efbdc6a2
commit
e2424298cf
1 changed files with 7 additions and 2 deletions
|
|
@ -252,7 +252,9 @@ export class BackupController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post("schedule")
|
@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)) {
|
if (!/^[a-zA-Z0-9\-]+$/.test(body.name)) {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "Invalid name.");
|
throw new HttpError(HttpStatus.BAD_REQUEST, "Invalid name.");
|
||||||
}
|
}
|
||||||
|
|
@ -271,6 +273,7 @@ export class BackupController extends Controller {
|
||||||
is_flow: true,
|
is_flow: true,
|
||||||
script_path: WINDMILL_BACKUP_FLOW_PATH,
|
script_path: WINDMILL_BACKUP_FLOW_PATH,
|
||||||
timezone: body.timezone || "Asia/Bangkok",
|
timezone: body.timezone || "Asia/Bangkok",
|
||||||
|
paused_until: body.startAt,
|
||||||
args: {
|
args: {
|
||||||
backup_name: body.name,
|
backup_name: body.name,
|
||||||
prefix_timestamp: true,
|
prefix_timestamp: true,
|
||||||
|
|
@ -302,7 +305,8 @@ export class BackupController extends Controller {
|
||||||
@Put("schedule/{id}")
|
@Put("schedule/{id}")
|
||||||
async updateSchedule(
|
async updateSchedule(
|
||||||
@Path() id: string,
|
@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)) {
|
if (!/^[a-zA-Z0-9\-]+$/.test(body.name)) {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "Invalid name.");
|
throw new HttpError(HttpStatus.BAD_REQUEST, "Invalid name.");
|
||||||
|
|
@ -320,6 +324,7 @@ export class BackupController extends Controller {
|
||||||
summary: body.name,
|
summary: body.name,
|
||||||
schedule: body.schedule,
|
schedule: body.schedule,
|
||||||
timezone: body.timezone || "Asia/Bangkok",
|
timezone: body.timezone || "Asia/Bangkok",
|
||||||
|
paused_until: body.startAt,
|
||||||
args: {
|
args: {
|
||||||
backup_name: body.name,
|
backup_name: body.name,
|
||||||
prefix_timestamp: true,
|
prefix_timestamp: true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue