Initial commit - Rentall App

- Full-stack rental marketplace application
- React frontend with TypeScript
- Node.js/Express backend with JWT authentication
- Features: item listings, rental requests, calendar availability, user profiles
This commit is contained in:
jackiettran
2025-07-15 21:21:09 -04:00
commit c09384e3ea
53 changed files with 24425 additions and 0 deletions

76
backend/models/Rental.js Normal file
View File

@@ -0,0 +1,76 @@
const { DataTypes } = require('sequelize');
const sequelize = require('../config/database');
const Rental = sequelize.define('Rental', {
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true
},
itemId: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: 'Items',
key: 'id'
}
},
renterId: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: 'Users',
key: 'id'
}
},
ownerId: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: 'Users',
key: 'id'
}
},
startDate: {
type: DataTypes.DATE,
allowNull: false
},
endDate: {
type: DataTypes.DATE,
allowNull: false
},
totalAmount: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false
},
status: {
type: DataTypes.ENUM('pending', 'confirmed', 'active', 'completed', 'cancelled'),
defaultValue: 'pending'
},
paymentStatus: {
type: DataTypes.ENUM('pending', 'paid', 'refunded'),
defaultValue: 'pending'
},
deliveryMethod: {
type: DataTypes.ENUM('pickup', 'delivery'),
defaultValue: 'pickup'
},
deliveryAddress: {
type: DataTypes.TEXT
},
notes: {
type: DataTypes.TEXT
},
rating: {
type: DataTypes.INTEGER,
validate: {
min: 1,
max: 5
}
},
review: {
type: DataTypes.TEXT
}
});
module.exports = Rental;