@sphereon/ssi-sdk.data-store
Version:
37 lines (30 loc) • 1.19 kB
text/typescript
import typeorm from 'typeorm'
const { Entity, Column, PrimaryGeneratedColumn, OneToOne, JoinColumn, BaseEntity } = typeorm
import { BaseConfigEntity } from './BaseConfigEntity'
import { ConnectionType } from '../../types'
import { IdentityEntity } from './IdentityEntity'
import { OpenIdConfigEntity } from './OpenIdConfigEntity'
import { DidAuthConfigEntity } from './DidAuthConfigEntity'
('Connection')
export class ConnectionEntity extends BaseEntity {
('uuid')
id!: string
('simple-enum', { name: 'type', enum: ConnectionType, nullable: false })
type!: ConnectionType
('text', { name: 'tenant_id', nullable: true })
tenantId?: string
('text', { name: 'owner_id', nullable: true })
ownerId?: string
(() => BaseConfigEntity, (config: OpenIdConfigEntity | DidAuthConfigEntity) => config.connection, {
cascade: true,
onDelete: 'CASCADE',
eager: true,
nullable: false,
})
config!: BaseConfigEntity
(() => IdentityEntity, (identity: IdentityEntity) => identity.connection, {
onDelete: 'CASCADE',
})
({ name: 'identity_id' })
identity!: IdentityEntity
}