-
Notifications
You must be signed in to change notification settings - Fork 0
✨ feat: add api for update emoji(group) and update api and update interface #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
j2woo
wants to merge
5
commits into
main
Choose a base branch
from
2-add-group-updateEmoji
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e99495c
✨ feat(api): add api for group post
j2woo 5cbe415
2-add-group-updateEmojiAndPost
j2woo 05d6ff1
♻️ refactor: apply requested reviews
j2woo 43cb10d
Merge branch 'main' into 2-add-group-updateEmoji
j2woo b9730e9
♻️ refactor: apply requested reviews
j2woo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
|
|
||
| export interface Group { | ||
| groupId: string; | ||
| userId: string; | ||
| groupName: string; | ||
| inviteUrl: string; | ||
|
|
||
| } | ||
|
|
||
| export interface GroupMember{ | ||
| groupMemberId: string; | ||
| groupId: string; | ||
| userId: string; | ||
| groupRollingPaperId: string; | ||
| } | ||
| export interface GroupInputDTO{ | ||
| groupId: string; | ||
| } | ||
|
|
||
| export interface GroupMemberInputDTO{ | ||
| groupMemberId: string; | ||
| } | ||
|
|
||
| export interface GroupDTO { | ||
| userId: string; | ||
| groupName: string; | ||
| inviteUrl: string; | ||
| } | ||
|
|
||
| export interface GroupMemberDTO{ | ||
| groupId: string; | ||
| userId: string; | ||
| groupRollingPaperId: string; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| export interface GroupRollingPaper { | ||
| groupRollingPaperId: string; | ||
| title: string | null; | ||
| } | ||
|
|
||
|
|
||
| export interface GroupRollingPaperInputDTO { | ||
| groupRollingPaperId: string; | ||
| } | ||
|
|
||
| export interface GroupRollingPaperDTO { | ||
| title: string | null; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,9 @@ import { | |
| GroupPost, | ||
| GroupPostInputDTO, | ||
| GroupPostDTO, | ||
|
|
||
| GroupPostEmojiDTO, | ||
|
|
||
| } from "@/interfaces/GroupPost"; | ||
| import { group } from "console"; | ||
|
|
||
|
|
@@ -65,13 +68,17 @@ export default class GroupService { | |
| public async updateGroupPost( | ||
| groupPostInputDTO: GroupPostInputDTO, | ||
| groupPostDTO: GroupPostDTO, | ||
| ): Promise<{ groupUadatedPostResult: GroupPost }> { | ||
|
|
||
| ): Promise<{ groupUpdatedPostResult: GroupPost }> { | ||
|
|
||
| try { | ||
| const groupPostId = groupPostInputDTO.groupPostId; | ||
|
|
||
| // ! 수정한 사람 누구인지 확인 로직 필요, 비로그인 유저면 비밀번호 확인해줘야해! | ||
| // 이건 로그인 회원 | ||
| const groupUadatedPostResult= await this.groupPostModel.update( | ||
|
|
||
| const groupUpdatedPostResult= await this.groupPostModel.update( | ||
|
|
||
| { | ||
| content:groupPostDTO.content, | ||
| post_color:groupPostDTO.postColor, | ||
|
|
@@ -81,11 +88,13 @@ export default class GroupService { | |
| ); | ||
| // 비로그인 회원은 필요한 거- 비밀번호 확인 | ||
|
|
||
| if (!groupUadatedPostResult) { | ||
|
|
||
| if (groupUpdatedPostResult[0]===0) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sequelize UPDATE 시 return type이
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 넵 |
||
| throw new Error("Unable to update post"); | ||
| } | ||
|
|
||
| return { groupUadatedPostResult }; | ||
| return { groupUpdatedPostResult }; | ||
|
|
||
| } catch (error) { | ||
| this.logger.error(error); | ||
| throw error; | ||
|
|
@@ -113,4 +122,32 @@ export default class GroupService { | |
| throw error; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| // TODO: 롤링페이퍼 주인만 이모지 수정 가능! | ||
| public async updateEmojiForPost( | ||
| groupPostInputDTO: GroupPostInputDTO, | ||
| groupPostEmojiDTO: GroupPostEmojiDTO, | ||
| ): Promise<{ groupUpdatedEmojiResult: GroupPost}> { | ||
| try { | ||
| const groupPostId = groupPostInputDTO.groupPostId; | ||
|
|
||
| const groupUpdatedEmojiResult= await this.groupPostModel.update( | ||
| { | ||
| emoji_type : groupPostEmojiDTO.emojiType, | ||
| }, | ||
| { where: { group_post_id: groupPostId } }, | ||
| ); | ||
|
|
||
| if (groupUpdatedEmojiResult[0]=== 0) { | ||
| throw new Error("Unable to update emoji for a post"); | ||
| } | ||
|
|
||
| return { groupUpdatedEmojiResult}; | ||
| } catch (error) { | ||
| this.logger.error(error); | ||
| throw error; | ||
| } | ||
| } | ||
|
|
||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
응답 시
result에 배열을 그대로 담아서 주는데,trueorfalse값만 전달해주는게 어떤가요?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
groupUpdatedPostResult와 groupPostDetail 차이점이 뭔가요? 좀 헷갈려서..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
groupUp0datedPostResult는 수정 성공 여부이고 groupPostDetail은 수정 후 포스트의 정보를 전달하기 위한 해당 포스트의 디테일 정보입니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
result에 true false 값으로 수정하겠습니다.