``` NOTE B = Backend F = Frontend ``` # [B] Auth API ## ACL | APIs\Roles | Anonymous | Loggedin | | ---------------------- | --------- | -------- | | `POST /auth/authorize` | ❌ | ✅ | ## Schemas ## APIs ### `POST /api/auth/authorize` **Request Schema** ```typescript= { email: string password: string } ``` **Response Schema** ```typescript= { token: string } ``` ### `POST /api/auth/access-tokens` > Aik: not sure what does this do ### `DELETE /api/auth/access-tokens` > Aik: not sure what does this do ### `POST /api/auth/reset-password` **Request Header** ```typescript= { Authorization: "Bearer {{token}}" } ``` **Response Schema** ```typescript= { email: string } ``` ### `POST /api/auth/register` **Request Schema** ```typescript= { ...user data } ``` **Response Schema** ```typescript= { userId: string } ``` ### `GET /api/auth/userinfo` **Request Header** ```typescript= { Authorization: "Bearer {{token}}" } ``` **Response Schema** ```typescript= { ...user data } ``` # [B] Course API ## ACL ## Schemas ### ```typescript= ``` ## APIs ### `POST /api/courses` **Request schema** ```typescript= { name!: { th!: string en?: string } slug!: string grades?: Array<{ id!: string }> subjects?: Array<{ id!: string }> categories?: Array<{ id!: string subCategories?: Array<{ id!: string }> }> price!: { fullPrice!: number discountPrice?: number } visibility!: string status!: string description!: { th!: string en?: string } benefit!: { th!: string en?: string } language!: string thumbnailUrl!: { th!: string en?: string } } ``` **Example request** ```jsonld= { "id": "3e7fe154-732c-4918-a962-c55809826ba5", "name": { "th": "สนุกคิด คณิตรอบตัว" }, "slug": "สนุกคิด-คณิตรอบตัว", "grades": [{ "id": "a680ca17-ee5f-4c2a-bed3-14e5d7bdaf77" }], "subjects": [{ "id": "f3eeca4a-62a9-497e-865b-baed08267bc5" }], "categories": [{ "id": "771e95b6-5943-48b0-a98c-43f075e3fe2c", "subCategories": [{ "id": "594d2728-8a6f-4afb-876b-775c72a4aa16" }] }], "price": { "fullPrice": 350.00, "discountPrice": null }, "visibility": "public", "status": "active", "description": { "th": "คอร์สที่จะทำน้องๆเข้าใจคณิตศาสตร์จากเรื่องรอบๆตัว" }, "benefit": { "th": "- เพิ่มความเข้าใจทางด้านคณิตศาสตร์\n- ส่งเสริมพัฒนาการทางด้านความคิดสร้างสรร" }, "language": "th", "thumbnailUrl": { "th": "https://d3njjcbhbojbot.cloudfront.net/api/utilities/v1/imageproxy/https://s3.amazonaws.com/coursera_assets/ddp/branding/minnesota/ux-design-minnesota-banner.jpg?auto=format%2Ccompress&dpr=1&w=300&h=&fit=crop" } } ``` **Response schema** ```typescript= { id!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "3e7fe154-732c-4918-a962-c55809826ba5" } } ``` ### `GET /api/courses` **Response schema** ```typescript= Array<{ name!: { th!: string en?: string } slug!: string grades?: Array<{ id!: string name!: { th!: string en?: string } }> subjects?: Array<{ id!: string name!: { th!: string en?: string } }> categories?: Array<{ id!: string name!: { th!: string en?: string } subCategories?: Array<{ id!: string name!: { th!: string en?: string } }> }> price!: { fullPrice!: number discountPrice?: number } createdAt!: Date createdBy!: string updatedAt?: Date updatedBy?: string }> ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": [ { "id": "3e7fe154-732c-4918-a962-c55809826ba5", "name": { "th": "สนุกคิด คณิตรอบตัว" }, "slug": "สนุกคิด-คณิตรอบตัว", "grades": [{ "id": "a680ca17-ee5f-4c2a-bed3-14e5d7bdaf77", "name": { "th": "ป.1" } }], "subjects": [{ "id": "f3eeca4a-62a9-497e-865b-baed08267bc5", "name": { "th": "คณิตศาสตร์" } }], "categories": [{ "id": "771e95b6-5943-48b0-a98c-43f075e3fe2c", "name": { "th": "เตรียมสอบ" }, "subCategories": [{ "id": "594d2728-8a6f-4afb-876b-775c72a4aa16", "name": { "th": "ป.1" } }] }], "price": { "fullPrice": 350.00, "discountPrice": null }, "createdAt": "2020-08-19T17:59:52.482Z", "createdBy": "b606067c-41f1-4e0f-a192-60aadc7d94af", "updatedAt": "2020-08-19T17:59:52.482Z", "updatedBy": "b606067c-41f1-4e0f-a192-60aadc7d94af" } ], "meta": { "pagination": { "pageNumber": 1, "pageSize": 10, "total": 1 }, "searchCriteria": { "keyword": "สนุกคิด คณิตรอบตัว", "grades": ["a680ca17-ee5f-4c2a-bed3-14e5d7bdaf77"], "subjects": ["f3eeca4a-62a9-497e-865b-baed08267bc5"], "categories": ["771e95b6-5943-48b0-a98c-43f075e3fe2c"], "subCategories": ["594d2728-8a6f-4afb-876b-775c72a4aa16"], "fullPrice": { "from": 0, "to": 350 }, "discount": false } } } ``` ### `GET /api/courses/:courseId` **Response schema** ```typescript= { name!: { th!: string en?: string } slug!: string grades?: Array<{ id!: string }> subjects?: Array<{ id!: string }> categories?: Array<{ id!: string subCategories?: Array<{ id!: string }> }> price!: { fullPrice!: number discountPrice?: number } visibility!: string status!: string description!: { th!: string en?: string } benefit!: { th!: string en?: string } language!: string thumbnailUrl!: { th!: string en?: string } } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "3e7fe154-732c-4918-a962-c55809826ba5", "name": { "th": "สนุกคิด คณิตรอบตัว" }, "slug": "สนุกคิด-คณิตรอบตัว", "grades": [{ "id": "a680ca17-ee5f-4c2a-bed3-14e5d7bdaf77" }], "subjects": [{ "id": "f3eeca4a-62a9-497e-865b-baed08267bc5" }], "categories": [{ "id": "771e95b6-5943-48b0-a98c-43f075e3fe2c", "subCategories": [{ "id": "594d2728-8a6f-4afb-876b-775c72a4aa16" }] }], "price": { "fullPrice": 350.00, "discountPrice": null }, "visibility": "public", "status": "active", "description": { "th": "คอร์สที่จะทำน้องๆเข้าใจคณิตศาสตร์จากเรื่องรอบๆตัว" }, "benefit": { "th": "- เพิ่มความเข้าใจทางด้านคณิตศาสตร์\n- ส่งเสริมพัฒนาการทางด้านความคิดสร้างสรร" }, "language": "th", "thumbnailUrl": { "th": "https://d3njjcbhbojbot.cloudfront.net/api/utilities/v1/imageproxy/https://s3.amazonaws.com/coursera_assets/ddp/branding/minnesota/ux-design-minnesota-banner.jpg?auto=format%2Ccompress&dpr=1&w=300&h=&fit=crop" }, "createdAt": "2020-08-19T17:59:52.482Z", "createdBy": "b606067c-41f1-4e0f-a192-60aadc7d94af", "updatedAt": "2020-08-19T17:59:52.482Z", "updatedBy": "b606067c-41f1-4e0f-a192-60aadc7d94af" } } ``` ### `PUT /api/courses/:courseId` **Request schema** ```typescript= { name?: { th?: string en?: string } slug?: string grades?: Array<{ id!: string }> subjects?: Array<{ id!: string }> categories?: Array<{ id!: string subCategories?: Array<{ id!: string }> }> price?: { fullPrice?: number discountPrice?: number } visibility!: string status!: string description?: { th!: string en?: string } benefit?: { th!: string en?: string } language?: string thumbnailUrl?: { th!: string en?: string } } ``` **Example request** ```jsonld= { "id": "3e7fe154-732c-4918-a962-c55809826ba5", "name": { "th": "สนุกคิด คณิตรอบตัว" }, "slug": "สนุกคิด-คณิตรอบตัว", "grades": [{ "id": "a680ca17-ee5f-4c2a-bed3-14e5d7bdaf77" }], "subjects": [{ "id": "f3eeca4a-62a9-497e-865b-baed08267bc5" }], "categories": [{ "id": "771e95b6-5943-48b0-a98c-43f075e3fe2c", "subCategories": [{ "id": "594d2728-8a6f-4afb-876b-775c72a4aa16" }] }], "price": { "fullPrice": 350.00, "discountPrice": null }, "visibility": "public", "status": "active", "description": { "th": "คอร์สที่จะทำน้องๆเข้าใจคณิตศาสตร์จากเรื่องรอบๆตัว" }, "benefit": { "th": "- เพิ่มความเข้าใจทางด้านคณิตศาสตร์\n- ส่งเสริมพัฒนาการทางด้านความคิดสร้างสรร" }, "language": "th", "thumbnailUrl": { "th": "https://d3njjcbhbojbot.cloudfront.net/api/utilities/v1/imageproxy/https://s3.amazonaws.com/coursera_assets/ddp/branding/minnesota/ux-design-minnesota-banner.jpg?auto=format%2Ccompress&dpr=1&w=300&h=&fit=crop" } } ``` **Response schema** ```typescript= { id!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "3e7fe154-732c-4918-a962-c55809826ba5" } } ``` ### `DELETE /api/courses/:courseId` **Response schema** ```typescript= { id!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "3e7fe154-732c-4918-a962-c55809826ba5" } } ``` # [B] Course's Instructor ## ACL ## Schemas ## APIS ### `POST /api/course-instructors?courseId=:courseId` **Request schema** ```jsonld= { instructor!: { id!: string } description?: { th?: string en?: string } } ``` **Example request** ```jsonld= { "instructor": { "id": "3e7fe154-732c-4918-a962-c55809826ba5" }, "description": { "th": "ประวัติวิทยากรอย่างย่อ" } } ``` **Response schema** ```jsonld= { id!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "3e7fe154-732c-4918-a962-c55809826ba5" } } ``` ### `GET /api/course-instructors?courseId=:courseId` **Response schema** ```jsonld= Array<{ id!: string instructor!: { id: string firstName!: { th!: string en?: string } lastName!: { th!: string en?: string } imageUrl?: string } description?: { th!: string en?: string } }> ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": [{ "id": "3e7fe154-732c-4918-a962-c55809826ba5", "instructor": { "id": "3e7fe154-732c-4918-a962-c55809826ba5", "firstName": { "th": "รัก" }, "lastName": { "th": "เรียนรู้" }, "imageUrl": "https://www.pngitem.com/pimgs/m/146-1468479_my-profile-icon-blank-profile-picture-circle-hd.png" } "description": { "th": "ประวัติวิทยากรอย่างย่อ" } }], "meta": { "pagination": { "pageNumber": 1, "pageSize": 10, "total": 1 } } } ``` ### `GET /api/course-instructors/:courseInstructorId` **Response schema** ```jsonld= { id: string instructor!: { id!: string firstName!: { th!: string en?: string } lastName!: { th!: string en?: string } imageUrl?: string } description?: { th!: string en?: string } } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "3e7fe154-732c-4918-a962-c55809826ba5", "instructor": { "id": "3e7fe154-732c-4918-a962-c55809826ba5", "firstName": { "th": "รัก" }, "lastName": { "th": "เรียนรู้" }, "imageUrl": "https://www.pngitem.com/pimgs/m/146-1468479_my-profile-icon-blank-profile-picture-circle-hd.png" } "description": { "th": "ประวัติวิทยากรอย่างย่อ" } } } ``` ### `PUT /api/course-instructors/:courseInstructorId` **Request schema** ```jsonld= { instructor?: { id!: string } description?: { th!: string en?: string } } ``` **Example request** ```jsonld= { "instructor": { "id": "3e7fe154-732c-4918-a962-c55809826ba5" }, "description": { "th": "ประวัติวิทยากรอย่างย่อ" } } ``` **Response schema** ```jsonld= { id!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "3e7fe154-732c-4918-a962-c55809826ba5" } } ``` ### `DELETE /api/course-instructors/:courseInstructorId` **Response schema** ```jsonld= { id!: string deletedAt!: Date deletedBy!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "3e7fe154-732c-4918-a962-c55809826ba5", "deletedAt": "2020-08-19T17:59:52.482Z", "deletedBy": "3e7fe154-732c-4918-a962-c55809826ba5" } } ``` # [B] Course's Section API ## ACL ## Schemas ### `CourseSection` Model ```typescript= { name: { th: string en: string } order: number } ``` ## APIS ### `POST /api/course-sections?courseId=:courseId` **Request schema** ```typescript= { name!: { th!: string en?: string } order: number } ``` **Example request** ```jsonld= ``` **Response schema** ```typescript= { sectionId: string createdAt: Date createdBy: string } ``` **Example response** ```jsonld= ``` ### `GET /api/course-sections?courseId=:courseId` **Response schema** ```typescript= Array<CourseSection> ``` **Example response** ```jsonld= ``` ### `GET /api/course-sections/:sectionId` **Response schema** ```typescript= { sectionId: string ...CourseSection } ``` **Example response** ```jsonld= ``` ### `PUT /api/course-sections/:sectionId` **Request schema** ```jsonld= Partial<CourseSection> ``` **Example request** ```jsonld= ``` **Response schema** ```jsonld= { sectionId: string ...CourseSection } ``` **Example response** ```jsonld= ``` ### `DELETE /api/course-sections/:sectionId` **Response schema** ```jsonld= { } ``` **Example response** ```jsonld= ``` ## Section's Content API ## ACL ## Schemas ### `SectionContent` Model ```typescript= { contentId: string name: { th: string en: string } type: 'VIDEO' | 'QUIZ' | 'ASSIGNMENT' | 'FILE' | 'PDF' order: number } ``` #### `VIDEO` Content ```typescript= { ... contentData: { youtubeUrl: string previewYoutubeUrl: string description: { th: string en: string } videoTimeSecond: number canPreview: boolean } } ``` #### `QUIZ` Content ```typescript= { ... contentData: { iframeUrl: string description: { th: string en: string } maxScore: number timeLimitSecond: number } } ``` #### `FILE` Content ```typescript= { ... contentData: { fileUrl: string description: { th: string en: string } sizeKB: number } } ``` #### `PDF` Content ```typescript= { ... contentData: { pdfUrl: string description: { th: string en: string } canDownload: boolean } } ``` #### `ASSIGNMENT` Content ```typescript= { ... contentData: { ...? } } ``` ## APIS ### `POST /api/section-contents?sectionId=:sectionId` **Request schema** ```jsonld= { ...SectionContent (without contentId) } ``` **Example request** ```jsonld= ``` **Response schema** ```jsonld= { contentId: string ...SectionContent } ``` **Example response** ```jsonld= ``` ### `GET /api/section-contents?sectionId=:sectionId` **Response schema** ```jsonld= Array<SectionContent> ``` **Example response** ```jsonld= ``` ### `GET /api/section-contents/:contentId` **Response schema** ```jsonld= { ...SectionContent } ``` **Example response** ```jsonld= ``` ### `PUT /api/section-contents/:contentId` **Request schema** ```typescript= Partial<SectionContent> ``` **Example request** ```jsonld= ``` **Response schema** ```typescript= { ...SectionContent } ``` **Example response** ```jsonld= ``` ### `DELETE /api/section-contents/:contentId` **Response schema** ```typescript= { contentId: string } ``` **Example response** ```jsonld= ``` ## Course's Session API ## ACL ## Schemas ### `CourseSession` Model ```typescript= { sessionId: string name: { th: string en: string } detail: { description: { th: string en: string } ...more detail? } registrationDateStart: string // ISO registrationDateEnd: string // ISO learningDateStart: string // ISO learningDateEnd: string // ISO publicType: 'PUBLIC' | 'PRIVATE' isActive: boolean } ``` ## APIS ### `POST /api/course-sessions?courseId=:courseId` **Request Schema** ```typescript= { ...CourseSession (without sessionId) } ``` **Example Request** ```jsonld= ``` **Response schema** ```jsonld= Array<CourseSession> ``` **Example response** ```jsonld= ``` ### `GET /api/course-sessions/:courseSessionId` **Response schema** ```jsonld= { ...CourseSession } ``` **Example response** ```jsonld= ``` ### `GET /api/course-sessions?courseId=:courseId` **Response schema** ```jsonld= Array<CourseSession> ``` **Example response** ```jsonld= ``` ### `GET /api/course-sessions/:courseSessionId` **Response schema** ```jsonld= { ...CourseSession } ``` **Example response** ```jsonld= ``` ### `PUT /api/course-sessions/:courseSessionId` **Request schema** ```jsonld= { ...Partial<CourseSession> } ``` **Example request** ```jsonld= ``` **Response schema** ```jsonld= { ...CourseSession } ``` **Example response** ```jsonld= ``` ### `DELETE /api/course-sessions/:courseSessionId` **Response schema** ```jsonld= { sessionId: string } ``` **Example response** ```jsonld= ``` # [B] Course's Material API ## ACL ## Schemas ## APIS ### `POST /api/course-materials?courseId=:courseId` **Request schema** ```jsonld= ``` **Example request** ```jsonld= ``` **Response schema** ```jsonld= ``` **Example response** ```jsonld= ``` ### `GET /api/course-materials?courseId=:courseId` **Response schema** ```jsonld= ``` **Example response** ```jsonld= ``` ### `GET /api/course-materials/:materialId` ### `PUT /api/course-materials/:materialId` ### `DELETE /api/course-materials/:materialId` ## Grade API ### `POST /api/grades` **Request schema** ```typescript= { name!: { th!: string en?: string } status!: string } ``` **Example request** ```jsonld= { "name": { "th": "ประถมศึกษา" }, "status": "active" } ``` **Response schema** ```typescript= { id!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "b6de786f-023a-4587-b745-47f3ec50b32d" } } ``` ### `GET /api/grades` **Response schema** ```typescript= Array<{ id!: string name!: { th!: string en?: string } status!: string createdAt!: Date createdBy!: string updatedAt?: Date updatedBy?: string }> ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": [{ "id": "b6de786f-023a-4587-b745-47f3ec50b32d", "name": { "th": "ประถมศึกษา" }, "status": "active", "createdAt": "2020-08-19T17:59:52.482Z", "createdBy": "3e7fe154-732c-4918-a962-c55809826ba5", "updatedAt": "2020-08-19T17:59:52.482Z", "updatedBy": "3e7fe154-732c-4918-a962-c55809826ba5" }], "meta": { "pagination": { "pageNumber": 1, "pageSize": 10, "total": 1 } } } ``` ### `GET /api/grades/:gradeId` **Response schema** ```typescript= { id!: string name!: { th!: string en?: string } status!: string createdAt!: Date createdBy!: string updatedAt?: Date updatedBy?: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "b6de786f-023a-4587-b745-47f3ec50b32d", "name": { "th": "ประถมศึกษา" }, "status": "active", "createdAt": "2020-08-19T17:59:52.482Z", "createdBy": "3e7fe154-732c-4918-a962-c55809826ba5", "updatedAt": "2020-08-19T17:59:52.482Z", "updatedBy": "3e7fe154-732c-4918-a962-c55809826ba5" } } ``` ### `PUT /api/grades/:gradeId` **Request schema** ```typescript= { name?: { th?: string en?: string } status?: string } ``` **Example request** ```jsonld= { "name": { "th": "ประถมศึกษา" }, "status": "active" } ``` **Response schema** ```typescript= { id!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "b6de786f-023a-4587-b745-47f3ec50b32d" } } ``` ### `DELETE /api/grades/:gradeId` **Response schema** ```typescript= { id!: string deletedAt!: Date deletedBy!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "3e7fe154-732c-4918-a962-c55809826ba5", "deletedAt": "2020-08-19T17:59:52.482Z", "deletedBy": "3e7fe154-732c-4918-a962-c55809826ba5" } } ``` # [B] Subject API ## ACL ## Schemas ## APIS **Request schema** ```typescript= { name!: { th!: string en?: string } status!: string } ``` **Example request** ```jsonld= { "name": { "th": "คณิตศาสตร์" }, "status": "active" } ``` **Response schema** ```typescript= { id!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "b6de786f-023a-4587-b745-47f3ec50b32d" } } ``` ### `GET /api/subjects` **Response schema** ```typescript= Array<{ id!: string name!: { th!: string en?: string } status!: string createdAt!: Date createdBy!: string updatedAt?: Date updatedBy?: string }> ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": [{ "id": "b6de786f-023a-4587-b745-47f3ec50b32d", "name": { "th": "คณิตศาสตร์" }, "status": "active", "createdAt": "2020-08-19T17:59:52.482Z", "createdBy": "3e7fe154-732c-4918-a962-c55809826ba5", "updatedAt": "2020-08-19T17:59:52.482Z", "updatedBy": "3e7fe154-732c-4918-a962-c55809826ba5" }], "meta": { "pagination": { "pageNumber": 1, "pageSize": 10, "total": 1 } } } ``` ### `PUT /api/subjects/:subjectId` **Request schema** ```typescript= { name?: { th?: string en?: string } status!: string } ``` **Example request** ```jsonld= { "name": { "th": "คณิตศาสตร์" }, "status": "active" } ``` **Response schema** ```typescript= { id!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "b6de786f-023a-4587-b745-47f3ec50b32d" } } ``` ### `DELETE /api/subjects/:subjectId` **Response schema** ```typescript= { id!: string deletedAt!: Date deletedBy!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "3e7fe154-732c-4918-a962-c55809826ba5", "deletedAt": "2020-08-19T17:59:52.482Z", "deletedBy": "3e7fe154-732c-4918-a962-c55809826ba5" } } ``` # [B] Category API ## ACL ## Schemas ## APIS ### `POST /api/categories` **Request schema** ```typescript= { name!: { th!: string en?: string } slug!: string status!: string } ``` **Example request** ```jsonld= { "name": { "th": "ติวข้อสอบ" }, "slug": "ติวข้อสอบ", "status": "active" } ``` **Response schema** ```typescript= { id!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "b6de786f-023a-4587-b745-47f3ec50b32d" } } ``` ### `GET /api/categories` **Response schema** ```typescript= Array<{ id!: string name!: { th!: string en?: string } slug!: string status!: string numberOfSubCategory!: number createdAt!: Date createdBy!: string updatedAt?: Date updatedBy?: string }> ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": [{ "id": "b6de786f-023a-4587-b745-47f3ec50b32d", "name": { "th": "ติวข้อสอบ" }, "slug": "ติวข้อสอบ", "status": "active", "numberOfSubCategory": 0, "createdAt": "2020-08-19T17:59:52.482Z", "createdBy": "3e7fe154-732c-4918-a962-c55809826ba5", "updatedAt": "2020-08-19T17:59:52.482Z", "updatedBy": "3e7fe154-732c-4918-a962-c55809826ba5" }], "meta": { "pagination": { "pageNumber": 1, "pageSize": 10, "total": 1 } } } ``` ### `GET /api/categories/:categoryId` **Response schema** ```typescript= { id!: string name!: { th!: string en: string } slug!: string status!: string numberOfSubCategory!: number createdAt!: Date createdBy!: string updatedAt?: Date updatedBy?: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "b6de786f-023a-4587-b745-47f3ec50b32d", "name": { "th": "ติวข้อสอบ" }, "slug": "ติวข้อสอบ", "status": "active", "numberOfSubCategory": 0, "createdAt": "2020-08-19T17:59:52.482Z", "createdBy": "3e7fe154-732c-4918-a962-c55809826ba5", "updatedAt": "2020-08-19T17:59:52.482Z", "updatedBy": "3e7fe154-732c-4918-a962-c55809826ba5" } } ``` ### `PUT /api/categories/:categoryId` ```typescript= { name?: { th?: string en?: string } slug?: string status?: string } ``` **Example request** ```jsonld= { "name": { "th": "หลักสูตร" }, "slug": "หลักสูตร", "status": "active" } ``` **Response schema** ```typescript= { id!: string updatedAt?: Date updatedBy?: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "b6de786f-023a-4587-b745-47f3ec50b32d", "updatedAt": "2020-08-19T17:59:52.482Z", "updatedBy": "3e7fe154-732c-4918-a962-c55809826ba5" } } ``` ### `DELETE /api/categories/:categoryId` **Response schema** ```typescript= { id!: string deletedAt!: Date deletedBy!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "b6de786f-023a-4587-b745-47f3ec50b32d", "deletedAt": "2020-08-19T17:59:52.482Z", "deletedBy": "3e7fe154-732c-4918-a962-c55809826ba5" } } ``` # [B] Category's Sub Category API ## ACL ## Schemas ## APIS ### `POST /api/sub-categories?categoryId=:categoryId` **Request schema** ```typescript= { name!: { th!: string en?: string } slug!: string status!: string } ``` **Example request** ```jsonld= { "name": { "th": "GAT" }, "slug": "gat", "status": "active" } ``` **Response schema** ```typescript= { id!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "b6de786f-023a-4587-b745-47f3ec50b32d" } } ``` ### `GET /api/sub-categories?categoryId=:categoryId` **Response schema** ```typescript= Array<{ id!: string name!: { th!: string en?: string } slug!: string status!: string createdAt!: Date createdBy!: string updatedAt?: Date updatedBy?: string }> ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": [{ "id": "b6de786f-023a-4587-b745-47f3ec50b32d", "name": { "th": "GAT" }, "slug": "gat", "status": "active", "createdAt": "2020-08-19T17:59:52.482Z", "createdBy": "3e7fe154-732c-4918-a962-c55809826ba5", "updatedAt": "2020-08-19T17:59:52.482Z", "updatedBy": "3e7fe154-732c-4918-a962-c55809826ba5" }], "meta": { "pagination": { "pageNumber": 1, "pageSize": 10, "total": 1 } } } ``` ### `GET /api/sub-categories/:subCategoryId` **Response schema** ```typescript= { id!: string name?: { th!: string en?: string } slug?: string status!: string createdAt!: Date createdBy!: string updatedAt?: Date updatedBy?: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "b6de786f-023a-4587-b745-47f3ec50b32d", "name": { "th": "GAT" }, "slug": "gat", "status": "active", "createdAt": "2020-08-19T17:59:52.482Z", "createdBy": "3e7fe154-732c-4918-a962-c55809826ba5", "updatedAt": "2020-08-19T17:59:52.482Z", "updatedBy": "3e7fe154-732c-4918-a962-c55809826ba5" } } ``` ### `PUT /api/sub-categories/:subCategoryId` ```typescript= { name?: { th?: string en?: string } slug?: string status?: string } ``` **Example request** ```jsonld= { "name": { "th": "GAT" }, "slug": "gat", "status": "active" } ``` **Response schema** ```typescript= { id!: string updatedAt?: Date updatedBy?: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "b6de786f-023a-4587-b745-47f3ec50b32d", "updatedAt": "2020-08-19T17:59:52.482Z", "updatedBy": "3e7fe154-732c-4918-a962-c55809826ba5" } } ``` ### `DELETE /api/sub-categories/:subCategoryId` **Response schema** ```typescript= { id!: string deletedAt!: Date deletedBy!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "b6de786f-023a-4587-b745-47f3ec50b32d", "deletedAt": "2020-08-19T17:59:52.482Z", "deletedBy": "3e7fe154-732c-4918-a962-c55809826ba5" } } ``` # [B] Instructor API ## ACL ## Schemas ## APIS ### `POST /api/instructors` **Request schema** ```typescript= { firstName!: { th!: string en?: string } lastName!: { th!: string en?: string } position!: string imageUrl?: string educationExperiences!: Array<{ educationLevel!: string schoolName!: string position!: strign }> workExperiences!: Array<string> } ``` **Example request** ```jsonld= { "firstName": { "th": "รัก" }, "lastName": { "th": "เรียนรู้" }, "imageUrl": "https://www.pngitem.com/pimgs/m/146-1468479_my-profile-icon-blank-profile-picture-circle-hd.png", "educationExperiences": [{ "educationLevel": "elementary", "schoolName": "สถานศึกษา", "position": "วิทย์-คณิต" }], "workExperiences": ["ครูชำนาญการ โรงเรียนหมีใหญ่"] } ``` **Response schema** ```typescript= { id!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "b6de786f-023a-4587-b745-47f3ec50b32d" } } ``` ### `GET /api/instructors` **Response schema** ```typescript= Array<{ id!: string firstName!: { th!: string en?: string } lastName!: { th!: string en?: string } position!: string imageUrl?: string educationExperiences!: Array<{ educationLevel!: string schoolName!: string position!: strign }> workExperiences!: Array<string> }> ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": [{ "id": "3e7fe154-732c-4918-a962-c55809826ba5", "firstName": { "th": "รัก" }, "lastName": { "th": "เรียนรู้" }, "imageUrl": "https://www.pngitem.com/pimgs/m/146-1468479_my-profile-icon-blank-profile-picture-circle-hd.png", "educationExperiences": [{ "educationLevel": "elementary", "schoolName": "สถานศึกษา", "position": "วิทย์-คณิต" }], "workExperiences": ["ครูชำนาญการ โรงเรียนหมีใหญ่"] }], "meta": { "pagination": { "pageNumber": 1, "pageSize": 10, "total": 1 } } } ``` ### `GET /api/instructors/:instructorId` **Response schema** ```typescript= Array<{ id!: string firstName!: { th!: string en?: string } lastName!: { th!: string en?: string } position!: string imageUrl?: string educationExperiences!: Array<{ educationLevel!: string schoolName!: string position!: strign }> workExperiences!: Array<string> }> ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "3e7fe154-732c-4918-a962-c55809826ba5", "firstName": { "th": "รัก" }, "lastName": { "th": "เรียนรู้" }, "imageUrl": "https://www.pngitem.com/pimgs/m/146-1468479_my-profile-icon-blank-profile-picture-circle-hd.png", "educationExperiences": [{ "educationLevel": "elementary", "schoolName": "สถานศึกษา", "position": "วิทย์-คณิต" }], "workExperiences": ["ครูชำนาญการ โรงเรียนหมีใหญ่"] } } ``` ### `PUT /api/instructors/:instructorId` **Request schema** ```typescript= { firstName?: { th?: string en?: string } lastName?: { th?: string en?: string } position?: string imageUrl?: string educationExperiences?: Array<{ educationLevel!: string schoolName!: string position!: strign }> workExperiences?: Array<string> } ``` **Example request** ```jsonld= { "firstName": { "th": "รัก" }, "lastName": { "th": "เรียนรู้" }, "imageUrl": "https://www.pngitem.com/pimgs/m/146-1468479_my-profile-icon-blank-profile-picture-circle-hd.png", "educationExperiences": [{ "educationLevel": "elementary", "schoolName": "สถานศึกษา", "position": "วิทย์-คณิต" }], "workExperiences": ["ครูชำนาญการ โรงเรียนหมีใหญ่"] } ``` **Response schema** ```typescript= { id!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "b6de786f-023a-4587-b745-47f3ec50b32d" } } ``` ### `DELETE /api/instructors/:instructorId` **Response schema** ```typescript= { id!: string deletedAt!: Date deletedBy!: string } ``` **Example response** ```jsonld= { "code": 200, "message": "success", "data": { "id": "b6de786f-023a-4587-b745-47f3ec50b32d", "deletedAt": "2020-08-19T17:59:52.482Z", "deletedBy": "3e7fe154-732c-4918-a962-c55809826ba5" } } ``` # [B] Admin Group API ## ACL ## Schemas ### `AdminGroup` ```typescript= { adminGroupId: string name: string permissions: Array<{ name: { th: string en: string } slug: string }> } ``` ## APIS ### `POST /api/admin-groups` **Request Schema** ```typescript= { ...AdminGroup (without adminGroupId) } ``` **Response Schema** ```typescript= { adminGroupId: string ...AdminGroup } ``` ### `GET /api/admin-groups` **Response Schema** ```typescript= Array<AdminGroup> ``` ### `GET /api/admin-groups/:adminGroupId` **Response Schema** ```typescript= { ...AdminGroup } ``` ### `PUT /api/admin-groups/:adminGroupId` **Request Schema** ```typescript= { ...Partial<AdminGroup> } ``` **Response Schema** ```typescript= { ...AdminGroup } ``` ### `DELETE /api/admin-groups/:adminGroupId` **Response Schema** ```typescript= { adminGroupId: string } ``` # [B] Admin API ## ACL ## Schemas ### `Admin` ```typescript= { adminId: string username: string email: string } ``` ## APIS ### `POST /api/admins` **Request Schema** ```typescript= { ...Admin (without adminId) } ``` **Response Schema** ```typescript= { adminId: string ...Admin } ``` ### `GET /api/admins` **Response Schema** ```typescript= Array<Admin> ``` ### `GET /api/admins/:adminId` **Response Schema** ```typescript= { ...Admin } ``` ### `PUT /api/admins/:adminId` **Request Schema** ```typescript= { ...Partial<Admin> } ``` **Response Schema** ```typescript= { ...Admin } ``` ### `DELETE /api/admins/:adminId` **Response Schema** ```typescript= { adminId: string } ``` # [F] Course API ## ACL ## Schemas ## APIS ### `GET /api/courses` **Response schema** ```typescript= Array<{ slug!: string name!: { th!: string en?: string } description!: { th!: string en?: string } thumbnailUrl!: { th!: string en?: string } subCategories!: Array<{ name!: { th!: string en?: string } categories: { slug!: string name!: { th!: string en?: string } } }> subjects!: Array<{ name!: { th!: string en?: string } }> instructors!: Array<{ name!: { th!: string en?: string } }> fullPrice!: number discountPrice?: number duration!: number }> ``` **Sample response** ```jsonld= { } ``` ### `GET /api/courses/:slug` **Response schema** ```typescript= { slug!: string name!: { th!: string en?: string } description!: { th!: string en?: string } thumbnailUrl!: { th!: string en?: string } previewVideoUrl!: { th!: string en?: string } subCategories!: Array<{ name!: { th!: string en?: string } categories: { slug!: string name!: { th!: string en?: string } } }> subjects!: Array<{ name!: { th!: string en?: string } }> fullPrice!: number discountPrice?: number duration!: number } ``` **Sample response** ```jsonld= { } ``` # [F] Categories API