21 lines
840 B
JavaScript
21 lines
840 B
JavaScript
const { DataTypes } = require('sequelize');
|
|
const { sequelize } = require('../config/database');
|
|
|
|
const Room = sequelize.define('rooms', {
|
|
id: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, primaryKey: true },
|
|
room_code: { type: DataTypes.STRING(20), allowNull: false },
|
|
room_name: { type: DataTypes.STRING(100), allowNull: false },
|
|
school_id: { type: DataTypes.UUID, allowNull: false },
|
|
room_type: { type: DataTypes.ENUM('classroom', 'lab', 'library', 'gym', 'other') },
|
|
capacity: { type: DataTypes.INTEGER },
|
|
floor: { type: DataTypes.INTEGER },
|
|
created_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
updated_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
}, {
|
|
tableName: 'rooms',
|
|
timestamps: true,
|
|
underscored: true,
|
|
});
|
|
|
|
module.exports = Room;
|