- Enhanced the folder mapping persistence mapper for better error handling and data validation. - Updated the Sequelize folder mapping repository to streamline data loading and improve transaction handling. - Refactored folder mapping schemas for clarity and consistency in validation. - Improved folder API error handling and response data processing. - Enhanced folder mapping form component with better state management and user feedback. - Introduced a new quick editor component for creating profiles and needs within the folder mapping context.
29 lines
878 B
TypeScript
29 lines
878 B
TypeScript
import { z } from "zod/v4";
|
|
|
|
import { ConfigurationSchema } from "./access/access-definition";
|
|
export const FolderMappingInputSchema = z.strictObject({
|
|
profileId: z.uuid(),
|
|
needId: z.uuid(),
|
|
path: z.string().trim().min(1).max(255),
|
|
driveLetter: z
|
|
.string()
|
|
.trim()
|
|
.regex(/^[A-Za-z]:?$/)
|
|
.nullable(),
|
|
state: ConfigurationSchema,
|
|
notes: z.string().trim().max(4000).nullable(),
|
|
});
|
|
export type FolderMappingInput = z.infer<typeof FolderMappingInputSchema>;
|
|
export class FolderMappingError extends Error {
|
|
constructor(public readonly code: string) {
|
|
super(code);
|
|
}
|
|
}
|
|
export const FOLDER_STATE_TRANSITIONS = {
|
|
pending: ["pending", "configured", "never_configured"],
|
|
configured: ["configured", "removal_pending"],
|
|
removal_pending: ["removal_pending", "removed"],
|
|
removed: ["removed"],
|
|
never_configured: ["never_configured"],
|
|
} as const;
|