From c22d9d45f55d653b0c8a8faa0b374ba34597c2ec Mon Sep 17 00:00:00 2001 From: "A.G.J. Cate" Date: Thu, 17 Oct 2024 11:40:44 +0200 Subject: [PATCH] feat: added additional issuer branding properties --- .../IssuerLocaleBrandingEntity.ts | 22 ++++++++++++++++++- .../issuanceBranding/issuanceBranding.ts | 7 +++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/packages/data-store/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts b/packages/data-store/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts index 86752066d..3c98e48d6 100644 --- a/packages/data-store/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts +++ b/packages/data-store/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts @@ -5,7 +5,8 @@ import { imageAttributesEntityFrom } from './ImageAttributesEntity' import { IssuerBrandingEntity } from './IssuerBrandingEntity' import { BaseLocaleBrandingEntity } from './BaseLocaleBrandingEntity' import { textAttributesEntityFrom } from './TextAttributesEntity' -import { isEmptyString } from '../validators' +import { isEmptyString, IsNonEmptyStringConstraint } from '../validators' +import { Validate } from 'class-validator' @ChildEntity('IssuerLocaleBranding') @Index('IDX_IssuerLocaleBrandingEntity_issuerBranding_locale', ['issuerBranding', 'locale'], { unique: true }) @@ -16,6 +17,21 @@ export class IssuerLocaleBrandingEntity extends BaseLocaleBrandingEntity { @JoinColumn({ name: 'issuerBrandingId' }) issuerBranding!: IssuerBrandingEntity + @Column('text', { name: 'client_uri', nullable: true, unique: false }) + @Validate(IsNonEmptyStringConstraint, { message: 'Blank client uris are not allowed' }) + clientUri?: string + + @Column('text', { name: 'tos_uri', nullable: true, unique: false }) + @Validate(IsNonEmptyStringConstraint, { message: 'Blank tos uris are not allowed' }) + tosUri?: string + + @Column('text', { name: 'policy_uri', nullable: true, unique: false }) + @Validate(IsNonEmptyStringConstraint, { message: 'Blank policy uris are not allowed' }) + policyUri?: string + + @Column('simple-array', { name: 'contacts', nullable: true, unique: false }) + contacts?: Array + @Column('text', { name: 'issuerBrandingId', nullable: false }) issuerBrandingId!: string } @@ -28,6 +44,10 @@ export const issuerLocaleBrandingEntityFrom = (args: IBasicIssuerLocaleBranding) issuerLocaleBrandingEntity.description = isEmptyString(args.description) ? undefined : args.description issuerLocaleBrandingEntity.background = args.background ? backgroundAttributesEntityFrom(args.background) : undefined issuerLocaleBrandingEntity.text = args.text ? textAttributesEntityFrom(args.text) : undefined + issuerLocaleBrandingEntity.clientUri = isEmptyString(args.clientUri) ? undefined : args.clientUri + issuerLocaleBrandingEntity.tosUri = isEmptyString(args.tosUri) ? undefined : args.tosUri + issuerLocaleBrandingEntity.policyUri = isEmptyString(args.policyUri) ? undefined : args.policyUri + issuerLocaleBrandingEntity.contacts = args.contacts return issuerLocaleBrandingEntity } diff --git a/packages/data-store/src/types/issuanceBranding/issuanceBranding.ts b/packages/data-store/src/types/issuanceBranding/issuanceBranding.ts index 609541825..af967957b 100644 --- a/packages/data-store/src/types/issuanceBranding/issuanceBranding.ts +++ b/packages/data-store/src/types/issuanceBranding/issuanceBranding.ts @@ -80,7 +80,12 @@ export interface IPartialCredentialBranding extends Partial +} export interface IBasicIssuerLocaleBranding extends Omit { logo?: IBasicImageAttributes