diff --git a/prisma/schema.prisma b/prisma/schema.prisma index a3dcc16..a8e7139 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -447,7 +447,9 @@ model student_results { id Int @id @default(autoincrement()) @db.UnsignedInt class_id Int? name String? @db.VarChar(500) - description String? @db.VarChar(500) + score String? @db.VarChar(500) + vi_content String? @db.VarChar(500) + en_content String? @db.VarChar(500) result_image String @db.VarChar(500) order Int? status Int diff --git a/src/application/student-result/queries/list-student-result/list-student-result-query-mapper.ts b/src/application/student-result/queries/list-student-result/list-student-result-query-mapper.ts index f3e1964..1356998 100644 --- a/src/application/student-result/queries/list-student-result/list-student-result-query-mapper.ts +++ b/src/application/student-result/queries/list-student-result/list-student-result-query-mapper.ts @@ -10,7 +10,8 @@ export function map(studentResult: StudentResultDTO): StudentResultDTO { image: studentResult?.class?.image ?? null, }, name: studentResult.name ?? null, - description: studentResult.description ?? null, + score: studentResult.score ?? null, + content: studentResult.content ?? null, result_image: studentResult.result_image, order: studentResult.order ?? null, status: studentResult.status, diff --git a/src/application/student-result/queries/list-student-result/list-student-result-query.ts b/src/application/student-result/queries/list-student-result/list-student-result-query.ts index 11b2939..d38f06c 100644 --- a/src/application/student-result/queries/list-student-result/list-student-result-query.ts +++ b/src/application/student-result/queries/list-student-result/list-student-result-query.ts @@ -34,7 +34,8 @@ export function makeListStudentResultQuery({ studentResultRepository, db }: Pick image: enrichedStudentResult.class.image ?? null, }, name: enrichedStudentResult.name ?? null, - description: enrichedStudentResult.description ?? null, + score: enrichedStudentResult.score ?? null, + content: language === "vi" ? enrichedStudentResult?.vi_content ?? '' : enrichedStudentResult?.en_content ?? '', result_image: enrichedStudentResult.result_image ?? '', order: enrichedStudentResult.order ?? null, status: enrichedStudentResult.status, diff --git a/src/domain/dtos/student-result.ts b/src/domain/dtos/student-result.ts index 83ecdc6..0b5d52a 100644 --- a/src/domain/dtos/student-result.ts +++ b/src/domain/dtos/student-result.ts @@ -2,7 +2,8 @@ export interface StudentResultDTO { id: number | null; class: IClass; name: string | null; - description: string | null; + score: string | null; + content: string | null; result_image: string; order: number | null; status: number; diff --git a/src/domain/entities/student-result.ts b/src/domain/entities/student-result.ts index 39d6e68..57f4f85 100644 --- a/src/domain/entities/student-result.ts +++ b/src/domain/entities/student-result.ts @@ -2,7 +2,9 @@ export class StudentResultEntity { public id?: number; public class_id: number; public name?: string | null; - public description?: string | null; + public vi_content?: string | null; + public en_content?: string | null; + public score?: string | null; public result_image: string; public order?: number | null; public status: number; @@ -15,7 +17,9 @@ export class StudentResultEntity { id?: number; class_id: number; name?: string; - description?: string; + vi_content?: string; + en_content?: string; + score?: string; result_image: string; order?: number; status: number; @@ -27,7 +31,9 @@ export class StudentResultEntity { this.id = studentResultEntity.id; this.class_id = studentResultEntity.class_id; this.name = studentResultEntity.name; - this.description = studentResultEntity.description; + this.score = studentResultEntity.score; + this.vi_content = studentResultEntity.vi_content; + this.en_content = studentResultEntity.en_content; this.result_image = studentResultEntity.result_image; this.order = studentResultEntity.order; this.status = studentResultEntity.status; diff --git a/src/web/routes/student-result.ts b/src/web/routes/student-result.ts index d22378d..d4cd447 100644 --- a/src/web/routes/student-result.ts +++ b/src/web/routes/student-result.ts @@ -40,7 +40,8 @@ export default async function studentResultRoutes(fastify: FastifyRouteInstance) nullable: false, }, name: { type: 'string', nullable: true }, - description: { type: 'string', nullable: true }, + score: { type: 'string', nullable: true }, + content: { type: 'string', nullable: true }, result_image: { type: 'string' }, order: { type: 'integer', nullable: true }, status: { type: 'integer' },