-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(fe): change project architecture (#40)
* refactor: remove unused exports and components * refactor: change file structure * refactor: rename refresh to tokenRefresh and update related types * chore: auto-fix linting and formatting issues * refactor: update import rules --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
0808050
commit 9e9f39b
Showing
138 changed files
with
840 additions
and
790 deletions.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export * from './model/session.type'; | ||
export * from './model/qna.type'; | ||
export * from './model/chatting.type'; | ||
export * from './model/session.store'; | ||
export { default as ChattingMessage } from './ui/ChattingMessage'; |
2 changes: 1 addition & 1 deletion
2
...atures/session/chatting/chatting.slice.ts → .../entities/session/model/chatting.slice.ts
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
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...ent/src/features/session/qna/qna.slice.ts → ...t/src/entities/session/model/qna.slice.ts
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
File renamed without changes.
8 changes: 4 additions & 4 deletions
8
...ent/src/features/session/session.slice.ts → ...c/entities/session/model/session.slice.ts
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
6 changes: 3 additions & 3 deletions
6
...ent/src/features/session/session.store.ts → ...c/entities/session/model/session.store.ts
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...nt/src/components/qna/ChattingMessage.tsx → ...c/entities/session/ui/ChattingMessage.tsx
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import axios from 'axios'; | ||
|
||
export const logout = () => axios.post(`/api/auth/logout`); |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import axios from 'axios'; | ||
import { z } from 'zod'; | ||
|
||
export const PostTokenRefreshResponseSchema = z.object({ | ||
accessToken: z.string(), | ||
userId: z.number(), | ||
}); | ||
|
||
export type PostTokenRefreshResponseDTO = z.infer<typeof PostTokenRefreshResponseSchema>; | ||
|
||
export const tokenRefresh = () => | ||
axios | ||
.post<PostTokenRefreshResponseDTO>(`/api/auth/token`, undefined, { | ||
withCredentials: true, | ||
}) | ||
.then((res) => PostTokenRefreshResponseSchema.parse(res.data)); |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export * from './auth.api'; | ||
export * from './auth.hook'; | ||
export * from './auth.store'; | ||
export * from './api/token-refresh.api'; | ||
export * from './api/logout.api'; | ||
export * from './api/login.api'; | ||
export * from './model/auth.store'; | ||
export { default as SignInModal } from './ui/SignInModal'; |
File renamed without changes.
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
10 changes: 4 additions & 6 deletions
10
...ient/src/components/modal/SignInModal.tsx → ...ient/src/features/auth/ui/SignInModal.tsx
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
32 changes: 32 additions & 0 deletions
32
apps/client/src/features/close-question/api/close-question.api.ts
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import axios from 'axios'; | ||
import { z } from 'zod'; | ||
|
||
export const PatchQuestionClosedRequestSchema = z.object({ | ||
token: z.string(), | ||
sessionId: z.string(), | ||
closed: z.boolean(), | ||
}); | ||
|
||
export const PatchQuestionClosedResponseSchema = z.object({ | ||
question: z.object({ | ||
questionId: z.number(), | ||
createUserToken: z.string(), | ||
sessionId: z.string(), | ||
body: z.string(), | ||
closed: z.boolean(), | ||
pinned: z.boolean(), | ||
createdAt: z.string(), | ||
}), | ||
}); | ||
|
||
export type PatchQuestionClosedRequestDTO = z.infer<typeof PatchQuestionClosedRequestSchema>; | ||
|
||
export type PatchQuestionClosedResponseDTO = z.infer<typeof PatchQuestionClosedResponseSchema>; | ||
|
||
export const patchQuestionClosed = (questionId: number, body: PatchQuestionClosedRequestDTO) => | ||
axios | ||
.patch<PatchQuestionClosedResponseDTO>( | ||
`/api/questions/${questionId}/closed`, | ||
PatchQuestionClosedRequestSchema.parse(body), | ||
) | ||
.then((res) => PatchQuestionClosedResponseSchema.parse(res.data)); |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './api/close-question.api'; |
19 changes: 19 additions & 0 deletions
19
apps/client/src/features/create-session/api/create-session.api.ts
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import axios from 'axios'; | ||
import { z } from 'zod'; | ||
|
||
export const PostSessionRequestSchema = z.object({ | ||
title: z.string().min(1), | ||
}); | ||
|
||
export const PostSessionResponseSchema = z.object({ | ||
sessionId: z.string(), | ||
}); | ||
|
||
export type PostSessionRequestDTO = z.infer<typeof PostSessionRequestSchema>; | ||
|
||
export type PostSessionResponseDTO = z.infer<typeof PostSessionResponseSchema>; | ||
|
||
export const postSession = (body: PostSessionRequestDTO) => | ||
axios | ||
.post<PostSessionResponseDTO>('/api/sessions', PostSessionRequestSchema.parse(body)) | ||
.then((res) => PostSessionResponseSchema.parse(res.data)); |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as CreateSessionModal } from './ui/CreateSessionModal'; |
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
23 changes: 23 additions & 0 deletions
23
apps/client/src/features/create-update-question/api/create-question.api.ts
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import axios from 'axios'; | ||
import { z } from 'zod'; | ||
|
||
import { QuestionSchema } from '@/entities/session'; | ||
|
||
export const PostQuestionRequestSchema = z.object({ | ||
token: z.string(), | ||
sessionId: z.string(), | ||
body: z.string().min(1), | ||
}); | ||
|
||
export const PostQuestionResponseSchema = z.object({ | ||
question: QuestionSchema, | ||
}); | ||
|
||
export type PostQuestionRequestDTO = z.infer<typeof PostQuestionRequestSchema>; | ||
|
||
export type PostQuestionResponseDTO = z.infer<typeof PostQuestionResponseSchema>; | ||
|
||
export const postQuestion = (body: PostQuestionRequestDTO) => | ||
axios | ||
.post<PostQuestionResponseDTO>('/api/questions', PostQuestionRequestSchema.parse(body)) | ||
.then((res) => PostQuestionResponseSchema.parse(res.data)); |
32 changes: 32 additions & 0 deletions
32
apps/client/src/features/create-update-question/api/update-question.api.ts
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import axios from 'axios'; | ||
import { z } from 'zod'; | ||
|
||
export const PatchQuestionBodyRequestSchema = z.object({ | ||
token: z.string(), | ||
sessionId: z.string(), | ||
body: z.string().min(1), | ||
}); | ||
|
||
export const PatchQuestionBodyResponseSchema = z.object({ | ||
question: z.object({ | ||
questionId: z.number(), | ||
createUserToken: z.string(), | ||
sessionId: z.string(), | ||
body: z.string(), | ||
closed: z.boolean(), | ||
pinned: z.boolean(), | ||
createdAt: z.string(), | ||
}), | ||
}); | ||
|
||
export type PatchQuestionBodyRequestDTO = z.infer<typeof PatchQuestionBodyRequestSchema>; | ||
|
||
export type PatchQuestionBodyResponseDTO = z.infer<typeof PatchQuestionBodyResponseSchema>; | ||
|
||
export const patchQuestionBody = (questionId: number, body: PatchQuestionBodyRequestDTO) => | ||
axios | ||
.patch<PatchQuestionBodyResponseDTO>( | ||
`/api/questions/${questionId}/body`, | ||
PatchQuestionBodyRequestSchema.parse(body), | ||
) | ||
.then((res) => PatchQuestionBodyResponseSchema.parse(res.data)); |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as CreateQuestionModal } from './ui/CreateQuestionModal'; |
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
Oops, something went wrong.