How to use the sequelize-typescript.DataType.STRING 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 englercj / playground / server / src / models / Playground.ts View on Github external
*/
    @Column({
        type: DataType.CHAR(63),
        allowNull: false,
        defaultValue: () => nanoid(),
        unique: 'unique_slug',
        // unique: 'unique_slug_version',
    })
    slug: string;

    /**
     * The user-defined name of the playground.
     *
     */
    @Column({
        type: DataType.STRING(1023),
    })
    name: string;

    /**
     * The user-defined description of the playground.
     *
     */
    @Column({
        type: DataType.STRING(4095),
    })
    description: string;

    /**
     * The playground contents.
     *
     */
github thx / rap2-delos / src / models / bo / property.ts View on Github external
@AllowNull(false)
  @Column({
    type: DataType.ENUM(TYPES.STRING, TYPES.NUMBER, TYPES.BOOLEAN, TYPES.OBJECT, TYPES.ARRAY, TYPES.FUNCTION, TYPES.REGEXP, TYPES.Null),
    comment: 'property type',
  })
  /** Data Type */
  type: string

  @AllowNull(false)
  @Default(2)
  @Column
  /** request params type (position) */
  pos: number

  @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
github thx / rap2-delos / src / models / bo / property.ts View on Github external
comment: 'property type',
  })
  /** Data Type */
  type: string

  @AllowNull(false)
  @Default(2)
  @Column
  /** request params type (position) */
  pos: number

  @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())
github atlassian / nucleus / src / db / sequelize / models / index.ts View on Github external
registered: boolean;

  @ForeignKey(() => App)
  @Column(DataType.INTEGER)
  appId: number;

  @BelongsTo(() => App)
  app: App;

  @HasMany(() => WebHookError)
  errors: WebHookError[];
}

@Table
export class WebHookError extends Model {
  @Column(DataType.STRING(1000))
  message: string;

  @Column(DataType.INTEGER)
  responseCode: number;

  @Column(DataType.STRING(10000))
  responseBody: string;

  @ForeignKey(() => WebHook)
  @Column(DataType.INTEGER)
  webHookId: number;

  @BelongsTo(() => WebHook)
  webHook: WebHook;
}
github atlassian / nucleus / src / db / sequelize / models / index.ts View on Github external
@Table
export class File extends Model {
  @Column(DataType.STRING)
  fileName: string;

  @Column(DataType.STRING)
  platform: string;

  @Column(DataType.STRING)
  arch: string;

  @Column(DataType.STRING)
  type: string;

  @Column(DataType.STRING({ length: 40 }))
  sha1: string;

  @Column(DataType.STRING({ length: 64 }))
  sha256: string;

  @ForeignKey(() => Version)
  @Column(DataType.INTEGER)
  versionId: number;

  @BelongsTo(() => Version)
  version: Version;
}

@Table
export class Migration extends Model implements NucleusMigration {
  @Column(DataType.STRING)
github BMalaichik / nestjs-starter-kit / packages / backend / src / modules / db / entities / contact.entity.ts View on Github external
type: DataType.STRING(100),
    })
    public firstName: string;

    @Column({
        type: DataType.DATEONLY,
    })
    public dateOfBirth: string;

    @Column({
        type: DataType.STRING(100),
    })
    public title: string;

    @Column({
        type: DataType.STRING(100),
    })
    public lastName: string;

    @Column({
        type: DataType.STRING,
    })
    public city: string;

    @Column({
        type: DataType.STRING,
    })
    public zip: string;

    @Column({
        type: DataType.STRING,
    })
github thx / rap2-delos / src / models / bo / user.ts View on Github external
import { Table, Column, Model, HasMany, AutoIncrement, PrimaryKey, AllowNull, DataType, Unique, BelongsToMany } from 'sequelize-typescript'
import { Organization, Repository, OrganizationsMembers, RepositoriesMembers } from '../'

@Table({ paranoid: true, freezeTableName: false, timestamps: true })
export default class User extends Model {

  @AutoIncrement
  @PrimaryKey
  @Column
  id: number

  @AllowNull(false)
  @Column(DataType.STRING(32))
  fullname: string

  @Column(DataType.STRING(32))
  password: string

  @AllowNull(false)
  @Unique
  @Column(DataType.STRING(128))
  email: string

  @HasMany(() => Organization, 'ownerId')
  ownedOrganizations: Organization[]

  @BelongsToMany(() => Organization, () => OrganizationsMembers)
  joinedOrganizations: Organization[]

  @HasMany(() => Repository, 'ownerId')
  ownedRepositories: Repository[]
github thx / rap2-delos / src / models / bo / organization.ts View on Github external
})
  }

  @AutoIncrement
  @PrimaryKey
  @Column
  id: number

  @AllowNull(false)
  @Column(DataType.STRING(256))
  name: string

  @Column(DataType.TEXT)
  description: string

  @Column(DataType.STRING(256))
  logo: string

  @AllowNull(false)
  @Default(true)
  @Column({ comment: 'true:public, false:private' })
  visibility: boolean

  @ForeignKey(() => User)
  @Column
  creatorId: number

  @ForeignKey(() => User)
  @Column
  ownerId: number

  @BelongsTo(() => User, 'creatorId')
github thx / rap2-delos / src / models / bo / notification.ts View on Github external
@PrimaryKey
  @Column
  id: number

  @Column({ comment: 'sender' })
  fromId: number

  @AllowNull(false)
  @Column({ comment: 'receiver' })
  toId: number

  @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 thx / rap2-delos / src / models / bo / repository.ts View on Github external
@AutoIncrement
  @PrimaryKey
  @Column
  id: number

  @AllowNull(false)
  @Column(DataType.STRING(256))
  name: string

  @Column(DataType.TEXT)
  description: string

  @Column(DataType.STRING(256))
  logo: string

  @Column(DataType.STRING(32))
  token: string

  @AllowNull(false)
  @Default(true)
  @Column({ comment: 'true:public, false:private' })
  visibility: boolean

  @ForeignKey(() => User)
  @Column
  ownerId: number

  @ForeignKey(() => Organization)
  @Column
  organizationId: number

  @ForeignKey(() => User)