-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose MM endpoints in the WF service (#2820)
* fix: swagger * refactor(workflow): update type definitions for collection flow - Change type from 'any' to 'unknown' for better type safety - Improve type definition for nested records in workflow steps (Your type definitions are so loose, they could qualify as a pair of sweatpants at a buffet) --------- Co-authored-by: Alon Peretz <[email protected]>
- Loading branch information
1 parent
e548a6b
commit 3af904d
Showing
8 changed files
with
188 additions
and
180 deletions.
There are no files selected for viewing
Submodule data-migrations
updated
from 6a9dff to 1b3bae
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
37 changes: 37 additions & 0 deletions
37
services/workflows-service/src/business-report/business-report-list.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,37 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsOptional, IsString } from 'class-validator'; | ||
import { PageDto } from '@/common/dto'; | ||
import { z } from 'zod'; | ||
import { BusinessReportDto } from '@/business-report/business-report.dto'; | ||
|
||
export class BusinessReportListRequestParamDto { | ||
@IsOptional() | ||
@IsString() | ||
businessId?: string; | ||
|
||
@IsOptional() | ||
@ApiProperty({ type: String, required: false }) | ||
search?: string; | ||
|
||
@ApiProperty({ type: PageDto }) | ||
page!: PageDto; | ||
} | ||
|
||
export const ListBusinessReportsSchema = z.object({ | ||
search: z.string().optional(), | ||
page: z.object({ | ||
number: z.coerce.number().int().positive(), | ||
size: z.coerce.number().int().positive().max(100), | ||
}), | ||
}); | ||
|
||
export class BusinessReportListResponseDto { | ||
@ApiProperty({ type: Number, example: 20 }) | ||
totalItems!: number; | ||
|
||
@ApiProperty({ type: Number, example: 1 }) | ||
totalPages!: number; | ||
|
||
@ApiProperty({ type: [BusinessReportDto] }) | ||
data!: BusinessReportDto[]; | ||
} |
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
64 changes: 64 additions & 0 deletions
64
services/workflows-service/src/business-report/business-report.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,64 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { | ||
MERCHANT_REPORT_STATUSES, | ||
MERCHANT_REPORT_TYPES, | ||
MERCHANT_REPORT_VERSIONS, | ||
type MerchantReportStatus, | ||
type MerchantReportType, | ||
type MerchantReportVersion, | ||
} from '@/business-report/constants'; | ||
|
||
export class WebsiteDto { | ||
@ApiProperty({ type: String }) | ||
id!: string; | ||
|
||
@ApiProperty({ type: String }) | ||
url!: string; | ||
|
||
@ApiProperty({ type: String }) | ||
createdAt!: string; | ||
|
||
@ApiProperty({ type: String }) | ||
updatedAt!: string; | ||
} | ||
|
||
export class BusinessReportDto { | ||
@ApiProperty({ type: String }) | ||
id!: string; | ||
|
||
@ApiProperty({ type: String }) | ||
websiteId!: string; | ||
|
||
@ApiProperty({ type: String }) | ||
merchantId!: string; | ||
|
||
@ApiProperty({ type: String, enum: MERCHANT_REPORT_TYPES }) | ||
reportType!: MerchantReportType; | ||
|
||
@ApiProperty({ type: String, enum: MERCHANT_REPORT_VERSIONS }) | ||
workflowVersion!: MerchantReportVersion; | ||
|
||
@ApiProperty({ type: String }) | ||
parentCompanyName!: string; | ||
|
||
@ApiProperty({ type: String, enum: MERCHANT_REPORT_STATUSES }) | ||
status!: MerchantReportStatus; | ||
|
||
@ApiProperty({ type: Number }) | ||
riskScore!: number; | ||
|
||
@ApiProperty({ type: Boolean }) | ||
isAlert!: boolean; | ||
|
||
@ApiProperty({ type: WebsiteDto }) | ||
website!: WebsiteDto; | ||
|
||
@ApiProperty({ type: String }) | ||
createdAt!: string; | ||
|
||
@ApiProperty({ type: String }) | ||
updatedAt!: string; | ||
|
||
@ApiProperty({ type: Object }) | ||
data!: Record<string, unknown>; | ||
} |
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.