-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathcheck.controller.ts
41 lines (38 loc) · 1.57 KB
/
check.controller.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { Body, Controller, HttpCode, HttpStatus, Post } from "@nestjs/common";
import { CheckService } from "./check.service";
import { CheckNameConflictDto } from "./dto/check-name-conflict.dto";
import { CheckNameConflicReponse } from "./types/check-name-conflict-response.type";
import { Public } from "src/utils/decorators/auth.decorator";
import { ApiBody, ApiOkResponse, ApiOperation, ApiTags } from "@nestjs/swagger";
import { CheckYorkieDto } from "./dto/check-yorkie.dto";
import { CheckYorkieResponse } from "./types/check-yorkie-response.type";
@ApiTags("Check")
@Controller("check")
export class CheckController {
constructor(private checkService: CheckService) {}
@Public()
@Post("name-conflict")
@ApiOperation({
summary: "Check Whether The Name Conflicts with Username or Title of Workspace.",
description: "If the name is conflict, it returns true.",
})
@ApiBody({ type: CheckNameConflictDto })
@ApiOkResponse({ type: CheckNameConflicReponse })
async checkNameConflict(
@Body() checkNameConflictDto: CheckNameConflictDto
): Promise<CheckNameConflicReponse> {
return this.checkService.checkNameConflict(checkNameConflictDto.name);
}
@Public()
@Post("yorkie")
@ApiOperation({
summary: "Check Whether The Access is Authorized",
description: "If the user doesn't have the permission, reject the access",
})
@ApiBody({ type: CheckYorkieDto })
@ApiOkResponse({ type: CheckYorkieResponse })
@HttpCode(HttpStatus.OK)
async checkYorkie(@Body() checkYorkieDto: CheckYorkieDto): Promise<CheckYorkieResponse> {
return this.checkService.checkYorkie(checkYorkieDto);
}
}