- Added comprehensive guidelines for API route naming and structure in `ROUTE_NAMING_BEST_PRACTICES.md`. - Updated `ARCHITECHTURE.md` to reference the new best practices document. - Refactored course-related routes to follow new naming conventions, including changes to endpoint paths and validation schemas. - Removed the deprecated course clone route and integrated cloning functionality directly into the course routes. - Adjusted various API methods to ensure consistent usage of HTTP methods and parameter structures across the application.
28 lines
755 B
TypeScript
28 lines
755 B
TypeScript
import * as z from 'zod';
|
|
|
|
const fullnameValidation = z.string().min(5);
|
|
|
|
export const ZOnboardingCreateOrg = z.object({
|
|
fullname: fullnameValidation,
|
|
orgName: z
|
|
.string()
|
|
.min(5)
|
|
.refine((val) => !/^[-]|[-]$/.test(val), {
|
|
message: 'validations.organization_name.hyphen_rule'
|
|
}),
|
|
siteName: z
|
|
.string()
|
|
.min(5)
|
|
.refine((val) => !/^[-]|[-]$/.test(val), {
|
|
message: 'validations.site_name.hyphen_rule'
|
|
})
|
|
});
|
|
export type TOnboardingCreateOrg = z.infer<typeof ZOnboardingCreateOrg>;
|
|
|
|
export const ZOnboardingUpdateMetadata = z.object({
|
|
fullname: fullnameValidation,
|
|
goal: z.string().min(5),
|
|
source: z.string().min(5)
|
|
});
|
|
export type TOnboardingUpdateMetadata = z.infer<typeof ZOnboardingUpdateMetadata>;
|