-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…uest-api 아이템 스웨거 잠시 주석처리
- Loading branch information
Showing
1 changed file
with
197 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
import { applyDecorators } from '@nestjs/common'; | ||
import { ApiOperation, ApiResponse, ApiBody } from '@nestjs/swagger'; | ||
import { | ||
BuyItemDto, | ||
EquipItemDto, | ||
UnequipItemDto, | ||
} from './dto/item-changeStatus.dto'; | ||
|
||
export const ApiItems = { | ||
getAllItems: () => { | ||
return applyDecorators( | ||
ApiOperation({ | ||
summary: '모든 items 조회', | ||
description: '존재하는 모든 아이템을 조회합니다.', | ||
}), | ||
ApiResponse({ | ||
status: 200, | ||
description: '모든 items 성공적으로 조회됨', | ||
content: { | ||
JSON: { | ||
example: { | ||
id: 2, | ||
name: 'blue-hat', | ||
cost: 2000, | ||
image: '2', | ||
createdAt: '2024-11-05T10:30:15.000Z', | ||
updatedAt: '2024-11-05T10:40:15.000Z', | ||
}, | ||
}, | ||
}, | ||
}), | ||
); | ||
}, | ||
buyItem: () => { | ||
return applyDecorators( | ||
ApiOperation({ | ||
summary: '특정 user의 특정 item 구매하기', | ||
description: '특정 user가 특정 item을 구매합니다.', | ||
}), | ||
ApiBody({ | ||
description: 'userId와 itemId를 포함한 요청 바디', | ||
type: BuyItemDto, | ||
}), | ||
ApiResponse({ | ||
status: 204, | ||
description: 'user가 item을 성공적으로 구매함', | ||
}), | ||
ApiResponse({ | ||
status: 400, | ||
description: '유효하지 않은 요청 값 (userId 또는 itemId 오류)', | ||
content: { | ||
JSON: { | ||
example: { | ||
statusCode: 400, | ||
message: 'Invalid userId or itemId provided', | ||
error: 'Bad request', | ||
}, | ||
}, | ||
}, | ||
}), | ||
); | ||
}, | ||
|
||
equipItem: () => { | ||
return applyDecorators( | ||
ApiOperation({ | ||
summary: '특정 user가 특정 item 장착', | ||
description: '특정 user가 소유한 item을 장착', | ||
}), | ||
ApiBody({ | ||
description: 'userId와 itemId를 포함한 요청 바디', | ||
type: EquipItemDto, | ||
}), | ||
ApiResponse({ | ||
status: 204, | ||
description: 'item 장착 성공', | ||
}), | ||
ApiResponse({ | ||
status: 400, | ||
description: '유효하지 않은 요청 값 (userId 또는 itemId 오류)', | ||
content: { | ||
JSON: { | ||
example: { | ||
statusCode: 400, | ||
message: 'Invalid userId or itemId provided', | ||
error: 'Bad request', | ||
}, | ||
}, | ||
}, | ||
}), | ||
); | ||
}, | ||
|
||
unequipItem: () => { | ||
return applyDecorators( | ||
ApiOperation({ | ||
summary: '특정 user가 특정 item 해제', | ||
description: '특정 user가 장착한 item을 해제한다', | ||
}), | ||
ApiBody({ | ||
description: 'userId와 itemId를 포함한 요청 바디', | ||
type: UnequipItemDto, | ||
}), | ||
ApiResponse({ | ||
status: 204, | ||
description: 'item 해제 성공', | ||
}), | ||
ApiResponse({ | ||
status: 400, | ||
description: '유효하지 않은 요청 값 (userId 또는 itemId 오류)', | ||
content: { | ||
JSON: { | ||
example: { | ||
statusCode: 400, | ||
message: 'Invalid userId or itemId provided', | ||
error: 'Bad request', | ||
}, | ||
}, | ||
}, | ||
}), | ||
); | ||
}, | ||
|
||
deleteUserItem: () => { | ||
return applyDecorators( | ||
ApiOperation({ | ||
summary: '특정 user의 특정 item 삭제', | ||
description: '특정 user의 특정 item을 삭제한다', | ||
}), | ||
ApiResponse({ | ||
status: 204, | ||
description: 'user의 item 삭제 성공', | ||
}), | ||
ApiResponse({ | ||
status: 400, | ||
description: '유효하지 않은 요청 값 (userId 또는 itemId 오류)', | ||
content: { | ||
JSON: { | ||
example: { | ||
statusCode: 400, | ||
message: 'Invalid userId or itemId provided', | ||
error: 'Bad request', | ||
}, | ||
}, | ||
}, | ||
}), | ||
); | ||
}, | ||
|
||
getUserItems: () => { | ||
return applyDecorators( | ||
ApiOperation({ | ||
summary: '특정 user의 items 조회', | ||
description: '특정 user가 소유한 모든 items를 조회한다', | ||
}), | ||
ApiResponse({ | ||
status: 200, | ||
description: 'user의 모든 items가 성공적으로 조회됨', | ||
content: { | ||
JSON: { | ||
example: [ | ||
{ | ||
id: 2, | ||
itemId: 3, | ||
userId: 1, | ||
isEquipped: false, | ||
createdAt: '2024-11-05T10:30:15.000Z', | ||
updatedAt: '2024-11-05T10:40:15.000Z', | ||
}, | ||
{ | ||
id: 3, | ||
itemId: 5, | ||
userId: 1, | ||
isEquipped: true, | ||
createdAt: '2024-11-05T10:40:15.000Z', | ||
updatedAt: '2024-11-05T10:40:15.000Z', | ||
}, | ||
], | ||
}, | ||
}, | ||
}), | ||
ApiResponse({ | ||
status: 404, | ||
description: '해당 user를 찾을 수 없음', | ||
content: { | ||
JSON: { | ||
example: { | ||
statusCode: 404, | ||
message: 'User not found', | ||
error: 'Not Found', | ||
}, | ||
}, | ||
}, | ||
}), | ||
); | ||
}, | ||
}; |