Skip to content

Commit

Permalink
feat(be): submission controller for load test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaehyeon1020 committed Dec 6, 2024
1 parent 59d1673 commit 449b44e
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions apps/backend/apps/client/src/submission/submission.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
Req,
Query,
DefaultValuePipe,
Headers
Headers,
ParseIntPipe
} from '@nestjs/common'
import { AuthNotNeededIfOpenSpace, AuthenticatedRequest } from '@libs/auth'
import {
Expand Down Expand Up @@ -77,12 +78,14 @@ export class SubmissionController {
*/
@Post('test')
async submitTest(
@Req() req: AuthenticatedRequest,
// @Req() req: AuthenticatedRequest,
@Query('userId', ParseIntPipe) userId: number, // TODO: 로드테스트용, 테스트 후 삭제
@Query('problemId', new RequiredIntPipe('problemId')) problemId: number,
@Body() submissionDto: CreateSubmissionDto
) {
return await this.submissionService.submitTest(
req.user.id,
// req.user.id,
userId,
problemId,
submissionDto
)
Expand All @@ -93,8 +96,9 @@ export class SubmissionController {
* @returns Testcase별 결과가 담겨있는 Object
*/
@Get('test')
async getTestResult(@Req() req: AuthenticatedRequest) {
return await this.submissionService.getTestResult(req.user.id)
// TODO: 로드테스트용, 테스트 후 삭제 (req 사용으로 되돌리기)
async getTestResult(@Query('userId', ParseIntPipe) userId: number) {
return await this.submissionService.getTestResult(userId)
}

/**
Expand All @@ -103,12 +107,13 @@ export class SubmissionController {
*/
@Post('user-test')
async submitUserTest(
@Req() req: AuthenticatedRequest,
// @Req() req: AuthenticatedRequest,
@Query('userId', ParseIntPipe) userId: number, // TODO: 로드테스트용, 테스트 후 삭제
@Query('problemId', new RequiredIntPipe('problemId')) problemId: number,
@Body() userTestSubmissionDto: CreateUserTestSubmissionDto
) {
return await this.submissionService.submitTest(
req.user.id,
userId,
problemId,
userTestSubmissionDto,
true
Expand All @@ -120,8 +125,9 @@ export class SubmissionController {
* @returns Testcase별 결과가 담겨있는 Object
*/
@Get('user-test')
async getUserTestResult(@Req() req: AuthenticatedRequest) {
return await this.submissionService.getTestResult(req.user.id, true)
// TODO: 로드테스트용, 테스트 후 삭제 (req 사용으로 되돌리기)
async getUserTestResult(@Query('userId', ParseIntPipe) userId: number) {
return await this.submissionService.getTestResult(userId, true)
}

@Get('delay-cause')
Expand Down

0 comments on commit 449b44e

Please sign in to comment.