31745/backend/src/db/models/scouting.js
Flatlogic Bot 8a3fe26358 testscout
2025-05-23 21:46:46 +00:00

74 lines
1.4 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 scouting = sequelize.define(
'scouting',
{
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true,
},
team_number: {
type: DataTypes.INTEGER,
},
coral_l1: {
type: DataTypes.INTEGER,
},
coral_l2: {
type: DataTypes.INTEGER,
},
coral_l3: {
type: DataTypes.INTEGER,
},
coral_l4: {
type: DataTypes.INTEGER,
},
algae_processor: {
type: DataTypes.INTEGER,
},
algae_net: {
type: DataTypes.INTEGER,
},
importHash: {
type: DataTypes.STRING(255),
allowNull: true,
unique: true,
},
},
{
timestamps: true,
paranoid: true,
freezeTableName: true,
},
);
scouting.associate = (db) => {
/// loop through entities and it's fields, and if ref === current e[name] and create relation has many on parent entity
//end loop
db.scouting.belongsTo(db.users, {
as: 'createdBy',
});
db.scouting.belongsTo(db.users, {
as: 'updatedBy',
});
};
return scouting;
};