How to use the sequelize-typescript.DataType.CHAR 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
timestamps: true,
})
export class Playground extends Model implements IPlayground
{
    @BelongsToMany(() => Tag, () => PlaygroundTag)
    tags: Tag[];

    @HasMany(() => ExternalJs)
    externaljs: ExternalJs[];

    /**
     * A unique identifier that is used in the URL when referring to a Playground.
     *
     */
    @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;
github adrien2p / nestjs-api-ai / src / modules / common / models / ApiAiUser.ts View on Github external
id: number;

    @Column({
        type: DataType.CHAR(30),
        allowNull: false
    })
    firstName: string;

    @Column({
        type: DataType.CHAR(30),
        allowNull: false
    })
    lastName: string;

    @Column({
        type: DataType.CHAR(100),
        allowNull: false,
        validate: {
            isEmail: true,
            unique: "L'adresse e-mail fourni existe déjà, veuillez en choisir une autre."
        }
    })
    email: string;

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

    @Column({
        type: DataType.TEXT,
github adrien2p / nestjs-sequelize-jwt / src / modules / users / user.entity.ts View on Github external
tableName: 'users'
} as IDefineOptions;

@Table(tableOptions)
export class User extends Model {
    @Column({
        type: DataType.NUMERIC,
        allowNull: false,
        autoIncrement: true,
        unique: true,
        primaryKey: true
    })
    public id: number;

    @Column({
        type: DataType.CHAR(30),
        allowNull: false
    })
    public firstName: string;

    @Column({
        type: DataType.CHAR(30),
        allowNull: false
    })
    public lastName: string;

    @Column({
        type: DataType.CHAR(100),
        allowNull: false,
        validate: {
            isEmail: true,
            isUnique: async (value: string, next: Function): Promise => {
github adrien2p / nestjs-api-ai / src / modules / common / models / ApiAiUser.ts View on Github external
type: DataType.NUMERIC,
        allowNull: false,
        autoIncrement: true,
        unique: true,
        primaryKey: true
    })
    id: number;

    @Column({
        type: DataType.CHAR(30),
        allowNull: false
    })
    firstName: string;

    @Column({
        type: DataType.CHAR(30),
        allowNull: false
    })
    lastName: string;

    @Column({
        type: DataType.CHAR(100),
        allowNull: false,
        validate: {
            isEmail: true,
            unique: "L'adresse e-mail fourni existe déjà, veuillez en choisir une autre."
        }
    })
    email: string;

    @Column({
        type: DataType.TEXT,
github adrien2p / nestjs-graphql / src / modules / users / user.entity.ts View on Github external
public id: number;

    @Column({
        type: DataType.CHAR(30),
        allowNull: false,
    })
    public firstName: string;

    @Column({
        type: DataType.CHAR(30),
        allowNull: false,
    })
    public lastName: string;

    @Column({
        type: DataType.CHAR(100),
        allowNull: false,
        validate: {
            isEmail: true,
            isUnique: async (value: string, next: Function): Promise => {
                const isExist = await User.findOne({ where: { email: value }});
                if (isExist) {
                    const error = new MessageCodeError('user:create:emailAlreadyExist');
                    next(error);
                }
                next();
            },
        },
    })
    public email: string;

    @Column({
github adrien2p / nestjs-graphql / src / modules / users / user.entity.ts View on Github external
type: DataType.INTEGER,
        allowNull: false,
        autoIncrement: true,
        unique: true,
        primaryKey: true,
    })
    public id: number;

    @Column({
        type: DataType.CHAR(30),
        allowNull: false,
    })
    public firstName: string;

    @Column({
        type: DataType.CHAR(30),
        allowNull: false,
    })
    public lastName: string;

    @Column({
        type: DataType.CHAR(100),
        allowNull: false,
        validate: {
            isEmail: true,
            isUnique: async (value: string, next: Function): Promise => {
                const isExist = await User.findOne({ where: { email: value }});
                if (isExist) {
                    const error = new MessageCodeError('user:create:emailAlreadyExist');
                    next(error);
                }
                next();
github adrien2p / nestjs-graphql / src / modules / cars / car.entity.ts View on Github external
allowNull: false,
        autoIncrement: true,
        unique: true,
        primaryKey: true,
    })
    public id: number;

    @Column({
        type: DataType.INTEGER,
        allowNull: false,
    })
    @ForeignKey(() => User)
    public userId: number;

    @Column({
        type: DataType.CHAR(50),
        allowNull: false,
    })
    public brandName: string;

    @Column({
        type: DataType.DATE,
        allowNull: false,
    })
    public purchaseDate: Date;

    @CreatedAt
    public createdAt: Date;

    @UpdatedAt
    public updatedAt: Date;
github adrien2p / nestjs-sequelize-jwt / src / modules / users / user.entity.ts View on Github external
public id: number;

    @Column({
        type: DataType.CHAR(30),
        allowNull: false
    })
    public firstName: string;

    @Column({
        type: DataType.CHAR(30),
        allowNull: false
    })
    public lastName: string;

    @Column({
        type: DataType.CHAR(100),
        allowNull: false,
        validate: {
            isEmail: true,
            isUnique: async (value: string, next: Function): Promise => {
                const isExist = await User.findOne({ where: { email: value } });
                if (isExist) {
                    const error = new MessageCodeError('user:create:emailAlreadyExist');
                    next(error);
                }
                next();
            }
        }
    })
    public email: string;

    @Column({