diff --git a/backend/src/share/share.module.ts b/backend/src/share/share.module.ts index a5f4b1f..f7a5fef 100644 --- a/backend/src/share/share.module.ts +++ b/backend/src/share/share.module.ts @@ -1,12 +1,11 @@ -import { Module } from "@nestjs/common"; -import { JwtModule, JwtService } from "@nestjs/jwt"; -import { AuthModule } from "src/auth/auth.module"; +import { forwardRef, Module } from "@nestjs/common"; +import { JwtModule } from "@nestjs/jwt"; import { FileModule } from "src/file/file.module"; import { ShareController } from "./share.controller"; import { ShareService } from "./share.service"; @Module({ - imports: [JwtModule.register({})], + imports: [JwtModule.register({}), forwardRef(() => FileModule)], controllers: [ShareController], providers: [ShareService], exports: [ShareService], diff --git a/backend/src/share/share.service.ts b/backend/src/share/share.service.ts index a6fa6fc..d15dc52 100644 --- a/backend/src/share/share.service.ts +++ b/backend/src/share/share.service.ts @@ -11,6 +11,7 @@ import * as archiver from "archiver"; import * as argon from "argon2"; import * as fs from "fs"; import * as moment from "moment"; +import { FileService } from "src/file/file.service"; import { PrismaService } from "src/prisma/prisma.service"; import { CreateShareDTO } from "./dto/createShare.dto"; @@ -18,7 +19,7 @@ import { CreateShareDTO } from "./dto/createShare.dto"; export class ShareService { constructor( private prisma: PrismaService, - + private fileService: FileService, private config: ConfigService, private jwtService: JwtService ) {} @@ -139,6 +140,7 @@ export class ShareService { if (!share) throw new NotFoundException("Share not found"); + await this.fileService.deleteAllFiles(shareId); await this.prisma.share.delete({ where: { id: shareId } }); }