fix: remove access type from document

This commit is contained in:
Abdalhamid Alhamad
2024-12-02 12:13:03 +03:00
parent 847c078735
commit 2bf9dea771
13 changed files with 12 additions and 63 deletions
+1 -12
View File
@@ -1,4 +1,4 @@
import { Injectable, NotFoundException } from '@nestjs/common';
import { Injectable } from '@nestjs/common';
import { UploadDocumentRequestDto } from '../dtos/request';
import { DocumentRepository } from '../repositories';
import { OciService } from './oci.service';
@@ -8,17 +8,6 @@ export class DocumentService {
constructor(private readonly ociService: OciService, private readonly documentRepository: DocumentRepository) {}
async createDocument(file: Express.Multer.File, uploadedDocumentRequest: UploadDocumentRequestDto) {
const uploadedFile = await this.ociService.uploadFile(file, uploadedDocumentRequest);
console.log('test');
return this.documentRepository.createDocument(uploadedFile);
}
async findDocumentById(documentId: string) {
const document = await this.documentRepository.findDocumentById(documentId);
if (!document) {
throw new NotFoundException('DOCUMENT.NOT_FOUND');
}
return document;
}
}
+1 -5
View File
@@ -34,10 +34,7 @@ export class OciService {
});
}
async uploadFile(
file: Express.Multer.File,
{ documentType, accessType }: UploadDocumentRequestDto,
): Promise<UploadResponseDto> {
async uploadFile(file: Express.Multer.File, { documentType }: UploadDocumentRequestDto): Promise<UploadResponseDto> {
const bucketName = BUCKETS[documentType];
const objectName = generateNewFileName(file.originalname);
@@ -62,7 +59,6 @@ export class OciService {
extension: path.extname(file.originalname),
url: `https://objectstorage.${this.region}.oraclecloud.com/n/${this.namespace}/b/${bucketName}/o/${objectName}`,
documentType,
accessType,
});
}
}