mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Add schedule management features
- Implemented `HandleSchedules` component for creating and updating schedules with validation. - Added `ShowSchedules` component to display a list of schedules with options to edit and delete. - Created API routes for schedule management including create, update, delete, and list functionalities. - Defined the `schedule` table schema in the database with necessary fields and relationships. - Integrated schedule management into the application service dashboard, allowing users to manage schedules directly from the UI.
This commit is contained in:
@@ -31,3 +31,4 @@ export * from "./utils";
|
||||
export * from "./preview-deployments";
|
||||
export * from "./ai";
|
||||
export * from "./account";
|
||||
export * from "./schedule";
|
||||
|
||||
38
packages/server/src/db/schema/schedule.ts
Normal file
38
packages/server/src/db/schema/schedule.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { relations } from "drizzle-orm";
|
||||
import { pgTable, text } from "drizzle-orm/pg-core";
|
||||
import { createInsertSchema } from "drizzle-zod";
|
||||
import { nanoid } from "nanoid";
|
||||
import { z } from "zod";
|
||||
import { applications } from "./application";
|
||||
|
||||
export const schedules = pgTable("schedule", {
|
||||
scheduleId: text("scheduleId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
name: text("name").notNull(),
|
||||
cronExpression: text("cronExpression").notNull(),
|
||||
command: text("command").notNull(),
|
||||
applicationId: text("applicationId")
|
||||
.notNull()
|
||||
.references(() => applications.applicationId, {
|
||||
onDelete: "cascade",
|
||||
}),
|
||||
createdAt: text("createdAt")
|
||||
.notNull()
|
||||
.$defaultFn(() => new Date().toISOString()),
|
||||
});
|
||||
|
||||
export const schedulesRelations = relations(schedules, ({ one }) => ({
|
||||
application: one(applications, {
|
||||
fields: [schedules.applicationId],
|
||||
references: [applications.applicationId],
|
||||
}),
|
||||
}));
|
||||
|
||||
export const createScheduleSchema = createInsertSchema(schedules, {
|
||||
name: z.string().min(1),
|
||||
cronExpression: z.string().min(1),
|
||||
command: z.string().min(1),
|
||||
applicationId: z.string().min(1),
|
||||
});
|
||||
Reference in New Issue
Block a user