Add schedule logs feature and enhance schedule management

- Introduced a new component `ShowSchedulesLogs` to display logs for each schedule, allowing users to view deployment logs associated with their schedules.
- Updated the `ShowSchedules` component to integrate the new logs feature, providing a button to access logs for each schedule.
- Enhanced the `schedule` schema by adding an `appName` column to better identify applications associated with schedules.
- Updated the API to support fetching deployments with their associated schedules, improving data retrieval for the frontend.
- Implemented utility functions for managing schedule-related operations, including creating and removing deployments linked to schedules.
This commit is contained in:
Mauricio Siu
2025-05-02 04:29:32 -06:00
parent 442f051457
commit f2bb01c800
14 changed files with 5949 additions and 71 deletions

View File

@@ -136,6 +136,17 @@ export const apiCreateDeploymentServer = schema
serverId: z.string().min(1),
});
export const apiCreateDeploymentSchedule = schema
.pick({
title: true,
status: true,
logPath: true,
description: true,
})
.extend({
scheduleId: z.string().min(1),
});
export const apiFindAllByApplication = schema
.pick({
applicationId: true,

View File

@@ -5,6 +5,8 @@ import { nanoid } from "nanoid";
import { z } from "zod";
import { applications } from "./application";
import { deployments } from "./deployment";
import { generateAppName } from "./utils";
export const schedules = pgTable("schedule", {
scheduleId: text("scheduleId")
.notNull()
@@ -12,6 +14,9 @@ export const schedules = pgTable("schedule", {
.$defaultFn(() => nanoid()),
name: text("name").notNull(),
cronExpression: text("cronExpression").notNull(),
appName: text("appName")
.notNull()
.$defaultFn(() => generateAppName("schedule")),
command: text("command").notNull(),
applicationId: text("applicationId")
.notNull()
@@ -24,6 +29,8 @@ export const schedules = pgTable("schedule", {
.$defaultFn(() => new Date().toISOString()),
});
export type Schedule = typeof schedules.$inferSelect;
export const schedulesRelations = relations(schedules, ({ one, many }) => ({
application: one(applications, {
fields: [schedules.applicationId],