Add explicit project device sync
This commit is contained in:
parent
9d07ed9856
commit
6f8b292b6b
15 changed files with 771 additions and 5 deletions
15
src/shared/constants/project-device-sync-fields.ts
Normal file
15
src/shared/constants/project-device-sync-fields.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
export const projectDeviceSyncFields = [
|
||||
"name",
|
||||
"displayName",
|
||||
"phaseType",
|
||||
"connectionKind",
|
||||
"costGroup",
|
||||
"category",
|
||||
"quantity",
|
||||
"powerPerUnit",
|
||||
"simultaneityFactor",
|
||||
"cosPhi",
|
||||
"remark",
|
||||
] as const;
|
||||
|
||||
export type ProjectDeviceSyncField = (typeof projectDeviceSyncFields)[number];
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import { z } from "zod";
|
||||
import { projectDeviceSyncFields } from "../constants/project-device-sync-fields.js";
|
||||
|
||||
export const createProjectDeviceSchema = z.object({
|
||||
name: z.string().min(1),
|
||||
|
|
@ -18,5 +19,14 @@ export const createProjectDeviceSchema = z.object({
|
|||
|
||||
export const updateProjectDeviceSchema = createProjectDeviceSchema;
|
||||
|
||||
export const synchronizeProjectDeviceRowsSchema = z.object({
|
||||
rowIds: z.array(z.string().min(1)).min(1),
|
||||
fields: z.array(z.enum(projectDeviceSyncFields)).min(1),
|
||||
});
|
||||
|
||||
export const disconnectProjectDeviceRowsSchema = z.object({
|
||||
rowIds: z.array(z.string().min(1)).min(1),
|
||||
});
|
||||
|
||||
export type CreateProjectDeviceInput = z.infer<typeof createProjectDeviceSchema>;
|
||||
export type UpdateProjectDeviceInput = z.infer<typeof updateProjectDeviceSchema>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue