Spaces:
Sleeping
Sleeping
Download backend/src/controllers/setting.ts from jacqueshuang/ng: direct link, hf CLI and curl.
- Browser
- Download file 976 Bytes
-
https://huggingface.co/spaces/jacqueshuang/ng/resolve/main/backend/src/controllers/setting.ts
- Command line
-
hf download hf://spaces/jacqueshuang/ng/backend/src/controllers/setting.ts
-
curl -L -o setting.ts https://huggingface.co/spaces/jacqueshuang/ng/resolve/main/backend/src/controllers/setting.ts
976 Bytes
| import { Request, Response } from "express"; | |
| import { injectable, inject } from "inversify"; | |
| import { TYPES } from "../core/types"; | |
| import { SettingService } from "../services/SettingService"; | |
| import { BaseController } from "./BaseController"; | |
| () | |
| export class SettingController extends BaseController { | |
| constructor((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); | |
| }); | |
| } | |
| } | |