Spaces:
Sleeping
Sleeping
File size: 976 Bytes
f0953a4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import { Request, Response } from "express";
import { injectable, inject } from "inversify";
import { TYPES } from "../core/types";
import { SettingService } from "../services/SettingService";
import { BaseController } from "./BaseController";
@injectable()
export class SettingController extends BaseController {
constructor(@inject(TYPES.SettingService) private settingService: SettingService) {
super();
}
async get(req: Request, res: Response): Promise<void> {
await this.handleRequest(req, res, async () => {
const userId = req.user?.userId;
const role = Number(req.user?.role);
return await this.settingService.getSettings(userId, role);
});
}
async save(req: Request, res: Response): Promise<void> {
await this.handleRequest(req, res, async () => {
const userId = req.user?.userId;
const role = Number(req.user?.role);
return await this.settingService.saveSettings(userId, role, req.body);
});
}
}
|