-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add keys in the create tenant DTO (#195)
* Add keys in the create tenant DTO * Remove useless schema property description
- Loading branch information
1 parent
98d85d0
commit 82444c4
Showing
3 changed files
with
32 additions
and
49 deletions.
There are no files selected for viewing
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
31 changes: 9 additions & 22 deletions
31
apps/policy-engine/src/engine/http/rest/dto/create-tenant.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 |
---|---|---|
@@ -1,24 +1,11 @@ | ||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger' | ||
import { Type } from 'class-transformer' | ||
import { IsDefined, IsString } from 'class-validator' | ||
import { dataStoreConfigurationSchema } from '@narval/policy-engine-shared' | ||
import { createZodDto } from 'nestjs-zod' | ||
import { z } from 'zod' | ||
|
||
class DataStoreConfigurationDto { | ||
dataUrl: string | ||
signatureUrl: string | ||
} | ||
const createTenantSchema = z.object({ | ||
clientId: z.string().optional(), | ||
entityDataStore: dataStoreConfigurationSchema, | ||
policyDataStore: dataStoreConfigurationSchema | ||
}) | ||
|
||
export class CreateTenantDto { | ||
@IsString() | ||
@ApiPropertyOptional() | ||
clientId?: string | ||
|
||
@IsDefined() | ||
@Type(() => DataStoreConfigurationDto) | ||
@ApiProperty() | ||
entityDataStore: DataStoreConfigurationDto | ||
|
||
@IsDefined() | ||
@Type(() => DataStoreConfigurationDto) | ||
@ApiProperty() | ||
policyDataStore: DataStoreConfigurationDto | ||
} | ||
export class CreateTenantDto extends createZodDto(createTenantSchema) {} |