feat: enhance API route naming conventions and structure

- 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.
This commit is contained in:
Rotimi Best
2025-12-05 17:24:16 +01:00
parent eff364baa4
commit 4b52906445
34 changed files with 777 additions and 189 deletions
+1 -1
View File
@@ -160,7 +160,7 @@ validations.{fieldName}.{errorCode}
```typescript
// packages/utils/src/validation/lesson/lesson.ts
import { z } from 'zod';
import * as z from 'zod';
/**
* Lesson Create Validation Schema
@@ -1,4 +1,4 @@
import { z } from 'zod';
import * as z from 'zod';
export const ZUpdateProfile = z.object({
fullname: z.string().min(5).optional(),
+12 -3
View File
@@ -1,9 +1,8 @@
import * as z from 'zod';
import { ALLOWED_CONTENT_TYPES, ALLOWED_DOCUMENT_TYPES } from '../constants';
import { z } from 'zod';
export const ZCourseClone = z.object({
id: z.string().min(1),
title: z.string().min(1),
description: z.string().optional(),
slug: z.string().min(1),
@@ -11,6 +10,16 @@ export const ZCourseClone = z.object({
});
export type TCourseClone = z.infer<typeof ZCourseClone>;
export const ZCourseCloneParam = z.object({
courseId: z.string().min(1)
});
export type TCourseCloneParam = z.infer<typeof ZCourseCloneParam>;
export const ZCourseDownloadParam = z.object({
courseId: z.string().min(1)
});
export type TCourseDownloadParam = z.infer<typeof ZCourseDownloadParam>;
export const ZCertificateDownload = z.object({
theme: z.string().min(1),
studentName: z.string().min(1),
+1 -1
View File
@@ -1,4 +1,4 @@
import { z } from 'zod';
import * as z from 'zod';
export const ZEmailData = z.object({
from: z.string().optional(),
+2 -1
View File
@@ -1,5 +1,6 @@
import * as z from 'zod';
import { ALLOWED_IMAGE_TYPES } from '../constants';
import { z } from 'zod';
/**
* Schema for image upload presign URL request
@@ -2,7 +2,7 @@ import * as z from 'zod';
const fullnameValidation = z.string().min(5);
export const ZOnboardingStep1 = z.object({
export const ZOnboardingCreateOrg = z.object({
fullname: fullnameValidation,
orgName: z
.string()
@@ -17,11 +17,11 @@ export const ZOnboardingStep1 = z.object({
message: 'validations.site_name.hyphen_rule'
})
});
export type TOnboardingStep1 = z.infer<typeof ZOnboardingStep1>;
export type TOnboardingCreateOrg = z.infer<typeof ZOnboardingCreateOrg>;
export const ZOnboardingStep2 = z.object({
export const ZOnboardingUpdateMetadata = z.object({
fullname: fullnameValidation,
goal: z.string().min(5),
source: z.string().min(5)
});
export type TOnboardingStep2 = z.infer<typeof ZOnboardingStep2>;
export type TOnboardingUpdateMetadata = z.infer<typeof ZOnboardingUpdateMetadata>;