HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
🐣
프론트엔드 데브코스 4기 교육생
/
이동근팀
이동근팀
/
🦆
SNS 팀 프로젝트
/
타입 논의
타입 논의
타입 논의

타입 논의

 

UserResponse

{ "coverImage": String, // 커버 이미지 "image": String, // 프로필 이미지 "role": String, "emailVerified": Boolean, // 사용되지 않음 "banned": Boolean, // 사용되지 않음 "isOnline": Boolean, "posts": Post[], "likes": Like[], "comments": String[], "followers": [], "following": [ { "_id": "6169e91316cb2265df003c6d", "user": "6169e58216cb2265df003bf4", "follower": "6169e206aa57d952c6dc1edd", "createdAt": "2021-10-15T20:48:19.816Z", "updatedAt": "2021-10-15T20:48:19.816Z", "__v": 0 } ], "notifications": Notification[], "messages": Message[], "_id": String, "fullName": String, "email": String, "createdAt": String, "updatedAt": String }
 
ChannelResponse
{ "authRequired": Boolean, // 사용되지 않음 "posts": String[], "_id": String, "name": String, "description": String, "createdAt": String, "updatedAt": String }
PostResponse
{ "likes": Like[], "comments": Comment[], "_id": String, "image": Optional<String>, "imagePublicId": Optional<String>, "title": String, "channel": Channel, "author": User, "createdAt": String, "updatedAt": String }
LikeResponse
{ "_id": String, "user": String, // 사용자 id "post": String, // 포스트 id "createdAt": String, "updatedAt": String }
 
CommentResponse
{ "_id": String, "comment": String, "author": User, "post": String, // 포스트 id "createdAt": String, "updatedAt": String }
NotificationResponse
{ "seen": Boolean, "_id": String, "author": User, "user": User | String, "post": Nullable<String>, // 포스트 id "follow": Optional<String>, // 사용자 id "comment": Optional<Comment>, "message": Optional<String>, // 메시지 id "createdAt": String, "updatedAt": String }
FollowResponse
{ "_id": String, "user": String, // 사용자 id "follower": String, // 사용자 id "createdAt": String, "updatedAt": String }
ConversationResponse
MessageResponse
{ "_id": String, "message": String, "sender": User, "receiver": User, "seen": Boolean, "createdAt": String, "updatedAt": String }

실제 타입

User

export interface User extends UserFullName { _id: string; email: string; image: string; // default = default 이미지 postCount: number; // 총 포스트 개수 commentCount: number; // 본인이 작성한 총 댓글 개수 } export interface UserFullName { username: string; // 사용자 실명 introduce: string; // default='안녕하세요 000입니다' slackId?: string; // default=undefined slackWorkspace?: 'Frontend' | 'Backend'; // default=undefined }

Post

export interface Post extends PostTitle { _id: string; comments: Comment[]; author: User; } export interface PostTitle { title: string; // 머쓱이 제목 (default='머쓱이') content: string; // 소개글 (default='') musseukImageName: string; // 머쓱이 이미지 파일 이름, default: 'musseuk_default' }

Comment

export interface Comment extends CommentField { _id: string; } export interface CommentField { content: string; // default: '' position: [number, number]; // 댓글 좌표(백분율) default: [0, 0] nickname: string; // default: 익명의 머쓱이 decorationImageName: string; // 장식 이미지 파일 이름 // default: 'decoration_soju1' }