Files
rentall-app/backend/models/ConditionCheck.js
2025-10-06 15:41:48 -04:00

53 lines
1.0 KiB
JavaScript

const { DataTypes } = require("sequelize");
const sequelize = require("../config/database");
const ConditionCheck = sequelize.define("ConditionCheck", {
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true,
},
rentalId: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: "Rentals",
key: "id",
},
},
checkType: {
type: DataTypes.ENUM(
"pre_rental_owner",
"rental_start_renter",
"rental_end_renter",
"post_rental_owner"
),
allowNull: false,
},
photos: {
type: DataTypes.ARRAY(DataTypes.STRING),
defaultValue: [],
},
notes: {
type: DataTypes.TEXT,
},
submittedBy: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: "Users",
key: "id",
},
},
submittedAt: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
},
metadata: {
type: DataTypes.JSONB,
defaultValue: {},
},
});
module.exports = ConditionCheck;