@@ -6,112 +6,130 @@ import { UserObject } from "../../object/user.object";
6
6
* 유저를 조회합니다.
7
7
*/
8
8
export const ListUser : Endpoint < ListUserReq , ListUserRes > = {
9
- method : "GET" ,
10
- path : ( e ) => `/users` ,
11
- queryParams : [ "page" , "take" ] ,
9
+ method : "GET" ,
10
+ path : ( e ) => `/users` ,
11
+ queryParams : [ "page" , "take" ] ,
12
12
} ;
13
13
export type ListUserReqQuery = {
14
- page ?: number ;
15
- take ?: number ;
14
+ page ?: number ;
15
+ take ?: number ;
16
16
} ;
17
- export type ListUserReq = ListUserReqQuery
17
+ export type ListUserReq = ListUserReqQuery ;
18
18
export type ListUserRes = {
19
- users : UserObject [ ] ;
20
- total : number ;
19
+ users : UserObject [ ] ;
20
+ total : number ;
21
21
} ;
22
22
23
23
/**
24
24
* GET /users/:userId
25
25
* 유저를 조회합니다.
26
26
*/
27
27
export const GetUser : Endpoint < GetUserReq , GetUserRes > = {
28
- method : "GET" ,
29
- path : ( e ) => `/users/${ e . userId } ` ,
30
- pathParams : [ "userId" ] ,
28
+ method : "GET" ,
29
+ path : ( e ) => `/users/${ e . userId } ` ,
30
+ pathParams : [ "userId" ] ,
31
31
} ;
32
32
export type GetUserReqPath = {
33
- userId : number | string ;
33
+ userId : number | string ;
34
34
} ;
35
35
export type GetUserReq = GetUserReqPath ;
36
36
export type GetUserRes = {
37
- user : UserObject ;
37
+ user : UserObject ;
38
+ } ;
39
+
40
+ /**
41
+ * POST /users
42
+ * 유저를 생성합니다.
43
+ */
44
+ export const CreateUser : Endpoint < CreateUserReq , CreateUserRes > = {
45
+ method : "POST" ,
46
+ path : ( e ) => `/users` ,
47
+ bodyParams : [ "name" , "email" , "profileImage" ] ,
48
+ } ;
49
+ export type CreateUserReq = {
50
+ name : string ;
51
+ email : string ;
52
+ profileImage ?: string ;
53
+ } ;
54
+ export type CreateUserRes = {
55
+ user : UserObject ;
38
56
} ;
39
57
40
58
/**
41
59
* GET /users/search
42
60
* 유저를 검색합니다.
43
61
*/
44
62
export const SearchUser : Endpoint < SearchUserReq , SearchUserRes > = {
45
- method : "GET" ,
46
- path : ( e ) => `/users/search` ,
47
- queryParams : [ "name" , "email" ] ,
63
+ method : "GET" ,
64
+ path : ( e ) => `/users/search` ,
65
+ queryParams : [ "name" , "email" ] ,
48
66
} ;
49
67
export type SearchUserReq = {
50
- name ?: string ;
51
- email ?: string ;
68
+ name ?: string ;
69
+ email ?: string ;
52
70
} ;
53
71
export type SearchUserRes = {
54
- users : UserObject [ ] ;
72
+ users : UserObject [ ] ;
55
73
} ;
56
74
57
75
/**
58
76
* PATCH /users/:userId
59
77
* 유저를 수정합니다.
60
78
*/
61
79
export const UpdateUser : Endpoint < UpdateUserReq , UpdateUserRes > = {
62
- method : "PATCH" ,
63
- path : ( e ) => `/users/${ e . userId } ` ,
64
- pathParams : [ "userId" ] ,
65
- bodyParams : [ "name" , "profileImage" ] ,
80
+ method : "PATCH" ,
81
+ path : ( e ) => `/users/${ e . userId } ` ,
82
+ pathParams : [ "userId" ] ,
83
+ bodyParams : [ "name" , "profileImage" ] ,
66
84
} ;
67
85
export type UpdateUserReqPath = {
68
- userId : number | string ;
86
+ userId : number | string ;
69
87
} ;
70
88
export type UpdateUserReq = UpdateUserReqPath & {
71
- name ?: string ;
72
- profileImage ?: string ;
89
+ name ?: string ;
90
+ profileImage ?: string ;
73
91
} ;
74
92
export type UpdateUserRes = {
75
- user : UserObject ;
93
+ user : UserObject ;
76
94
} ;
77
95
78
96
/**
79
97
* PATCH /users/:userId/profile-image
80
98
* 유저 프로필 이미지를 수정합니다.
81
99
*/
82
100
export const UpdateUserProfileImage : Endpoint <
83
- UpdateUserProfileImageReq ,
84
- UpdateUserProfileImageRes
85
- > = {
86
- method : "PATCH" ,
87
- path : ( e ) => `/users/${ e . userId } /profile-image` ,
88
- pathParams : [ "userId" ] ,
89
- bodyParams : [ "file" ] ,
90
- headers : {
91
- "Content-Type" : "multipart/form-data" ,
92
- }
101
+ UpdateUserProfileImageReq ,
102
+ UpdateUserProfileImageRes
103
+ > = {
104
+ method : "PATCH" ,
105
+ path : ( e ) => `/users/${ e . userId } /profile-image` ,
106
+ pathParams : [ "userId" ] ,
107
+ bodyParams : [ "file" ] ,
108
+ headers : {
109
+ "Content-Type" : "multipart/form-data" ,
110
+ } ,
93
111
} ;
94
112
export type UpdateUserProfileImageReqPath = {
95
- userId : number | string ;
113
+ userId : number | string ;
96
114
} ;
97
115
export type UpdateUserProfileImageReq = UpdateUserProfileImageReqPath & {
98
- file : any ;
116
+ file : any ;
99
117
} ;
100
118
export type UpdateUserProfileImageRes = {
101
- user : UserObject ;
119
+ user : UserObject ;
102
120
} ;
103
121
104
122
/**
105
123
* DELETE /users/:userId
106
124
* 유저를 삭제합니다.
107
125
*/
108
126
export const DeleteUser : Endpoint < DeleteUserReq , DeleteUserRes > = {
109
- method : "DELETE" ,
110
- path : ( e ) => `/users/${ e . userId } ` ,
111
- pathParams : [ "userId" ] ,
127
+ method : "DELETE" ,
128
+ path : ( e ) => `/users/${ e . userId } ` ,
129
+ pathParams : [ "userId" ] ,
112
130
} ;
113
131
export type DeleteUserReqPath = {
114
- userId : number | string ;
132
+ userId : number | string ;
115
133
} ;
116
134
export type DeleteUserReq = DeleteUserReqPath ;
117
135
export type DeleteUserRes = { } ;
0 commit comments