Skip to content

Commit

Permalink
feat: added additional issuer branding properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Brummos committed Oct 17, 2024
1 parent cf36c38 commit c22d9d4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand All @@ -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<string>

@Column('text', { name: 'issuerBrandingId', nullable: false })
issuerBrandingId!: string
}
Expand All @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ export interface IPartialCredentialBranding extends Partial<Omit<ICredentialBran
localeBranding?: IPartialCredentialLocaleBranding
}

export interface IIssuerLocaleBranding extends ILocaleBranding {}
export interface IIssuerLocaleBranding extends ILocaleBranding {
clientUri?: string
tosUri?: string
policyUri?: string
contacts?: Array<string>
}
export interface IBasicIssuerLocaleBranding
extends Omit<IIssuerLocaleBranding, 'id' | 'createdAt' | 'lastUpdatedAt' | 'logo' | 'background' | 'text'> {
logo?: IBasicImageAttributes
Expand Down

0 comments on commit c22d9d4

Please sign in to comment.