-
Notifications
You must be signed in to change notification settings - Fork 0
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
inv-126 : 타이틀, 내용 업데이트 쿼리 #64
Merged
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
190cf6e
feat: using update request api
xilucks 80d687c
feat: title update use debounce
xilucks 7b6b807
chore: 불필요한 console.log 제거
xilucks d6a2470
Merge remote-tracking branch 'origin/main'
xilucks 129d5f0
refactor: Config 명세 변경 적용
xilucks 1415fbe
feat: 삭제 api 연결
xilucks eae2757
refactor: title update mutation
bepyan 08338c5
refactor: query auth
bepyan 1426349
fix: editor.data typo
bepyan 25cace2
feat: 저장 토스트 문구 수정
bepyan f1d5f8a
fix: query typo
bepyan 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 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 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 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 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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
import { count, eq } from "drizzle-orm"; | ||
import { nanoid } from "nanoid"; | ||
import { getAuth } from "~/lib/auth/utils"; | ||
import { db } from "~/lib/db"; | ||
import { | ||
invitations, | ||
|
@@ -11,7 +12,7 @@ import { | |
|
||
type CreateInvitationParams = Omit< | ||
InvitationInsert, | ||
"id" | "eventUrl" | "createdAt" | "updatedAt" | ||
"id" | "userId" | "eventUrl" | "createdAt" | "updatedAt" | ||
>; | ||
|
||
type UpdateInvitationParams = { | ||
|
@@ -41,27 +42,31 @@ export async function getInvitationByEventUrl(eventUrl: string) { | |
return responses[0]; | ||
} | ||
|
||
export async function getInvitationsByUserId( | ||
userId: Invitation["userId"], | ||
): Promise<Invitation[]> { | ||
export async function getInvitationsByUserId(): Promise<Invitation[]> { | ||
const sessionId = await getAuth(); | ||
const sessionUserId = sessionId.session.userId; | ||
|
||
return await db | ||
.select() | ||
.from(invitations) | ||
.where(eq(invitations.userId, userId)); | ||
.where(eq(invitations.userId, sessionUserId)); | ||
} | ||
|
||
export async function createInvitation( | ||
params: CreateInvitationParams, | ||
): Promise<InvitationInsert> { | ||
const id = nanoid(); | ||
const currentTimestamp = new Date(); | ||
const sessionId = await getAuth(); | ||
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.
|
||
const sessionUserId = sessionId.session.userId; | ||
|
||
try { | ||
const res = await db | ||
.insert(invitations) | ||
.values({ | ||
...params, | ||
id, | ||
userId: sessionUserId, | ||
eventUrl: id, | ||
createdAt: currentTimestamp, | ||
updatedAt: currentTimestamp, | ||
|
Oops, something went wrong.
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.
subDomain은 수정이 가능하기에,
editor.config.invitationId
로 적용해주세요1