-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔥 Added validation pipes to inoput unified typse
- Loading branch information
Showing
19 changed files
with
418 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,85 @@ | ||
import { Address, Email, Phone } from '@crm/@utils/@types'; | ||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; | ||
import { IsNumber, IsOptional, IsString } from 'class-validator'; | ||
|
||
export class UnifiedCompanyInput { | ||
@ApiProperty({ description: 'The name of the company' }) | ||
@ApiProperty({ type: String, description: 'The name of the company' }) | ||
@IsString() | ||
name: string; | ||
|
||
@ApiPropertyOptional({ description: 'The industry of the company' }) | ||
@ApiPropertyOptional({ | ||
type: String, | ||
description: 'The industry of the company', | ||
}) | ||
@IsString() | ||
@IsOptional() | ||
industry?: string; | ||
|
||
@ApiPropertyOptional({ | ||
type: Number, | ||
description: 'The number of employees of the company', | ||
}) | ||
@IsNumber() | ||
@IsOptional() | ||
number_of_employees?: number; | ||
|
||
@ApiPropertyOptional({ | ||
type: String, | ||
description: 'The uuid of the user who owns the company', | ||
}) | ||
@IsString() | ||
@IsOptional() | ||
user_id?: string; | ||
|
||
@ApiPropertyOptional({ | ||
description: 'The email addresses of the company', | ||
type: [Email], | ||
}) | ||
@IsOptional() | ||
email_addresses?: Email[]; | ||
|
||
@ApiPropertyOptional({ | ||
description: 'The addresses of the company', | ||
type: [Address], | ||
}) | ||
@IsOptional() | ||
addresses?: Address[]; | ||
|
||
@ApiPropertyOptional({ | ||
description: 'The phone numbers of the company', | ||
type: [Phone], | ||
}) | ||
@IsOptional() | ||
phone_numbers?: Phone[]; | ||
|
||
@ApiPropertyOptional({ | ||
type: {}, | ||
description: | ||
'The custom field mappings of the company between the remote 3rd party & Panora', | ||
}) | ||
@IsOptional() | ||
field_mappings?: Record<string, any>; | ||
} | ||
|
||
export class UnifiedCompanyOutput extends UnifiedCompanyInput { | ||
@ApiPropertyOptional({ description: 'The uuid of the company' }) | ||
@ApiPropertyOptional({ type: String, description: 'The uuid of the company' }) | ||
@IsString() | ||
@IsOptional() | ||
id?: string; | ||
|
||
@ApiPropertyOptional({ | ||
type: String, | ||
description: 'The id of the company in the context of the Crm 3rd Party', | ||
}) | ||
@IsString() | ||
@IsOptional() | ||
remote_id?: string; | ||
|
||
@ApiPropertyOptional({ | ||
type: [{}], | ||
type: {}, | ||
description: | ||
'The remote data of the company in the context of the Crm 3rd Party', | ||
}) | ||
@IsOptional() | ||
remote_data?: Record<string, any>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,71 @@ | ||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; | ||
import { IsNumber, IsOptional, IsString } from 'class-validator'; | ||
|
||
export class UnifiedDealInput { | ||
@ApiProperty({ description: 'The name of the deal' }) | ||
@ApiProperty({ type: String, description: 'The name of the deal' }) | ||
@IsString() | ||
name: string; | ||
|
||
@ApiProperty({ description: 'The description of the deal' }) | ||
@ApiProperty({ type: String, description: 'The description of the deal' }) | ||
@IsString() | ||
description: string; | ||
|
||
@ApiProperty({ description: 'The amount of the deal' }) | ||
@ApiProperty({ type: Number, description: 'The amount of the deal' }) | ||
@IsNumber() | ||
amount: number; | ||
|
||
@ApiPropertyOptional({ | ||
type: String, | ||
description: 'The uuid of the user who is on the deal', | ||
}) | ||
@IsString() | ||
@IsOptional() | ||
user_id?: string; | ||
|
||
@ApiPropertyOptional({ description: 'The uuid of the stage of the deal' }) | ||
@ApiPropertyOptional({ | ||
type: String, | ||
description: 'The uuid of the stage of the deal', | ||
}) | ||
@IsString() | ||
@IsOptional() | ||
stage_id?: string; | ||
|
||
@ApiPropertyOptional({ | ||
type: String, | ||
description: 'The uuid of the company tied to the deal', | ||
}) | ||
@IsString() | ||
@IsOptional() | ||
company_id?: string; | ||
|
||
@ApiPropertyOptional({ | ||
type: {}, | ||
description: | ||
'The custom field mappings of the company between the remote 3rd party & Panora', | ||
}) | ||
@IsOptional() | ||
field_mappings?: Record<string, any>; | ||
} | ||
|
||
export class UnifiedDealOutput extends UnifiedDealInput { | ||
@ApiPropertyOptional({ description: 'The uuid of the deal' }) | ||
@ApiPropertyOptional({ type: String, description: 'The uuid of the deal' }) | ||
@IsString() | ||
@IsOptional() | ||
id?: string; | ||
|
||
@ApiPropertyOptional({ | ||
type: String, | ||
description: 'The id of the deal in the context of the Crm 3rd Party', | ||
}) | ||
@IsString() | ||
@IsOptional() | ||
remote_id?: string; | ||
|
||
@ApiPropertyOptional({ | ||
type: [{}], | ||
type: {}, | ||
description: | ||
'The remote data of the deal in the context of the Crm 3rd Party', | ||
}) | ||
@IsOptional() | ||
remote_data?: Record<string, any>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,99 @@ | ||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; | ||
import { IsIn, IsOptional, IsString } from 'class-validator'; | ||
|
||
export class UnifiedEngagementInput { | ||
@ApiPropertyOptional({ description: 'The content of the engagement' }) | ||
@ApiPropertyOptional({ type: String, description: 'The content of the engagement' }) | ||
@IsString() | ||
@IsOptional() | ||
content?: string; | ||
|
||
@ApiPropertyOptional({ description: 'The direction of the engagement. Authorized values are INBOUND or OUTBOUND' }) | ||
@ApiPropertyOptional({ | ||
type: String, | ||
description: 'The direction of the engagement. Authorized values are INBOUND or OUTBOUND' | ||
}) | ||
@IsIn(['INBOUND', 'OUTBOUND'], { | ||
message: "Direction must be either INBOUND or OUTBOUND" | ||
}) | ||
@IsOptional() | ||
direction?: string; | ||
|
||
@ApiPropertyOptional({ description: 'The subject of the engagement' }) | ||
@ApiPropertyOptional({ | ||
type: String, | ||
description: 'The subject of the engagement' | ||
}) | ||
@IsString() | ||
@IsOptional() | ||
subject?: string; | ||
|
||
@ApiPropertyOptional({ description: 'The start time of the engagement' }) | ||
@IsOptional() | ||
start_at?: Date; | ||
|
||
@ApiPropertyOptional({ description: 'The end time of the engagement' }) | ||
@IsOptional() | ||
end_time?: Date; | ||
|
||
@ApiProperty({ | ||
type: String, | ||
description: | ||
'The type of the engagement. Authorized values are EMAIL, CALL or MEETING', | ||
}) | ||
@IsIn(['EMAIL', 'CALL', 'MEETING'], { | ||
message: "Type must be either EMAIL, CALL or MEETING" | ||
}) | ||
type: string; | ||
|
||
@ApiPropertyOptional({ | ||
type: String, | ||
description: 'The uuid of the user tied to the engagement', | ||
}) | ||
@IsString() | ||
@IsOptional() | ||
user_id?: string; | ||
|
||
@ApiPropertyOptional({ | ||
type: String, | ||
description: 'The uuid of the company tied to the engagement', | ||
}) | ||
@IsString() | ||
@IsOptional() | ||
company_id?: string; // uuid of Company object | ||
|
||
@ApiPropertyOptional({ | ||
type: [String], | ||
description: 'The uuids of contacts tied to the engagement object', | ||
}) | ||
@IsOptional() | ||
contacts?: string[]; // array of uuids of Engagement Contacts objects | ||
|
||
@ApiPropertyOptional({ | ||
type: {}, | ||
description: | ||
'The custom field mappings of the engagement between the remote 3rd party & Panora', | ||
}) | ||
@IsOptional() | ||
field_mappings?: Record<string, any>; | ||
} | ||
|
||
export class UnifiedEngagementOutput extends UnifiedEngagementInput { | ||
@ApiPropertyOptional({ description: 'The uuid of the engagement' }) | ||
@ApiPropertyOptional({ type: String, description: 'The uuid of the engagement' }) | ||
@IsString() | ||
@IsOptional() | ||
id?: string; | ||
|
||
@ApiPropertyOptional({ | ||
type: String, | ||
description: 'The id of the engagement in the context of the Crm 3rd Party', | ||
}) | ||
@IsString() | ||
@IsOptional() | ||
remote_id?: string; | ||
|
||
@ApiPropertyOptional({ | ||
type: [{}], | ||
type: {}, | ||
description: | ||
'The remote data of the engagement in the context of the Crm 3rd Party', | ||
}) | ||
@IsOptional() | ||
remote_data?: Record<string, any>; | ||
} |
Oops, something went wrong.