- Introduced vehicle types and transport management in the backend, including new models and associations for vehicles and transports. - Implemented service methods to retrieve vehicle types and handle vehicle purchases, ensuring user validation and transaction management. - Updated the FalukantController and router to expose new endpoints for fetching vehicle types and buying vehicles. - Enhanced the frontend with a new transport tab in BranchView, allowing users to buy vehicles, and added localization for vehicle-related terms. - Included initialization logic for vehicle types in the database setup.
34 lines
583 B
JavaScript
34 lines
583 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,
|
|
},
|
|
},
|
|
{
|
|
sequelize,
|
|
modelName: 'Vehicle',
|
|
tableName: 'vehicle',
|
|
schema: 'falukant_data',
|
|
timestamps: true,
|
|
underscored: true,
|
|
}
|
|
);
|
|
|
|
export default Vehicle;
|
|
|
|
|