Skip to content

Commit

Permalink
Merge pull request #1 from Usenmfon/feat/BAC-27
Browse files Browse the repository at this point in the history
Feat/bac 27
  • Loading branch information
Usenmfon authored Nov 25, 2022
2 parents 7860cb8 + 22b9379 commit 1fe5657
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 166 deletions.
4 changes: 0 additions & 4 deletions backend/.husky/pre-commit

This file was deleted.

4 changes: 0 additions & 4 deletions backend/.husky/pre-push

This file was deleted.

4 changes: 1 addition & 3 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
"migration:generate": "sequelize-cli migration:create --name",
"migration:create": "knex migrate:make",
"migration:run": "knex migrate:latest --knexfile knexfile.js",
"test": "cross-env APP_ENV=test NODE_ENV=test mocha",
"prepare": "cd .. && husky install backend/.husky",
"lint": "eslint --fix"
"test": "cross-env APP_ENV=test NODE_ENV=test mocha"
},
"keywords": [],
"author": "",
Expand Down
20 changes: 20 additions & 0 deletions backend/src/controllers/TaskController.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,24 @@ export default class TaskController {
next(error);
}
}

static async getUserTask(req, res, next) {
try{
const result = await taskService.getUserTask(req.params);

res.send(result?.data);
} catch (error) {
next(error);
}
}

static async deleteTaskCategory(req, res, next) {
try{
const result = await taskService.deleteTaskCategory(req.body);

res.send(result?.data);
} catch (error) {
next(error);
}
}
}
10 changes: 8 additions & 2 deletions backend/src/database/repositories/HttpRepo.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export default class HttpRepo {

pluginId = '637d8ecf82bf004233def988';

organizationId = '';
organizationId = '61db3b27eba8adb50ca1399b';

collectionName = '';
collectionName = 'task';

readUrl = `${this.url}/data/read/${this.pluginId}/${this.collectionName}/${this.organizationId}`;

Expand Down Expand Up @@ -65,6 +65,12 @@ export default class HttpRepo {
return axios.get(url, config);
}

async getUserTask(params) {
this.request.payload = params;

return await this.getReq(this.readUrl, this.request);
}

async deleteReq(url, data) {
return axios.delete(url, data);
}
Expand Down
1 change: 1 addition & 0 deletions backend/src/routes/taskRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ import TaskController from '../controllers/TaskController.js';
const router = express.Router();

router.post('/', TaskController.create);
router.post('/:id', TaskController.getUserTask);

export default router;
12 changes: 12 additions & 0 deletions backend/src/services/task/Task.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ class TaskService extends HttpRepo {

return create;
}

async getUserTask(params) {
const getUserTask = await this.repo.getUserTask({object_id: params.id});

return getUserTask;
}

async deleteTaskCategory(params) {
const deleteTask = await this.repo.delete(params);

return deleteTask;
}
}

export default new TaskService();
153 changes: 0 additions & 153 deletions backend/test/integration/Server.test.js

This file was deleted.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"devDependencies": {
"stoppable": "^1.1.0"
}
}

0 comments on commit 1fe5657

Please sign in to comment.