mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-25 21:59:40 +00:00
feat: finish generating signed url for document upload flow
This commit is contained in:
@ -3,12 +3,12 @@ import { IsEnum, IsString } from 'class-validator';
|
||||
import { i18nValidationMessage as i18n } from 'nestjs-i18n';
|
||||
import { DocumentType } from '~/document/enums';
|
||||
|
||||
export class GenerateUploadSignedUrlRequestDto {
|
||||
export class CreateDocumentRequestDto {
|
||||
@ApiProperty({ enum: DocumentType })
|
||||
@IsEnum(DocumentType, { message: i18n('validation.IsEnum', { path: 'general', property: 'document.documentType' }) })
|
||||
documentType!: DocumentType;
|
||||
|
||||
@ApiProperty({ type: String })
|
||||
@ApiProperty({ type: String, example: '.jpg' })
|
||||
@IsString({ message: i18n('validation.IsString', { path: 'general', property: 'document.document.extension' }) })
|
||||
extension!: string;
|
||||
|
@ -1,2 +1 @@
|
||||
export * from './generate-upload-signed-url.request.dto';
|
||||
export * from './upload-document.request.dto';
|
||||
export * from './create-document.request.dto';
|
||||
|
@ -1,8 +0,0 @@
|
||||
import { IsEnum } from 'class-validator';
|
||||
import { i18nValidationMessage as i18n } from 'nestjs-i18n';
|
||||
import { DocumentType } from '~/document/enums';
|
||||
|
||||
export class UploadDocumentRequestDto {
|
||||
@IsEnum(DocumentType, { message: i18n('validation.IsEnum', { path: 'general', property: 'document.documentType' }) })
|
||||
documentType!: DocumentType;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Document } from '~/document/entities';
|
||||
import { DocumentMetaResponseDto } from './document-meta.response.dto';
|
||||
|
||||
export class GenerateUploadSignedUrlResponseDto {
|
||||
@ApiProperty({ type: DocumentMetaResponseDto })
|
||||
document!: DocumentMetaResponseDto;
|
||||
|
||||
@ApiProperty()
|
||||
uploadUrl!: string;
|
||||
|
||||
constructor(document: Document, uploadUrl: string) {
|
||||
this.document = new DocumentMetaResponseDto(document);
|
||||
this.uploadUrl = uploadUrl;
|
||||
}
|
||||
}
|
@ -1,2 +1,3 @@
|
||||
export * from './document-meta.response.dto';
|
||||
export * from './generate-upload-signed-url.response.dto';
|
||||
export * from './upload.response.dto';
|
||||
|
Reference in New Issue
Block a user