feat: implement connection request management including schema, API endpoints, and business logic for users and agents.
This commit is contained in:
20
src/connection-requests/dto/create-connection-request.dto.ts
Normal file
20
src/connection-requests/dto/create-connection-request.dto.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IsString, IsOptional, IsUUID, MaxLength } from 'class-validator';
|
||||
|
||||
export class CreateConnectionRequestDto {
|
||||
@ApiProperty({
|
||||
example: 'uuid-agent-profile-id',
|
||||
description: 'The ID of the agent profile to connect with',
|
||||
})
|
||||
@IsUUID('4')
|
||||
agentProfileId: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: 'Hi, I am interested in your services for buying a home.',
|
||||
description: 'Optional message to send with the connection request',
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(1000)
|
||||
message?: string;
|
||||
}
|
||||
2
src/connection-requests/dto/index.ts
Normal file
2
src/connection-requests/dto/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './create-connection-request.dto';
|
||||
export * from './respond-connection-request.dto';
|
||||
@@ -0,0 +1,14 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsIn } from 'class-validator';
|
||||
|
||||
export class RespondConnectionRequestDto {
|
||||
@ApiProperty({
|
||||
enum: ['ACCEPTED', 'REJECTED'],
|
||||
example: 'ACCEPTED',
|
||||
description: 'The response status (ACCEPTED or REJECTED)',
|
||||
})
|
||||
@IsIn(['ACCEPTED', 'REJECTED'], {
|
||||
message: 'Status must be ACCEPTED or REJECTED',
|
||||
})
|
||||
status: 'ACCEPTED' | 'REJECTED';
|
||||
}
|
||||
Reference in New Issue
Block a user