mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2026-10-23 13:47:57 +00:00
20 lines
827 B
TypeScript
20 lines
827 B
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { FindOptionsWhere } from 'typeorm';
|
|
import { UploadDocumentRequestDto } from '../dtos/request';
|
|
import { Document } from '../entities';
|
|
import { DocumentRepository } from '../repositories';
|
|
import { OciService } from './oci.service';
|
|
|
|
@Injectable()
|
|
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);
|
|
return this.documentRepository.createDocument(uploadedFile);
|
|
}
|
|
|
|
findDocuments(where: FindOptionsWhere<Document>) {
|
|
return this.documentRepository.findDocuments(where);
|
|
}
|
|
}
|