How to use the sequelize-typescript.DataType.JSONB function in sequelize-typescript

To help you get started, we’ve selected a few sequelize-typescript examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adrien2p / nestjs-api-ai / src / modules / common / models / Action.ts View on Github external
actionName: string;

    @Column({
        type: DataType.INTEGER,
        allowNull: false
    })
    requestId: number;

    @Column({
        type: DataType.JSONB,
        allowNull: false
    })
    data: any;

    @Column({
        type: DataType.JSONB,
        allowNull: false
    })
    response: any;

    @CreatedAt
    createdAt: Date;

    @UpdatedAt
    updatedAt: Date;

    @DeletedAt
    deletedAt: Date;

    @BeforeValidate
    static validateData (action: Action, options: any) {
        if (!options.transaction) throw new Error('Missing transaction.');
github birkir / prime / packages / prime-core / src / models / Webhook.ts View on Github external
@PrimaryKey
  @Default(DataType.UUIDV4)
  @Column(DataType.UUID)
  public id;

  @Column(DataType.STRING)
  public name: string;

  @Column(DataType.STRING)
  public url: string;

  @Default('POST')
  @Column(DataType.STRING)
  public method: string;

  @Column(DataType.JSONB)
  public options: any;

  @Column(DataType.UUID)
  public userId: any;

  @CreatedAt
  @Column
  public createdAt: Date;

  @UpdatedAt
  @Column
  public updatedAt: Date;

  @DeletedAt
  @Column
  public deletedAt: Date;
github birkir / prime / packages / prime-core / src / models / WebhookCall.ts View on Github external
export class WebhookCall extends Model {
  @PrimaryKey
  @Default(DataType.UUIDV4)
  @Column(DataType.UUID)
  public id;

  @Column(DataType.UUID)
  public webhookId: any;

  @Column(DataType.BOOLEAN)
  public success: any;

  @Column(DataType.INTEGER)
  public status: number;

  @Column(DataType.JSONB)
  public request: any;

  @Column(DataType.JSONB)
  public response: any;

  @Column
  public executedAt: Date;

  @BelongsTo(() => Webhook, {
    foreignKey: 'webhookId',
    onDelete: 'SET NULL',
    onUpdate: 'SET NULL',
  })
  public webhook: Webhook;
}
github adrien2p / nestjs-api-ai / src / modules / common / models / Action.ts View on Github external
agentName: string;

    @Column({
        type: DataType.TEXT,
        allowNull: false
    })
    actionName: string;

    @Column({
        type: DataType.INTEGER,
        allowNull: false
    })
    requestId: number;

    @Column({
        type: DataType.JSONB,
        allowNull: false
    })
    data: any;

    @Column({
        type: DataType.JSONB,
        allowNull: false
    })
    response: any;

    @CreatedAt
    createdAt: Date;

    @UpdatedAt
    updatedAt: Date;
github birkir / prime / packages / prime-core / src / models / Settings.ts View on Github external
const masterLocale = [].concat(settings.locales).find((locale: any) => locale && locale.master);

    if (!masterLocale) {
      settings.locales.push(defaultLocale);
    }

    settings.masterLocale = [].concat(settings.locales).find((locale: any) => locale && locale.master);

    return settings;
  }
  @PrimaryKey
  @Default(DataType.UUIDV4)
  @Column(DataType.UUID)
  public id: any;

  @Column(DataType.JSONB)
  public data: any;

  @Column(DataType.UUID)
  public userId;

  @CreatedAt
  @Column
  public createdAt: Date;

  @UpdatedAt
  @Column
  public updatedAt: Date;

  @BelongsTo(() => User, 'userId')
  public user: User;
}
github birkir / prime / packages / prime-core / src / models / WebhookCall.ts View on Github external
@Column(DataType.UUID)
  public id;

  @Column(DataType.UUID)
  public webhookId: any;

  @Column(DataType.BOOLEAN)
  public success: any;

  @Column(DataType.INTEGER)
  public status: number;

  @Column(DataType.JSONB)
  public request: any;

  @Column(DataType.JSONB)
  public response: any;

  @Column
  public executedAt: Date;

  @BelongsTo(() => Webhook, {
    foreignKey: 'webhookId',
    onDelete: 'SET NULL',
    onUpdate: 'SET NULL',
  })
  public webhook: Webhook;
}
github birkir / prime / packages / prime-core / src / models / ContentType.ts View on Github external
@Column
  public title: string;

  @Default(false)
  @Column
  public isSlice: boolean;

  @Default(false)
  @Column
  public isTemplate: boolean;

  @Column(DataType.JSONB)
  public groups: any;

  @Column(DataType.JSONB)
  public settings: any;

  @Column(DataType.UUID)
  public userId: any;

  @HasMany(() => ContentEntry, {
    onUpdate: 'SET NULL',
    onDelete: 'SET NULL',
  })
  public contentEntries: ContentEntry;

  @HasMany(() => ContentTypeField)
  public fields: ContentTypeField[];

  @BelongsTo(() => User, 'userId')
  public user: User;
github birkir / prime / packages / prime-core / src / models / ContentType.ts View on Github external
@Unique
  @Column
  public name: string;

  @Column
  public title: string;

  @Default(false)
  @Column
  public isSlice: boolean;

  @Default(false)
  @Column
  public isTemplate: boolean;

  @Column(DataType.JSONB)
  public groups: any;

  @Column(DataType.JSONB)
  public settings: any;

  @Column(DataType.UUID)
  public userId: any;

  @HasMany(() => ContentEntry, {
    onUpdate: 'SET NULL',
    onDelete: 'SET NULL',
  })
  public contentEntries: ContentEntry;

  @HasMany(() => ContentTypeField)
  public fields: ContentTypeField[];
github BMalaichik / nestjs-starter-kit / packages / backend / src / modules / db / entities / file.entity.ts View on Github external
@Column({ type: DataType.STRING })
    description: string;

    @Column({  allowNull: false })
    key: string;

    @Column({  allowNull: false })
    name: string;

    @Column({ allowNull: false })
    uploadedByUserId: number;

    @Column({
        allowNull: false,
        type: DataType.JSONB,
    })
    context: {
        departmentId?: number;
        clientId?: number;
    };

    @CreatedAt
    createdAt?: Date;

    @UpdatedAt
    updatedAt?: Date;
}