Skip to content

Commit 15bef84

Browse files
committed
fix: modify wrong api-response type, add bad request case
1 parent 40286ab commit 15bef84

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/cafe/cafe.controller.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
BadRequestException,
23
Body,
34
Controller,
45
Delete,
@@ -59,7 +60,7 @@ export class CafeController {
5960
summary: 'get my liked cafe list',
6061
})
6162
@ApiOkResponse({
62-
type: Array<PaginationCafeListResDto>,
63+
type: PaginationCafeListResDto,
6364
description: 'Cafe list that I liked',
6465
})
6566
@ApiInternalServerErrorResponse({
@@ -79,7 +80,7 @@ export class CafeController {
7980
summary: 'search cafe by name',
8081
})
8182
@ApiOkResponse({
82-
type: Array<PaginationCafeListResDto>,
83+
type: PaginationCafeListResDto,
8384
description: 'Cafe list containing search keyword',
8485
})
8586
@ApiInternalServerErrorResponse({
@@ -90,6 +91,10 @@ export class CafeController {
9091
@Query('name') name: string,
9192
@Query() query: PaginationDto,
9293
): Promise<PaginationCafeListResDto> {
94+
if (!name || name.trim() === '') {
95+
throw new BadRequestException('Name is required');
96+
}
97+
9398
return await this.cafeService.searchCafeByName(name, query);
9499
}
95100

0 commit comments

Comments
 (0)