-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add question answer protocol (#539)
* feat:added question answer protocol Signed-off-by: pallavicoder <[email protected]> * fear:added question answer webhook Signed-off-by: pallavicoder <[email protected]> * feat:add question answer protocol inside platform Signed-off-by: pallavicoder <[email protected]> * fix:removed extra cost variables Signed-off-by: pallavicoder <[email protected]> --------- Signed-off-by: pallavicoder <[email protected]> Signed-off-by: bhavanakarwade <[email protected]>
- Loading branch information
1 parent
6f6c4da
commit 2d3c593
Showing
12 changed files
with
468 additions
and
5 deletions.
There are no files selected for viewing
Empty file.
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
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
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
95 changes: 95 additions & 0 deletions
95
apps/api-gateway/src/connection/dtos/question-answer.dto.ts
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 |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import { trim } from '@credebl/common/cast.helper'; | ||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; | ||
import { Transform, Type } from 'class-transformer'; | ||
import { IsArray, IsNotEmpty, IsOptional, IsString, ValidateNested } from 'class-validator'; | ||
|
||
class ValidResponses { | ||
@ApiProperty({ example: 'Emma' }) | ||
@IsNotEmpty({ message: 'text is required' }) | ||
@IsString({ message: 'text should be a string' }) | ||
@Transform(({ value }) => trim(value)) | ||
@Type(() => String) | ||
text: string; | ||
} | ||
export class QuestionDto { | ||
@ApiPropertyOptional() | ||
@IsOptional() | ||
@IsString({ message: 'detail must be a string' }) | ||
@IsNotEmpty({ message: 'please provide valid detail' }) | ||
detail: string; | ||
|
||
@ApiProperty({ example: [{ 'text': 'Emma'}, { 'text': 'Kiva'}] }) | ||
@IsNotEmpty({ message: 'Please provide valid responses' }) | ||
@IsArray({ message: 'Responses should be array' }) | ||
@ValidateNested({ each: true }) | ||
@Type(() => ValidResponses) | ||
validResponses: ValidResponses[]; | ||
|
||
@ApiProperty({ example: 'What is your name'}) | ||
@IsNotEmpty({ message: 'question is required' }) | ||
@IsString({ message: 'question must be a string' }) | ||
@IsNotEmpty({ message: 'please provide valid question' }) | ||
question: string; | ||
|
||
orgId: string; | ||
connectionId: string; | ||
tenantId: string; | ||
} | ||
|
||
export class QuestionAnswerWebhookDto { | ||
|
||
|
||
@ApiPropertyOptional() | ||
@IsOptional() | ||
id: string; | ||
|
||
@ApiPropertyOptional() | ||
@IsOptional() | ||
createdAt: string; | ||
|
||
@ApiPropertyOptional() | ||
@IsOptional() | ||
questionText: string; | ||
|
||
@ApiPropertyOptional() | ||
@IsOptional() | ||
questionDetail: string; | ||
|
||
@ApiPropertyOptional() | ||
@IsOptional() | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
validResponses:any; | ||
|
||
@ApiPropertyOptional() | ||
@IsOptional() | ||
connectionId: string; | ||
|
||
@ApiPropertyOptional() | ||
@IsOptional() | ||
role: string; | ||
|
||
@ApiPropertyOptional() | ||
@IsOptional() | ||
signatureRequired: boolean; | ||
|
||
@ApiPropertyOptional() | ||
@IsOptional() | ||
state: boolean; | ||
|
||
@ApiPropertyOptional() | ||
@IsOptional() | ||
threadId: string; | ||
|
||
@ApiPropertyOptional() | ||
@IsOptional() | ||
updatedAt: string; | ||
|
||
@ApiPropertyOptional() | ||
@IsOptional() | ||
contextCorrelationId: string; | ||
|
||
@ApiPropertyOptional() | ||
@IsOptional() | ||
type: string; | ||
|
||
} |
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
Oops, something went wrong.