-
Notifications
You must be signed in to change notification settings - Fork 29
Task#00000 Referral Tracking implementation #741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: aspire-leaders
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; | ||
| import { IsArray, IsEmail, IsEnum, IsOptional, IsString, MaxLength } from 'class-validator'; | ||
| import { | ||
| ReferralEntityStatus, | ||
| ReferralEntitySubType, | ||
| ReferralEntityType, | ||
| } from '../referrals.types'; | ||
|
|
||
| export class CreateReferralEntityDto { | ||
| @ApiPropertyOptional({ description: 'Custom slug (any format accepted; will be normalized to lowercase a-z0-9_). If omitted, auto-generated.' }) | ||
| @IsOptional() | ||
| @IsString() | ||
| @MaxLength(100) | ||
| slug?: string; | ||
|
|
||
| @ApiProperty({ description: 'First name (or full org/university name)' }) | ||
| @IsString() | ||
| @MaxLength(255) | ||
| firstName: string; | ||
|
|
||
| @ApiPropertyOptional({ description: 'Last name (optional for org/university)' }) | ||
| @IsOptional() | ||
| @IsString() | ||
| @MaxLength(255) | ||
| lastName?: string; | ||
|
|
||
| @ApiProperty({ enum: ReferralEntityType }) | ||
| @IsEnum(ReferralEntityType) | ||
| type: ReferralEntityType; | ||
|
|
||
| @ApiProperty({ enum: ReferralEntitySubType }) | ||
| @IsEnum(ReferralEntitySubType) | ||
| subType: ReferralEntitySubType; | ||
|
|
||
| @ApiPropertyOptional({ description: 'Region (optional)' }) | ||
| @IsOptional() | ||
| @IsString() | ||
| @MaxLength(100) | ||
| region?: string; | ||
|
|
||
| @ApiPropertyOptional({ description: 'Linked internal entity UUID (optional)' }) | ||
| @IsOptional() | ||
| @IsString() | ||
| linkedEntityId?: string; | ||
|
|
||
| @ApiPropertyOptional({ description: 'Primary contact email (optional)' }) | ||
| @IsOptional() | ||
| @IsEmail() | ||
| @MaxLength(255) | ||
| contactEmail?: string; | ||
|
|
||
| @ApiPropertyOptional({ description: 'Additional emails (array of email strings)', type: [String] }) | ||
| @IsOptional() | ||
| @IsArray() | ||
| @IsEmail({}, { each: true }) | ||
| additionalEmails?: string[]; | ||
|
|
||
| @ApiPropertyOptional({ description: 'Country (optional)' }) | ||
| @IsOptional() | ||
| @IsString() | ||
| @MaxLength(100) | ||
| country?: string; | ||
|
|
||
| @ApiPropertyOptional({ enum: ReferralEntityStatus, default: ReferralEntityStatus.ACTIVE }) | ||
| @IsOptional() | ||
| @IsEnum(ReferralEntityStatus) | ||
| status?: ReferralEntityStatus; | ||
| } | ||
|
Tusharmahajan12 marked this conversation as resolved.
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { ApiProperty } from '@nestjs/swagger'; | ||
| import { IsNotEmpty, IsString } from 'class-validator'; | ||
|
|
||
| export class ImportReferralsDto { | ||
| @ApiProperty({ | ||
| description: | ||
| 'CSV content with header: firstName,lastName,type,subType,region,contactEmail,country', | ||
| }) | ||
| @IsString() | ||
| @IsNotEmpty() | ||
| csv: string; | ||
| } | ||
|
|
||
|
Tusharmahajan12 marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import { ApiPropertyOptional } from '@nestjs/swagger'; | ||
| import { Type } from 'class-transformer'; | ||
| import { IsArray, IsEnum, IsNumber, IsObject, IsOptional, IsString, Min } from 'class-validator'; | ||
| import { ReferralEntitySubType, ReferralEntityType } from '../referrals.types'; | ||
|
|
||
| export class ReferralFiltersDto { | ||
| @ApiPropertyOptional({ enum: ReferralEntityType, description: 'Filter by referral type' }) | ||
| @IsOptional() | ||
| @IsEnum(ReferralEntityType) | ||
| type?: ReferralEntityType; | ||
|
|
||
| @ApiPropertyOptional({ enum: ReferralEntitySubType, description: 'Filter by referral sub-type' }) | ||
| @IsOptional() | ||
| @IsEnum(ReferralEntitySubType) | ||
| subType?: ReferralEntitySubType; | ||
|
|
||
| @ApiPropertyOptional({ type: String, description: 'Search across firstName, lastName, contactEmail, and slug' }) | ||
| @IsOptional() | ||
| @IsString() | ||
| search?: string; | ||
|
|
||
| @ApiPropertyOptional({ type: [String], description: 'Filter by regions' }) | ||
| @IsOptional() | ||
| @IsArray() | ||
| @IsString({ each: true }) | ||
| regions?: string[]; | ||
|
|
||
| @ApiPropertyOptional({ type: [String], description: 'Filter by countries' }) | ||
| @IsOptional() | ||
| @IsArray() | ||
| @IsString({ each: true }) | ||
| countries?: string[]; | ||
| } | ||
|
|
||
| export class ListReferralsDto { | ||
| @ApiPropertyOptional({ description: 'Number of records to return', default: 10 }) | ||
| @IsOptional() | ||
| @Type(() => Number) | ||
| @IsNumber() | ||
| @Min(1) | ||
| limit?: number; | ||
|
|
||
| @ApiPropertyOptional({ description: 'Number of records to skip', default: 0 }) | ||
| @IsOptional() | ||
| @Type(() => Number) | ||
| @IsNumber() | ||
| @Min(0) | ||
| offset?: number; | ||
|
|
||
| @ApiPropertyOptional({ type: ReferralFiltersDto, description: 'Filters to apply' }) | ||
| @IsOptional() | ||
| @IsObject() | ||
| @Type(() => ReferralFiltersDto) | ||
| filters?: ReferralFiltersDto; | ||
|
Comment on lines
+50
to
+54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add The 🔧 Proposed fix+import { IsArray, IsEnum, IsNumber, IsObject, IsOptional, IsString, Min, ValidateNested } from 'class-validator';
`@ApiPropertyOptional`({ type: ReferralFiltersDto, description: 'Filters to apply' })
`@IsOptional`()
+ `@ValidateNested`()
`@IsObject`()
`@Type`(() => ReferralFiltersDto)
filters?: ReferralFiltersDto;As per coding guidelines, the code should adhere to NestJS best practices for DTO validation. 🧰 Tools🪛 ESLint[error] 50-50: Replace (prettier/prettier) 🤖 Prompt for AI Agents |
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.