targo-backend/src/identity-and-account/preferences/controllers/preferences.controller.ts

22 lines
886 B
TypeScript

import { Body, Controller, Get, Patch, Query, Req } from "@nestjs/common";
import { PreferencesService } from "../services/preferences.service";
import { PreferencesDto } from "../dtos/preferences.dto";
import { Result } from "src/common/errors/result-error.factory";
import { Access } from "src/common/decorators/module-access.decorators";
@Controller('preferences')
export class PreferencesController {
constructor(private readonly service: PreferencesService) { }
@Patch('update')
async updatePreferences(@Access('email') email: string, @Body() payload: PreferencesDto
): Promise<Result<PreferencesDto, string>> {
return this.service.updatePreferences(email, payload);
}
@Get()
async findPreferences(@Access('email') email: string, @Query() employee_email?: string) {
return this.service.findPreferences(email, employee_email);
}
}