41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { z } from "zod";
|
|
import { expectedProjectRevisionSchema } from "./project-command.schemas.js";
|
|
|
|
export const createProjectSchema = z.object({
|
|
name: z.string().min(1),
|
|
singlePhaseVoltageV: z.number().positive().optional(),
|
|
threePhaseVoltageV: z.number().positive().optional(),
|
|
});
|
|
|
|
export const updateProjectSettingsSchema = z
|
|
.object({
|
|
expectedRevision: expectedProjectRevisionSchema,
|
|
singlePhaseVoltageV: z.number().positive(),
|
|
threePhaseVoltageV: z.number().positive(),
|
|
})
|
|
.strict();
|
|
|
|
export const createDistributionBoardSchema = z.object({
|
|
name: z.string().min(1),
|
|
});
|
|
|
|
export const createFloorSchema = z.object({
|
|
name: z.string().min(1),
|
|
});
|
|
|
|
export const createRoomSchema = z.object({
|
|
floorId: z.string().min(1).optional(),
|
|
roomNumber: z.string().min(1),
|
|
roomName: z.string().min(1),
|
|
});
|
|
|
|
export type CreateProjectInput = z.infer<typeof createProjectSchema>;
|
|
export type UpdateProjectSettingsInput = z.infer<
|
|
typeof updateProjectSettingsSchema
|
|
>;
|
|
export type CreateDistributionBoardInput = z.infer<
|
|
typeof createDistributionBoardSchema
|
|
>;
|
|
export type CreateFloorInput = z.infer<typeof createFloorSchema>;
|
|
export type CreateRoomInput = z.infer<typeof createRoomSchema>;
|