Spaces:
Runtime error
Runtime error
| import { Controller, Get, Put, Body, UseGuards } from '@nestjs/common'; | |
| import { ApiTags, ApiBearerAuth, ApiOperation } from '@nestjs/swagger'; | |
| import { ProfileService } from './profile.service'; | |
| import { UpdateProfileDto } from './dto/update-profile.dto'; | |
| import { GetUser } from 'src/shared/decorators/get-user.decorator'; | |
| import { LogToDiscord } from 'src/shared/decorators/log-to-discord.decorator'; | |
| import type { UserSessionType } from 'src/shared/types/user-session.type'; | |
| import { UserAuthGuard } from '../auth/guards/user-auth.guard'; | |
| ('User: Profile') | |
| ('user/profile') | |
| (UserAuthGuard) | |
| () | |
| () | |
| export class ProfileController { | |
| constructor(private readonly profileService: ProfileService) {} | |
| () | |
| ({ summary: 'Get user profile' }) | |
| async getProfile(() sessionData: UserSessionType) { | |
| const user = await this.profileService.getProfile(sessionData.user.id); | |
| return { user }; | |
| } | |
| () | |
| ({ | |
| summary: 'Update user profile (cannot change email or phone)', | |
| }) | |
| async updateProfile( | |
| () sessionData: UserSessionType, | |
| () updateDto: UpdateProfileDto, | |
| ) { | |
| const user = await this.profileService.updateProfile( | |
| sessionData.user.id, | |
| updateDto, | |
| ); | |
| return { | |
| message: 'Profile updated successfully', | |
| user, | |
| }; | |
| } | |
| ('interests') | |
| ({ summary: 'Get user interests (genres)' }) | |
| async getUserInterests(() sessionData: UserSessionType) { | |
| const interests = await this.profileService.getUserInterests( | |
| sessionData.user.id, | |
| ); | |
| return { interests }; | |
| } | |
| } | |