Skip to content

User API Specification

이의찬 edited this page Apr 13, 2024 · 24 revisions
κΈ°λŠ₯ λ©”μ„œλ“œ URI λΉ„κ³ 
νŒ”λ‘œμš° μš”μ²­ POST /users/{user_id}/follow ⚠️
μ‚¬μš©μž 검색 GET /users ⚠️
μ‚¬μš©μž ν”„λ‘œν•„ 쑰회 GET /users/{user_id} ⚠️
  • βœ…: 확인 μ™„λ£Œ
  • ⚠️: λŒ€κΈ° μƒνƒœ
  • ❌: λ…Όμ˜ ν•„μš”

0️⃣ νƒ€μž… μ •μ˜

interface User {
  id: number;
  profile_image: string;
  name: string; 
  content: string;
  relationship_status: "self" | "following" | "none"; // 🚨 질문 리슀트 3
}

interface Feed { 
  id: string | number; 🚨 질문 리슀트 2
  title: string;
  content: string;
  image: string;

  like_count: number;
  comment_count: number;
};

1️⃣ νŒ”λ‘œμš° μš”μ²­

interface Request {
  uri: '/users/{user_id}/follow';
  method: 'POST';
  body : {
    user_id: number;
  }
}

interface Response {
  code: '2000';
  data: {
    // 🚨 질문 리슀트 1
  };
}

2️⃣ μ‚¬μš©μž 검색

μš°μ„  λͺ¨λ“  μž…λ ₯으둜 진행, μΆ”ν›„ μ“°λ‘œν‹€λ§ / λ””λ°”μš΄μŠ€ λ„μž… κ°€λŠ₯

// 일반 μ‚¬μš©μž 검색
interface Request {
  uri: "/search/users";
  method: "GET"
  query:{
    user_id: number;
  }
}

interface Response {
    code: "2000";
    data:{
        domains: User[] // 0️⃣ User
    }
}

// μ’‹μ•„μš” μ‚¬μš©μž 검색
interface Request {
  uri: "/search/like";
  method: "GET"
  query:{
    user_id: number;
  }
}

interface Response {
    code: "2000";
    data:{
        domains: User[] // 0️⃣ User
    }
}

// μ‚¬μš©μž + (κ²Œμ‹œλ¬Ό 검색 - μΆ”ν›„ λ“±λ‘λœλ‹€λ©΄)
`/search/top?q=${}`

// (κ²Œμ‹œλ¬Ό 검색 - μΆ”ν›„ λ“±λ‘λœλ‹€λ©΄)
`/search/posts?q=${}`

3️⃣ μ‚¬μš©μž ν”„λ‘œν•„ 쑰회

interface Request {
  uri: '/users/{user_id}';
  method: 'GET';
}

interface Response {
  code: "2000";
  data : {
    user: User; // 0️⃣ User
    feeds: Feed[]; // 0️⃣ Feed
  }
}

🚨 질문 리슀트

  1. μž‘μ„± μ™„λ£Œ, μ’‹μ•„μš” 성곡, μ‹ κ³  성곡에 λŒ€ν•œ 응닡 λ°μ΄ν„°λŠ” λ¬΄μ—‡μœΌλ‘œ μ„€μ •ν•΄μ•Ό ν•˜λ‚˜μš”?
  2. κ²Œμ‹œλ¬Ό, μœ μ €μ™€ 같은 고유 Id νƒ€μž… ν™•μ • ν•„μš” (string vs bigint)
  3. νŒ”λ‘œμš° 여뢀와 자기 κ²Œμ‹œλ¬Ό 여뢀에 λŒ€ν•œ μ—¬λΆ€ 체킹에 λŒ€ν•œ 방법
    • λ³€μˆ˜ ν•˜λ‚˜λ‘œ μ²΄ν¬ν•˜λŠ” 방법 relationship_status: 'self' | 'following' | 'none'
    • λ³€μˆ˜ λ‘κ°œλ‘œ μ²΄ν¬ν•˜λŠ” 방법 is_follow: boolean is_self_feed: boolean