-
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.
[FEAT] #2 - 취업교육리스트목록 조회 API 구현 및 DB설정 수정
- Loading branch information
1 parent
a39951a
commit 5dc3996
Showing
7 changed files
with
58 additions
and
26 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
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,14 @@ | ||
const jobEduProvider = require("./jobEduProvider"); | ||
const baseResponse = require("../../../config/baseResponseStatus"); | ||
const {response, errResponse} = require("../../../config/response"); | ||
|
||
export const getJobEduList = async (req, res) => { | ||
try { | ||
const jobEduListResult = await jobEduProvider.retrieveJobEduList(); | ||
|
||
return res.send(response(baseResponse.SUCCESS, jobEduListResult)); | ||
} catch (error) { | ||
console.error(error); | ||
return res.send(errResponse(baseResponse.DB_ERROR)); | ||
} | ||
}; |
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,16 @@ | ||
const { logger } = require("../../../config/winston"); | ||
import pool from "../../../config/database"; | ||
|
||
export const selectJobEduList = async function () { | ||
const query = ` | ||
select * from job_educations limit 3; | ||
`; | ||
|
||
try { | ||
const result = await pool.query(query); | ||
return result; | ||
} catch (error) { | ||
logger.error("쿼리 실패"); | ||
throw error; | ||
} | ||
}; |
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,15 @@ | ||
import pool from "../../../config/database"; | ||
const jobEduDao = require("./jobEduDao"); | ||
|
||
const { logger } = require("../../../config/winston"); | ||
|
||
export const retrieveJobEduList = async function () { | ||
try { | ||
const result = await jobEduDao.selectJobEduList(); | ||
return result; | ||
} catch (error) { | ||
logger.error("DB 연결 실패"); | ||
throw error; | ||
} | ||
}; | ||
|
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,7 @@ | ||
module.exports = function(app){ | ||
const jobEdu = require('./jobEduController'); | ||
|
||
// 1. 취업교육 목록 API | ||
app.get('/app/jobEdu', jobEdu.getJobEduList); | ||
|
||
}; |