Skip to content

Commit eef8602

Browse files
authored
[#60] ✨ 스웨거 업데이트에 따른 타입 추가 (#140)
* [#60] ✨ update apiSchema alongto backend update * [#60] 🚚 move my page related types from auth to profile * [#60] 🚚 rename profile types to myPage types * [#60] ✨ add check nickname interface in mypage types * [#60] ✨ add multipart formdata generic type * [#60] ✨ apply multipart formdata interface on file upload requiring types * [#60] 🚚 move svg types * [#60] 🚚 turn type files to uppercase
1 parent fd30d7f commit eef8602

File tree

14 files changed

+120
-47
lines changed

14 files changed

+120
-47
lines changed

src/app/(pages)/sign-in/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { SubmitHandler, useForm } from 'react-hook-form'
44

5-
import { SignInRequest } from '@/types/api/auth.types'
5+
import { SignInRequest } from '@/types/api/Auth.types'
66
import { useSignInMutation } from 'queries/useSignIn'
77

88
export default function LoginPage(): JSX.Element {

src/app/(pages)/sign-up/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// import { useRouter } from 'next/navigation'
44
import { SubmitHandler, useForm } from 'react-hook-form'
55

6-
import { SignUpRequest } from '@/types/api/auth.types'
6+
import { SignUpRequest } from '@/types/api/Auth.types'
77
import { useSignUpMutation } from 'queries/useSignUp'
88

99
export default function SignUpPage(): JSX.Element {

src/app/api/auth/sign-in/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NextResponse } from 'next/server'
22

3-
import { SignInRequest, SignInResponse } from '@/types/api/auth.types'
3+
import { SignInRequest, SignInResponse } from '@/types/api/Auth.types'
44
import { HTTPError } from 'ky'
55

66
import { backendApi } from '@/services/api'

src/services/auth/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SignInRequest, SignUpRequest } from '@/types/api/auth.types'
1+
import { SignInRequest, SignUpRequest } from '@/types/api/Auth.types'
22

33
import { backendApi, proxyApi } from '@/services/api'
44

Lines changed: 68 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,23 @@ export interface paths {
5757
patch?: never
5858
trace?: never
5959
}
60+
'/v1/my-page/check-nickname': {
61+
parameters: {
62+
query?: never
63+
header?: never
64+
path?: never
65+
cookie?: never
66+
}
67+
get?: never
68+
put?: never
69+
/** 닉네임 중복 체크 */
70+
post: operations['checkNicknameDuplicate']
71+
delete?: never
72+
options?: never
73+
head?: never
74+
patch?: never
75+
trace?: never
76+
}
6077
'/v1/likes': {
6178
parameters: {
6279
query?: never
@@ -797,12 +814,6 @@ export interface components {
797814
* "태그4"
798815
* ] */
799816
tags: string[]
800-
/**
801-
* @description 포트폴리오 이미지 url
802-
* @default default_image_url
803-
* @example 이미지url
804-
*/
805-
portImageUrl: string
806817
/** @description 포트폴리오 링크 리스트 */
807818
links?: components['schemas']['LinkRequest'][]
808819
/** @description 포트폴리오 학력 리스트 */
@@ -1062,6 +1073,19 @@ export interface components {
10621073
/** @description 경력 리스트 */
10631074
careers?: components['schemas']['CareerResponse'][]
10641075
}
1076+
checkNicknameRequest: {
1077+
/**
1078+
* @description 회원 닉네임
1079+
* @example new_nickname
1080+
*/
1081+
nickname: string
1082+
}
1083+
ApiResponseBoolean: {
1084+
isSuccess?: boolean
1085+
code?: string
1086+
message?: string
1087+
result?: boolean
1088+
}
10651089
LikeRequest: {
10661090
/**
10671091
* Format: int64
@@ -1293,12 +1317,6 @@ export interface components {
12931317
*/
12941318
email: string
12951319
}
1296-
ApiResponseBoolean: {
1297-
isSuccess?: boolean
1298-
code?: string
1299-
message?: string
1300-
result?: boolean
1301-
}
13021320
ApiResponseString: {
13031321
isSuccess?: boolean
13041322
code?: string
@@ -1317,11 +1335,6 @@ export interface components {
13171335
* @example 뽀꼬
13181336
*/
13191337
nickname?: string
1320-
/**
1321-
* @description 프로필 사진 url
1322-
* @example aaa.com
1323-
*/
1324-
imageUrl?: string
13251338
/**
13261339
* @description 소개문구
13271340
* @example 간단한 소개글을 작성해보세요!
@@ -2131,6 +2144,34 @@ export interface operations {
21312144
}
21322145
}
21332146
createPortfolio: {
2147+
parameters: {
2148+
query?: never
2149+
header?: never
2150+
path?: never
2151+
cookie?: never
2152+
}
2153+
requestBody?: {
2154+
content: {
2155+
'multipart/form-data': {
2156+
request: components['schemas']['PortfolioCreateRequest']
2157+
/** Format: binary */
2158+
portImage?: string
2159+
}
2160+
}
2161+
}
2162+
responses: {
2163+
/** @description OK */
2164+
200: {
2165+
headers: {
2166+
[name: string]: unknown
2167+
}
2168+
content: {
2169+
'application/json': components['schemas']['ApiResponsePortCreateResponse']
2170+
}
2171+
}
2172+
}
2173+
}
2174+
checkNicknameDuplicate: {
21342175
parameters: {
21352176
query?: never
21362177
header?: never
@@ -2139,7 +2180,7 @@ export interface operations {
21392180
}
21402181
requestBody: {
21412182
content: {
2142-
'application/json': components['schemas']['PortfolioCreateRequest']
2183+
'application/json': components['schemas']['checkNicknameRequest']
21432184
}
21442185
}
21452186
responses: {
@@ -2149,7 +2190,7 @@ export interface operations {
21492190
[name: string]: unknown
21502191
}
21512192
content: {
2152-
'*/*': components['schemas']['ApiResponsePortCreateResponse']
2193+
'*/*': components['schemas']['ApiResponseBoolean']
21532194
}
21542195
}
21552196
}
@@ -2457,9 +2498,13 @@ export interface operations {
24572498
path?: never
24582499
cookie?: never
24592500
}
2460-
requestBody: {
2501+
requestBody?: {
24612502
content: {
2462-
'application/json': components['schemas']['ProfileUpdateRequest']
2503+
'multipart/form-data': {
2504+
request: components['schemas']['ProfileUpdateRequest']
2505+
/** Format: binary */
2506+
profileImage?: string
2507+
}
24632508
}
24642509
}
24652510
responses: {
@@ -2469,7 +2514,7 @@ export interface operations {
24692514
[name: string]: unknown
24702515
}
24712516
content: {
2472-
'*/*': components['schemas']['ApiResponseProfileUpdateResponse']
2517+
'application/json': components['schemas']['ApiResponseProfileUpdateResponse']
24732518
}
24742519
}
24752520
}
@@ -2483,7 +2528,7 @@ export interface operations {
24832528
}
24842529
requestBody: {
24852530
content: {
2486-
'application/json': components['schemas']['PasswordUpdateRequest']
2531+
'multipart/form-data': components['schemas']['PasswordUpdateRequest']
24872532
}
24882533
}
24892534
responses: {
Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,3 @@ export interface CheckEmailRequest {
5252
email: Email // 검사하고자 하는 이메일
5353
}
5454
export type CheckEmailResponse = boolean
55-
56-
/*
57-
path: '/v1/my-page/password'
58-
PATCH: 마이 페이지 비밀번호 수정
59-
*/
60-
export interface PasswordUpdateRequest {
61-
password: Password // 새 비밀번호
62-
}
63-
64-
/*
65-
PasswordUpdateResponse
66-
{
67-
"isSuccess": true,
68-
"code": "COMMON200",
69-
"message": "비밀번호 수정이 완료되었습니다."
70-
}
71-
*/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,9 @@ interface User {
3131

3232
// MemberInfo: 일부 사용자 정보를 제외한 타입
3333
type MemberInfo = Omit<User, 'email' | 'name'>
34+
35+
interface MultipartFormData<T> {
36+
request: T
37+
/** Format: binary */
38+
file?: File
39+
}
Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,44 @@ export interface GetProfileResponse extends ProfileBase, User {
2323
/*
2424
PATCH: 마이페이지 프로필 저장
2525
*/
26-
export type ProfileUpdateRequest = ProfileBase
26+
export type ProfileUpdateRequest = MultipartFormData<ProfileBase>
2727

2828
export interface ProfileUpdateResponse extends ProfileBase {
2929
completionRate?: number // 포트폴리오 완성률 (%)
3030
}
31+
32+
/*
33+
path: '/v1/my-page/check-nickname'
34+
POST: 닉네임 중복 체크
35+
*/
36+
export interface CheckNicknameRequest {
37+
nickname: Nickname // 닉네임 중복 검사 대상
38+
}
39+
40+
export type CheckNicknameResponse = boolean
41+
42+
/*
43+
PasswordUpdateResponse
44+
{
45+
"isSuccess": true,
46+
"code": "COMMON200",
47+
"message": "비밀번호 수정이 완료되었습니다."
48+
}
49+
*/
50+
51+
/*
52+
path: '/v1/my-page/password'
53+
PATCH: 마이 페이지 비밀번호 수정
54+
*/
55+
export interface PasswordUpdateRequest {
56+
password: Password // 새 비밀번호
57+
}
58+
59+
/*
60+
PasswordUpdateResponse
61+
{
62+
"isSuccess": true,
63+
"code": "COMMON200",
64+
"message": "비밀번호 수정이 완료되었습니다."
65+
}
66+
*/

0 commit comments

Comments
 (0)