Spaces:
Runtime error
Runtime error
Commit ·
80e295f
1
Parent(s): 115e048
Deploy files from GitHub repository
Browse files
repositories/exam_event_assign_repository.go
CHANGED
|
@@ -23,7 +23,8 @@ func NewExamEventAssignRepository(db *gorm.DB) ExamEventAssignRepository {
|
|
| 23 |
|
| 24 |
func (r *examEventAssignRepository) Check(ctx context.Context, eventId uuid.UUID, examId uuid.UUID) error {
|
| 25 |
return r.db.WithContext(ctx).
|
| 26 |
-
Where("event_id = ?
|
|
|
|
| 27 |
First(&entity.ExamEventAssign{}).Error
|
| 28 |
}
|
| 29 |
func (r *examEventAssignRepository) Create(ctx context.Context, m entity.ExamEventAssign) error {
|
|
|
|
| 23 |
|
| 24 |
func (r *examEventAssignRepository) Check(ctx context.Context, eventId uuid.UUID, examId uuid.UUID) error {
|
| 25 |
return r.db.WithContext(ctx).
|
| 26 |
+
Where("event_id = ?", eventId).
|
| 27 |
+
Where("exam_id = ?", examId).
|
| 28 |
First(&entity.ExamEventAssign{}).Error
|
| 29 |
}
|
| 30 |
func (r *examEventAssignRepository) Create(ctx context.Context, m entity.ExamEventAssign) error {
|
repositories/exam_event_attempt_repository.go
CHANGED
|
@@ -38,6 +38,7 @@ func (r *examEventAttemptRepository) GetByExamEvent(ctx context.Context, eventId
|
|
| 38 |
var attempt entity.ExamEventAttempt
|
| 39 |
|
| 40 |
err := r.db.WithContext(ctx).
|
|
|
|
| 41 |
Preload("Answers").
|
| 42 |
Where("event_id = ?", eventId).
|
| 43 |
Where("exam_id = ?", examId).
|
|
|
|
| 38 |
var attempt entity.ExamEventAttempt
|
| 39 |
|
| 40 |
err := r.db.WithContext(ctx).
|
| 41 |
+
Preload("Questions").
|
| 42 |
Preload("Answers").
|
| 43 |
Where("event_id = ?", eventId).
|
| 44 |
Where("exam_id = ?", examId).
|
router/exam_event_router.go
CHANGED
|
@@ -10,9 +10,9 @@ func ExamEventRouter(router *gin.Engine, middleware provider.MiddlewareProvider,
|
|
| 10 |
auth := middleware.ProvideAuthenticationMiddleware()
|
| 11 |
routerGroup := router.Group("api/v1/events")
|
| 12 |
{
|
| 13 |
-
routerGroup.GET("/:event_slug/exam
|
| 14 |
routerGroup.GET("/:event_slug/exam/:exam_slug/attempt", auth.VerifyAccount, examController.Attempt)
|
| 15 |
-
routerGroup.POST("/:event_slug/exam/:attempt_id/answer_question
|
| 16 |
-
routerGroup.POST("/:event_slug/exam/:attempt_id/submit
|
| 17 |
}
|
| 18 |
}
|
|
|
|
| 10 |
auth := middleware.ProvideAuthenticationMiddleware()
|
| 11 |
routerGroup := router.Group("api/v1/events")
|
| 12 |
{
|
| 13 |
+
routerGroup.GET("/:event_slug/exam", auth.VerifyAccount, examController.List)
|
| 14 |
routerGroup.GET("/:event_slug/exam/:exam_slug/attempt", auth.VerifyAccount, examController.Attempt)
|
| 15 |
+
routerGroup.POST("/:event_slug/exam/:attempt_id/answer_question", auth.VerifyAccount, examController.Answer)
|
| 16 |
+
routerGroup.POST("/:event_slug/exam/:attempt_id/submit", auth.VerifyAccount, examController.Submit)
|
| 17 |
}
|
| 18 |
}
|
services/account_service.go
CHANGED
|
@@ -37,6 +37,7 @@ func NewAccountService(jwtService JWTService, accountRepo repositories.AccountRe
|
|
| 37 |
jwtService: jwtService,
|
| 38 |
accountRepo: accountRepo,
|
| 39 |
accountDetailRepo: accountDetailRepo,
|
|
|
|
| 40 |
}
|
| 41 |
}
|
| 42 |
|
|
|
|
| 37 |
jwtService: jwtService,
|
| 38 |
accountRepo: accountRepo,
|
| 39 |
accountDetailRepo: accountDetailRepo,
|
| 40 |
+
|
| 41 |
}
|
| 42 |
}
|
| 43 |
|