generated from coralkashri/basicNodejsProjectHierarchy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plans Create/Modify/Archive/Delete - Client & Server [Not including t…
…asks selecting] Topics Create/Modify/Archive/Delete - Client & Server [Not including tasks reordering & Not including rounded dependency validation]
- Loading branch information
Korel Kashri
committed
Apr 4, 2020
1 parent
68935a2
commit e0a31eb
Showing
20 changed files
with
750 additions
and
200 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const hash = require('../helpers/hash').get_hash_code; | ||
const responses_gen = require('../helpers/responses'); | ||
const requests_handler = require('../helpers/requests_handler'); | ||
let tasks_model = require('../models/tasks'); | ||
const access_limitations = require('../helpers/configurations/access_limitations'); | ||
|
||
// API | ||
|
||
exports.get_tasks = async (req, res, next) => { | ||
try { | ||
let tasks = await tasks_model.get(req, res, next); | ||
return responses_gen.generate_response(res, 200, tasks, "Tasks successfully restored"); | ||
} catch (e) { | ||
return responses_gen.generate_response(res, 400, null, e.message); | ||
} | ||
}; | ||
|
||
exports.get_task = async (req, res, next) => { | ||
try { | ||
let task = await tasks_model.get(req, res, next); | ||
return responses_gen.generate_response(res, 200, task, "Task successfully restored"); | ||
} catch (e) { | ||
return responses_gen.generate_response(res, 400, null, e.message); | ||
} | ||
}; | ||
|
||
exports.create = async (req, res, next) => { | ||
try { | ||
let task = await tasks_model.create(req, res, next); | ||
return responses_gen.generate_response(res, 200, task, "Task successfully created"); | ||
} catch (e) { | ||
return responses_gen.generate_response(res, 400, null, e.message); | ||
} | ||
}; | ||
|
||
exports.modify = async (req, res, next) => { | ||
try { | ||
let task = await tasks_model.modify(req, res, next); | ||
return responses_gen.generate_response(res, 200, task, "Task successfully modified"); | ||
} catch (e) { | ||
return responses_gen.generate_response(res, 400, null, e.message); | ||
} | ||
}; | ||
|
||
exports.remove = async (req, res, next) => { | ||
try { | ||
let result = await tasks_model.remove(req, res, next); | ||
return responses_gen.generate_response(res, 200, null, "Task successfully removed"); | ||
} catch (e) { | ||
return responses_gen.generate_response(res, 400, null, e.message); | ||
} | ||
}; |
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
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
Oops, something went wrong.