How to use the sequelize-typescript.Default 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 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;
github oughtinc / mosaic / server / lib / models / experiment.ts View on Github external
@Column(DataType.STRING)
  public name: string;

  @AllowNull
  @Default(null)
  @Column(DataType.INTEGER)
  public eligibilityRank: number;

  @Column(DataType.JSON)
  public description: Object;

  @Column(DataType.JSON)
  public metadata: Object;

  @AllowNull(false)
  @Default(true)
  @Column(DataType.BOOLEAN)
  public areNewWorkspacesOracleOnlyByDefault: boolean;

  @BelongsToMany(() => Tree, "ExperimentTreeRelation", "ExperimentId", "TreeId")
  public trees: Tree[];

  @BelongsToMany(
    () => Experiment,
    "FallbackRelation",
    "primaryExperimentId",
    "fallbackExperimentId",
  )
  public fallbacks: Experiment[];

  @HasMany(() => Instructions, "experimentId")
  public instructions: Instructions[];
github thx / rap2-delos / src / models / bo / property.ts View on Github external
@AllowNull(false)
  @Column(DataType.STRING(256))
  name: string

  @Column({ type: DataType.STRING(128), comment: 'property generation rules' })
  rule: string

  @Column({ type: DataType.TEXT, comment: 'value of this property' })
  value: string

  @Column(DataType.TEXT)
  description: string

  @AllowNull(false)
  @Default(-1)
  @Column({ comment: 'parent property ID' })
  parentId: number

  @AllowNull(false)
  @Default(1)
  @Column(DataType.BIGINT())
  priority: number

  @ForeignKey(() => Interface)
  @Column
  interfaceId: number

  @ForeignKey(() => User)
  @Column
  creatorId: number
github danielgerlag / workflow-es / providers / workflow-es-mysql / src / models / subscription.ts View on Github external
import { Table, Model, Column, Default, PrimaryKey, BelongsTo, DataType} from 'sequelize-typescript'
import { Workflow } from './workflow'

@Table({
    timestamps: false,
    freezeTableName: true
})
export class Subscription extends Model {
    
    @Default(DataType.UUIDV1)
    @Column(DataType.UUID)
    @PrimaryKey
    id: string;
    
    @BelongsTo(() => Workflow)
    workflowId: Workflow;
    
    @Column
    stepId: number;
    
    @Column
    eventName: string;

    @Column(DataType.TEXT)
    get eventKey(): any {
        return JSON.parse(this.getDataValue('eventKey'));
github birkir / prime / packages / prime-core / src / models / ContentTypeField.ts View on Github external
public name: string;

  @Column
  public title: string;

  @Column
  public description: string;

  @Column
  public type: string;

  @Default('Main')
  @Column
  public group: string;

  @Default(0)
  @Column
  public position: number;

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

  @ForeignKey(() => ContentType)
  @Column(DataType.UUID)
  public contentTypeId;

  @ForeignKey(() => ContentTypeField)
  @Column(DataType.UUID)
  public contentTypeFieldId;

  @BelongsTo(() => ContentType, {
github thx / rap2-delos / src / models / bo / notification.ts View on Github external
@AllowNull(false)
  @Column({ comment: 'msg type' })
  type: string

  @Column(DataType.STRING(128))
  param1: string

  @Column(DataType.STRING(128))
  param2: string

  @Column(DataType.STRING(128))
  param3: string

  @AllowNull(false)
  @Default(false)
  @Column
  readed: boolean
}
github birkir / prime / packages / prime-core / src / models / ContentEntry.ts View on Github external
public entryId: string;

  @PrimaryKey
  @Default(DataType.UUIDV4)
  @Column(DataType.UUID)
  public versionId: any;

  @ForeignKey(() => ContentType)
  @Column(DataType.UUID)
  public contentTypeId: any;

  @ForeignKey(() => ContentRelease)
  @Column(DataType.UUID)
  public contentReleaseId: any;

  @Default('en')
  @Column
  public language: string;

  @Column
  public isPublished: boolean;

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

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

  @CreatedAt
  @Column
  public createdAt: Date;
github TeamHive / nestjs-seed / src / app / modules / common / entities / base.entity.ts View on Github external
import * as Sequelize from 'sequelize';
import { Table, Column, Model, Unique, Default } from 'sequelize-typescript';

@Table({
    paranoid: true,
    timestamps: true,
    underscored: true,
    freezeTableName: true
})
export class BaseEntity<i> extends Model&gt; {
    @Unique
    @Default(Sequelize.UUIDV4)
    @Column({
        type: Sequelize.UUID,
        field: 'identity'
    })
    identity: string;
}
</i>