feat(simulations): GET /simulations/:id — lecture rapport avec auth + REPORT_NOT_READY
This commit is contained in:
parent
6ca2412304
commit
0680a6382f
3 changed files with 215 additions and 0 deletions
|
|
@ -78,4 +78,18 @@ simulations.post('/', authMiddleware, async (c) => {
|
|||
return c.json(result.data, 201)
|
||||
})
|
||||
|
||||
simulations.get('/:id', authMiddleware, async (c) => {
|
||||
// `:id` est garanti présent par le pattern de route Hono
|
||||
const id = c.req.param('id')!
|
||||
const profile = c.get('profile')
|
||||
|
||||
const result = await simulationController.getById(id, profile)
|
||||
|
||||
if ('error' in result) {
|
||||
return c.json(result, result.status as 401 | 404 | 500)
|
||||
}
|
||||
|
||||
return c.json(result.data, 200)
|
||||
})
|
||||
|
||||
export default simulations
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue