mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2026-10-24 18:37:57 +00:00
fix: remove access type from document
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user