Skip to content

Instantly share code, notes, and snippets.

@kasir-barati
Last active January 3, 2021 11:13
Show Gist options
  • Save kasir-barati/bd82f3cdd8f8254b56208adaf1aa07c3 to your computer and use it in GitHub Desktop.
Save kasir-barati/bd82f3cdd8f8254b56208adaf1aa07c3 to your computer and use it in GitHub Desktop.
const { DataTypes, Model } = require("sequelize");
const sequelize = require("../sequelize");
class Role extends Model {
static col = {
id: "id",
name: "name",
};
static alias = {
user: "RoleHasUsers",
};
}
Role.init(
{
[Role.col.id]: {
type: DataTypes.UUID,
primaryKey: true,
defaultValue: DataTypes.UUIDV4,
},
[Role.col.name]: DataTypes.STRING,
},
{
sequelize: sequelize.getSeq(),
}
);
module.exports = Role;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment