Skip to content

Commit

Permalink
simplification of timesheet api
Browse files Browse the repository at this point in the history
  • Loading branch information
markdturner committed Aug 26, 2024
1 parent ccbd5d4 commit aff653f
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 700 deletions.
37 changes: 1 addition & 36 deletions src/api/timesheet/controllers/timesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,47 +15,12 @@ module.exports = {
console.error(err)
}
},
findOne: async (ctx, next) => {
try {
ctx.body = await service.findOne(ctx.params.id, ctx.request.query)
} catch (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)
} catch (err) {
ctx.body = err
console.error(err)
}
},
allocated: async (ctx, next) => {
try {
let period = ctx.request.headers['period']
ctx.body = await service.findAllocatedTime(period)
} catch (err) {
ctx.body = err
console.error(err)
}
},
leave: async (ctx, next) => {
try {
ctx.body = await service.findLeave(ctx.request.query)
} catch (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)
} catch (err) {
ctx.body = err
console.error(err)
}
},
}
}
37 changes: 0 additions & 37 deletions src/api/timesheet/routes/timesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,6 @@ module.exports = {
policies: [],
middlewares: [],
},
},
{
method: "GET",
path: "/timesheets/allocated",
handler: "timesheet.allocated",
config: {
policies: [],
middlewares: [],
},
},
{
method: "GET",
path: "/timesheets/:id",
handler: "timesheet.findOne",
config: {
policies: [],
middlewares: [],
},
},
{
method: "GET",
path: "/timesheets/project/:id",
handler: "timesheet.project",
config: {
policies: [],
middlewares: [],
},
},

{
method: "GET",
path: "/timesheets/user/:id",
handler: "timesheet.user",
config: {
policies: [],
middlewares: [],
},
}
],
};
Loading

0 comments on commit aff653f

Please sign in to comment.