@@ -13,14 +13,18 @@ import { MeetingDTO } from "../../../utils/dto/meeting/IMeetingDTO";
13
13
import { IPutClassroomMeetingPayload } from "../../../utils/interfaces/request/IPutClassroomMeetingPayload" ;
14
14
import { PracticumMeetingPutPayloadSchema } from "../../../utils/validator/meeting/Joi/PracticumMeetingPutPayloadSchema" ;
15
15
import { IPostMeetingAttendancePayload } from "../../../utils/interfaces/request/IPostMeetingAttendancePayload" ;
16
- import { MeetingAttendancePostPayloadSchema } from "../../../utils/validator/attendance/Joi/MeetingAttendancePostPayloadSchema" ;
16
+ import {
17
+ MeetingAttendancePostPayloadSchema ,
18
+ MeetingAttendancePutPayloadSchema ,
19
+ } from "../../../utils/validator/attendance/Joi/MeetingAttendancePostPayloadSchema" ;
17
20
import { AttendanceService } from "../../../services/attendance/AttendanceService" ;
18
21
import { ListStudentAttendanceDTO } from "../../../utils/dto/attendances/IListStudentAttendanceDTO" ;
19
22
import { IPostMeetingScore } from "../../../utils/interfaces/request/IPostMeetingResponseScore" ;
20
23
import { MeetingScorePostPayloadSchema } from "../../../utils/validator/score/MeetingResponseScorePostPayloadSchema" ;
21
24
import { ScoreService } from "../../../services/score/ScoreService" ;
22
25
import { ControlCardService } from "../../../services/controlCard/ControlCardService" ;
23
26
import { MeetingControlCardDTO } from "../../../utils/dto/controlCard/IMeetingControlCardDTO" ;
27
+ import { IPutMeetingAttendancePayload } from "../../../utils/interfaces/request/IPutMeetingAttendancePayload" ;
24
28
25
29
export class MeetingHandlerImpl extends MeetingHandler {
26
30
private meetingService : MeetingService ;
@@ -46,6 +50,63 @@ export class MeetingHandlerImpl extends MeetingHandler {
46
50
this . schemaValidator = schemaValidator ;
47
51
}
48
52
53
+ async putMeetingAttendance (
54
+ req : Request ,
55
+ res : Response ,
56
+ next : NextFunction
57
+ ) : Promise < any > {
58
+ const { id } = req . params ;
59
+ const payload : IPutMeetingAttendancePayload = req . body ;
60
+ const { profileId } = getTokenPayload ( res ) ;
61
+
62
+ try {
63
+ this . schemaValidator . validate ( {
64
+ schema : MeetingAttendancePutPayloadSchema ,
65
+ payload,
66
+ } ) ;
67
+
68
+ await this . attendanceService . updateAttendaceByMeetingIdAndProfileId (
69
+ id ,
70
+ payload ,
71
+ profileId
72
+ ) ;
73
+
74
+ return res
75
+ . status ( 200 )
76
+ . json (
77
+ createResponse (
78
+ RESPONSE_MESSAGE . SUCCESS ,
79
+ "successfully update attendance"
80
+ )
81
+ ) ;
82
+ } catch ( error ) {
83
+ return next ( error ) ;
84
+ }
85
+ }
86
+
87
+ async getStudentMeetingScores (
88
+ req : Request ,
89
+ res : Response ,
90
+ next : NextFunction
91
+ ) : Promise < any > {
92
+ const { id } = req . params ;
93
+ const { classroom, type } = req . query ;
94
+
95
+ try {
96
+ const scores = await this . meetingService . getMeetingStudentMeetingScores (
97
+ id ,
98
+ type ,
99
+ classroom
100
+ ) ;
101
+
102
+ return res
103
+ . status ( 200 )
104
+ . json ( createResponse ( RESPONSE_MESSAGE . SUCCESS , scores ) ) ;
105
+ } catch ( error ) {
106
+ return next ( error ) ;
107
+ }
108
+ }
109
+
49
110
async getMeetingControlCards (
50
111
req : Request ,
51
112
res : Response ,
@@ -62,7 +123,7 @@ export class MeetingHandlerImpl extends MeetingHandler {
62
123
) ;
63
124
64
125
return res
65
- . status ( 201 )
126
+ . status ( 200 )
66
127
. json (
67
128
createResponse (
68
129
RESPONSE_MESSAGE . SUCCESS ,
0 commit comments