Files
yourpart3/backend/models/taxi/taxiMap.js
Torsten Schulz (local) 1ab9407e79
All checks were successful
Deploy to production / deploy (push) Successful in 2m56s
Refactor code structure for improved readability and maintainability; optimize performance across multiple modules.
2026-07-21 09:08:15 +02:00

72 lines
1.4 KiB
JavaScript
Executable File

import { DataTypes } from 'sequelize';
import { sequelize } from '../../utils/sequelize.js';
const TaxiMap = sequelize.define('TaxiMap', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
name: {
type: DataTypes.STRING(100),
allowNull: false
},
description: {
type: DataTypes.TEXT,
allowNull: true
},
width: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 8,
comment: 'Map width in tiles'
},
height: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 8,
comment: 'Map height in tiles'
},
tileSize: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 50,
comment: 'Size of each tile in pixels'
},
mapTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
comment: 'Reference to TaxiMapType'
},
isActive: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true
},
isDefault: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
comment: 'Whether this is the default map for new games'
},
// createdAt/updatedAt via timestamps
}, {
tableName: 'taxi_map',
schema: 'taxi',
timestamps: true,
underscored: true,
indexes: [
{
fields: ['name']
},
{
fields: ['is_active']
},
{
fields: ['is_default']
},
]
});
export default TaxiMap;