jolocom-credential-type.entity.ts 653 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
import {
  BaseEntity,
  Entity,
  PrimaryGeneratedColumn,
  ManyToOne,
  Column,
} from 'typeorm';
import { JolocomWallet } from './jolocom-wallet.entity';
import { BaseMetadata } from 'cred-types-jolocom-core/js/types';

@Entity()
export class JolocomCredentialType extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @ManyToOne(
    () => JolocomWallet,
    wallet => wallet.credentialOffers,
  )
  wallet: JolocomWallet;

  @Column({ unique: true })
  type: string;

  @Column()
  name: string;

  @Column('simple-json')
  context: BaseMetadata['context'];

  @Column('simple-json')
  claimInterface: BaseMetadata['claimInterface'];
}