diff options
Diffstat (limited to 'app/Controllers/Http/Dashboard/DataController.ts')
-rw-r--r-- | app/Controllers/Http/Dashboard/DataController.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/Controllers/Http/Dashboard/DataController.ts b/app/Controllers/Http/Dashboard/DataController.ts new file mode 100644 index 0000000..f77702f --- /dev/null +++ b/app/Controllers/Http/Dashboard/DataController.ts | |||
@@ -0,0 +1,24 @@ | |||
1 | import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'; | ||
2 | |||
3 | export default class DataController { | ||
4 | /** | ||
5 | * Display the data page | ||
6 | */ | ||
7 | public async show({ view, auth }: HttpContextContract) { | ||
8 | const { user } = auth; | ||
9 | |||
10 | const services = await user?.related('services').query(); | ||
11 | const workspaces = await user?.related('workspaces').query(); | ||
12 | |||
13 | return view.render('dashboard/data', { | ||
14 | username: user?.username, | ||
15 | lastname: user?.lastname, | ||
16 | mail: user?.email, | ||
17 | created: user?.created_at.toFormat('yyyy-MM-dd HH:mm:ss'), | ||
18 | updated: user?.updated_at.toFormat('yyyy-MM-dd HH:mm:ss'), | ||
19 | stringify: JSON.stringify, | ||
20 | services, | ||
21 | workspaces, | ||
22 | }); | ||
23 | } | ||
24 | } | ||