Skip to content

Commit

Permalink
#update: thuanvv update field api
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvanthuan committed Jan 27, 2025
1 parent a969d25 commit 75db589
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
4 changes: 3 additions & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/domain/dtos/student-result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 9 additions & 3 deletions src/domain/entities/student-result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/web/routes/student-result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand Down

0 comments on commit 75db589

Please sign in to comment.