update dependencies, attempt to fix server restart issue

This commit is contained in:
Amruth Pillai
2023-04-20 22:33:11 +02:00
parent ed710f6fe5
commit 036b2917a6
12 changed files with 1588 additions and 1243 deletions

View File

@ -6,7 +6,6 @@ import { compareSync, hashSync } from 'bcryptjs';
import { OAuth2Client } from 'google-auth-library';
import { PostgresErrorCode } from '@/database/errorCodes.enum';
import { ResumeService } from '@/resume/resume.service';
import { CreateGoogleUserDto } from '@/users/dto/create-google-user.dto';
import { User } from '@/users/entities/user.entity';
import { UsersService } from '@/users/users.service';

View File

@ -1,4 +1,4 @@
import { IsNotEmpty, IsString, MinLength } from 'class-validator';
import { IsNotEmpty, IsString } from 'class-validator';
export class UpdateProfileDto {
@IsString()

View File

@ -1,5 +1,6 @@
import { HttpModule } from '@nestjs/axios';
import { CacheModule, Module } from '@nestjs/common';
import { CacheModule } from '@nestjs/cache-manager';
import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { FontsController } from './fonts.controller';

View File

@ -1,5 +1,5 @@
import { Controller, Get } from '@nestjs/common';
import { HealthCheck, HealthCheckService, HttpHealthIndicator, TypeOrmHealthIndicator } from '@nestjs/terminus';
import { HealthCheck, HealthCheckService, TypeOrmHealthIndicator } from '@nestjs/terminus';
@Controller('health')
export class HealthController {

View File

@ -1,4 +1,4 @@
import { Controller, Get, InternalServerErrorException, Param, Query } from '@nestjs/common';
import { Controller, Get, Param, Query } from '@nestjs/common';
import { PrinterService } from './printer.service';

View File

@ -252,10 +252,10 @@ export class ResumeService {
const publicUrl = urlPrefix + key;
await this.s3Client.send(
new PutObjectCommand({
Bucket: this.configService.get<string>('storage.bucket'),
Key: key,
Body: file.buffer,
ACL: 'public-read',
Bucket: this.configService.get<string>('storage.bucket'),
})
);
updatedResume = set(resume, 'basics.photo.url', publicUrl);
@ -283,14 +283,15 @@ export class ResumeService {
const resume = await this.findOne(id, userId);
const publicUrl = resume.basics.photo.url;
if (!publicUrl || publicUrl === '') return;
if (this.s3Enabled) {
const urlPrefix = this.configService.get<string>('storage.urlPrefix');
const key = publicUrl.replace(urlPrefix, '');
await this.s3Client.send(
new DeleteObjectCommand({
Bucket: this.configService.get<string>('storage.bucket'),
Key: key,
Bucket: this.configService.get<string>('storage.bucket'),
})
);
} else {
@ -299,9 +300,7 @@ export class ResumeService {
const isValidFile = (await fs.stat(filePath)).isFile();
if (isValidFile) {
await fs.unlink(filePath);
}
if (isValidFile) await fs.unlink(filePath);
}
const updatedResume = set(resume, 'basics.photo.url', '');