-
Notifications
You must be signed in to change notification settings - Fork 3
feat: api-client 공통 패키지 도입 및 admin auth/scores 이관 #435
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
| @@ -1,15 +1 @@ | ||
| import type { AxiosResponse } from "axios"; | ||
| import { publicAxiosInstance } from "@/lib/api/client"; | ||
| import type { AdminSignInResponse, ReissueAccessTokenResponse } from "@/types/auth"; | ||
|
|
||
| export const adminSignInApi = (email: string, password: string): Promise<AxiosResponse<AdminSignInResponse>> => | ||
| publicAxiosInstance.post("/auth/email/sign-in", { email, password }); | ||
|
|
||
| export const reissueAccessTokenApi = (refreshToken: string): Promise<AxiosResponse<ReissueAccessTokenResponse>> => | ||
| publicAxiosInstance.post( | ||
| "/admin/auth/reissue", | ||
| {}, | ||
| { | ||
| headers: { Authorization: `Bearer ${refreshToken}` }, | ||
| }, | ||
| ); | ||
| export { adminSignInApi, reissueAccessTokenApi } from "@solid-connect/api-client/generated/admin"; |
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 |
|---|---|---|
| @@ -1,45 +1 @@ | ||
| import { axiosInstance } from "@/lib/api/client"; | ||
| import type { | ||
| GpaScoreUpdateRequest, | ||
| GpaScoreWithUser, | ||
| LanguageScoreWithUser, | ||
| LanguageTestScoreUpdateRequest, | ||
| LanguageTestType, | ||
| PageResponse, | ||
| ScoreSearchCondition, | ||
| VerifyStatus, | ||
| } from "@/types/scores"; | ||
|
|
||
| export const scoreApi = { | ||
| // GPA 성적 조회 | ||
| getGpaScores: (condition: ScoreSearchCondition, page: number): Promise<PageResponse<GpaScoreWithUser>> => | ||
| axiosInstance.get("/admin/scores/gpas", { params: { ...condition, page } }).then((res) => res.data), | ||
|
|
||
| // GPA 성적 수정 | ||
| updateGpaScore: (id: number, status: VerifyStatus, reason?: string, score?: GpaScoreWithUser) => { | ||
| if (!score) throw new Error("Score data is required"); | ||
| const request: GpaScoreUpdateRequest = { | ||
| gpa: score.gpaScoreStatusResponse.gpaResponse.gpa, | ||
| gpaCriteria: score.gpaScoreStatusResponse.gpaResponse.gpaCriteria, | ||
| verifyStatus: status, | ||
| rejectedReason: reason, | ||
| }; | ||
| return axiosInstance.put(`/admin/scores/gpas/${id}`, request); | ||
| }, | ||
|
|
||
| // 어학성적 조회 | ||
| getLanguageScores: (condition: ScoreSearchCondition, page: number): Promise<PageResponse<LanguageScoreWithUser>> => | ||
| axiosInstance.get("/admin/scores/language-tests", { params: { ...condition, page } }).then((res) => res.data), | ||
|
|
||
| // 어학성적 수정 | ||
| updateLanguageScore: (id: number, status: VerifyStatus, reason?: string, score?: LanguageScoreWithUser) => { | ||
| if (!score) throw new Error("Score data is required"); | ||
| const request: LanguageTestScoreUpdateRequest = { | ||
| languageTestType: score.languageTestScoreStatusResponse.languageTestResponse.languageTestType as LanguageTestType, | ||
| languageTestScore: score.languageTestScoreStatusResponse.languageTestResponse.languageTestScore, | ||
| verifyStatus: status, | ||
| rejectedReason: reason, | ||
| }; | ||
| return axiosInstance.put(`/admin/scores/language-tests/${id}`, request); | ||
| }, | ||
| }; | ||
| export { scoreApi } from "@solid-connect/api-client/generated/admin"; |
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,8 +1 @@ | ||
| export interface AdminSignInResponse { | ||
| accessToken: string; | ||
| refreshToken: string; | ||
| } | ||
|
|
||
| export interface ReissueAccessTokenResponse { | ||
| accessToken: string; | ||
| } | ||
| export type { AdminSignInResponse, ReissueAccessTokenResponse } from "@solid-connect/api-client/generated/admin"; |
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,105 +1,13 @@ | ||
| export type VerifyStatus = "PENDING" | "APPROVED" | "REJECTED"; | ||
|
|
||
| export interface ScoreSearchCondition { | ||
| verifyStatus?: VerifyStatus; | ||
| } | ||
|
|
||
| export interface GpaResponse { | ||
| gpa: number; | ||
| gpaCriteria: number; | ||
| gpaReportUrl: string; | ||
| } | ||
|
|
||
| export interface GpaScore { | ||
| verifyStatus: VerifyStatus; | ||
| rejectedReason?: string; | ||
| } | ||
|
|
||
| export interface GpaScoreStatusResponse { | ||
| id: number; | ||
| gpaResponse: GpaResponse; | ||
| verifyStatus: VerifyStatus; | ||
| rejectedReason: string | null; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| } | ||
|
|
||
| export interface SiteUserResponse { | ||
| id: number; | ||
| nickname: string; | ||
| profileImageUrl: string; | ||
| } | ||
|
|
||
| export interface GpaScoreWithUser { | ||
| gpaScoreStatusResponse: GpaScoreStatusResponse; | ||
| siteUserResponse: SiteUserResponse; | ||
| } | ||
|
|
||
| export interface PageResponse<T> { | ||
| content: T[]; | ||
| pageNumber: number; | ||
| pageSize: number; | ||
| totalElements: number; | ||
| totalPages: number; | ||
| } | ||
|
|
||
| export interface LanguageResponse { | ||
| languageType: string; | ||
| score: number; | ||
| testDate: string; | ||
| expireDate: string; | ||
| languageReportUrl: string; | ||
| } | ||
|
|
||
| export interface LanguageTestResponse { | ||
| languageTestType: string; | ||
| languageTestScore: string; | ||
| languageTestReportUrl: string; | ||
| } | ||
|
|
||
| export interface LanguageTestScore { | ||
| verifyStatus: VerifyStatus; | ||
| rejectedReason?: string; | ||
| } | ||
|
|
||
| export interface LanguageTestScoreStatusResponse { | ||
| id: number; | ||
| languageTestResponse: LanguageTestResponse; | ||
| verifyStatus: VerifyStatus; | ||
| rejectedReason: string | null; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| } | ||
|
|
||
| export interface LanguageScoreWithUser { | ||
| languageTestScoreStatusResponse: LanguageTestScoreStatusResponse; | ||
| siteUserResponse: SiteUserResponse; | ||
| } | ||
|
|
||
| export type LanguageTestType = | ||
| | "TOEIC" | ||
| | "TOEFL_IBT" | ||
| | "TOEFL_ITP" | ||
| | "IELTS" | ||
| | "JLPT" | ||
| | "NEW_HSK" | ||
| | "ETC" | ||
| | "DALF" | ||
| | "CEFR" | ||
| | "TCF" | ||
| | "TEF" | ||
| | "DUOLINGO"; | ||
|
|
||
| export interface GpaScoreUpdateRequest { | ||
| gpa: number; | ||
| gpaCriteria: number; | ||
| verifyStatus: VerifyStatus; | ||
| rejectedReason?: string; | ||
| } | ||
|
|
||
| export interface LanguageTestScoreUpdateRequest { | ||
| languageTestType: LanguageTestType; | ||
| languageTestScore: string; | ||
| verifyStatus: VerifyStatus; | ||
| rejectedReason?: string; | ||
| } | ||
| export type { | ||
| GpaScoreStatusResponse, | ||
| GpaScoreUpdateRequest, | ||
| GpaScoreWithUser, | ||
| LanguageScoreWithUser, | ||
| LanguageTestScoreStatusResponse, | ||
| LanguageTestScoreUpdateRequest, | ||
| LanguageTestType, | ||
| PageResponse, | ||
| ScoreSearchCondition, | ||
| SiteUserResponse, | ||
| VerifyStatus, | ||
| } from "@solid-connect/api-client/generated/admin"; |
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,24 @@ | ||
| { | ||
| "name": "@solid-connect/api-client", | ||
| "version": "0.0.0", | ||
| "private": true, | ||
| "scripts": { | ||
| "sync:bruno": "node ./scripts/sync-bruno.mjs", | ||
| "sync:bruno:remote": "BRUNO_SOURCE_MODE=remote node ./scripts/sync-bruno.mjs", | ||
| "build": "pnpm run sync:bruno", | ||
| "typecheck": "tsc --noEmit", | ||
| "codegen:check": "pnpm run sync:bruno && git diff --exit-code src/generated/apis || (echo \"Generated API client is out of sync. Run: pnpm --filter @solid-connect/api-client run sync:bruno\" && exit 1)" | ||
| }, | ||
| "exports": { | ||
| ".": "./src/index.ts", | ||
| "./runtime": "./src/runtime/index.ts", | ||
| "./generated/admin": "./src/generated/admin/index.ts", | ||
| "./hooks": "./src/hooks/index.ts" | ||
| }, | ||
| "dependencies": { | ||
| "axios": "^1.6.7" | ||
| }, | ||
| "devDependencies": { | ||
| "typescript": "^5.3.3" | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: solid-connection/solid-connect-web
Length of output: 763
🏁 Script executed:
Repository: solid-connection/solid-connect-web
Length of output: 2849
🏁 Script executed:
Repository: solid-connection/solid-connect-web
Length of output: 1351
codegen:check가 CI 파이프라인에 포함되지 않고 있습니다.원래 리뷰 의견이 가정했던 상황과 실제가 다릅니다. 현재 설계의 핵심:
빌드 중 생성 파일 갱신:
"build": "pnpm run sync:bruno"설정은 의도된 것입니다. Admin 앱 빌드 시 turbo의^build의존성으로 인해 api-client가 빌드되며, 항상 최신 API 클라이언트를 생성합니다.캐시 비활성화: sync:bruno 태스크에
cache: false가 설정되어 있어서 turbo 캐시를 무시하고 매번 실행됩니다. 이는 빌드 시점에 항상 신선한 생성 파일을 보장하려는 의도입니다.누락된 검증: 문제는
codegen:check스크립트가 존재하지만 CI 파이프라인에 포함되지 않았다는 점입니다. 현재 CI는ci:check(lint & typecheck만)만 실행하고, 생성된 파일이 소스와 일치하는지 검증하지 않습니다.권장사항:
ci:check태스크에codegen:check의존성을 추가하여 CI에서 생성 파일의 동기화 상태를 검증할 것codegen:check를 실행하여 개발자가 로컬에서sync:bruno를 실행하지 않은 채 커밋한 경우를 감지할 것🤖 Prompt for AI Agents