2024-08-01 23:46:29 +00:00
|
|
|
import 'reflect-metadata';
|
2024-07-29 01:39:42 +00:00
|
|
|
import { Hono } from 'hono';
|
2024-08-01 23:46:29 +00:00
|
|
|
import { injectable } from 'tsyringe';
|
2024-07-29 01:39:42 +00:00
|
|
|
import { requireAuth } from "../middleware/auth.middleware";
|
2024-08-01 16:26:42 +00:00
|
|
|
import type { HonoTypes } from '../types';
|
|
|
|
|
import type { Controller } from '../interfaces/controller.interface';
|
2024-07-29 01:39:42 +00:00
|
|
|
|
2024-08-01 16:26:42 +00:00
|
|
|
@injectable()
|
|
|
|
|
export class UserController implements Controller {
|
|
|
|
|
controller = new Hono<HonoTypes>();
|
2024-07-29 01:39:42 +00:00
|
|
|
|
2024-08-01 16:26:42 +00:00
|
|
|
constructor(
|
|
|
|
|
) { }
|
|
|
|
|
|
|
|
|
|
routes() {
|
|
|
|
|
return this.controller
|
|
|
|
|
.get('/me', requireAuth, async (c) => {
|
|
|
|
|
const user = c.var.user;
|
|
|
|
|
return c.json({ user });
|
|
|
|
|
})
|
|
|
|
|
.get('/user', requireAuth, async (c) => {
|
|
|
|
|
const user = c.var.user;
|
|
|
|
|
return c.json({ user });
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|