1. 채널 목록[GET]
→ 채널 목록을 불러옵니다.
/channels
Request
Response
[ // Channel Array { authRequired: Boolean, // 사용되지 않는다고 했는데 인증채널할 때 필요하지 않남. posts: String[], _id: String, name: String, description: String, createdAt: String, updateAt: String } ]
2. 특정 채널 정보[GET]
/channel/{channelName}
Request
Response
{ // Channel authRequired: Boolean, // 사용되지 않는다고 했는데 인증채널할 때 필요하지 않남. posts: String[], _id: String, name: String, description: String, createdAt: String, updateAt: String }
3. 특정 채널의 포스트 목록[GET]
필요한 프로퍼티만 두고 다 빼자
/posts/channels/{channelId}
Request
{ // params offset: Number, // option limit: Number // option }
Response
[ // Post Array { "likes": [ { "_id": String, "user": String, // 사용자 id "post": String, // 포스트 id "createdAt": String, "updatedAt": String } ], "comments": [ { "_id": String, "comment": String, "author": User, "post": String, // 포스트 id "createdAt": String, "updatedAt": String } ], "_id": String, "image": Optional<String>, "imagePublicId": Optional<String>, "title": String, "channel": { "authRequired": Boolean, // 사용되지 않음 "posts": String[], "_id": String, "name": String, "description": String, "createdAt": String, "updatedAt": String }, "author": { "coverImage": String, // 커버 이미지 "image": String, // 프로필 이미지 "role": String, "isOnline": Boolean, "posts": Post[], "likes": [ { "_id": String, "user": String, // 사용자 id "follower": String, // 사용자 id "createdAt": String, "updatedAt": String } ], "comments": String[], "followers": [ { "_id": String, "user": String, // 사용자 id "follower": String, // 사용자 id "createdAt": String, "updatedAt": String } ], "following": [ { "_id": String, "user": String, // 사용자 id "follower": String, // 사용자 id "createdAt": String, "updatedAt": String } ], "notifications": Notification[], "messages": Message[], "_id": String, "fullName": String, "email": String, "createdAt": String, "updatedAt": String }, "createdAt": String, "updatedAt": String } ]
4. 특정 채널에 포스트 작성하기[POST]
/posts/create
Request
{ header: { Authorization: 'bearer JWT token' }, body: { title: String, image: Binary | null, channelId: String } }
Response
// 없는디요
5. 특정 포스트 상세 보기[POST] ← GET인거 같은데.. // GET이 맞다고 합니당
/posts/{postId}
Request
// 없음
Response
{ // Post Object "likes": Like[], "comments": Comment[], "_id": String, "image": Optional<String>, "imagePublicId": Optional<String>, "title": String, "channel": Channel, "author": User, "createdAt": String, "updatedAt": String }
6. 포스트 수정하기[PUT]
/posts/update
Request
{ header: { Authorization: 'bearer JWT token' }, body: { postId: String, title: String, image: Binary | null, imageToDeletePulicId: String, // option -> 이미지 삭제 시 imagePublicId channelId: String } }
Response
7. 포스트 삭제하기[DELETE]
/posts/delete
Request
{ header: { Authorization: 'bearer JWT token' }, body: { id: String } }
Response
8. 포스트(사용자도 함께) 검색[GET]
/search/all/{query}
흠. 이 API는 포스트 검색만으로 사용해도 될 듯합니다.
Request
Response
// (User | Post)[] { "likes": Like[], "comments": Comment[], "_id": String, "image": Optional<String>, "imagePublicId": Optional<String>, "title": String, "channel": Channel, "author": User, "createdAt": String, "updatedAt": String }