Skip to content

Commit be4f923

Browse files
authored
Merge pull request #104 from Stack-Knowledge/develop
Release 1.1.0
2 parents 4384da7 + 2434cf7 commit be4f923

File tree

158 files changed

+2391
-885
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+2391
-885
lines changed

.vscode/settings.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"typescript.tsdk": "node_modules/typescript/lib"
2+
"typescript.tsdk": "node_modules/typescript/lib",
3+
"editor.codeActionsOnSave": {
4+
"source.fixAll.eslint": true
5+
}
36
}

package.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
"@tanstack/react-query": "^4.29.7",
2020
"@tanstack/react-query-devtools": "^4.29.7",
2121
"@types/react": "^18.2.0",
22+
"eslint-config-prettier": "^9.1.0",
23+
"eslint-plugin-react-hooks": "5.0.0-canary-0cdfef19b-20231211",
24+
"eslint-plugin-sort-exports": "^0.8.0",
25+
"eslint-plugin-storybook": "^0.6.15",
26+
"eslint-plugin-unused-imports": "^3.0.0",
2227
"next": "13.4.2",
2328
"react": "^18.2.0",
2429
"react-toastify": "^9.1.3",
@@ -31,6 +36,11 @@
3136
"@types/react": "^18.2.0"
3237
},
3338
"devDependencies": {
34-
"@types/gtag.js": "^0.0.17"
39+
"@types/gtag.js": "^0.0.17",
40+
"@typescript-eslint/eslint-plugin": "^6.14.0",
41+
"@typescript-eslint/parser": "^6.14.0",
42+
"eslint": "^8.55.0",
43+
"eslint-plugin-import": "^2.29.0",
44+
"eslint-plugin-react": "^7.33.2"
3545
}
3646
}

packages/api/.eslintignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
**/.next
2+
**/node_modules
3+
**/style.ts
4+
*.d.ts
5+
6+
packages/api/admin/src/libs/api/admin.ts
7+
packages/api/client/src/libs/api/client.ts
8+
9+
**/styles/page/*.ts

packages/api/.eslintrc.json

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{
2+
"plugins": ["react", "@typescript-eslint", "unused-imports", "sort-exports"],
3+
"extends": [
4+
"eslint:recommended",
5+
"plugin:@typescript-eslint/recommended",
6+
"next/core-web-vitals",
7+
"prettier"
8+
],
9+
"parser": "@typescript-eslint/parser",
10+
"parserOptions": {
11+
"ecmaVersion": 2021,
12+
"sourceType": "module"
13+
},
14+
"rules": {
15+
/* 2개의 스페이스를 들여쓰기에 사용합니다. */
16+
"indent": ["error", 2],
17+
18+
/* 작은따옴표('')를 문자열에 사용합니다. */
19+
"quotes": ["error", "single"],
20+
21+
"react-hooks/exhaustive-deps": "off",
22+
23+
/* 사용되지 않는 변수를 경고로 표시합니다. */
24+
"no-unused-vars": "error",
25+
26+
/* 디버깅용 로그문(console.log)을 사용할 수 있도록 허용합니다. */
27+
"no-console": "error",
28+
29+
/* 사용하지 않는 import문을 제거합니다. */
30+
"unused-imports/no-unused-imports-ts": ["error"],
31+
32+
"sort-exports/sort-exports": ["error"],
33+
34+
"no-restricted-imports": [
35+
"error",
36+
{
37+
"patterns": ["../"]
38+
}
39+
],
40+
41+
"arrow-body-style": ["error", "as-needed"],
42+
"react/self-closing-comp": ["error", { "component": true, "html": true }],
43+
"@typescript-eslint/consistent-type-imports": [
44+
"error",
45+
{
46+
"prefer": "type-imports"
47+
}
48+
],
49+
"import/order": [
50+
"error",
51+
{
52+
"groups": [
53+
"builtin",
54+
"external",
55+
"internal",
56+
"parent",
57+
"sibling",
58+
"index",
59+
"object",
60+
"type"
61+
],
62+
"pathGroups": [
63+
{
64+
"pattern": "react",
65+
"group": "external",
66+
"position": "before"
67+
},
68+
{
69+
"pattern": "next/**",
70+
"group": "external",
71+
"position": "before"
72+
},
73+
{
74+
"pattern": "@emotion/**",
75+
"group": "external",
76+
"position": "before"
77+
},
78+
{
79+
"pattern": "./**",
80+
"group": "sibling",
81+
"position": "after"
82+
},
83+
{
84+
"pattern": "@/**",
85+
"group": "sibling",
86+
"position": "after"
87+
},
88+
{
89+
"pattern": "client/**",
90+
"group": "internal",
91+
"position": "before"
92+
},
93+
{
94+
"pattern": "admin/**",
95+
"group": "internal",
96+
"position": "before"
97+
},
98+
{
99+
"pattern": "api/**",
100+
"group": "internal",
101+
"position": "before"
102+
},
103+
{
104+
"pattern": "common",
105+
"group": "internal",
106+
"position": "before"
107+
}
108+
],
109+
"alphabetize": { "order": "asc" },
110+
"newlines-between": "always",
111+
"pathGroupsExcludedImportTypes": ["extanal", "admin"]
112+
}
113+
]
114+
}
115+
}

packages/api/admin/src/hooks/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export * from './mission';
2-
export * from './user';
32
export * from './order';
3+
export * from './user';

packages/api/admin/src/hooks/mission/usePostMission.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ import { useMutation } from '@tanstack/react-query';
22

33
import { post, missionQueryKeys, missionUrl } from 'api/common';
44

5+
import type { MissionDetailType } from 'types';
6+
57
export const usePostMission = () =>
6-
useMutation<
7-
void,
8-
Error,
9-
{ title: string; content: string; timeLimit: number }
10-
>(missionQueryKeys.postMission(), (newMission) =>
11-
post(missionUrl.mission(), newMission)
8+
useMutation<void, Error, MissionDetailType>(
9+
missionQueryKeys.postMission(),
10+
(newMission) => post(missionUrl.mission(), newMission)
1211
);

packages/api/admin/src/hooks/order/useGetOrderedItemList.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { useQuery } from '@tanstack/react-query';
22

33
import { orderQueryKeys, orderUrl, get } from 'api/common';
44

5-
import type { OrderdItemType } from 'types';
6-
75
import type { UseQueryOptions } from '@tanstack/react-query';
6+
import type { OrderdItemType } from 'types';
87

98
export const useGetOrderedItemList = (
109
options?: UseQueryOptions<OrderdItemType[]>
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export * from './useGetApprovedList';
12
export * from './useGetScoringList';
23
export * from './useGetSolveDetail';
4+
export * from './usePatchApprovalStatus';
35
export * from './usePostScoringResult';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { useQuery } from '@tanstack/react-query';
2+
3+
import { userQueryKeys, userUrl, get } from 'api/common';
4+
5+
import type { UseQueryOptions } from '@tanstack/react-query';
6+
import type { ApprovalStatusType } from 'types';
7+
8+
export const useGetApprovedList = (
9+
options?: UseQueryOptions<ApprovalStatusType[]>
10+
) =>
11+
useQuery<ApprovalStatusType[]>(
12+
userQueryKeys.getApprovedList(),
13+
() => get(userUrl.approvedList()),
14+
options
15+
);

packages/api/admin/src/hooks/user/useGetScoringList.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { useQuery } from '@tanstack/react-query';
22

33
import { userQueryKeys, userUrl, get } from 'api/common';
44

5-
import type { ScoringListType } from 'types';
6-
75
import type { UseQueryOptions } from '@tanstack/react-query';
6+
import type { ScoringListType } from 'types';
87

98
export const useGetScoringList = (
109
options?: UseQueryOptions<ScoringListType[]>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { useMutation } from '@tanstack/react-query';
2+
3+
import { userQueryKeys, userUrl, patch } from 'api/common';
4+
5+
interface ApprovedStatus {
6+
approveStatus: 'REJECT' | 'APPROVED';
7+
}
8+
9+
export const usePatchApprovalStatus = (userId: string) =>
10+
useMutation<void, Error, ApprovedStatus>(
11+
userQueryKeys.patchApprovedStatus(userId),
12+
(data) => patch(userUrl.approvedStatus(userId), data)
13+
);

packages/api/client/src/hooks/item/useGetItemList.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { useQuery } from '@tanstack/react-query';
22

33
import { itemQueryKeys, itemUrl, get } from 'api/common';
44

5-
import type { ShopItemType } from 'types';
6-
75
import type { UseQueryOptions } from '@tanstack/react-query';
6+
import type { ShopItemType } from 'types';
87

98
export const useGetItemList = (options?: UseQueryOptions<ShopItemType[]>) =>
109
useQuery<ShopItemType[]>(

packages/api/client/src/hooks/order/usePostItemOrder.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useMutation } from '@tanstack/react-query';
22

33
import { post, orderQueryKeys, orderUrl } from 'api/common';
44

5-
import { AxiosError } from 'axios';
5+
import type { AxiosError } from 'axios';
66

77
interface ItemOrderRequestType {
88
itemId: string;

packages/api/client/src/hooks/solve/usePostSolve.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { useMutation } from '@tanstack/react-query';
22

33
import { post, solveQueryKeys, solveUrl } from 'api/common';
4-
import { AxiosError } from 'axios';
4+
5+
import type { AxiosError } from 'axios';
56

67
export const usePostSolve = (missionId: string) =>
78
useMutation<

packages/api/client/src/hooks/student/useGetStudentInfo.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { useQuery } from '@tanstack/react-query';
22

33
import { studentQueryKeys, studentUrl, get } from 'api/common';
44

5-
import type { StudentType } from 'types';
6-
75
import type { UseQueryOptions } from '@tanstack/react-query';
6+
import type { StudentType } from 'types';
87

98
export const useGetStudentInfo = (options?: UseQueryOptions<StudentType>) =>
109
useQuery<StudentType>(
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export * from './usePatchAccessToken';
21
export * from './usePostLoginCode';
2+
export * from './useDeleteLogout';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { useMutation } from '@tanstack/react-query';
2+
3+
import { authUrl, authQueryKeys, del } from 'api/common';
4+
5+
export const useDeleteLogout = () =>
6+
useMutation(authQueryKeys.deleteAuth(), () =>
7+
del(authUrl.deleteAuth(), {
8+
headers: {
9+
RefreshToken: `${localStorage.getItem('refresh_token')}`,
10+
Authorization: `Bearer ${localStorage.getItem('access_token')}`,
11+
},
12+
})
13+
);

packages/api/common/src/hooks/auth/usePatchAccessToken.ts

-26
This file was deleted.

packages/api/common/src/hooks/auth/usePostLoginCode.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { useMutation } from '@tanstack/react-query';
22

3-
import { post, authQueryKeys, authUrl } from 'api/common';
3+
import { authQueryKeys, authUrl, post } from 'api/common';
44

5-
import { TokenResponseType } from 'types';
5+
import type { TokenResponseLoginType } from 'types';
66

77
export const usePostLoginCode = () =>
8-
useMutation<TokenResponseType, Error, { code: string }>(
8+
useMutation<TokenResponseLoginType, Error, { code: string }>(
99
authQueryKeys.postLoginCode(),
1010
(loginCode) => post(authUrl.auth(), loginCode),
1111
{
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export * from './mission';
21
export * from './auth';
2+
export * from './mission';
33
export * from './student';

packages/api/common/src/hooks/mission/useGetMissionDetail.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { useQuery } from '@tanstack/react-query';
22

33
import { missionUrl, missionQueryKeys, get } from 'api/common';
44

5-
import type { MissionDetailType } from 'types';
6-
75
import type { UseQueryOptions } from '@tanstack/react-query';
6+
import type { MissionDetailType } from 'types';
87

98
export const useGetMissionDetail = (
109
missionId: string,

packages/api/common/src/hooks/mission/useGetMissionList.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { useQuery } from '@tanstack/react-query';
22

33
import { missionQueryKeys, missionUrl, get } from 'api/common';
44

5-
import type { MissionListItemType } from 'types';
6-
75
import type { UseQueryOptions } from '@tanstack/react-query';
6+
import type { MissionListItemType } from 'types';
87

98
export const useGetMissionList = (
109
options?: UseQueryOptions<MissionListItemType[]>

packages/api/common/src/hooks/student/useGetRankingList.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { useQuery } from '@tanstack/react-query';
22

33
import { studentQueryKeys, studentUrl, get } from 'api/common';
44

5-
import type { RankingPropsType } from 'types';
6-
75
import type { UseQueryOptions } from '@tanstack/react-query';
6+
import type { RankingPropsType } from 'types';
87

98
export const useGetRankingList = (
109
options?: UseQueryOptions<RankingPropsType[]>
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export * from './method';
21
export * from './instance';
2+
export * from './method';

0 commit comments

Comments
 (0)