|
@@ -1,11 +1,12 @@
|
|
|
-import { Controller, Get, Post, Body, Patch, Param, Delete, UseGuards, ValidationPipe, Put, Query } from '@nestjs/common';
|
|
|
+import { Controller, Get, Post, Body, Patch, Param, Delete, UseGuards, ValidationPipe, Put, Query, UseInterceptors, UploadedFile } from '@nestjs/common';
|
|
|
import { UserService } from './user.service';
|
|
|
import { JwtAuthGuard } from '../../modules/immich-jwt/guards/jwt-auth.guard';
|
|
|
import { AuthUserDto, GetAuthUser } from '../../decorators/auth-user.decorator';
|
|
|
import { CreateUserDto } from './dto/create-user.dto';
|
|
|
import { AdminRolesGuard } from '../../middlewares/admin-role-guard.middleware';
|
|
|
import { UpdateUserDto } from './dto/update-user.dto';
|
|
|
-import { boolean } from 'joi';
|
|
|
+import { FileInterceptor } from '@nestjs/platform-express';
|
|
|
+import { profileImageUploadOption } from '../../config/profile-image-upload.config';
|
|
|
|
|
|
@Controller('user')
|
|
|
export class UserController {
|
|
@@ -35,4 +36,16 @@ export class UserController {
|
|
|
async updateUser(@Body(ValidationPipe) updateUserDto: UpdateUserDto) {
|
|
|
return await this.userService.updateUser(updateUserDto)
|
|
|
}
|
|
|
+
|
|
|
+ @UseGuards(JwtAuthGuard)
|
|
|
+ @UseInterceptors(FileInterceptor('file', profileImageUploadOption))
|
|
|
+ @Post('/profile-image')
|
|
|
+ async createProfileImage(@GetAuthUser() authUser: AuthUserDto, @UploadedFile() fileInfo: Express.Multer.File) {
|
|
|
+ return await this.userService.createProfileImage(authUser, fileInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Get('/profile-image/:userId')
|
|
|
+ async getProfileImage(@Param('assetId') assetId: string) {
|
|
|
+
|
|
|
+ }
|
|
|
}
|