67 lines
1.2 KiB
JavaScript
67 lines
1.2 KiB
JavaScript
const config = require('../../config');
|
|
const providers = config.providers;
|
|
const crypto = require('crypto');
|
|
const bcrypt = require('bcrypt');
|
|
const moment = require('moment');
|
|
|
|
module.exports = function(sequelize, DataTypes) {
|
|
const fishing_hotspots = sequelize.define(
|
|
'fishing_hotspots',
|
|
{
|
|
id: {
|
|
type: DataTypes.UUID,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
primaryKey: true,
|
|
},
|
|
|
|
location_name: {
|
|
type: DataTypes.TEXT,
|
|
|
|
},
|
|
|
|
latitude: {
|
|
type: DataTypes.DECIMAL,
|
|
|
|
},
|
|
|
|
longitude: {
|
|
type: DataTypes.DECIMAL,
|
|
|
|
},
|
|
|
|
importHash: {
|
|
type: DataTypes.STRING(255),
|
|
allowNull: true,
|
|
unique: true,
|
|
},
|
|
},
|
|
{
|
|
timestamps: true,
|
|
paranoid: true,
|
|
freezeTableName: true,
|
|
},
|
|
);
|
|
|
|
fishing_hotspots.associate = (db) => {
|
|
|
|
db.fishing_hotspots.belongsTo(db.organizations, {
|
|
as: 'organizations',
|
|
foreignKey: {
|
|
name: 'organizationsId',
|
|
},
|
|
constraints: false,
|
|
});
|
|
|
|
db.fishing_hotspots.belongsTo(db.users, {
|
|
as: 'createdBy',
|
|
});
|
|
|
|
db.fishing_hotspots.belongsTo(db.users, {
|
|
as: 'updatedBy',
|
|
});
|
|
};
|
|
|
|
return fishing_hotspots;
|
|
};
|
|
|