mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-18 09:55:19 +00:00
refactor: streamline mount schema definitions by utilizing createSchema for improved consistency and clarity
This commit is contained in:
@@ -116,54 +116,43 @@ export type ServiceType = NonNullable<
|
|||||||
z.infer<typeof createSchema>["serviceType"]
|
z.infer<typeof createSchema>["serviceType"]
|
||||||
>;
|
>;
|
||||||
|
|
||||||
const serviceTypeEnum = z.enum([
|
export const apiCreateMount = createSchema
|
||||||
"application",
|
.pick({
|
||||||
"postgres",
|
type: true,
|
||||||
"mysql",
|
hostPath: true,
|
||||||
"mariadb",
|
volumeName: true,
|
||||||
"mongo",
|
content: true,
|
||||||
"redis",
|
mountPath: true,
|
||||||
"compose",
|
serviceType: true,
|
||||||
]);
|
filePath: true,
|
||||||
|
})
|
||||||
export const apiCreateMount = z.object({
|
.extend({
|
||||||
type: z.enum(["bind", "volume", "file"]),
|
serviceId: z.string().min(1),
|
||||||
hostPath: z.string().optional(),
|
});
|
||||||
volumeName: z.string().optional(),
|
|
||||||
content: z.string().optional(),
|
|
||||||
mountPath: z.string().min(1),
|
|
||||||
serviceType: serviceTypeEnum.default("application"),
|
|
||||||
filePath: z.string().optional(),
|
|
||||||
serviceId: z.string().min(1),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const apiFindOneMount = z.object({
|
export const apiFindOneMount = z.object({
|
||||||
mountId: z.string().min(1),
|
mountId: z.string().min(1),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const apiRemoveMount = z.object({
|
export const apiRemoveMount = createSchema
|
||||||
|
.pick({
|
||||||
|
mountId: true,
|
||||||
|
})
|
||||||
|
// .extend({
|
||||||
|
// appName: z.string().min(1),
|
||||||
|
// })
|
||||||
|
.required();
|
||||||
|
|
||||||
|
export const apiFindMountByApplicationId = createSchema
|
||||||
|
.extend({
|
||||||
|
serviceId: z.string().min(1),
|
||||||
|
})
|
||||||
|
.pick({
|
||||||
|
serviceId: true,
|
||||||
|
serviceType: true,
|
||||||
|
})
|
||||||
|
.required();
|
||||||
|
|
||||||
|
export const apiUpdateMount = createSchema.partial().extend({
|
||||||
mountId: z.string().min(1),
|
mountId: z.string().min(1),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const apiFindMountByApplicationId = z.object({
|
|
||||||
serviceId: z.string().min(1),
|
|
||||||
serviceType: serviceTypeEnum,
|
|
||||||
});
|
|
||||||
|
|
||||||
export const apiUpdateMount = z.object({
|
|
||||||
mountId: z.string().min(1),
|
|
||||||
type: z.enum(["bind", "volume", "file"]).optional(),
|
|
||||||
hostPath: z.string().optional(),
|
|
||||||
volumeName: z.string().optional(),
|
|
||||||
filePath: z.string().optional(),
|
|
||||||
content: z.string().optional(),
|
|
||||||
serviceType: serviceTypeEnum.optional(),
|
|
||||||
mountPath: z.string().min(1).optional(),
|
|
||||||
applicationId: z.string().optional(),
|
|
||||||
postgresId: z.string().optional(),
|
|
||||||
mariadbId: z.string().optional(),
|
|
||||||
mongoId: z.string().optional(),
|
|
||||||
mysqlId: z.string().optional(),
|
|
||||||
redisId: z.string().optional(),
|
|
||||||
composeId: z.string().optional(),
|
|
||||||
});
|
|
||||||
|
|||||||
Reference in New Issue
Block a user