DuOrigin v2 - React + NestJS + Prisma + EUDR API Integration
This commit is contained in:
69
backend/src/empresas/dto/create-empresa.dto.ts
Normal file
69
backend/src/empresas/dto/create-empresa.dto.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import { IsString, IsOptional, IsBoolean, Matches, IsEmail, MinLength } from 'class-validator';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
|
||||
export class CreateEmpresaDto {
|
||||
@ApiProperty({ example: 'Fazenda Bom Sucesso Ltda' })
|
||||
@IsString()
|
||||
@MinLength(3, { message: 'Razão social deve ter no mínimo 3 caracteres' })
|
||||
razaoSocial: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'Fazenda Bom Sucesso' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
nomeFantasia?: string;
|
||||
|
||||
@ApiProperty({ example: '12.345.678/0001-90' })
|
||||
@IsString()
|
||||
@Matches(/^\d{2}\.\d{3}\.\d{3}\/\d{4}-\d{2}$/, { message: 'CNPJ inválido. Use o formato XX.XXX.XXX/XXXX-XX' })
|
||||
cnpj: string;
|
||||
|
||||
@ApiPropertyOptional({ example: '123.456.789.012' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
inscricaoEstadual?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'Soja, Milho, Café' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
atividadeAgricola?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'Rodovia BR-050, Km 45' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
endereco?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'Uberlândia' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
cidade?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'MG' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
estado?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: '38400-000' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
cep?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: '(34) 99999-0000' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
telefone?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'contato@fazenda.com.br' })
|
||||
@IsOptional()
|
||||
@IsEmail({}, { message: 'Email inválido' })
|
||||
email?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'João da Silva' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
responsavel?: string;
|
||||
|
||||
@ApiPropertyOptional({ default: true })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
ativo?: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user