mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
feat(nestjs): migrate to NestJS
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
import { IsEmail, IsOptional, IsString } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class ContactAddressDto {
|
||||
@ApiProperty({ required: false, description: 'Billing address line 1' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
billingAddress1?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Billing address line 2' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
billingAddress2?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Billing address city' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
billingAddressCity?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Billing address country' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
billingAddressCountry?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Billing address email' })
|
||||
@IsOptional()
|
||||
@IsEmail()
|
||||
billingAddressEmail?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Billing address zipcode' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
billingAddressZipcode?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Billing address phone' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
billingAddressPhone?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Billing address state' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
billingAddressState?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Shipping address line 1' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
shippingAddress1?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Shipping address line 2' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
shippingAddress2?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Shipping address city' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
shippingAddressCity?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Shipping address country' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
shippingAddressCountry?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Shipping address email' })
|
||||
@IsOptional()
|
||||
@IsEmail()
|
||||
shippingAddressEmail?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Shipping address zipcode' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
shippingAddressZipcode?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Shipping address phone' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
shippingAddressPhone?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Shipping address state' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
shippingAddressState?: string;
|
||||
}
|
||||
100
packages/server/src/modules/Customers/dtos/CreateCustomer.dto.ts
Normal file
100
packages/server/src/modules/Customers/dtos/CreateCustomer.dto.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
import {
|
||||
IsBoolean,
|
||||
IsEmail,
|
||||
IsNotEmpty,
|
||||
IsNumber,
|
||||
IsOptional,
|
||||
IsString,
|
||||
} from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { ContactAddressDto } from './ContactAddress.dto';
|
||||
|
||||
export class CreateCustomerDto extends ContactAddressDto {
|
||||
@ApiProperty({ required: true, description: 'Customer type' })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
customerType: string;
|
||||
|
||||
@ApiProperty({ required: true, description: 'Currency code' })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
currencyCode: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Opening balance' })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
openingBalance?: number;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Opening balance date' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
openingBalanceAt?: string;
|
||||
|
||||
@ApiProperty({
|
||||
required: false,
|
||||
description: 'Opening balance exchange rate',
|
||||
})
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
openingBalanceExchangeRate?: number;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Opening balance branch ID' })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
openingBalanceBranchId?: number;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Salutation' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
salutation?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'First name' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
firstName?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Last name' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
lastName?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Company name' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
companyName?: string;
|
||||
|
||||
@ApiProperty({ required: true, description: 'Display name' })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
displayName: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Website' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
website?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Email' })
|
||||
@IsOptional()
|
||||
@IsEmail()
|
||||
email?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Work phone' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
workPhone?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Personal phone' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
personalPhone?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Note' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
note?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Active status', default: true })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
active?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import { IsBoolean, IsEmail, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { ContactAddressDto } from './ContactAddress.dto';
|
||||
|
||||
export class EditCustomerDto extends ContactAddressDto {
|
||||
@ApiProperty({ required: true, description: 'Customer type' })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
customerType: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Salutation' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
salutation?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'First name' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
firstName?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Last name' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
lastName?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Company name' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
companyName?: string;
|
||||
|
||||
@ApiProperty({ required: true, description: 'Display name' })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
displayName: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Website' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
website?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Email' })
|
||||
@IsOptional()
|
||||
@IsEmail()
|
||||
email?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Work phone' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
workPhone?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Personal phone' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
personalPhone?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Note' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
note?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Active status' })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
active?: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user