- Implemented new endpoints in AdminController for managing Falukant regions, including fetching, updating, and deleting region distances. - Enhanced the FalukantService with methods for retrieving region distances and handling upsert operations. - Updated the router to expose new routes for region management and transport creation. - Introduced a transport management interface in the frontend, allowing users to create and manage transports between branches. - Added localization for new transport-related terms and improved the vehicle management interface to include transport options. - Enhanced the database initialization logic to support new region and transport models.
46 lines
916 B
JavaScript
46 lines
916 B
JavaScript
import { Model, DataTypes } from 'sequelize';
|
||
import { sequelize } from '../../../utils/sequelize.js';
|
||
|
||
class Vehicle extends Model {}
|
||
|
||
Vehicle.init(
|
||
{
|
||
vehicleTypeId: {
|
||
type: DataTypes.INTEGER,
|
||
allowNull: false,
|
||
},
|
||
falukantUserId: {
|
||
type: DataTypes.INTEGER,
|
||
allowNull: false,
|
||
},
|
||
regionId: {
|
||
type: DataTypes.INTEGER,
|
||
allowNull: false,
|
||
},
|
||
condition: {
|
||
// current condition of the vehicle (0–100)
|
||
type: DataTypes.INTEGER,
|
||
allowNull: false,
|
||
defaultValue: 100,
|
||
},
|
||
availableFrom: {
|
||
// timestamp when the vehicle becomes available for use
|
||
type: DataTypes.DATE,
|
||
allowNull: false,
|
||
defaultValue: DataTypes.NOW,
|
||
},
|
||
},
|
||
{
|
||
sequelize,
|
||
modelName: 'Vehicle',
|
||
tableName: 'vehicle',
|
||
schema: 'falukant_data',
|
||
timestamps: true,
|
||
underscored: true,
|
||
}
|
||
);
|
||
|
||
export default Vehicle;
|
||
|
||
|