-
Notifications
You must be signed in to change notification settings - Fork 1
[FE-Feat] 개인 일정 생성, 조회 #169
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9c2678d
feat: 로그인 여부 미들웨어에서 확인하기
hamo-o fa80084
feat: 개인 일정 model 및 get api 정의, fetch 포맷 변경
hamo-o 45a858d
fix: API URI 변경 및 파라미터 형식 변경
hamo-o 27f91b4
feat: API 응답값으로 카드 컨텐츠 랜더링
hamo-o 590e084
feat: 개인 일정 생성 API 연결
hamo-o dab4348
fix: 잘못된 경로 수정
hamo-o 334e51c
chore: 불필요한 cookies 파일 삭제
hamo-o 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
25 changes: 25 additions & 0 deletions
25
frontend/src/features/discussion/ui/DiscussionRank/index.tsx
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,25 @@ | ||
| import { useState } from 'react'; | ||
|
|
||
| import { Tab } from '@/components/Tab'; | ||
|
|
||
| const DiscussionRank = () => { | ||
| const [tab, setTab] = useState('eventsRankedDefault'); | ||
| const handleChange = (value: string) => { | ||
| setTab(value); | ||
| }; | ||
|
|
||
| return ( | ||
| <div> | ||
| <Tab onChange={handleChange} selectedValue={tab}> | ||
| <Tab.List> | ||
| <Tab.Item value='eventsRankedDefault'>참가자 많은 순</Tab.Item> | ||
| <Tab.Item value='eventsRankedOfTime'>빠른 시간 순</Tab.Item> | ||
| </Tab.List> | ||
| <Tab.Content value='eventsRankedDefault'>캘린더</Tab.Content> | ||
| <Tab.Content value='eventsRankedOfTime'>순위</Tab.Content> | ||
| </Tab> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default DiscussionRank; |
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,21 @@ | ||
| import { request } from '@/utils/fetch'; | ||
|
|
||
| import type { PersonalEventDTO, PersonalEventRequest, PersonalEventResponse } from '../model'; | ||
|
|
||
| export const personalEventApi = { | ||
| getPersonalEvent: async ( | ||
| { startDateTime, endDateTime }: Pick<PersonalEventDTO, 'startDateTime' | 'endDateTime'>, | ||
| ): Promise<PersonalEventResponse[]> => { | ||
| const response = await request.get('/api/v1/personal-event', { | ||
| params: { | ||
| startDateTime: `${startDateTime}T00:00:00`, | ||
| endDateTime: `${endDateTime}T00:00:00`, | ||
| }, | ||
| }); | ||
| return response.data; | ||
| }, | ||
| postPersonalEvent: async (body: PersonalEventRequest): Promise<PersonalEventResponse> => { | ||
| const response = await request.post('/api/v1/personal-event', { body }); | ||
| return response; | ||
| }, | ||
hamo-o marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
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,7 @@ | ||
| import type { PersonalEventDTO } from '../model'; | ||
|
|
||
| export const personalEventKeys = { | ||
| all: ['personalEvents'], | ||
| detail: (data: Pick<PersonalEventDTO, 'startDateTime' | 'endDateTime'>) => | ||
| [...personalEventKeys.all, data], | ||
| }; |
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,20 @@ | ||
| import { useMutation, useQueryClient } from '@tanstack/react-query'; | ||
|
|
||
| import type { PersonalEventRequest } from '../model'; | ||
| import { personalEventApi } from '.'; | ||
| import { personalEventKeys } from './keys'; | ||
|
|
||
| export const usePersonalEventMutation = () => { | ||
| const queryClient = useQueryClient(); | ||
|
|
||
| const { mutate } = useMutation({ | ||
| mutationFn: (body: PersonalEventRequest) => personalEventApi.postPersonalEvent(body), | ||
| onSuccess: () => { | ||
| queryClient.invalidateQueries({ | ||
| queryKey: personalEventKeys.all, | ||
| }); | ||
| }, | ||
| }); | ||
|
|
||
| return { mutate }; | ||
| }; |
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,16 @@ | ||
| import { useQuery } from '@tanstack/react-query'; | ||
|
|
||
| import type { PersonalEventDTO, PersonalEventResponse } from '../model'; | ||
| import { personalEventApi } from '.'; | ||
| import { personalEventKeys } from './keys'; | ||
|
|
||
| export const usePersonalEventsQuery = ( | ||
| data: Pick<PersonalEventDTO, 'startDateTime' | 'endDateTime'>, | ||
| ) => { | ||
| const { data: personalEvents, isLoading } = useQuery<PersonalEventResponse[]>({ | ||
| queryKey: personalEventKeys.detail(data), | ||
| queryFn: () => personalEventApi.getPersonalEvent(data), | ||
| }); | ||
|
|
||
| return { personalEvents, isLoading }; | ||
| }; |
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 |
|---|---|---|
| @@ -1 +1,23 @@ | ||
| import { z } from 'zod'; | ||
|
|
||
| const PersonalEventDTO = z.object({ | ||
| id: z.number(), | ||
| title: z.string(), | ||
| startDateTime: z.string().datetime(), | ||
| endDateTime: z.string().datetime(), | ||
|
Comment on lines
+6
to
+7
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. p3; |
||
| isAdjustable: z.boolean(), | ||
| syncWithGoogleCalendar: z.boolean(), | ||
| googleEventId: z.string(), | ||
| calendarId: z.string(), | ||
| }); | ||
hamo-o marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const PersonalEventResponse = PersonalEventDTO.omit({ syncWithGoogleCalendar: true }); | ||
| const PersonalEventRequest = PersonalEventDTO.omit( | ||
| { id: true, googleEventId: true, calendarId: true }, | ||
| ); | ||
|
|
||
| export type PersonalEventDTO = z.infer<typeof PersonalEventDTO>; | ||
| export type PersonalEventResponse = z.infer<typeof PersonalEventResponse>; | ||
| export type PersonalEventRequest = z.infer<typeof PersonalEventRequest>; | ||
|
|
||
| export type PopoverType = 'add' | 'edit'; | ||
28 changes: 14 additions & 14 deletions
28
frontend/src/features/my-calendar/ui/CalendarCardList/index.tsx
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.