-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[feat] 면접 질문 스크랩 API
- Loading branch information
Showing
7 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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,3 +1,4 @@ | ||
export { default as interviewController } from './interviewController'; | ||
export { default as userController } from './userController'; | ||
export { default as historyController } from './historyController'; | ||
export { default as historyController } from './historyController'; | ||
export { default as questionController } from './questionController'; |
This file contains 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,22 @@ | ||
import { Request, Response, NextFunction } from 'express'; | ||
import { message, statusCode } from '../module/constant'; | ||
import { success } from '../module/constant/utils'; | ||
import { questionService } from '../service'; | ||
|
||
const addPin = async (req: Request, res: Response, next: NextFunction) => { | ||
const {interveiwQuestionId} = req.params; | ||
|
||
try { | ||
const data = await questionService.addPin(+interveiwQuestionId); | ||
|
||
return res | ||
.status(statusCode.CREATED) | ||
.send(success(statusCode.CREATED, message.ADD_PIN_SUCCESS, data)); | ||
} catch (error) { | ||
next(error); | ||
} | ||
}; | ||
|
||
export default { | ||
addPin, | ||
}; |
This file contains 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 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 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,17 @@ | ||
import { Router } from 'express'; | ||
import { body, header, param } from 'express-validator'; | ||
import { questionController } from '../controller'; | ||
import errorValidator from '../middleware/error/errorValidator'; | ||
|
||
const router: Router = Router(); | ||
|
||
router.patch( | ||
'/:interviewQuestionId', | ||
[ | ||
param('interveiwQuestionId').notEmpty(), | ||
], | ||
errorValidator, | ||
questionController.addPin, | ||
); | ||
|
||
export default router; |
This file contains 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,3 +1,4 @@ | ||
export { default as interviewService } from './interviewService'; | ||
export { default as userService } from './userService'; | ||
export { default as historyService } from './historyService'; | ||
export { default as historyService } from './historyService'; | ||
export { default as questionService } from './questionService'; |
This file contains 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 @@ | ||
import { PrismaClient } from '@prisma/client'; | ||
import errorGenerator from '../middleware/error/errorGenerator'; | ||
import { message, statusCode } from '../module/constant'; | ||
const prisma = new PrismaClient(); | ||
|
||
const addPin = async (interveiwQuestionId: number) => { | ||
try { | ||
const pin = await prisma.interviewQuestion.update({ | ||
where: { | ||
id: interveiwQuestionId | ||
}, | ||
data: { | ||
pin: true, | ||
} | ||
}); | ||
return pin | ||
} catch(error) { | ||
throw error; | ||
} | ||
}; | ||
|
||
export default { | ||
addPin, | ||
}; |