Skip to content

Feed API Specification

BangDori edited this page Apr 15, 2024 · 32 revisions
  1. Feed
  2. Comment
  3. Likes

0๏ธโƒฃ ํƒ€์ž… ์ •์˜

interface Image {
  id: number;
  imageUrl: string;
}

interface Feed {
  id: number;
  userId: number;

  user: {
    id: number;
    profileImage: string;
    name: string;
  };

  title: string;
  content: string;
  images: Image[];

  updatedAt: string;
}

interface Comment {
  id: number;

  user: {
    id: number;
    profileImage: string;
    name: string;
  };

  content: string;
  updatedAt: string;
}

๐Ÿšจ ์งˆ๋ฌธ ๋ฆฌ์ŠคํŠธ

  1. ์ž‘์„ฑ ์™„๋ฃŒ, ์ข‹์•„์š” ์„ฑ๊ณต, ์‹ ๊ณ  ์„ฑ๊ณต์— ๋Œ€ํ•œ ์‘๋‹ต ๋ฐ์ดํ„ฐ๋Š” ๋ฌด์—‡์œผ๋กœ ์„ค์ •ํ•ด์•ผ ํ•˜๋‚˜์š”? โœ… ํ”ผ๋“œ๋ฐฑ 4
  2. ๊ฒŒ์‹œ๋ฌผ, ์œ ์ €์™€ ๊ฐ™์€ ๊ณ ์œ  Id ํƒ€์ž… ํ™•์ • ํ•„์š” (string vs bigint) โœ… ํ”ผ๋“œ๋ฐฑ 1
  3. ํŒ”๋กœ์šฐ ์—ฌ๋ถ€์™€ ์ž๊ธฐ ๊ฒŒ์‹œ๋ฌผ ์—ฌ๋ถ€์— ๋Œ€ํ•œ ์—ฌ๋ถ€ ์ฒดํ‚น์— ๋Œ€ํ•œ ๋ฐฉ๋ฒ• โš ๏ธ ์ถ”ํ›„ ๋ณ€๊ฒฝ๊ฐ€๋Šฅ
    • ๋ณ€์ˆ˜ ํ•˜๋‚˜๋กœ ์ฒดํฌํ•˜๋Š” ๋ฐฉ๋ฒ• relationshipStatus: 'self' | 'following' | 'none'
    • ๋ณ€์ˆ˜ ๋‘๊ฐœ๋กœ ์ฒดํฌํ•˜๋Š” ๋ฐฉ๋ฒ• isFollow: boolean isSelfFeed: boolean
  4. ๊ณต๊ฐœ ๋ฒ”์œ„ ๋ณ€์ˆ˜ ๋ช… ์–ด๋–ค ๊ฑธ๋กœ ์ •์˜ํ•˜๋Š”๊ฒŒ ์ข‹์„๊นŒ โœ… ํ”ผ๋“œ๋ฐฑ 5
  5. ์‹ ๊ณ ํ•˜๊ธฐ ์‚ฌ์œ ์— ๋Œ€ํ•œ ๋ณ€์ˆ˜๋ช…๊ณผ ํƒ€์ž…์„ ์–ด๋–ป๊ฒŒ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์„๊นŒ? โœ… ํ”ผ๋“œ๋ฐฑ 3

โœ๏ธ ํ”ผ๋“œ๋ฐฑ

  1. ๋ชจ๋“  id๋Š” number๋กœ ๊ด€๋ฆฌํ•ด๋„ ๋ฌด๋ฐฉํ•  ๋“ฏ. BIGINT์˜ ๊ฐ’์ด -9223372036854775808 ~ 9223372036854775807์ธ๋ฐ, unsigned๋กœ ๊ด€๋ฆฌํ•˜๋ฉด ์ด ๊ฐ’์„ ๋„˜์„ ์ผ์ด ๊ฑฐ์˜ ์—†์„ ๊ฒƒ์ด๋ผ ํŒ๋‹จ. (๋‹จ java ์—์„œ๋Š” BigInteger ํƒ€์ž…์œผ๋กœ ์น˜ํ™˜ํ•ด์•ผ ํ•  ์ˆ˜๋„ ์žˆ์œผ๋‚˜ ๊ณผ์—ฐ Long ๋ฒ”์œ„๋ฅผ ๋„˜์„ ์ผ์ด ์žˆ์„๊นŒ?)
  2. API ์‘๋‹ต ๋ฐ์ดํ„ฐ๋Š” ์Šค๋„ค์ดํฌ ์ผ€์ด์Šค๊ฐ€ ์•„๋‹Œ, ์นด๋ฉœ ์ผ€์ด์Šค๋กœ ์‚ฌ์šฉ๋œ๋‹ค.
  3. ํ˜„์žฌ ๋ฌธ์˜ํ•˜๊ธฐ API์—์„œ๋Š” category๋กœ ๋ถ„๋ฅ˜ํ•˜๊ณ  ์žˆ์œผ๋‹ˆ ํ†ต์ผ์„ฑ์„ ์œ„ํ•ด ์—ฌ๊ธฐ์—์„œ๋„ category๋กœ ํ•˜๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™๋‹ค.
  4. images: string[]; -> ์‚ฌ์ง„ ๊ฒฝ๋กœ๋งŒ ๋ฐ›์•„์˜ค๋ฉด FE๋‹จ์—์„œ key๊ฐ’ ๋ถ€์žฌ๋กœ ์ธํ•ด ๊ด€๋ฆฌ๊ฐ€ ํž˜๋“ค์ง€ ์•Š์„์ง€? id, url ํ•จ๊ป˜ ๋„˜๊ธฐ๋Š” ๋ฐฐ์—ด ํƒ€์ž…์„ ๋ณด๋‚ด์ค„ ์ˆ˜ ์žˆ์Œ. ์‘๋‹ต ๋ฐ์ดํ„ฐ๊ฐ€ ํ•„์š”ํ•˜๋‹ค๋ฉด ๊ทธ์— ๋งž์ถ”์–ด ๋ฐ์ดํ„ฐ๋ฅผ ๋„˜๊ฒจ๋“œ๋ฆฌ๊ฒ ์ง€๋งŒ, ์•„๋งˆ ํ•„์š”์—†์ง€ ์•Š์„๊นŒ์š”? ๊ทธ๋Ÿด ๋•Œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์‘๋‹ต ํฌ๋งท์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
    {
      "code": "2000",
      "data": {}
    }
  5. BE์—์„œ๋„ public, friend, private๋ฅผ ์‚ฌ์šฉํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
  6. RESTful ๋ช…์„ธ์— ์˜ํ•ด ์š”์ฒญ url์€ /feeds/{feed_id}, ์ฆ‰ query param์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Œ.
  7. ํ”ผ๋“œ ์ƒ์„ธ์—์„œ ๊ตณ์ด feed์™€ comment๋ฅผ joinํ•  ํ•„์š”๊ฐ€ ์žˆ์„์ง€? /feeds/{feed_id}์™€ /feeds/{feed_id}/comments๋ฅผ ๋น„๋™๊ธฐ ์š”์ฒญ์œผ๋กœ ๋ฐ›๋Š” ๊ฒŒ ์„œ๋กœ ํŽธํ•  ๊ฑฐ๋ผ ์ƒ๊ฐํ•จ
  8. Feed List์—์„œ feedId๋ž‘ userId๋ฅผ ๋ฐ›์•„์˜ฌ ์ˆ˜ ์žˆ์œผ๋‹ˆ๊นŒ ์ด๊ฑธ๋กœ ๊ฒŒ์‹œ๋ฌผ ์ •๋ณด ๋ณด์—ฌ์ฃผ๊ณ , ๋‹ค์‹œ ์š”์ฒญํ•ด์„œ ์ž‘์„ฑ์ž์™€์˜ ๊ด€๊ณ„ ๋ฐ isLike, isBookMark ๋ฐ›์•„์˜ค๊ฒŒ ํ•˜๋ฉด ๋ ๋“ฏ
    • ์ด ๋ฐฉ๋ฒ•์ด ์•„๋‹ˆ๋ผ๋ฉด Join ํšŸ์ˆ˜๊ฐ€ ๋„ˆ๋ฌด ๋งŽ์•„์ ธ์„œ ์˜คํžˆ๋ ค ์‹œ๊ฐ„์ด ๋” ๊ฑธ๋ฆด ์ˆ˜๋„ ์žˆ์Œ
  9. report, bookmark ๋“ฑ ๋‹จ์ˆ˜ ๋ช…์‚ฌ๋Š” ๋ณต์ˆ˜ ๋ช…์‚ฌ๋กœ ๋ณ€๊ฒฝ
  10. likeCount๋Š” like์— ๋Œ€ํ•œ API ์š”์ฒญ์œผ๋กœ ๋ฐ›์•„์˜ค๋Š” ์‘๋‹ต ๋ฐ์ดํ„ฐ์ด๋ฏ€๋กœ totalCount๋กœ ๋ณ€๊ฒฝํ•˜๋Š”๊ฒŒ ์ข‹์„ ๋“ฏ!