© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
V2 api 논의사항 정리 (알림,유저) (01.05)
유저정보 관리
admin 계정 하나 따로 판다.
더미데이터를 DB라는 새로운 채널을 파 user라는 Thread에 넣어논다.
회원가입 시 DB채널의 Thread 를 get해서 해당 유저 파싱 후 데이터 변경한다 채널 ID는 .env로 관리
멘션 시 회원가입이 되어있는 유저에게는 해당 유저ID로 알림 회원가입이 되어있지 않은 유저에게는 adminID로 알림 admin이 알림을 보고 해당 유저에게 슬랙에서 DM 이 부분은 나중에 슬랙 봇과 연동 (아마 v3?)
알림 API
like Thread에 좋아요 시
like 생성
notification(like)로 보냄
comment Thread에 댓글 시
comment 생성
notification(comment)로 보냄
message → 멘션으로 사용
채널에서 Thread 생성 시 멘션 Thread 생성
ThreadID 를 담아서 message 생성
notification(message)로 보냄
Thread에서 comment시 멘션 message 생성
notification(message)로 보냄
// admin 계정으로 회원가입
{
"email": admin@admin.com,
"fullName": {
name : 데브나무 관리자,
nickname : 데브나무 관리자
},
"password": "1234qwer"
}
title= [
{ name: "김성빈", userId: "adminId" },
{ name: "김재민", userId: "adminId" },
{ name: "백윤서", userId: "adminId" },
{ name: "이재준", userId: "adminId" },
{ name: "조재훈", userId: "adminId" },
{ name: "김성빈2", userId: "adminId" },
{ name: "김재민2", userId: "adminId" },
{ name: "백윤서2", userId: "adminId" },
{ name: "이재준2", userId: "adminId" },
{ name: "조재훈2", userId: "adminId" },
];
// 김성빈 님 회원 가입 시
title= [
{ name: "김성빈", userId: "김성빈ID" }, // 업데이트
{ name: "김재민", userId: "adminId" },
{ name: "백윤서", userId: "adminId" },
{ name: "이재준", userId: "adminId" },
{ name: "조재훈", userId: "adminId" },
{ name: "김성빈2", userId: "adminId" },
{ name: "김재민2", userId: "adminId" },
{ name: "백윤서2", userId: "adminId" },
{ name: "이재준2", userId: "adminId" },
{ name: "조재훈2", userId: "adminId" },
];
const userDB = JSON.parse(title)
// POST : /likes/create
// req
{
"postId": String
}
// res
Like = {
"_id": String,
"user": String, // 사용자 id
"post": String, // 포스트 id
"createdAt": String,
"updatedAt": String
}
// POST : /notifications/create
// req
{
"notificationType": "LIKE"
"notificationTypeId": Like._id,
"userId": Like.user,
"postId": Like.post
}
// res
Notification = {
"seen": Boolean,
"_id": String,
"author": User,
"user": User | String,
"like": Like,
"createdAt": String,
"updatedAt": String
}
// POST : /comments/create
// req
{
"comment": String,
"postId": String
}
// res
Comment = {
"_id": String,
"comment": String,
"author": User,
"post": String, // 포스트 id
"createdAt": String,
"updatedAt": String
}
// POST : /notifications/create
// res
{
"notificationType": "COMMENT"
"notificationTypeId": Comment._id,
"userId": Comment.user,
"postId": Comment.post
}
// req
Notification = {
"seen": Boolean,
"_id": String,
"author": User,
"user": User | String,
"post": Nullable<String>, // 포스트 id
"comment": Comment,
"createdAt": String,
"updatedAt": String
}
// POST : /posts/create
// req
{
title: String,
image: Binary | null,
channelId: String
}
// res
Post = {
"likes": Like[],
"comments": Comment[],
"_id": String,
"image": Optional<String>,
"imagePublicId": Optional<String>,
"title": String,
"channel": Channel,
"author": User,
"createdAt": String,
"updatedAt": String
}
// post : /messages/create
// req
{
"message": JSON.stringfy{
channelName : Post.channel.name,
postId : Post._id,
content: form에서 받은 데이터
}
"receiver": String // 멘션된 사용자 id
}
// res
Message = {
"_id": String,
"message": String,
"sender": User,
"receiver": User,
"seen": Boolean,
"createdAt": String,
"updatedAt": String
}
// POST : /notifications/create
// req
{
"notificationType": "MESSAGE",
"notificationTypeId": Message._id,
"userId": Message.sender,
"postId": Post._id
}
// res
Notification = {
"seen": Boolean,
"_id": String,
"author": User,
"user": User | String,
"message": Message._id,
"createdAt": String,
"updatedAt": String
}
// post : /messages/create
// req
{
"message": JSON.stringfy{
channelName : Post.channel.name,
postId : Post._id,
content: form에서 받은 데이터
}
"receiver": String // 멘션된 사용자 id
}
// res
Message = {
"_id": String,
"message": String,
"sender": User,
"receiver": User,
"seen": Boolean,
"createdAt": String,
"updatedAt": String
}
// POST : /notifications/create
{
"notificationType": "MESSAGE",
"notificationTypeId": Message._id,
"userId": Message.sender._id,
"postId": postId
}
// res
Notification = {
"seen": Boolean,
"_id": String,
"author": User,
"user": User | String,
"message": Message._id,
"createdAt": String,
"updatedAt": String
}