Änderungen: - Entfernen der Methode `getMapByPosition` aus dem `TaxiMapController` und der zugehörigen Logik im `TaxiMapService`, um die Komplexität zu reduzieren. - Anpassung der Datenbankmodelle für `TaxiMap`, `TaxiLevelStats` und `TaxiMapType`, um die Tabellennamen zu vereinheitlichen. - Aktualisierung der Routen im `taxiMapRouter`, um die entfernte Funktionalität zu reflektieren. - Hinzufügung von neuen Importen in `index.js`, um die neuen Modelle zu integrieren. - Verbesserung der Benutzeroberfläche durch neue Erfolgsmeldungen in den Übersetzungsdateien für die Admin-Oberfläche. Diese Anpassungen tragen zur Vereinfachung der Codebasis und zur Verbesserung der Benutzererfahrung im Taxi-Minispiel bei.
85 lines
1.6 KiB
JavaScript
85 lines
1.6 KiB
JavaScript
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'
|
|
},
|
|
mapData: {
|
|
type: DataTypes.JSON,
|
|
allowNull: false,
|
|
comment: '2D array of map type IDs for each tile position'
|
|
},
|
|
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: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: DataTypes.NOW
|
|
},
|
|
updatedAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: DataTypes.NOW
|
|
}
|
|
}, {
|
|
tableName: 'taxi_map',
|
|
schema: 'taxi',
|
|
timestamps: true,
|
|
indexes: [
|
|
{
|
|
fields: ['name']
|
|
},
|
|
{
|
|
fields: ['is_active']
|
|
},
|
|
{
|
|
fields: ['is_default']
|
|
},
|
|
]
|
|
});
|
|
|
|
export default TaxiMap;
|