Skip to content

Commit 37a8a40

Browse files
feat: fixed collection flow url and create token endpoints swagger schema
1 parent f595dd5 commit 37a8a40

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { ApiProperty } from '@nestjs/swagger';
2+
import { IsNotEmpty, IsString } from 'class-validator';
3+
4+
export class CreateCollectionFlowUrlDto {
5+
@ApiProperty({
6+
required: true,
7+
type: String,
8+
})
9+
@IsNotEmpty()
10+
@IsString()
11+
workflowRuntimeDataId!: string;
12+
}

services/workflows-service/src/workflow/dtos/create-collection-flow-url.ts renamed to services/workflows-service/src/workflow/dtos/create-token.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ApiProperty } from '@nestjs/swagger';
22
import { IsNotEmpty, IsNumber, IsOptional, IsString } from 'class-validator';
33

4-
export class CreateCollectionFlowUrlDto {
4+
export class CreateTokenDto {
55
@ApiProperty({
66
required: true,
77
type: String,

services/workflows-service/src/workflow/workflow.controller.external.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { PrismaService } from '@/prisma/prisma.service';
1818
import type { AnyRecord, InputJsonValue, TProjectId, TProjectIds } from '@/types';
1919
import { WORKFLOW_DEFINITION_TAG } from '@/workflow-defintion/workflow-definition.controller';
2020
import { WorkflowDefinitionService } from '@/workflow-defintion/workflow-definition.service';
21-
import { CreateCollectionFlowUrlDto } from '@/workflow/dtos/create-collection-flow-url';
21+
import { CreateCollectionFlowUrlDto } from '@/workflow/dtos/create-collection-flow-url.dto';
2222
import { GetWorkflowsRuntimeInputDto } from '@/workflow/dtos/get-workflows-runtime-input.dto';
2323
import { GetWorkflowsRuntimeOutputDto } from '@/workflow/dtos/get-workflows-runtime-output.dto';
2424
import { WorkflowHookQuery } from '@/workflow/dtos/workflow-hook-query';
@@ -44,6 +44,7 @@ import { defaultContextSchema } from '@ballerine/common';
4444
import { WorkflowRunSchema } from './schemas/workflow-run';
4545
import { ValidationError } from '@/errors';
4646
import { WorkflowRuntimeListItemModel } from '@/workflow/workflow-runtime-list-item.model';
47+
import { CreateTokenDto } from '@/workflow/dtos/create-token.dto';
4748

4849
export const WORKFLOW_TAG = 'Workflows';
4950
@swagger.ApiBearerAuth()
@@ -378,7 +379,7 @@ export class WorkflowControllerExternal {
378379
@swagger.ApiForbiddenResponse({ type: errors.ForbiddenException })
379380
async createCollectionFlowUrl(
380381
@common.Body()
381-
{ workflowRuntimeDataId }: Pick<CreateCollectionFlowUrlDto, 'workflowRuntimeDataId'>,
382+
{ workflowRuntimeDataId }: CreateCollectionFlowUrlDto,
382383
) {
383384
const result = await this.workflowTokenService.findFirstByWorkflowruntimeDataIdUnscoped(
384385
workflowRuntimeDataId,
@@ -401,7 +402,7 @@ export class WorkflowControllerExternal {
401402
@common.HttpCode(200)
402403
@swagger.ApiForbiddenResponse({ type: errors.ForbiddenException })
403404
async createToken(
404-
@common.Body() { expiry, workflowRuntimeDataId, endUserId }: CreateCollectionFlowUrlDto,
405+
@common.Body() { expiry, workflowRuntimeDataId, endUserId }: CreateTokenDto,
405406
@CurrentProject() currentProjectId: TProjectId,
406407
) {
407408
const expiresAt = new Date(Date.now() + (expiry || 30) * 24 * 60 * 60 * 1000);

0 commit comments

Comments
 (0)