How to use the sequelize-typescript.DataType.UUID 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 / Navigation.ts View on Github external
import { Column, DataType, Model, PrimaryKey, Table } from 'sequelize-typescript';

@Table
export class Navigation extends Model {
  @PrimaryKey
  @Column({
    type: DataType.UUID,
    defaultValue: DataType.UUIDV4,
  })
  public id;

  @Column(DataType.UUID)
  public parentNavigationId;

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

  @Column(DataType.UUID)
  public contentTypeId: string;

  @Column(DataType.UUID)
  public contentEntryId: string;
github birkir / prime / packages / prime-core / src / models / Settings.ts View on Github external
master: true,
    };

    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;
github oughtinc / mosaic / server / lib / models / pointerImport.ts View on Github external
allowNull: false,
  })
  public id: string;

  @Column(DataType.BOOLEAN)
  public isLocked: boolean;

  @ForeignKey(() => Pointer)
  @Column(DataType.UUID)
  public pointerId: string;

  @BelongsTo(() => Pointer)
  public pointer: Pointer;

  @ForeignKey(() => Workspace)
  @Column(DataType.UUID)
  public workspaceId: string;

  @BelongsTo(() => Workspace)
  public workspace: Workspace;
}
github oughtinc / mosaic / server / lib / models / assignment.ts View on Github external
public user: User;

  @Column(DataType.BIGINT)
  public startAtTimestamp: number;

  @Column(DataType.BIGINT)
  public endAtTimestamp: number;

  @Column(DataType.BOOLEAN)
  public isOracle: boolean;

  @Column(DataType.BOOLEAN)
  public isTimed: boolean;

  @ForeignKey(() => Workspace)
  @Column(DataType.UUID)
  public workspaceId: string;

  @BelongsTo(() => Workspace)
  public Workspace: Workspace;

  @ForeignKey(() => Experiment)
  @Column(DataType.UUID)
  public experimentId: string;

  @BelongsTo(() => Experiment)
  public Experiments: Experiment;

  @HasMany(() => Snapshot)
  public snapshots: Snapshot[];
}
github primecms / heroku / src / models / ContentEntry.ts View on Github external
import { ContentType } from './ContentType';

@Scopes({
  contentType: {
    include: [{
      model: () => ContentType,
      through: { attributes: [] },
    }],
  },
})
@Table
export class ContentEntry extends Model {

  @PrimaryKey
  @Column({
    type: DataType.UUID,
    defaultValue: DataType.UUIDV4
  })
  id;

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

  @Column
  language: string;

  @Column(DataType.JSON)
  data;

  @BelongsTo(() => ContentType)
  contentType: ContentType;
github oughtinc / mosaic / server / lib / models / instructions.ts View on Github external
"returningMaliciousOracle",
  "lazyPointerUnlock",
];

@Table
export default class Instructions extends Model {
  @AllowNull(false)
  @Column(DataType.ENUM({ values: InstructionTypes }))
  public type: string;

  @AllowNull(false)
  @Column(DataType.TEXT)
  public value: string;

  @ForeignKey(() => Experiment)
  @Column(DataType.UUID)
  public experimentId: string;

  @BelongsTo(() => Experiment)
  public experiment: Experiment;
}
github oughtinc / mosaic / server / lib / models / tree.ts View on Github external
import Workspace from "./workspace";
import UserTreeOracleRelation from "./userTreeOracleRelation";
import User from "./user";

@Table
export default class Tree extends Model {
  @Column({
    type: DataType.UUID,
    primaryKey: true,
    defaultValue: UUIDV4,
    allowNull: false,
  })
  public id: string;

  @ForeignKey(() => Workspace)
  @Column(DataType.UUID)
  public rootWorkspaceId: string;

  @Column(DataType.BOOLEAN)
  public doesAllowOracleBypass: boolean;

  @Default(false)
  @Column(DataType.BOOLEAN)
  public isMIBWithoutRestarts: boolean;

  @AllowNull(false)
  @Default(1)
  @Column(DataType.INTEGER)
  public schedulingPriority: number;

  @AllowNull(false)
  @Default(6)