How to use the sequelize-typescript.AllowNull 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 oughtinc / mosaic / server / lib / models / notificationRequest.ts View on Github external
AllowNull,
  BelongsTo,
  Column,
  DataType,
  ForeignKey,
  Model,
  Table,
} from "sequelize-typescript";
import Experiment from "./experiment";
import User from "./user";
import getScheduler from "../scheduler";

@Table
export default class NotificationRequest extends Model {
  @ForeignKey(() => Experiment)
  @AllowNull(false)
  @Column(DataType.UUID)
  public experimentId: string;

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

  @ForeignKey(() => User)
  @AllowNull(false)
  @Column(DataType.STRING)
  public userId: string;

  @BelongsTo(() => User)
  public user: User;

  public static async findAllWithWorkAvailable() {
    // Notification system disabled
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")
github T-Systems-RUS / Portfolio / server / models / Project.ts View on Github external
@Column
    feedback: string;

    @Column({type: DataType.DECIMAL })
    pss: string;

    @Column
    active: boolean;

    @Column
    ishistory: boolean;

    @Column
    version: number;

    @AllowNull(false)
    @ForeignKey(() => Program)
    @Column
    programId: number;

    @BelongsTo(() => Program)
    program: Program;

    @ForeignKey(() => Domain)
    @Column
    domainId: number;

    @BelongsTo(() => Domain)
    domain: Domain;

    @ForeignKey(() => Type)
    @Column
github Hydractify / kanna_kobayashi / src / models / CommandLog.ts View on Github external
import { Model } from '../structures/Model';

/**
 * Keeps track of command usages
 */
@Table({
	tableName: 'command_logs',
	underscored: true,
	updatedAt: false,
})
export class CommandLog extends Model
{
	/**
	 * Name of the command
	 */
	@AllowNull(false)
	@Column({
		field: 'command_name',
		type: DataType.TEXT,
	})
	public readonly commandName!: string;

	/**
	 * Guild Id where this command ran
	 */
	@Column({
		field: 'guild_id',
		type: DataType.TEXT,
	})
	public readonly guildId!: string;

	/**
github thx / rap2-delos / src / models / bo / interface.ts View on Github external
public static METHODS = methods

  public request?: object
  public response?: object

  @AutoIncrement
  @PrimaryKey
  @Column
  id: number

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

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

  @AllowNull(false)
  @Column({ comment: 'API method' })
  method: string

  @Column(DataType.TEXT)
  description: string

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

  @Default(200)
github Hydractify / kanna_kobayashi / src / models / Quiz.ts View on Github external
},
		{
			name: 'Makoto Takiya',
			photo: 'https://myanimelist.cdn-dena.com/images/characters/4/317870.jpg',
		},
		{
			name: 'Shouta Magatsuchi',
			photo: 'https://68.media.tumblr.com/104abedcd97ce15a51ed3238091aedff/tumblr_op4vnkjh9g1uctmvwo7_1280.png',
		},
		{
			name: 'Saikawa Riko',
			photo: 'https://myanimelist.cdn-dena.com/images/characters/8/323304.jpg',
		},
	];

	@AllowNull(false)
	@Column({
		defaultValue: 15,
		type: DataType.INTEGER,
	})
	public duration!: number;

	@PrimaryKey
	@Validate({
		min: {
			args: 11,
			msg: 'guild_id must be 11 or larger!',
		},
	})
	@Column({
		field: 'guild_id',
		type: DataType.TEXT,