Skip to content

Commit 3228a36

Browse files
committed
hotfix: response with list
1 parent cce8444 commit 3228a36

3 files changed

Lines changed: 19 additions & 6 deletions

File tree

src/tree/controller.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { Response } from 'express';
1414
import {
1515
Coordinate,
1616
PlantTreeDto,
17+
TreeDetailListResponse,
1718
TreeDetailResponse,
1819
TreeListResponse,
1920
} from './dto';
@@ -106,15 +107,15 @@ export class TreeController {
106107
@ApiResponse({
107108
status: 200,
108109
description: '나무들 상세 정보 반환',
109-
type: TreeDetailResponse,
110+
type: TreeDetailListResponse,
110111
})
111112
async getTreeByRestaurantId(
112113
@Param('restaurantId') restaurantId: string,
113114
@User() user: UserParam,
114115
@Res() res: Response,
115116
) {
116117
const result = await this.tree.getTreesByRestaurantId(restaurantId, user);
117-
return res.status(HttpStatus.OK).json(result);
118+
return res.status(HttpStatus.OK).json(TreeDetailListResponse.from(result));
118119
}
119120

120121
@Post(':treeId/water')

src/tree/dto.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,20 @@ export class TreeDetailResponse {
179179
images: string[];
180180
}
181181

182+
export class TreeDetailListResponse {
183+
@ApiProperty({
184+
description: '나무 목록',
185+
type: [TreeDetailResponse],
186+
})
187+
items: TreeDetailResponse[];
188+
189+
static from(trees: TreeDetailResponse[]): TreeDetailListResponse {
190+
return {
191+
items: trees,
192+
};
193+
}
194+
}
195+
182196
export class TreeListResponse {
183197
@ApiProperty({
184198
description: '나무 목록',

src/user/controller.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ import {
4545
} from './dtos/updateProfile.dto';
4646
import { UpdateProfileUseCase } from './usecases/updateProfile';
4747
import { UpdateMbtiAndTagsUseCase } from './usecases/updateMbtiAndTags';
48-
import { ProfileResponseDto } from './dtos/profile.response';
49-
import { GetUserProfileUseCase } from './usecases/getUserProfile';
5048
import { UnfollowUserUseCase } from './usecases/unfollowUser';
5149
import { CheckFollowingStatusUseCase } from './usecases/checkFollowingStatus';
5250

@@ -91,8 +89,8 @@ export class UserController {
9189
})
9290
async getUserProfile(
9391
@User() user: UserParam,
94-
@Param('userId') userId: string,
95-
@Res() res: Response
92+
@Param('userId') userId: string,
93+
@Res() res: Response,
9694
) {
9795
const targetUser = await this.userService.getUser(userId);
9896
const result = await this.userService.getMypage(targetUser, user);

0 commit comments

Comments
 (0)