-
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.
add support for year query parameter to timesheets and leave
- Loading branch information
1 parent
6c607c8
commit c09bffe
Showing
2 changed files
with
108 additions
and
40 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,61 +1,61 @@ | ||
"use strict"; | ||
'use strict' | ||
|
||
/** | ||
* A set of functions called "actions" for `timesheet` | ||
* A set of functions called 'actions' for `timesheet` | ||
*/ | ||
|
||
const service = require("../services/timesheet"); | ||
const service = require('../services/timesheet') | ||
|
||
module.exports = { | ||
find: async (ctx, next) => { | ||
try { | ||
ctx.body = await service.find(); | ||
ctx.body = await service.find(ctx.request.query) | ||
} catch (err) { | ||
ctx.body = err; | ||
console.error(err); | ||
ctx.body = err | ||
console.error(err) | ||
} | ||
}, | ||
findOne: async (ctx, next) => { | ||
try { | ||
ctx.body = await service.findOne(ctx.params.id); | ||
ctx.body = await service.findOne(ctx.params.id, ctx.request.query) | ||
} catch (err) { | ||
ctx.body = err; | ||
console.error(err); | ||
ctx.body = err | ||
console.error(err) | ||
} | ||
}, | ||
project: async (ctx, next) => { | ||
try { | ||
let period = ctx.request.headers["period"]; | ||
ctx.body = await service.findProject(ctx.params.id, period); | ||
let period = ctx.request.headers['period'] | ||
ctx.body = await service.findProject(ctx.params.id, period) | ||
} catch (err) { | ||
ctx.body = err; | ||
console.error(err); | ||
ctx.body = err | ||
console.error(err) | ||
} | ||
}, | ||
allocated: async (ctx, next) => { | ||
try { | ||
let period = ctx.request.headers["period"]; | ||
ctx.body = await service.findAllocatedTime(period); | ||
let period = ctx.request.headers['period'] | ||
ctx.body = await service.findAllocatedTime(period) | ||
} catch (err) { | ||
ctx.body = err; | ||
console.error(err); | ||
ctx.body = err | ||
console.error(err) | ||
} | ||
}, | ||
leave: async (ctx, next) => { | ||
try { | ||
ctx.body = await service.findLeave(); | ||
ctx.body = await service.findLeave(ctx.request.query) | ||
} catch (err) { | ||
ctx.body = err; | ||
console.error(err); | ||
ctx.body = err | ||
console.error(err) | ||
} | ||
}, | ||
user: async (ctx, next) => { | ||
try { | ||
let period = ctx.request.headers["period"]; | ||
ctx.body = await service.findUser(ctx.params.id, period); | ||
let period = ctx.request.headers['period'] | ||
ctx.body = await service.findUser(ctx.params.id, period) | ||
} catch (err) { | ||
ctx.body = err; | ||
console.error(err); | ||
ctx.body = err | ||
console.error(err) | ||
} | ||
}, | ||
}; | ||
} |
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