-
Notifications
You must be signed in to change notification settings - Fork 0
voucher
LeeSangHoon edited this page Apr 24, 2023
·
2 revisions
| API | Description |
|---|---|
| GET /api/voucher | 소유권 목록 조회 |
| POST /api/voucher | 소유권 발급 |
| GET /api/voucher/:voucherId | 소유권 상세 조회 |
| DELETE /api/voucher/:voucherId | 소유권 삭제 |
| GET /api/voucher/:voucherId/log | 소유권 기록 조회 |
| GET /api/voucher/:voucherId/trade | 소유권으로 등록한 교환글 조회 |
GET /api/voucher
- 해당 검색 필터에 해당하는 소유권 목록 정보를 조회합니다.
| Parameter | Target | Type | Description |
|---|---|---|---|
| pageParam | query | number | 페이지 번호 |
| filter | query | Object | 검색 필터 |
| filter.photoNames | query | string[] | 조회할 포토카드 이름 목록 |
| filter.userNames | query | string[] | 조회할 소유자 아이디 목록 |
| filter.groupIds | query | number[] | 조회할 그룹 ID 목록 |
| filter.memberIds | query | number[] | 조회할 멤버 ID 목록 |
| filter.excludeVoucherIds | query | number[] | 조회에서 제외할 소유권 ID 목록 |
| filter.voucherState | query | "all" or "available" or "trading" or "shipping" or "shipped" | 조회할 소유권 상태 |
{
"_status": 200,
"message": "소유권 목록을 조회했습니다.",
"vouchers": [
{
"voucherId": 23,
"state": "trading",
"createdTime": "2023-04-21T17:17:10.000Z",
"photo": {
"photocardId": 207,
"name": "SIGNAL",
"imageName": "207_1681899933197.png",
"groupData": {
"groupId": 2,
"name": "TWICE"
},
"memberData": {
"memberId": 9,
"name": "정연"
}
},
"owner": {
"userId": 4,
"username": "user1",
"nickname": "교환매니아",
"imageName": "4_1681972498621.png"
}
}
],
"paging": {
"pageParam": 0,
"hasNextPage": true
}
}POST /api/voucher
- 관리자가 회원에게 포토카드 교환 기능에서 사용할 수 있는 소유권을 발급합니다.
| Parameter | Target | Type | Description |
|---|---|---|---|
| username | body | string | 사용자 아이디 |
| vouchers | body | Array | 발급할 소유권 목록 |
| vouchers.photocardId | body | number | 발급할 소유권의 포토카드 ID |
| vouchers.amount | body | number | 발급할 소유권의 갯수 |
{
"_status": 200,
"message": "wannav 사용자에게 소유권을 발급했어요."
}
{
"_status": 404,
"message": "가입되지 않은 사용자에요."
}GET /api/voucher/:voucherId
- 특정 소유권의 상세 정보를 조회합니다.
| Parameter | Target | Type | Description |
|---|---|---|---|
| voucherId | param | number | 소유권 ID |
{
"_status": 200,
"message": "23번 소유권의 상세 정보를 조회했습니다.",
"voucherId": 23,
"state": "trading",
"createdTime": "2023-04-21T17:17:10.000Z",
"photo": {
"photocardId": 207,
"name": "SIGNAL",
"imageName": "207_1681899933197.png",
"groupData": {
"groupId": 2,
"name": "TWICE"
},
"memberData": {
"memberId": 9,
"name": "정연"
}
},
"owner": {
"userId": 4,
"username": "user1",
"nickname": "교환매니아",
"imageName": "4_1681972498621.png"
}
}
{
"_status": 404,
"message": "해당 소유권의 데이터가 서버에 존재하지 않아요."
}DELETE /api/voucher/:voucherId
- 소유권을 삭제합니다.
| Parameter | Target | Type | Description |
|---|---|---|---|
| voucherId | param | number | 소유권 ID |
{
"_status": 200,
"message": "wannav 회원의 THE STORY BEGINS 소유권을 삭제했어요."
}
{
"_status": 404,
"message": "해당 소유권의 데이터가 서버에 존재하지 않아요."
}GET /api/voucher/:voucherId/log
- 특정 소유권의 발급, 교환, 발송 내역을 조회합니다.
| Parameter | Target | Type | Description |
|---|---|---|---|
| voucherId | param | number | 소유권 ID |
| pageParam | query | number | 페이지 번호 |
{
"_status": 200,
"message": "소유권의 기록을 조회했어요.",
"logs": [
{
"logId": 37,
"type": "shipped",
"voucherId": 20,
"originUserId": 5,
"destUserId": null,
"loggedTime": "2023-04-20T09:05:11.000Z"
},
{
"logId": 28,
"type": "traded",
"voucherId": 20,
"originUserId": 4,
"destUserId": 5,
"loggedTime": "2023-04-20T06:30:33.000Z"
},
{
"logId": 24,
"type": "issued",
"voucherId": 20,
"originUserId": 4,
"destUserId": null,
"loggedTime": "2023-04-20T06:30:12.000Z"
}
],
"paging": {
"pageParam": "0",
"hasNextPage": false
}
}
{
"_status": 404,
"message": "해당 소유권의 데이터가 서버에 존재하지 않아요."
}GET /api/voucher/:voucherId/trade
- 특정 소유권으로 등록한 교환글 중에서 아직 교환이 완료되지 않은 교환글을 조회합니다.
| Parameter | Target | Type | Description |
|---|---|---|---|
| voucherId | param | number | 소유권 ID |
{
"_status": 200,
"message": "교환글을 조회했어요.",
"tradeId": 5,
"userId": 5,
"state": "trading",
"amount": 1,
"writtenTime": "2023-04-20T06:17:29.000Z",
"tradedTime": null,
"voucher": {
"voucherId": 15,
"photocardId": 171,
"name": "PROOF",
"imageName": "171_1681838478058.png",
"groupData": {
"groupId": 1,
"name": "BTS"
},
"memberData": {
"memberId": 6,
"name": "V"
}
}
}
{
"_status": 404,
"message": "해당 소유권으로 작성된 교환글이 존재하지 않아요."
}