File tree Expand file tree Collapse file tree 2 files changed +20
-22
lines changed
Expand file tree Collapse file tree 2 files changed +20
-22
lines changed Original file line number Diff line number Diff line change @@ -8,26 +8,6 @@ import { isCustomer } from "../middlewares/authMiddleware";
88
99const router = express . Router ( ) ;
1010
11- //견적서 상세 조회
12- router . get (
13- "/:id" ,
14- passport . authenticate ( "jwt" , { session : false } ) ,
15- isCustomer ,
16- asyncHandle ( async ( req , res , next ) => {
17- try {
18- const { customerId } = req . user as { customerId : number } ;
19- const { id : quoteId } = req . params ;
20- const quote = await quoteService . getQuoteById (
21- customerId ,
22- parseInt ( quoteId )
23- ) ;
24- return res . status ( 200 ) . send ( quote ) ;
25- } catch ( error ) {
26- next ( error ) ;
27- }
28- } )
29- ) ;
30-
3111// 견적서 생성하기
3212router . post (
3313 "/" ,
@@ -186,4 +166,24 @@ router.get(
186166 } )
187167) ;
188168
169+ //견적서 상세 조회
170+ router . get (
171+ "/:id" ,
172+ passport . authenticate ( "jwt" , { session : false } ) ,
173+ isCustomer ,
174+ asyncHandle ( async ( req , res , next ) => {
175+ try {
176+ const { customerId } = req . user as { customerId : number } ;
177+ const { id : quoteId } = req . params ;
178+ const quote = await quoteService . getQuoteById (
179+ customerId ,
180+ parseInt ( quoteId )
181+ ) ;
182+ return res . status ( 200 ) . send ( quote ) ;
183+ } catch ( error ) {
184+ next ( error ) ;
185+ }
186+ } )
187+ ) ;
188+
189189export default router ; // 설정한 라우터를 내보내서 다른 파일에서 사용할 수 있게 해요.
Original file line number Diff line number Diff line change @@ -67,7 +67,6 @@ export const isCustomer = async (
6767 moverId ?: number ;
6868 } ;
6969 const findUser = await userRepository . findById ( user . id ) ;
70-
7170 if ( ! findUser ) {
7271 const error : CustomError = new Error ( "Unauthorized" ) ;
7372 error . status = 403 ;
@@ -110,7 +109,6 @@ export const isMover = async (
110109 } ;
111110 return next ( error ) ;
112111 }
113-
114112 if ( ! user ?. moverId ) {
115113 const error : CustomError = new Error ( "Unauthorized" ) ;
116114 error . status = 403 ;
You can’t perform that action at this time.
0 commit comments