1- import { Tags , Route , SuccessResponse , Response , Get , Path , Controller , Post , Body } from 'tsoa' ;
1+ import { Tags , Route , SuccessResponse , Response , Get , Path , Controller , Post , Body , Security , Request } from 'tsoa' ;
2+ import { Request as ExpressRequest } from 'express' ;
23import { AlbaApplyRequestDto , AlbaApplyResponseDto , AlbaDetailResponseDto } from '../DTO/alba_application_dto' ;
34import { getAlbaDetail , postAlbaApplication } from '../service/alba_application_service' ;
5+ import { uuidToBuffer } from '../util/uuid_util' ;
46
57@Route ( 'api/alba/application' )
68@Tags ( 'Alba Application' )
@@ -9,10 +11,11 @@ export class AlbaApplicationController extends Controller{
911 * 대타 아르바이트 정보 상세 조회 API
1012 * @params albaId
1113 */
14+ @Get ( '{albaId}' )
1215 @SuccessResponse ( '200' , '조회 성공' )
1316 @Response ( '404' , 'Not Found' )
1417 @Response ( '500' , 'Internal Server Error' )
15- @ Get ( '{albaId}' )
18+
1619
1720 public async fetchAlbaDetail (
1821 @Path ( ) albaId :string
@@ -27,15 +30,26 @@ export class AlbaApplicationController extends Controller{
2730 * @param requestBody (albaId,userId)
2831 * @returns 지원 정보와 정산 상태, 승인 여부(초기에는 전부 waiting으로 설정)
2932 */
33+ @Post ( '' )
34+ @Security ( 'jwt' )
3035 @SuccessResponse ( '201' , '생성 성공' )
36+ @Response ( '401' , 'Unauthorized' )
3137 @Response ( '404' , 'Not Found' )
3238 @Response ( '500' , 'Internal Server Error' )
33- @ Post ( '' )
39+
3440 public async applyAlba (
41+ @Request ( ) req :ExpressRequest ,
3542 @Body ( ) requestBody :AlbaApplyRequestDto
3643 ) :Promise < AlbaApplyResponseDto > {
44+ //UUID 문자열 Buffer로 변환
45+ const userId = ( req . user as unknown as { id : string } ) . id ;
46+ const userBuffer = Buffer . from ( uuidToBuffer ( userId ) )
47+
48+ const albaBuffer = Buffer . from ( uuidToBuffer ( requestBody . albaId ) )
49+
50+
3751 //대타 아르바이트 지원
38- const result = await postAlbaApplication ( requestBody )
52+ const result = await postAlbaApplication ( userBuffer , albaBuffer )
3953 this . setStatus ( 201 )
4054 return result
4155
0 commit comments