mirror of
https://github.com/morten-olsen/mini-loader.git
synced 2026-02-08 01:36:26 +01:00
init
This commit is contained in:
28
packages/server/src/repos/runs/runs.schemas.ts
Normal file
28
packages/server/src/repos/runs/runs.schemas.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const runStatusSchema = z.enum(['running', 'succeeded', 'failed']);
|
||||
|
||||
const createRunSchema = z.object({
|
||||
loadId: z.string(),
|
||||
config: z.any().optional(),
|
||||
data: z.any().optional(),
|
||||
});
|
||||
|
||||
const updateRunSchema = z.object({
|
||||
status: runStatusSchema,
|
||||
error: z.string().optional(),
|
||||
});
|
||||
|
||||
const findRunsSchema = z.object({
|
||||
loadId: z.string().optional(),
|
||||
offset: z.number().optional(),
|
||||
limit: z.number().optional(),
|
||||
});
|
||||
|
||||
type RunStatus = z.infer<typeof runStatusSchema>;
|
||||
type CreateRunOptions = z.infer<typeof createRunSchema>;
|
||||
type UpdateRunOptions = z.infer<typeof updateRunSchema>;
|
||||
type FindRunsOptions = z.infer<typeof findRunsSchema>;
|
||||
|
||||
export type { RunStatus, CreateRunOptions, UpdateRunOptions, FindRunsOptions };
|
||||
export { runStatusSchema, createRunSchema, updateRunSchema, findRunsSchema };
|
||||
Reference in New Issue
Block a user