@@ -33,33 +33,20 @@ async function findById(req, res) {
3333}
3434
3535/**
36- * @async
37- * @function createHacker
38- * @param {{body: {hackerDetails: {_id: ObjectId, accountId: ObjectId, school: string, gender: string, needsBus: boolean, application: {Object}}}} } req
36+ * @function createdHacker
37+ * @param {{body: {hacker: {_id: ObjectId, accountId: ObjectId, school: string, gender: string, needsBus: boolean, application: {Object}}}} } req
3938 * @param {* } res
40- * @return {JSON } Success or error status
41- * @description create a hacker from information in req.body.hackerDetails
39+ * @return {JSON } Success status
40+ * @description returns success message
4241 */
43- async function createHacker ( req , res ) {
44- const hackerDetails = req . body . hackerDetails ;
45- const success = await Services . Hacker . createHacker ( hackerDetails ) ;
46- hackerDetails . id = hackerDetails . _id ;
47- delete hackerDetails . _id ;
48- if ( success ) {
49- return res . status ( 200 ) . json ( {
50- message : "Hacker creation successful" ,
51- data : hackerDetails
52- } ) ;
53- } else {
54- return res . status ( 500 ) . json ( {
55- message : Constants . Error . HACKER_CREATE_500_MESSAGE ,
56- data : { }
57- } ) ;
58- }
42+ async function createdHacker ( req , res ) {
43+ return res . status ( 200 ) . json ( {
44+ message : "Hacker creation successful" ,
45+ data : req . body . hacker . toJSON ( )
46+ } ) ;
5947}
6048
6149/**
62- * @async
6350 * @function updateHacker
6451 * @param {{params: {id: ObjectId}, body: {Object}} } req
6552 * @param {* } res
@@ -70,7 +57,7 @@ async function createHacker(req, res) {
7057 * Returns a 200 status for an updated hacker.
7158 * The new information is located in req.body.
7259 */
73- async function updatedHacker ( req , res ) {
60+ function updatedHacker ( req , res ) {
7461 return res . status ( 200 ) . json ( {
7562 message : "Changed hacker information" ,
7663 data : req . body
@@ -99,7 +86,7 @@ function downloadedResume(req, res) {
9986module . exports = {
10087 updatedHacker : updatedHacker ,
10188 findById : Util . asyncMiddleware ( findById ) ,
102- createHacker : Util . asyncMiddleware ( createHacker ) ,
89+ createdHacker : createdHacker ,
10390 uploadedResume : uploadedResume ,
10491 downloadedResume : downloadedResume
10592} ;
0 commit comments