30 lines
851 B
TypeScript
30 lines
851 B
TypeScript
import { Body, Controller, Inject, Patch, UseGuards } from "@nestjs/common";
|
|
import { AuthGuard } from "../auth/auth.guard.js";
|
|
import { CurrentUser } from "../auth/current-user.decorator.js";
|
|
import type { AccessClaims } from "../auth/token.service.js";
|
|
import { UpdateAnonymousProfileDto } from "./dto.js";
|
|
import { ProfileService } from "./profile.service.js";
|
|
|
|
@Controller("me/anonymous-profile")
|
|
@UseGuards(AuthGuard)
|
|
export class ProfileController {
|
|
constructor(
|
|
@Inject(ProfileService) private readonly profiles: ProfileService,
|
|
) {}
|
|
|
|
@Patch()
|
|
update(
|
|
@CurrentUser() user: AccessClaims,
|
|
@Body() input: UpdateAnonymousProfileDto,
|
|
) {
|
|
return this.profiles.update(user.sub, input);
|
|
}
|
|
}
|
|
|
|
Reflect.defineMetadata(
|
|
"design:paramtypes",
|
|
[Object, UpdateAnonymousProfileDto],
|
|
ProfileController.prototype,
|
|
"update",
|
|
);
|