UNPKG

synt_backend

Version:

Synt light-weight node backend service

36 lines (35 loc) 957 B
"use strict"; const { Model } = require("sequelize"); module.exports = (sequelize, DataTypes) => { class LotPhaseUser extends Model { /** * Helper method for defining associations. * This method is not a part of Sequelize lifecycle. * The `models/index` file will call this method automatically. */ static associate(models) { // define association here this.hasOne(models.User, { foreignKey: "id", as: "User" }); this.hasOne(models.LotPhase, { foreignKey: "id", as: "LotPhase" }); } } LotPhaseUser.init( { //id: { primaryKey: true, type: DataTypes.INTEGER, autoIncrement: true }, type: DataTypes.ENUM( "owner", "bare_owner", "usufructuary", "viewer", "manager" ), is_commissioner: DataTypes.BOOLEAN, }, { sequelize, modelName: "LotPhaseUser", tableName: "LotPhaseUser", } ); return LotPhaseUser; };