Skip to content

KDT1-FE/KDT5-M5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 

Repository files navigation

๐Ÿค ๊ฑฐ๋ž˜ API ํ™œ์šฉ, ํŒ€ ํ”„๋กœ์ ํŠธ

์ฃผ์–ด์ง„ API๋ฅผ ๋ถ„์„ํ•ด ์–ด๋–ค ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰/์™„์„ฑํ•  ๊ฒƒ์ธ์ง€ ํŒ€ ๋‹จ์œ„๋กœ ์ž์œ ๋กญ๊ฒŒ ๊ฒฐ์ •ํ•˜๊ณ  ๋งŒ๋“ค์–ด๋ณด์„ธ์š”.
TypeScript๋ฅผ ํ•„์ˆ˜๋กœ ์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
๊ณผ์ œ ์ˆ˜ํ–‰ ๋ฐ ๋ฆฌ๋ทฐ ๊ธฐ๊ฐ„์€ ๋ณ„๋„ ๊ณต์ง€๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”!

๊ณผ์ œ ์ˆ˜ํ–‰ ๋ฐ ์ œ์ถœ ๋ฐฉ๋ฒ•

KDT๊ธฐ์ˆ˜๋ฒˆํ˜ธ_์ด๋ฆ„

E.g, KDT0_ParkYoungWoong
  1. ํ˜„์žฌ ์ €์žฅ์†Œ๋ฅผ ๋กœ์ปฌ์— ํด๋ก (Clone)ํ•ฉ๋‹ˆ๋‹ค.
  2. ์ž์‹ ์˜ ๋ณธ๋ช…์œผ๋กœ ๋ธŒ๋žœ์น˜๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.(๊ตฌ๋ถ„ ๊ฐ€๋Šฅํ•˜๋„๋ก ๋ณธ๋ช…์„ ๊ผญ ํŒŒ์Šค์นผ์ผ€์ด์Šค๋กœ ํ‘œ์‹œํ•˜์„ธ์š”, git branch KDTX_ParkYoungWoong)
  3. ์ž์‹ ์˜ ๋ณธ๋ช… ๋ธŒ๋žœ์น˜์—์„œ ๊ณผ์ œ๋ฅผ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.
  4. ๊ณผ์ œ ์ˆ˜ํ–‰์ด ์™„๋ฃŒ๋˜๋ฉด, ์ž์‹ ์˜ ๋ณธ๋ช… ๋ธŒ๋žœ์น˜๋ฅผ ์›๊ฒฉ ์ €์žฅ์†Œ์— ํ‘ธ์‹œ(Push)ํ•ฉ๋‹ˆ๋‹ค.(main ๋ธŒ๋žœ์น˜์— ํ‘ธ์‹œํ•˜์ง€ ์•Š๋„๋ก ๊ผญ ์ฃผ์˜ํ•˜์„ธ์š”, git push origin KDTX_ParkYoungWoong)
  5. ์ €์žฅ์†Œ์—์„œ main ๋ธŒ๋žœ์น˜๋ฅผ ๋Œ€์ƒ์œผ๋กœ Pull Request ์ƒ์„ฑํ•˜๋ฉด, ๊ณผ์ œ ์ œ์ถœ์ด ์™„๋ฃŒ๋ฉ๋‹ˆ๋‹ค!(E.g, main <== KDTX_ParkYoungWoong)
  • main ํ˜น์€ ๋‹ค๋ฅธ ์‚ฌ๋žŒ์˜ ๋ธŒ๋žœ์น˜๋กœ ์ ˆ๋Œ€ ๋ณ‘ํ•ฉํ•˜์ง€ ์•Š๋„๋ก ์ฃผ์˜ํ•˜์„ธ์š”!
  • Pull Request์—์„œ ๋ณด์ด๋Š” ์„ค๋ช…์„ ๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์ด ์ดํ•ดํ•˜๊ธฐ ์‰ฝ๋„๋ก ๊ผผ๊ผผํ•˜๊ฒŒ ์ž‘์„ฑํ•˜์„ธ์š”!
  • Pull Request์—์„œ ๊ณผ์ œ ์ œ์ถœ ํ›„ ์ ˆ๋Œ€ ๋ณ‘ํ•ฉ(Merge)ํ•˜์ง€ ์•Š๋„๋ก ์ฃผ์˜ํ•˜์„ธ์š”!
  • ๊ณผ์ œ ์ˆ˜ํ–‰ ๋ฐ ์ œ์ถœ ๊ณผ์ •์—์„œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•œ ๊ฒฝ์šฐ, ๋ฐ”๋กœ ๋‹ด๋‹น ๋ฉ˜ํ† ๋‚˜ ๊ฐ•์‚ฌ์—์„œ ์–˜๊ธฐํ•˜์„ธ์š”!

API ์‚ฌ์šฉ๋ฒ•

๋ชจ๋“  API ์š”์ฒญ(Request) headers์— ์•„๋ž˜ ์ •๋ณด๊ฐ€ ๊ผญ ํฌํ•จ๋ผ์•ผ ํ•ฉ๋‹ˆ๋‹ค!
username์€ KDT5_TeamX์™€ ๊ฐ™์ด ๋ณธ๋ช… ํ˜น์€ ํŒ€ ์ด๋ฆ„์„ ํฌํ•จํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค!
ํ™•์ธํ•  ์ˆ˜ ์—†๋Š” ์‚ฌ์šฉ์ž๋‚˜ ํŒ€์˜ DB ์ •๋ณด๋Š” ์ž„์˜๋กœ ์‚ญ์ œ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค!

{
  "content-type": "application/json",
  "apikey": "KDT5_nREmPe9B",
  "username": "KDT5_TeamX"
}

์ธ์ฆ

'์ธ์ฆ' ๊ด€๋ จ API๋Š” ๋ชจ๋‘ ์ผ๋ฐ˜ ์‚ฌ์šฉ์ž ์ „์šฉ์ž…๋‹ˆ๋‹ค.

ํšŒ์›๊ฐ€์ž…

์‚ฌ์šฉ์ž๊ฐ€ username์— ์ข…์†๋˜์–ด ํšŒ์›๊ฐ€์ž…ํ•ฉ๋‹ˆ๋‹ค.

  • ์‚ฌ์šฉ์ž ๋น„๋ฐ€๋ฒˆํ˜ธ๋Š” ์•”ํ˜ธํ™”ํ•ด ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.(๊ด€๋ฆฌ์ž๋Š” ํ™•์ธํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค!)
  • ํ”„๋กœํ•„ ์ด๋ฏธ์ง€๋Š” 1MB ์ดํ•˜์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค.
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/auth/signup
  \ -X 'POST'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface RequestBody {
  email: string // ์‚ฌ์šฉ์ž ์•„์ด๋”” (ํ•„์ˆ˜!)
  password: string // ์‚ฌ์šฉ์ž ๋น„๋ฐ€๋ฒˆํ˜ธ, 8์ž ์ด์ƒ (ํ•„์ˆ˜!)
  displayName: string // ์‚ฌ์šฉ์ž ์ด๋ฆ„, 20์ž ์ดํ•˜ (ํ•„์ˆ˜!)
  profileImgBase64?: string // ์‚ฌ์šฉ์ž ํ”„๋กœํ•„ ์ด๋ฏธ์ง€(base64) - jpg, jpeg, webp, png, gif, svg
}
{
  "email": "[email protected]",
  "password": "********",
  "displayName": "ParkYoungWoong",
  "profileImgBase64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAf...(์ƒ๋žต)"
}

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface ResponseValue {
  user: { // ํšŒ์›๊ฐ€์ž…ํ•œ ์‚ฌ์šฉ์ž ์ •๋ณด
    email: string // ์‚ฌ์šฉ์ž ์•„์ด๋””
    displayName: string // ์‚ฌ์šฉ์ž ํ‘œ์‹œ ์ด๋ฆ„
    profileImg: string | null // ์‚ฌ์šฉ์ž ํ”„๋กœํ•„ ์ด๋ฏธ์ง€(URL)
  }
  accessToken: string // ์‚ฌ์šฉ์ž ์ ‘๊ทผ ํ† ํฐ
}
{
  "user": {
    "email": "[email protected]",
    "displayName": "ParkYoungWoong",
    "profileImg": "https://storage.googleapis.com/heropy-api/vjbtIrh5dGv163442.png"
  },
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IlM3WDhpQ...(์ƒ๋žต)"
}

๋กœ๊ทธ์ธ

  • ๋ฐœ๊ธ‰๋œ accessToken์€ 24์‹œ๊ฐ„ ํ›„ ๋งŒ๋ฃŒ๋ฉ๋‹ˆ๋‹ค.(๋งŒ๋ฃŒ ํ›„ ๋‹ค์‹œ ๋กœ๊ทธ์ธ ํ•„์š”)
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/auth/login
  \ -X 'POST'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface RequestBody {
  email: string // ์‚ฌ์šฉ์ž ์•„์ด๋”” (ํ•„์ˆ˜!)
  password: string // ์‚ฌ์šฉ์ž ๋น„๋ฐ€๋ฒˆํ˜ธ (ํ•„์ˆ˜!)
}
{
  "email": "[email protected]",
  "password": "********"
}

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface ResponseValue {
  user: { // ํšŒ์›๊ฐ€์ž…ํ•œ ์‚ฌ์šฉ์ž ์ •๋ณด
    email: string // ์‚ฌ์šฉ์ž ์•„์ด๋””
    displayName: string // ์‚ฌ์šฉ์ž ํ‘œ์‹œ ์ด๋ฆ„
    profileImg: string | null // ์‚ฌ์šฉ์ž ํ”„๋กœํ•„ ์ด๋ฏธ์ง€(URL)
  }
  accessToken: string // ์‚ฌ์šฉ์ž ์ ‘๊ทผ ํ† ํฐ
}
{
  "user": {
    "email": "[email protected]",
    "displayName": "ParkYoungWoong",
    "profileImg": "https://storage.googleapis.com/heropy-api/vAKjlJ-Gx5v163442.png"
  },
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjlQS3I...(์ƒ๋žต)"
}

์ธ์ฆ ํ™•์ธ

curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/auth/me
  \ -X 'POST'
  \ -H 'Authorization: Bearer <accessToken>'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

  • ์—†์Œ

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface ResponseValue {
  email: string // ์‚ฌ์šฉ์ž ์•„์ด๋””
  displayName: string // ์‚ฌ์šฉ์ž ํ‘œ์‹œ ์ด๋ฆ„
  profileImg: string | null // ์‚ฌ์šฉ์ž ํ”„๋กœํ•„ ์ด๋ฏธ์ง€(URL)
}
{
  "email": "[email protected]",
  "displayName": "ParkYoungWoong",
  "profileImg": "https://storage.googleapis.com/heropy-api/vAKjlJ-Gx5v163442.png"
}

๋กœ๊ทธ์•„์›ƒ

curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/auth/logout
  \ -X 'POST'
  \ -H 'Authorization: Bearer <accessToken>'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

  • ์—†์Œ

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

type ResponseValue = true // ๋กœ๊ทธ์•„์›ƒ ์ฒ˜๋ฆฌ ์ƒํƒœ

์‚ฌ์šฉ์ž ์ •๋ณด ์ˆ˜์ •

curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/auth/user
  \ -X 'PUT'
  \ -H 'Authorization: Bearer <accessToken>'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface RequestBody {
  displayName?: string // ์ƒˆ๋กœ์šด ํ‘œ์‹œ ์ด๋ฆ„
  profileImgBase64?: string // ์‚ฌ์šฉ์ž ํ”„๋กœํ•„ ์ด๋ฏธ์ง€(base64) - jpg, jpeg, webp, png, gif, svg
  oldPassword?: string // ๊ธฐ์กด ๋น„๋ฐ€๋ฒˆํ˜ธ
  newPassword?: string // ์ƒˆ๋กœ์šด ๋น„๋ฐ€๋ฒˆํ˜ธ
}
{
  "oldPassword": "********",
  "newPassword": "**********"
}

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface ResponseValue {
  email: string // ์‚ฌ์šฉ์ž ์•„์ด๋””
  displayName: string // ์‚ฌ์šฉ์ž ํ‘œ์‹œ ์ด๋ฆ„
  profileImg: string | null // ์‚ฌ์šฉ์ž ํ”„๋กœํ•„ ์ด๋ฏธ์ง€(URL)
}
{
  "email": "[email protected]",
  "displayName": "ParkYoungWoong",
  "profileImg": "https://storage.googleapis.com/heropy-api/vAKjlJ-Gx5v163442.png"
}

์‚ฌ์šฉ์ž ๋ชฉ๋ก ์กฐํšŒ

  • ๊ด€๋ฆฌ์ž ์ „์šฉ API์ž…๋‹ˆ๋‹ค.
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/auth/users
  \ -X 'GET'
  \ -H 'masterKey: true'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

  • ์—†์Œ

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

type ResponseValue = User[]

interface User {
  email: string // ์‚ฌ์šฉ์ž ์•„์ด๋””
  displayName: string // ์‚ฌ์šฉ์ž ํ‘œ์‹œ ์ด๋ฆ„
  profileImg: string // ์‚ฌ์šฉ์ž ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ URL
}
[
  {
    "email": "[email protected]",
    "displayName": "HEROPY",
    "profileImg": null
  },
  {
    "email": "[email protected]",
    "displayName": "๋ฐ•์˜์›…",
    "profileImg": "https://storage.googleapis.com/heropy-api/Z_una7lyijv074804.png"
  },
  {
    "email": "[email protected]",
    "displayName": "๊ด€๋ฆฌ์ž",
    "profileImg": "https://storage.googleapis.com/heropy-api/ZXcXjwsB7nv121507.png"
  }
]

๊ณ„์ขŒ

'๊ณ„์ขŒ' ๊ด€๋ จ API๋Š” ๋ชจ๋‘ ์ผ๋ฐ˜ ์‚ฌ์šฉ์ž ์ „์šฉ์ž…๋‹ˆ๋‹ค.

์„ ํƒ ๊ฐ€๋Šฅํ•œ ์€ํ–‰ ๋ชฉ๋ก ์กฐํšŒ

  • ์€ํ–‰ ๋‹น ํ•˜๋‚˜์˜ ๊ณ„์ขŒ๋งŒ ํ—ˆ์šฉ๋ฉ๋‹ˆ๋‹ค.
  • ์‚ฌ์šฉ์ž๊ฐ€ ๊ณ„์ขŒ๋ฅผ ์ถ”๊ฐ€ํ•˜๋ฉด, ํ•ด๋‹น ์€ํ–‰ ์ •๋ณด disabled ์†์„ฑ์ด true๋กœ ๋ณ€๊ฒฝ๋ฉ๋‹ˆ๋‹ค.
  • ์€ํ–‰ ์ •๋ณด digits ์†์„ฑ์˜ ์ˆซ์ž๋ฅผ ๋ชจ๋‘ ๋”ํ•˜๋ฉด ๊ฐ ์€ํ–‰์˜ ์œ ํšจํ•œ ๊ณ„์ขŒ๋ฒˆํ˜ธ ๊ธธ์ด๊ฐ€ ๋ฉ๋‹ˆ๋‹ค.
  • [3, 2, 4, 3] => 123-12-1234-123
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/account/banks
  \ -X 'GET'
  \ -H 'Authorization: Bearer <accessToken>'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

  • ์—†์Œ

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

type ResponseValue = Bank[] // ์„ ํƒ ๊ฐ€๋Šฅํ•œ ์€ํ–‰ ์ •๋ณด ๋ชฉ๋ก

interface Bank { // ์„ ํƒ ๊ฐ€๋Šฅํ•œ ์€ํ–‰ ์ •๋ณด
  name: string // ์€ํ–‰ ์ด๋ฆ„
  code: string // ์€ํ–‰ ์ฝ”๋“œ
  digits: number[] // ์€ํ–‰ ๊ณ„์ขŒ ์ž๋ฆฟ์ˆ˜
  disabled: boolean // ์‚ฌ์šฉ์ž๊ฐ€ ์ถ”๊ฐ€ํ•œ ๊ณ„์ขŒ ์—ฌ๋ถ€
}
[
  {
    "name": "KB๊ตญ๋ฏผ์€ํ–‰",
    "code": "004",
    "digits": [3, 2, 4, 3],
    "disabled": false
  },
  {
    "name": "์‹ ํ•œ์€ํ–‰",
    "code": "088",
    "digits": [3, 3, 6],
    "disabled": true
  },
  {
    "name": "์šฐ๋ฆฌ์€ํ–‰",
    "code": "020",
    "digits": [4, 3, 6],
    "disabled": true
  },
  {
    "name": "ํ•˜๋‚˜์€ํ–‰",
    "code": "081",
    "digits": [3, 6, 5],
    "disabled": false
  },
  {
    "name": "์ผ€์ด๋ฑ…ํฌ",
    "code": "089",
    "digits": [3, 3, 6],
    "disabled": false
  },
  {
    "name": "์นด์นด์˜ค๋ฑ…ํฌ",
    "code": "090",
    "digits": [4, 2, 7],
    "disabled": false
  },
  {
    "name": "NH๋†ํ˜‘์€ํ–‰",
    "code": "011",
    "digits": [3, 4, 4, 2],
    "disabled": false
  }
]

๊ณ„์ขŒ ๋ชฉ๋ก ๋ฐ ์ž”์•ก ์กฐํšŒ

  • ๊ณ„์ขŒ๋ฒˆํ˜ธ๋Š” ์ผ๋ถ€๋งŒ ๋…ธ์ถœ๋ฉ๋‹ˆ๋‹ค. E.g. "123-XXXX-XXXX-XX"
  • ์ž”์•ก์˜ ๋‹จ์œ„๋Š” '์›ํ™”(๏ฟฆ)'์ž…๋‹ˆ๋‹ค.
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/account
  \ -X 'GET'
  \ -H 'Authorization: Bearer <accessToken>'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

  • ์—†์Œ

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface ResponseValue {
  totalBalance: number // ์‚ฌ์šฉ์ž ๊ณ„์ขŒ ์ž”์•ก ์ดํ•ฉ
  accounts: Bank[] // ์‚ฌ์šฉ์ž ๊ณ„์ขŒ ์ •๋ณด ๋ชฉ๋ก
}

interface Bank { // ์‚ฌ์šฉ์ž ๊ณ„์ขŒ ์ •๋ณด
  id: string // ๊ณ„์ขŒ ID
  bankName: string // ์€ํ–‰ ์ด๋ฆ„
  bankCode: string // ์€ํ–‰ ์ฝ”๋“œ
  accountNumber: string // ๊ณ„์ขŒ ๋ฒˆํ˜ธ
  balance: number // ๊ณ„์ขŒ ์ž”์•ก
}
{
  "totalBalance": 5999900,
  "accounts": [
    {
      "id": "jQMfKla8vOIFELA3mAXv",
      "bankName": "NH๋†ํ˜‘์€ํ–‰",
      "bankCode": "011",
      "accountNumber": "356-XXXX-XXXX-XX",
      "balance": 2999900
    },
    {
      "id": "wiPgsXvMAmcLw8AuRHIi",
      "bankName": "KB๊ตญ๋ฏผ์€ํ–‰",
      "bankCode": "004",
      "accountNumber": "123-XX-XXXX-XXX",
      "balance": 3000000
    }
  ]
}

๊ณ„์ขŒ ์—ฐ๊ฒฐ

  • ์—ฐ๊ฒฐ๋œ ๊ณ„์ขŒ ์ž”์•ก์—๋Š” ์ž๋™์œผ๋กœ ๊ธฐ๋ณธ '3๋ฐฑ๋งŒ์›'์ด ์ถ”๊ฐ€๋ฉ๋‹ˆ๋‹ค.
  • ์š”์ฒญํ•˜๋Š” ๊ณ„์ขŒ๋ฒˆํ˜ธ์™€ ์ „ํ™”๋ฒˆํ˜ธ์—๋Š” - ๊ตฌ๋ถ„์ด ์—†์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/account 
  \ -X 'POST'
  \ -H 'Authorization: Bearer <accessToken>'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface RequestBody {
  bankCode: string // ์—ฐ๊ฒฐํ•  ์€ํ–‰ ์ฝ”๋“œ (ํ•„์ˆ˜!)
  accountNumber: string // ์—ฐ๊ฒฐํ•  ๊ณ„์ขŒ๋ฒˆํ˜ธ (ํ•„์ˆ˜!)
  phoneNumber: string // ์‚ฌ์šฉ์ž ์ „ํ™”๋ฒˆํ˜ธ (ํ•„์ˆ˜!)
  signature: boolean // ์‚ฌ์šฉ์ž ์„œ๋ช… (ํ•„์ˆ˜!)
}
{
  "bankCode": "088",
  "accountNumber": "123456789012",
  "phoneNumber": "01012345678",
  "signature": true
}

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface ResponseValue { // ์—ฐ๊ฒฐ๋œ ๊ณ„์ขŒ ์ •๋ณด
  id: string // ๊ณ„์ขŒ ID
  bankName: string // ์€ํ–‰ ์ด๋ฆ„
  bankCode: string // ์€ํ–‰ ์ฝ”๋“œ
  accountNumber: string // ๊ณ„์ขŒ ๋ฒˆํ˜ธ
  balance: number // ๊ณ„์ขŒ ์ž”์•ก
}
{
  "id": "1qRFC6Ey5VkSu6nyj5Ba",
  "bankName": "์‹ ํ•œ์€ํ–‰",
  "bankCode": "088",
  "accountNumber": "123-XXX-XXXXXX",
  "balance": 3000000
}

๊ณ„์ขŒ ํ•ด์ง€

  • ํ•ด์ง€ํ•œ ๊ณ„์ขŒ๋Š” ๋‹ค์‹œ ์—ฐ๊ฒฐํ•ด๋„ ์ž”์•ก์ด ๋ฐ˜์˜๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.(๊ธฐ๋ณธ ๊ธˆ์•ก์œผ๋กœ ์ถ”๊ฐ€๋ฉ๋‹ˆ๋‹ค)
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/account 
  \ -X 'DELETE'
  \ -H 'Authorization: Bearer <accessToken>'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface RequestBody {
  accountId: string // ๊ณ„์ขŒ ID (ํ•„์ˆ˜!)
  signature: boolean // ์‚ฌ์šฉ์ž ์„œ๋ช… (ํ•„์ˆ˜!)
}
{
  "accountId": "jQMfKla8vOIFELA3mAXv",
  "signature": true
}

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

type ResponseValue = true  // ๊ณ„์ขŒ ํ•ด์ง€ ์ฒ˜๋ฆฌ ์ƒํƒœ

์ œํ’ˆ

'์ œํ’ˆ' ๊ด€๋ จ API๋Š” ๊ด€๋ฆฌ์ž ์ „์šฉ๊ณผ ์ผ๋ฐ˜ ์‚ฌ์šฉ์ž ์ „์šฉ์œผ๋กœ ๊ตฌ๋ถ„๋ฉ๋‹ˆ๋‹ค.
๊ณต์šฉ API๋„ ์žˆ์œผ๋‹ˆ ์ฃผ์˜ํ•˜์„ธ์š”!

๋ชจ๋“  ์ œํ’ˆ ์กฐํšŒ

  • ๊ด€๋ฆฌ์ž ์ „์šฉ API์ž…๋‹ˆ๋‹ค.
  • ์ƒ์„ธ ์ •๋ณด๊ฐ€ ์•„๋‹Œ ๊ธฐ๋ณธ ์ •๋ณด์˜ ์ œํ’ˆ ์„ค๋ช…์€ 100์ž๊นŒ์ง€๋งŒ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.
  • ์ƒ์„ธ ์ •๋ณด๊ฐ€ ์•„๋‹Œ ๊ธฐ๋ณธ ์ •๋ณด์˜ ์ œํ’ˆ ์ƒ์„ธ ์‚ฌ์ง„์€ ํฌํ•จ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
  • ์ œํ’ˆ ํ• ์ธ์œจ(discountRate)์€ ์ œํ’ˆ ๊ฐ€๊ฒฉ๊ณผ ์ง์ ‘ ๊ด€๊ณ„๊ฐ€ ์—†๋Š” ๋‹จ์ˆœ ๋ฉ”๋ชจ ์†์„ฑ์ž…๋‹ˆ๋‹ค.
  • ์ œํ’ˆ ํ• ์ธ์œจ์ด ์—†๋Š” ๊ฒฝ์šฐ, 0์œผ๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/products 
  \ -X 'GET'
  \ -H 'masterKey: true'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

  • ์—†์Œ

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

type ResponseValue = Product[] // ๊ด€๋ฆฌํ•˜๋Š” ๋ชจ๋“  ์ œํ’ˆ์˜ ๋ชฉ๋ก

interface Product { // ์ œํ’ˆ ์ •๋ณด
  id: string // ์ œํ’ˆ ID
  title: string // ์ œํ’ˆ ์ด๋ฆ„
  price: number // ์ œํ’ˆ ๊ฐ€๊ฒฉ
  description: string // ์ œํ’ˆ ์„ค๋ช…(์ตœ๋Œ€ 100์ž)
  tags: string[] // ์ œํ’ˆ ํƒœ๊ทธ
  thumbnail: string | null // ์ œํ’ˆ ์ธ๋„ค์ผ ์ด๋ฏธ์ง€(URL)
  isSoldOut: boolean // ์ œํ’ˆ ๋งค์ง„ ์—ฌ๋ถ€
  discountRate: number // ์ œํ’ˆ ํ• ์ธ์œจ
}
[
  {
    "id": "cFmeC7aY5KjZbBAdJE9y",
    "title": "์‚ผ์„ฑ์ „์ž ์Šค๋งˆํŠธ๋ชจ๋‹ˆํ„ฐ M7 S43AM700",
    "price": 639000,
    "description": "107.9cm(43์ธ์น˜) / ์™€์ด๋“œ(16:9) / ํ‰๋ฉด / VA / 3840 x 2160(4K UHD) / ํ”ฝ์…€ํ”ผ์น˜: 0.2451mm / 8ms(GTG) / 300cd / 5,00",
    "tags": [
      "๊ฐ€์ „",
      "๋ชจ๋‹ˆํ„ฐ",
      "์ปดํ“จํ„ฐ"
    ],
    "thumbnail": "https://storage.googleapis.com/heropy-api/vBAK4MQdH5v195712.png",
    "isSoldOut": false,
    "discountRate": 20
  },
  {
    "id": "nbqtQvEivYwEXTDet7YM",
    "title": "MacBook Pro 16",
    "price": 3360000,
    "description": "์—ญ๋Œ€ ๊ฐ€์žฅ ๊ฐ•๋ ฅํ•œ MacBook Pro๊ฐ€ ๋“ฑ์žฅํ–ˆ์Šต๋‹ˆ๋‹ค. ์ตœ์ดˆ์˜ ํ”„๋กœ์šฉ Apple Silicon์ธ M1 Pro ๋˜๋Š” M1 Max ์นฉ์„ ํƒ‘์žฌํ•ด ์œ์‚ด๊ฐ™์ด ๋น ๋ฅธ ์†๋„๋Š” ๋ฌผ๋ก , ํš๊ธฐ์ ์ธ ์„ฑ",
    "tags": [
      "๊ฐ€์ „",
      "๋…ธํŠธ๋ถ",
      "์ปดํ“จํ„ฐ"
    ],
    "thumbnail": "https://storage.googleapis.com/heropy-api/vIKMk_jy4Yv195256.png",
    "isSoldOut": false,
    "discountRate": 0
  }
]

์ „์ฒด ๊ฑฐ๋ž˜(ํŒ๋งค) ๋‚ด์—ญ

  • ๊ด€๋ฆฌ์ž ์ „์šฉ API์ž…๋‹ˆ๋‹ค.
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/products/transactions/all 
  \ -X 'GET'
  \ -H 'masterKey: true'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

  • ์—†์Œ

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

type RequestValue = TransactionDetail[] // ๋ชจ๋“  ๊ฑฐ๋ž˜ ๋‚ด์—ญ์˜ ๋ชฉ๋ก

interface TransactionDetail { // ๊ฑฐ๋ž˜ ๋‚ด์—ญ ์ •๋ณด
  detailId: string // ๊ฑฐ๋ž˜ ๋‚ด์—ญ ID
  user: { // ๊ฑฐ๋ž˜ํ•œ ์‚ฌ์šฉ์ž ์ •๋ณด
    email: string
    displayName: string
    profileImg: string | null
  }
  account: { // ๊ฑฐ๋ž˜ํ•œ ์‚ฌ์šฉ์ž์˜ ๊ณ„์ขŒ ์ •๋ณด
    bankName: string
    bankCode: string
    accountNumber: string
  }
  product: { // ๊ฑฐ๋ž˜ํ•œ ์ œํ’ˆ ์ •๋ณด
    productId: string
    title: string
    price: number
    description: string
    tags: string[]
    thumbnail: string | null
    discountRate: number
  }
  reservation: Reservation | null // ๊ฑฐ๋ž˜ํ•œ ์ œํ’ˆ์˜ ์˜ˆ์•ฝ ์ •๋ณด
  timePaid: string // ์ œํ’ˆ์„ ๊ฑฐ๋ž˜ํ•œ ์‹œ๊ฐ„
  isCanceled: boolean // ๊ฑฐ๋ž˜ ์ทจ์†Œ ์—ฌ๋ถ€
  done: boolean // ๊ฑฐ๋ž˜ ์™„๋ฃŒ ์—ฌ๋ถ€
}

interface Reservation {
  start: string // ์˜ˆ์•ฝ ์‹œ์ž‘ ์‹œ๊ฐ„
  end: string // ์˜ˆ์•ฝ ์ข…๋ฃŒ ์‹œ๊ฐ„
  isCanceled: boolean // ์˜ˆ์•ฝ ์ทจ์†Œ ์—ฌ๋ถ€
  isExpired: boolean // ์˜ˆ์•ฝ ๋งŒ๋ฃŒ ์—ฌ๋ถ€
}
[
  {
    "detailId": "dMhfxyrAupQP18OYmywy",
    "user": {
      "email": "[email protected]",
      "displayName": "ParkYoungWoong",
      "profileImg": "https://storage.googleapis.com/heropy-api/vsLRqTlPO5v200111.png"
    },
    "account": {
      "bankName": "KB๊ตญ๋ฏผ์€ํ–‰",
      "bankCode": "004",
      "accountNumber": "123-XX-XXXX-XXX"
    },
    "product": {
      "productId": "cFmeC7aY5KjZbBAdJE9y",
      "title": "์‚ผ์„ฑ์ „์ž ์Šค๋งˆํŠธ๋ชจ๋‹ˆํ„ฐ M7 S43AM700",
      "price": 639000,
      "description": "107.9cm(43์ธ์น˜) / ์™€์ด๋“œ(16:9) / ํ‰๋ฉด / VA / 3840 x 2160(4K UHD) / ํ”ฝ์…€ํ”ผ์น˜: 0.2451mm / 8ms(GTG) / 300cd / 5,00",
      "tags": [
        "๊ฐ€์ „",
        "๋ชจ๋‹ˆํ„ฐ",
        "์ปดํ“จํ„ฐ"
      ],
      "thumbnail": "https://storage.googleapis.com/heropy-api/vBAK4MQdH5v195712.png",
      "discountRate": 0
    },
    "reservation": null,
    "timePaid": "2021-11-07T20:01:49.100Z",
    "isCanceled": false,
    "done": false
  }
]

์˜ˆ์•ฝ ์ •๋ณด(reservation)๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ:

[
  {
    "reservation": {
      "start": "2021-11-12T06:00:00.000Z",
      "end": "2021-11-12T07:00:00.000Z",
      "isCanceled": false,
      "isExpired": true
    }
  }
]

๊ฑฐ๋ž˜(ํŒ๋งค) ๋‚ด์—ญ ์™„๋ฃŒ/์ทจ์†Œ ๋ฐ ํ•ด์ œ

  • ๊ด€๋ฆฌ์ž ์ „์šฉ API์ž…๋‹ˆ๋‹ค.
  • ๊ฑฐ๋ž˜ ๋‚ด์—ญ์„ ์ทจ์†Œํ•˜๋ฉด, ์˜ˆ์•ฝ๋„ ๊ฐ™์ด ์ทจ์†Œ๋ฉ๋‹ˆ๋‹ค.
  • ๊ฑฐ๋ž˜ ๋‚ด์—ญ์„ ์ทจ์†Œ ํ•ด์ œํ•˜๋ฉด, ์˜ˆ์•ฝ๋„ ๊ฐ™์ด ์ทจ์†Œ๊ฐ€ ํ•ด์ œ๋ฉ๋‹ˆ๋‹ค.
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/products/transactions/:detailId 
  \ -X 'PUT'
  \ -H 'masterKey: true'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface RequestBody {
  isCanceled?: boolean // ๊ฑฐ๋ž˜ ์ทจ์†Œ ์—ฌ๋ถ€ (์‚ฌ์šฉ์ž์˜ '์ œํ’ˆ ๊ฑฐ๋ž˜(๊ตฌ๋งค) ์ทจ์†Œ' ์ƒํƒœ์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค)
  done?: boolean // ๊ฑฐ๋ž˜ ์™„๋ฃŒ ์—ฌ๋ถ€ (์‚ฌ์šฉ์ž์˜ '์ œํ’ˆ ๊ฑฐ๋ž˜(๊ตฌ๋งค) ํ™•์ •' ์ƒํƒœ์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค)
}
{
  "isCanceled": true
}

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

type ResponseValue = true // ๊ฑฐ๋ž˜ ๋‚ด์—ญ ์™„๋ฃŒ/์ทจ์†Œ ๋ฐ ํ•ด์ œ ์ฒ˜๋ฆฌ ์ƒํƒœ

์ œํ’ˆ ์ถ”๊ฐ€

  • ๊ด€๋ฆฌ์ž ์ „์šฉ API์ž…๋‹ˆ๋‹ค.
  • ํŒŒ์ผ(์‚ฌ์ง„)์€ Base64๋กœ ์š”์ฒญํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
  • ์ œํ’ˆ ์ธ๋„ค์ผ ์‚ฌ์ง„์€ 1MB ์ดํ•˜์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค.
  • ์ œํ’ˆ ์ƒ์„ธ ์‚ฌ์ง„์€ 4MB ์ดํ•˜์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค.
  • ์ œํ’ˆ ํ• ์ธ์œจ(discountRate)์€ ์ œํ’ˆ ๊ฐ€๊ฒฉ๊ณผ ์ง์ ‘ ๊ด€๊ณ„๊ฐ€ ์—†๋Š” ๋‹จ์ˆœ ๋ฉ”๋ชจ ์†์„ฑ์ž…๋‹ˆ๋‹ค.
  • ์ œํ’ˆ ํ• ์ธ์œจ์€ 0~99 ์‚ฌ์ด ์ˆซ์ž๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”. ๋งŒ์•ฝ ํ• ์ธ์œจ์ด '20%'์ธ ๊ฒฝ์šฐ, 20์œผ๋กœ ์ž…๋ ฅํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
  • ์ œํ’ˆ ํ• ์ธ์œจ์„ ์ž…๋ ฅํ•˜์ง€ ์•Š์œผ๋ฉด, 0์œผ๋กœ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.
// ํ• ์ธ ์ „ ๊ฐ€๊ฒฉ์„ ๊ณ„์‚ฐ!
const priceBeforeDiscount = price * 100 / (100 - discountRate)
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/products 
  \ -X 'POST'
  \ -H 'masterKey: true'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface RequestBody {
  title: string // ์ œํ’ˆ ์ด๋ฆ„ (ํ•„์ˆ˜!)
  price: number // ์ œํ’ˆ ๊ฐ€๊ฒฉ (ํ•„์ˆ˜!)
  description: string // ์ œํ’ˆ ์ƒ์„ธ ์„ค๋ช… (ํ•„์ˆ˜!)
  tags?: string[] // ์ œํ’ˆ ํƒœ๊ทธ
  thumbnailBase64?: string // ์ œํ’ˆ ์ธ๋„ค์ผ(๋Œ€ํ‘œ) ์‚ฌ์ง„(base64) - jpg, jpeg, webp, png, gif, svg
  photoBase64?: string // ์ œํ’ˆ ์ƒ์„ธ ์‚ฌ์ง„(base64) - jpg, jpeg, webp, png, gif, svg
  discountRate?: number // ์ œํ’ˆ ํ• ์ธ์œจ
}
{
  "title": "MacBook Pro 16",
  "price": 3360000,
  "description": "์—ญ๋Œ€ ๊ฐ€์žฅ ๊ฐ•๋ ฅํ•œ MacBook Pro๊ฐ€ ๋“ฑ์žฅํ–ˆ์Šต๋‹ˆ๋‹ค. ์ตœ์ดˆ์˜ ํ”„๋กœ์šฉ Apple Silicon์ธ M1 Pro ๋˜๋Š” M1 Max ์นฉ์„ ํƒ‘์žฌํ•ด ์œ์‚ด๊ฐ™์ด ๋น ๋ฅธ ์†๋„๋Š” ๋ฌผ๋ก , ํš๊ธฐ์ ์ธ ์„ฑ๋Šฅ๊ณผ ๋†€๋ผ์šด ๋ฐฐํ„ฐ๋ฆฌ ์‚ฌ์šฉ ์‹œ๊ฐ„์„ ์ž๋ž‘ํ•˜์ฃ . ์—ฌ๊ธฐ์— ์‹œ์„ ์„ ์‚ฌ๋กœ์žก๋Š” Liquid Retina XDR ๋””์Šคํ”Œ๋ ˆ์ด, Mac ๋…ธํŠธ๋ถ ์‚ฌ์ƒ ์ตœ๊ณ ์˜ ์นด๋ฉ”๋ผ ๋ฐ ์˜ค๋””์˜ค ๊ทธ๋ฆฌ๊ณ  ๋”ํ•  ๋‚˜์œ„ ์—†์ด ๋‹ค์–‘ํ•œ ํฌํŠธ๊นŒ์ง€. ๊ธฐ์กด ๊ทธ ์–ด๋–ค ์นดํ…Œ๊ณ ๋ฆฌ์—๋„ ์†ํ•˜์ง€ ์•Š๋Š” ๋…ธํŠธ๋ถ. ์ƒˆ๋กœ์šด MacBook Pro๋Š” ๊ทธ์•ผ๋ง๋กœ ์•ผ์ˆ˜์ž…๋‹ˆ๋‹ค.",
  "tags": [
    "๊ฐ€์ „",
    "๋…ธํŠธ๋ถ",
    "์ปดํ“จํ„ฐ"
  ],
  "thumbnailBase64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...(์ƒ๋žต)"
}

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface ResponseValue { // ์ถ”๊ฐ€ํ•œ ์ œํ’ˆ์˜ ์ƒ์„ธ ๋‚ด์šฉ
  id: string // ์ œํ’ˆ ID
  title: string // ์ œํ’ˆ ์ด๋ฆ„
  price: number // ์ œํ’ˆ ๊ฐ€๊ฒฉ
  description: string // ์ œํ’ˆ ์ƒ์„ธ ์„ค๋ช…
  tags: string[] // ์ œํ’ˆ ํƒœ๊ทธ
  thumbnail: string | null // ์ œํ’ˆ ์ธ๋„ค์ผ ์ด๋ฏธ์ง€(URL)
  photo: string | null // ์ œํ’ˆ ์ƒ์„ธ ์ด๋ฏธ์ง€(URL)
  isSoldOut: boolean // ์ œํ’ˆ ๋งค์ง„ ์—ฌ๋ถ€
  discountRate: number // ์ œํ’ˆ ํ• ์ธ์œจ
}
{
  "id": "nbqtQvEivYwEXTDet7YM",
  "title": "MacBook Pro 16",
  "price": 3360000,
  "description": "์—ญ๋Œ€ ๊ฐ€์žฅ ๊ฐ•๋ ฅํ•œ MacBook Pro๊ฐ€ ๋“ฑ์žฅํ–ˆ์Šต๋‹ˆ๋‹ค. ์ตœ์ดˆ์˜ ํ”„๋กœ์šฉ Apple Silicon์ธ M1 Pro ๋˜๋Š” M1 Max ์นฉ์„ ํƒ‘์žฌํ•ด ์œ์‚ด๊ฐ™์ด ๋น ๋ฅธ ์†๋„๋Š” ๋ฌผ๋ก , ํš๊ธฐ์ ์ธ ์„ฑ๋Šฅ๊ณผ ๋†€๋ผ์šด ๋ฐฐํ„ฐ๋ฆฌ ์‚ฌ์šฉ ์‹œ๊ฐ„์„ ์ž๋ž‘ํ•˜์ฃ . ์—ฌ๊ธฐ์— ์‹œ์„ ์„ ์‚ฌ๋กœ์žก๋Š” Liquid Retina XDR ๋””์Šคํ”Œ๋ ˆ์ด, Mac ๋…ธํŠธ๋ถ ์‚ฌ์ƒ ์ตœ๊ณ ์˜ ์นด๋ฉ”๋ผ ๋ฐ ์˜ค๋””์˜ค ๊ทธ๋ฆฌ๊ณ  ๋”ํ•  ๋‚˜์œ„ ์—†์ด ๋‹ค์–‘ํ•œ ํฌํŠธ๊นŒ์ง€. ๊ธฐ์กด ๊ทธ ์–ด๋–ค ์นดํ…Œ๊ณ ๋ฆฌ์—๋„ ์†ํ•˜์ง€ ์•Š๋Š” ๋…ธํŠธ๋ถ. ์ƒˆ๋กœ์šด MacBook Pro๋Š” ๊ทธ์•ผ๋ง๋กœ ์•ผ์ˆ˜์ž…๋‹ˆ๋‹ค.",
  "tags": [
    "๊ฐ€์ „",
    "๋…ธํŠธ๋ถ",
    "์ปดํ“จํ„ฐ"
  ],
  "thumbnail": "https://storage.googleapis.com/heropy-api/vIKMk_jy4Yv195256.png",
  "photo": "https://storage.googleapis.com/heropy-api/voihKb3NLGcv195257.png",
  "isSoldOut": false,
  "discountRate": 0
}

์ œํ’ˆ ์ˆ˜์ •

  • ๊ด€๋ฆฌ์ž ์ „์šฉ API์ž…๋‹ˆ๋‹ค.
  • ์‚ฌ์šฉ์ž์˜ ๊ตฌ๋งค ๋‚ด์—ญ ํ™•์ธ์„ ์œ„ํ•ด, ์ œํ’ˆ์„ ์‹ค์ œ๋กœ๋Š” ์‚ญ์ œํ•˜์ง€ ์•Š๊ณ  ๋งค์ง„(Sold Out) ์ฒ˜๋ฆฌํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
  • ๋งค์ง„์€ ๋‹ค์‹œ ํ•ด์ œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/products/:productId
  \ -X 'PUT'
  \ -H 'masterKey: true'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface RequestBody {
  title?: string // ์ œํ’ˆ ์ด๋ฆ„
  price?: number // ์ œํ’ˆ ๊ฐ€๊ฒฉ
  description?: string // ์ œํ’ˆ ์ƒ์„ธ ์„ค๋ช…
  tags?: string[] // ์ œํ’ˆ ํƒœ๊ทธ
  thumbnailBase64?: string // ์ œํ’ˆ ์ธ๋„ค์ผ(๋Œ€ํ‘œ) ์‚ฌ์ง„(base64) - jpg, jpeg, webp, png, gif, svg
  photoBase64?: string // ์ œํ’ˆ ์ƒ์„ธ ์‚ฌ์ง„(base64) - jpg, jpeg, webp, png, gif, svg
  isSoldOut?: boolean // ์ œํ’ˆ ๋งค์ง„ ์—ฌ๋ถ€
  discountRate?: number // ์ œํ’ˆ ํ• ์ธ์œจ
}
{
  "price": 1500
}

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface ResponseValue { // ์ˆ˜์ •ํ•œ ์ œํ’ˆ์˜ ์ƒ์„ธ ๋‚ด์šฉ
  id: string // ์ œํ’ˆ ID
  title: string // ์ œํ’ˆ ์ด๋ฆ„
  price: number // ์ œํ’ˆ ๊ฐ€๊ฒฉ
  description: string // ์ œํ’ˆ ์ƒ์„ธ ์„ค๋ช…
  tags: string[] // ์ œํ’ˆ ํƒœ๊ทธ
  thumbnail: string | null // ์ œํ’ˆ ์ธ๋„ค์ผ ์ด๋ฏธ์ง€(URL)
  photo: string | null // ์ œํ’ˆ ์ƒ์„ธ ์ด๋ฏธ์ง€(URL)
  isSoldOut: boolean // ์ œํ’ˆ ๋งค์ง„ ์—ฌ๋ถ€ 
  discountRate: number // ์ œํ’ˆ ํ• ์ธ์œจ
}
{
  "id": "nbqtQvEivYwEXTDet7YM",
  "title": "MacBook Pro 16",
  "price": 1500,
  "description": "์—ญ๋Œ€ ๊ฐ€์žฅ ๊ฐ•๋ ฅํ•œ MacBook Pro๊ฐ€ ๋“ฑ์žฅํ–ˆ์Šต๋‹ˆ๋‹ค. ์ตœ์ดˆ์˜ ํ”„๋กœ์šฉ Apple Silicon์ธ M1 Pro ๋˜๋Š” M1 Max ์นฉ์„ ํƒ‘์žฌํ•ด ์œ์‚ด๊ฐ™์ด ๋น ๋ฅธ ์†๋„๋Š” ๋ฌผ๋ก , ํš๊ธฐ์ ์ธ ์„ฑ๋Šฅ๊ณผ ๋†€๋ผ์šด ๋ฐฐํ„ฐ๋ฆฌ ์‚ฌ์šฉ ์‹œ๊ฐ„์„ ์ž๋ž‘ํ•˜์ฃ . ์—ฌ๊ธฐ์— ์‹œ์„ ์„ ์‚ฌ๋กœ์žก๋Š” Liquid Retina XDR ๋””์Šคํ”Œ๋ ˆ์ด, Mac ๋…ธํŠธ๋ถ ์‚ฌ์ƒ ์ตœ๊ณ ์˜ ์นด๋ฉ”๋ผ ๋ฐ ์˜ค๋””์˜ค ๊ทธ๋ฆฌ๊ณ  ๋”ํ•  ๋‚˜์œ„ ์—†์ด ๋‹ค์–‘ํ•œ ํฌํŠธ๊นŒ์ง€. ๊ธฐ์กด ๊ทธ ์–ด๋–ค ์นดํ…Œ๊ณ ๋ฆฌ์—๋„ ์†ํ•˜์ง€ ์•Š๋Š” ๋…ธํŠธ๋ถ. ์ƒˆ๋กœ์šด MacBook Pro๋Š” ๊ทธ์•ผ๋ง๋กœ ์•ผ์ˆ˜์ž…๋‹ˆ๋‹ค.",
  "tags": [
    "๊ฐ€์ „",
    "๋…ธํŠธ๋ถ",
    "์ปดํ“จํ„ฐ"
  ],
  "thumbnail": "https://storage.googleapis.com/heropy-api/vIKMk_jy4Yv195256.png",
  "photo": "https://storage.googleapis.com/heropy-api/voihKb3NLGcv195257.png",
  "isSoldOut": false,
  "discountRate": 0
}

์ œํ’ˆ ์‚ญ์ œ

  • ๊ด€๋ฆฌ์ž ์ „์šฉ API์ž…๋‹ˆ๋‹ค.
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/products/:productId
  \ -X 'DELETE'
  \ -H 'masterKey: true'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

  • ์—†์Œ

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

type ResponseValue = true // ์ œํ’ˆ ์‚ญ์ œ ์ฒ˜๋ฆฌ ์ƒํƒœ

๋‹จ์ผ ์ œํ’ˆ ์ƒ์„ธ ์กฐํšŒ

  • ๊ณต์šฉ API์ž…๋‹ˆ๋‹ค.
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/products/:productId
  \ -X 'GET'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

  • ์—†์Œ

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface ResponseValue { // ์ œํ’ˆ์˜ ์ƒ์„ธ ๋‚ด์šฉ
  id: string // ์ œํ’ˆ ID
  title: string // ์ œํ’ˆ ์ด๋ฆ„
  price: number // ์ œํ’ˆ ๊ฐ€๊ฒฉ
  description: string // ์ œํ’ˆ ์ƒ์„ธ ์„ค๋ช…
  tags: string[] // ์ œํ’ˆ ํƒœ๊ทธ
  thumbnail: string | null // ์ œํ’ˆ ์ธ๋„ค์ผ ์ด๋ฏธ์ง€(URL)
  photo: string | null // ์ œํ’ˆ ์ƒ์„ธ ์ด๋ฏธ์ง€(URL)
  isSoldOut: boolean // ์ œํ’ˆ ๋งค์ง„ ์—ฌ๋ถ€ 
  reservations: Reservation[] // ์ œํ’ˆ์˜ ๋ชจ๋“  ์˜ˆ์•ฝ ์ •๋ณด ๋ชฉ๋ก
  discountRate: number // ์ œํ’ˆ ํ• ์ธ์œจ
}

interface Reservation {
  start: string // ์˜ˆ์•ฝ ์‹œ์ž‘ ์‹œ๊ฐ„
  end: string // ์˜ˆ์•ฝ ์ข…๋ฃŒ ์‹œ๊ฐ„
  isCanceled: boolean // ์˜ˆ์•ฝ ์ทจ์†Œ ์—ฌ๋ถ€
  isExpired: boolean // ์˜ˆ์•ฝ ๋งŒ๋ฃŒ ์—ฌ๋ถ€
}
{
  "id": "nbqtQvEivYwEXTDet7YM",
  "title": "MacBook Pro 16",
  "price": 3360000,
  "description": "์—ญ๋Œ€ ๊ฐ€์žฅ ๊ฐ•๋ ฅํ•œ MacBook Pro๊ฐ€ ๋“ฑ์žฅํ–ˆ์Šต๋‹ˆ๋‹ค. ์ตœ์ดˆ์˜ ํ”„๋กœ์šฉ Apple Silicon์ธ M1 Pro ๋˜๋Š” M1 Max ์นฉ์„ ํƒ‘์žฌํ•ด ์œ์‚ด๊ฐ™์ด ๋น ๋ฅธ ์†๋„๋Š” ๋ฌผ๋ก , ํš๊ธฐ์ ์ธ ์„ฑ๋Šฅ๊ณผ ๋†€๋ผ์šด ๋ฐฐํ„ฐ๋ฆฌ ์‚ฌ์šฉ ์‹œ๊ฐ„์„ ์ž๋ž‘ํ•˜์ฃ . ์—ฌ๊ธฐ์— ์‹œ์„ ์„ ์‚ฌ๋กœ์žก๋Š” Liquid Retina XDR ๋””์Šคํ”Œ๋ ˆ์ด, Mac ๋…ธํŠธ๋ถ ์‚ฌ์ƒ ์ตœ๊ณ ์˜ ์นด๋ฉ”๋ผ ๋ฐ ์˜ค๋””์˜ค ๊ทธ๋ฆฌ๊ณ  ๋”ํ•  ๋‚˜์œ„ ์—†์ด ๋‹ค์–‘ํ•œ ํฌํŠธ๊นŒ์ง€. ๊ธฐ์กด ๊ทธ ์–ด๋–ค ์นดํ…Œ๊ณ ๋ฆฌ์—๋„ ์†ํ•˜์ง€ ์•Š๋Š” ๋…ธํŠธ๋ถ. ์ƒˆ๋กœ์šด MacBook Pro๋Š” ๊ทธ์•ผ๋ง๋กœ ์•ผ์ˆ˜์ž…๋‹ˆ๋‹ค.",
  "tags": [
    "๊ฐ€์ „",
    "๋…ธํŠธ๋ถ",
    "์ปดํ“จํ„ฐ"
  ],
  "thumbnail": "https://storage.googleapis.com/heropy-api/vIKMk_jy4Yv195256.png",
  "photo": "https://storage.googleapis.com/heropy-api/voihKb3NLGcv195257.png",
  "isSoldOut": false,
  "reservations": [],
  "discountRate": 0
}

์˜ˆ์•ฝ ์ •๋ณด(reservation)๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ:

{
  "reservations": [
    {
      "reservation": {
        "start": "2021-11-12T06:00:00.000Z",
        "end": "2021-11-12T07:00:00.000Z",
        "isCanceled": false,
        "isExpired": true
      }
    }
  ] 
}

์ œํ’ˆ ๊ฒ€์ƒ‰

  • ์‚ฌ์šฉ์ž ์ „์šฉ API์ž…๋‹ˆ๋‹ค.
  • ์ œํ’ˆ ์ด๋ฆ„๊ณผ ํƒœ๊ทธ๋ฅผ ๋™์‹œ์— ๊ฒ€์ƒ‰ํ•  ์ˆ˜ ์žˆ๊ณ , 'And'(๊ฒ€์ƒ‰ํ•œ ์ด๋ฆ„๊ณผ ํƒœ๊ทธ ๋ชจ๋‘ ํฌํ•จ๋œ ์ œํ’ˆ) ์กฐ๊ฑด์œผ๋กœ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
  • ์ œํ’ˆ ์ด๋ฆ„๊ณผ ํƒœ๊ทธ ๋ชจ๋‘ ํฌํ•จํ•˜์ง€ ์•Š์œผ๋ฉด, ๋ชจ๋“  ์ œํ’ˆ์˜ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
  • ์ œํ’ˆ์˜ ๊ธฐ๋ณธ ์ •๋ณด๋งŒ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
  • ๋งค์ง„๋œ ์ œํ’ˆ์€ ๊ฒ€์ƒ‰๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/products/search
  \ -X 'POST'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface RequestBody {
  searchText?: string // ๊ฒ€์ƒ‰ํ•  ์ œํ’ˆ ์ด๋ฆ„
  searchTags?: string[] // ๊ฒ€์ƒ‰ํ•  ์ œํ’ˆ ํƒœ๊ทธ
}
{
  "searchText": "์‚ผ์„ฑ์ „์ž",
  "searchTags": ["๊ฐ€์ „"]
}

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

type ResponseValue = Product[] // ๊ด€๋ฆฌํ•˜๋Š” ๋ชจ๋“  ์ œํ’ˆ์˜ ๋ชฉ๋ก

interface Product { // ์ œํ’ˆ ์ •๋ณด
  id: string // ์ œํ’ˆ ID
  title: string // ์ œํ’ˆ ์ด๋ฆ„
  price: number // ์ œํ’ˆ ๊ฐ€๊ฒฉ
  description: string // ์ œํ’ˆ ์„ค๋ช…(์ตœ๋Œ€ 100์ž)
  tags: string[] // ์ œํ’ˆ ํƒœ๊ทธ
  thumbnail: string | null // ์ œํ’ˆ ์ธ๋„ค์ผ ์ด๋ฏธ์ง€(URL)
  discountRate: number // ์ œํ’ˆ ํ• ์ธ์œจ
}
[
  {
    "id": "cFmeC7aY5KjZbBAdJE9y",
    "title": "์‚ผ์„ฑ์ „์ž ์Šค๋งˆํŠธ๋ชจ๋‹ˆํ„ฐ M7 S43AM700",
    "price": 639000,
    "description": "107.9cm(43์ธ์น˜) / ์™€์ด๋“œ(16:9) / ํ‰๋ฉด / VA / 3840 x 2160(4K UHD) / ํ”ฝ์…€ํ”ผ์น˜: 0.2451mm / 8ms(GTG) / 300cd / 5,00",
    "tags": [
      "๊ฐ€์ „",
      "๋ชจ๋‹ˆํ„ฐ",
      "์ปดํ“จํ„ฐ"
    ],
    "thumbnail": "https://storage.googleapis.com/heropy-api/vBAK4MQdH5v195712.png",
    "discountRate": 0
  }
]

์ œํ’ˆ ๊ฑฐ๋ž˜(๊ตฌ๋งค) ์‹ ์ฒญ

  • ์‚ฌ์šฉ์ž ์ „์šฉ API์ž…๋‹ˆ๋‹ค.
  • ๊ฑฐ๋ž˜(๊ตฌ๋งค) ์‹ ์ฒญ์‹œ ์—ฐ๊ฒฐ๋œ ๊ณ„์ขŒ์—์„œ ๊ฒฐ์ œ๋ฉ๋‹ˆ๋‹ค.
  • ๊ฒฐ์ œํ•  ๊ณ„์ขŒ(ID)๋ฅผ ๊ผญ ์„ ํƒํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.(๊ณ„์ขŒ ๋ชฉ๋ก ๋ฐ ์ž”์•ก ์กฐํšŒ API๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”)
  • ์„ ํƒํ•œ ๊ณ„์ขŒ์˜ ์ž”์•ก๋ณด๋‹ค ๊ฒฐ์ œ ๊ธˆ์•ก์ด ํฌ๋ฉด ๊ฒฐ์ œ๊ฐ€ ์ฒ˜๋ฆฌ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.(์—๋Ÿฌ ๋ฐ˜ํ™˜)
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/products/buy 
  \ -X 'POST'
  \ -H 'Authorization: Bearer <accessToken>'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface RequestBody {
  productId: string // ๊ฑฐ๋ž˜ํ•  ์ œํ’ˆ ID (ํ•„์ˆ˜!)
  accountId: string // ๊ฒฐ์ œํ•  ์‚ฌ์šฉ์ž ๊ณ„์ขŒ ID (ํ•„์ˆ˜!)
  reservation?: { // ์˜ˆ์•ฝ ์ •๋ณด(์˜ˆ์•ฝ ์‹œ์Šคํ…œ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ๋งŒ ํ•„์š”)
    start: string // ์˜ˆ์•ฝ ์‹œ์ž‘ ์‹œ๊ฐ„(ISO)
    end: string // ์˜ˆ์•ฝ ์ข…๋ฃŒ ์‹œ๊ฐ„(ISO)
  }
}
const isoString = new Date().toISOString()
{
  "productId": "nbqtQvEivYwEXTDet7YM",
  "accountId": "Mq2KKHk8vlmr6Xkg58Fa",
  "reservation": {
    "start": "2021-11-12T06:00:00.000Z",
    "end": "2021-11-12T07:00:00.000Z"
  }
}

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

type ResponseValue = true // ๊ฑฐ๋ž˜ ์‹ ์ฒญ ์ฒ˜๋ฆฌ ์—ฌ๋ถ€

์ œํ’ˆ ๊ฑฐ๋ž˜(๊ตฌ๋งค) ์ทจ์†Œ

  • ์‚ฌ์šฉ์ž ์ „์šฉ API์ž…๋‹ˆ๋‹ค.
  • '๊ฑฐ๋ž˜ ์ทจ์†Œ'์‹œ ๊ฒฐ์ œํ•œ ์‚ฌ์šฉ์ž ๊ณ„์ขŒ๋กœ ๊ธˆ์•ก์ด ํ™˜๋ถˆ๋ฉ๋‹ˆ๋‹ค.
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/products/cancel 
  \ -X 'POST'
  \ -H 'Authorization: Bearer <accessToken>'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface RequestBody {
  detailId: string // ์ทจ์†Œํ•  ์ œํ’ˆ์˜ ๊ฑฐ๋ž˜ ๋‚ด์—ญ ID
}
{
  "detailId": "dMhfxyrAupQP18OYmywy"
}

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

type ResponseValue = true // ๊ฑฐ๋ž˜ ์ทจ์†Œ ์ฒ˜๋ฆฌ ์—ฌ๋ถ€

์ œํ’ˆ ๊ฑฐ๋ž˜(๊ตฌ๋งค) ํ™•์ •

  • ์‚ฌ์šฉ์ž ์ „์šฉ API์ž…๋‹ˆ๋‹ค.
  • '๊ฑฐ๋ž˜(๊ตฌ๋งค) ํ™•์ •' ํ›„์—๋Š” '๊ฑฐ๋ž˜ ์ทจ์†Œ'๋ฅผ ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/products/ok 
  \ -X 'POST'
  \ -H 'Authorization: Bearer <accessToken>'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface RequestBody {
  detailId: string // ๊ฑฐ๋ž˜(๊ตฌ๋งค) ํ™•์ •ํ•  ์ œํ’ˆ์˜ ๊ฑฐ๋ž˜ ๋‚ด์—ญ ID
}
{
  "detailId": "dMhfxyrAupQP18OYmywy"
}

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

type ResponseValue = true // ๊ฑฐ๋ž˜(๊ตฌ๋งค) ํ™•์ • ์ฒ˜๋ฆฌ ์—ฌ๋ถ€

์ œํ’ˆ ์ „์ฒด ๊ฑฐ๋ž˜(๊ตฌ๋งค) ๋‚ด์—ญ

  • ์‚ฌ์šฉ์ž ์ „์šฉ API์ž…๋‹ˆ๋‹ค.
  • ๊ฑฐ๋ž˜ ๋‚ด์—ญ์˜ ๊ธฐ๋ณธ ์ •๋ณด๋งŒ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/products/transactions/details 
  \ -X 'GET'
  \ -H 'Authorization: Bearer <accessToken>'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

  • ์—†์Œ

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

type RequestValue = TransactionDetail[] // ๋ชจ๋“  ๊ฑฐ๋ž˜ ๋‚ด์—ญ์˜ ๋ชฉ๋ก

interface TransactionDetail { // ๊ฑฐ๋ž˜ ๋‚ด์—ญ ์ •๋ณด
  detailId: string // ๊ฑฐ๋ž˜ ๋‚ด์—ญ ID
  product: { // ๊ฑฐ๋ž˜ํ•œ ์ œํ’ˆ ์ •๋ณด
    productId: string
    title: string
    price: number
    description: string
    tags: string[]
    thumbnail: string | null
    discountRate: number // ์ œํ’ˆ ํ• ์ธ์œจ
  }
  reservation: Reservation | null // ๊ฑฐ๋ž˜ํ•œ ์ œํ’ˆ์˜ ์˜ˆ์•ฝ ์ •๋ณด
  timePaid: string // ์ œํ’ˆ์„ ๊ฑฐ๋ž˜ํ•œ ์‹œ๊ฐ„
  isCanceled: boolean // ๊ฑฐ๋ž˜ ์ทจ์†Œ ์—ฌ๋ถ€
  done: boolean // ๊ฑฐ๋ž˜ ์™„๋ฃŒ ์—ฌ๋ถ€
}

interface Reservation {
  start: string // ์˜ˆ์•ฝ ์‹œ์ž‘ ์‹œ๊ฐ„
  end: string // ์˜ˆ์•ฝ ์ข…๋ฃŒ ์‹œ๊ฐ„
  isCanceled: boolean // ์˜ˆ์•ฝ ์ทจ์†Œ ์—ฌ๋ถ€
  isExpired: boolean // ์˜ˆ์•ฝ ๋งŒ๋ฃŒ ์—ฌ๋ถ€
}
[
  {
    "detailId": "9jAoagzrZBkSWI5NctEB",
    "product": {
      "productId": "nbqtQvEivYwEXTDet7YM",
      "title": "MacBook Pro 16",
      "price": 3360000,
      "description": "์—ญ๋Œ€ ๊ฐ€์žฅ ๊ฐ•๋ ฅํ•œ MacBook Pro๊ฐ€ ๋“ฑ์žฅํ–ˆ์Šต๋‹ˆ๋‹ค. ์ตœ์ดˆ์˜ ํ”„๋กœ์šฉ Apple Silicon์ธ M1 Pro ๋˜๋Š” M1 Max ์นฉ์„ ํƒ‘์žฌํ•ด ์œ์‚ด๊ฐ™์ด ๋น ๋ฅธ ์†๋„๋Š” ๋ฌผ๋ก , ํš๊ธฐ์ ์ธ ์„ฑ",
      "tags": [
        "๊ฐ€์ „",
        "๋…ธํŠธ๋ถ",
        "์ปดํ“จํ„ฐ"
      ],
      "thumbnail": "https://storage.googleapis.com/heropy-api/vIKMk_jy4Yv195256.png",
      "discountRate": 0
    },
    "reservation": null,
    "timePaid": "2021-11-07T20:17:32.112Z",
    "isCanceled": true,
    "done": false
  },
  {
    "detailId": "dMhfxyrAupQP18OYmywy",
    "product": {
      "productId": "cFmeC7aY5KjZbBAdJE9y",
      "title": "์‚ผ์„ฑ์ „์ž ์Šค๋งˆํŠธ๋ชจ๋‹ˆํ„ฐ M7 S43AM700",
      "price": 639000,
      "description": "107.9cm(43์ธ์น˜) / ์™€์ด๋“œ(16:9) / ํ‰๋ฉด / VA / 3840 x 2160(4K UHD) / ํ”ฝ์…€ํ”ผ์น˜: 0.2451mm / 8ms(GTG) / 300cd / 5,00",
      "tags": [
        "๊ฐ€์ „",
        "๋ชจ๋‹ˆํ„ฐ",
        "์ปดํ“จํ„ฐ"
      ],
      "thumbnail": "https://storage.googleapis.com/heropy-api/vBAK4MQdH5v195712.png",
      "discountRate": 0
    },
    "reservation": {
      "start": "2021-11-12T06:00:00.000Z",
      "end": "2021-11-12T07:00:00.000Z",
      "isCanceled": false,
      "isExpired": true
    },
    "timePaid": "2021-11-07T20:01:49.100Z",
    "isCanceled": false,
    "done": true
  }
]

๋‹จ์ผ ์ œํ’ˆ ์ƒ์„ธ ๊ฑฐ๋ž˜(๊ตฌ๋งค) ๋‚ด์—ญ

  • ์‚ฌ์šฉ์ž ์ „์šฉ API์ž…๋‹ˆ๋‹ค.
curl https://asia-northeast3-heropy-api.cloudfunctions.net/api/products/transactions/detail 
  \ -X 'POST'
  \ -H 'Authorization: Bearer <accessToken>'

์š”์ฒญ ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface RequestBody {
  detailId: string // ์ƒ์„ธ ๋‚ด์šฉ์„ ํ™•์ธํ•  ๊ฑฐ๋ž˜(๊ตฌ๋งค) ๋‚ด์—ญ ID
}
{
  "detailId": "dMhfxyrAupQP18OYmywy"
}

์‘๋‹ต ๋ฐ์ดํ„ฐ ํƒ€์ž… ๋ฐ ์˜ˆ์‹œ:

interface TransactionDetail { // ์ƒ์„ธ ๊ฑฐ๋ž˜ ์ •๋ณด
  detailId: string // ๊ฑฐ๋ž˜ ๋‚ด์—ญ ID
  account: { // ๊ฑฐ๋ž˜ํ•œ ์‚ฌ์šฉ์ž์˜ ๊ณ„์ขŒ ์ •๋ณด
    bankName: string
    bankCode: string
    accountNumber: string
  }
  product: { // ๊ฑฐ๋ž˜ํ•œ ์ œํ’ˆ ์ •๋ณด
    productId: string
    title: string
    price: number
    description: string
    tags: string[]
    thumbnail: string | null
    photo: string | null
    discountRate: number // ์ œํ’ˆ ํ• ์ธ์œจ
  }
  reservation: Reservation | null // ๊ฑฐ๋ž˜ํ•œ ์ œํ’ˆ์˜ ์˜ˆ์•ฝ ์ •๋ณด
  timePaid: string // ์ œํ’ˆ์„ ๊ฑฐ๋ž˜ํ•œ ์‹œ๊ฐ„
  isCanceled: boolean // ๊ฑฐ๋ž˜ ์ทจ์†Œ ์—ฌ๋ถ€
  done: boolean // ๊ฑฐ๋ž˜ ์™„๋ฃŒ ์—ฌ๋ถ€
}

interface Reservation {
  start: string // ์˜ˆ์•ฝ ์‹œ์ž‘ ์‹œ๊ฐ„
  end: string // ์˜ˆ์•ฝ ์ข…๋ฃŒ ์‹œ๊ฐ„
  isCanceled: boolean // ์˜ˆ์•ฝ ์ทจ์†Œ ์—ฌ๋ถ€
  isExpired: boolean // ์˜ˆ์•ฝ ๋งŒ๋ฃŒ ์—ฌ๋ถ€
}
{
  "detailId": "dMhfxyrAupQP18OYmywy",
  "account": {
    "bankName": "KB๊ตญ๋ฏผ์€ํ–‰",
    "bankCode": "004",
    "accountNumber": "123-XX-XXXX-XXX"
  },
  "product": {
    "productId": "cFmeC7aY5KjZbBAdJE9y",
    "title": "์‚ผ์„ฑ์ „์ž ์Šค๋งˆํŠธ๋ชจ๋‹ˆํ„ฐ M7 S43AM700",
    "price": 639000,
    "description": "107.9cm(43์ธ์น˜) / ์™€์ด๋“œ(16:9) / ํ‰๋ฉด / VA / 3840 x 2160(4K UHD) / ํ”ฝ์…€ํ”ผ์น˜: 0.2451mm / 8ms(GTG) / 300cd / 5,000:1 / ์ตœ๋Œ€ ์ฃผ์‚ฌ์œจ: 60Hz / HDMI 2.0 / USB Type-C / ํ”Œ๋ฆฌ์ปค ํ”„๋ฆฌ / ๋ธ”๋ฃจ๋ผ์ดํŠธ ์ฐจ๋‹จ / ๊ฒŒ์ž„๋ชจ๋“œ ์ง€์› / ์Šคํ”ผ์ปค / ๋ฆฌ๋ชจ์ปจ / USBํ—ˆ๋ธŒ / Wi-Fi(๋ฌด์„ ) / ์Šค๋งˆํŠธTV / ๋ธ”๋ฃจํˆฌ์Šค / ํ‹ธํŠธ(์ƒํ•˜) / 200 x 200mm / HDR / HDR10 / 10.6kg ๊ธฐํš์ „ ์ฐจ์„ธ๋Œ€ ๊ฒŒ์ž„ ๋ผ์ดํ”„ PS5 ๋งค๋ ฅ๋ถ„์„ ๊ด€๋ จ๊ธฐ์‚ฌ ํ์†Œ๋‹‰, 43์ธ์น˜ 4K UHD ์Šค๋งˆํŠธ ๋ชจ๋‹ˆํ„ฐ โ€˜์‚ผ์„ฑ์ „์ž M7 S43AM700โ€™ ์ถœ์‹œ ๋ฐ ํ• ์ธ ํ–‰์‚ฌ ์‚ฌ์šฉ๊ธฐ ์‚ผ์„ฑ ์Šค๋งˆํŠธ๋ชจ๋‹ˆํ„ฐ m7 s43am700",
    "tags": [
      "๊ฐ€์ „",
      "๋ชจ๋‹ˆํ„ฐ",
      "์ปดํ“จํ„ฐ"
    ],
    "thumbnail": "https://storage.googleapis.com/heropy-api/vBAK4MQdH5v195712.png",
    "photo": "https://storage.googleapis.com/heropy-api/vVLP-ox_zSDv195712.jpg",
    "discountRate": 0
  },
  "reservation": null,
  "timePaid": "2021-11-07T20:01:49.100Z",
  "isCanceled": false,
  "done": true
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published