Add vehicle management features in Falukant
- 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.
This commit is contained in:
@@ -95,6 +95,9 @@ import PoliticalOfficeHistory from './falukant/log/political_office_history.js';
|
||||
import ElectionHistory from './falukant/log/election_history.js';
|
||||
import Underground from './falukant/data/underground.js';
|
||||
import UndergroundType from './falukant/type/underground.js';
|
||||
import VehicleType from './falukant/type/vehicle.js';
|
||||
import Vehicle from './falukant/data/vehicle.js';
|
||||
import Transport from './falukant/data/transport.js';
|
||||
import Blog from './community/blog.js';
|
||||
import BlogPost from './community/blog_post.js';
|
||||
import Campaign from './match3/campaign.js';
|
||||
@@ -421,6 +424,71 @@ export default function setupAssociations() {
|
||||
PromotionalGiftLog.belongsTo(FalukantCharacter, { foreignKey: 'recipientCharacterId', as: 'recipient' });
|
||||
FalukantCharacter.hasMany(PromotionalGiftLog, { foreignKey: 'recipientCharacterId', as: 'giftlogs' });
|
||||
|
||||
// Vehicles & Transports
|
||||
|
||||
VehicleType.hasMany(Vehicle, {
|
||||
foreignKey: 'vehicleTypeId',
|
||||
as: 'vehicles',
|
||||
});
|
||||
Vehicle.belongsTo(VehicleType, {
|
||||
foreignKey: 'vehicleTypeId',
|
||||
as: 'type',
|
||||
});
|
||||
|
||||
FalukantUser.hasMany(Vehicle, {
|
||||
foreignKey: 'falukantUserId',
|
||||
as: 'vehicles',
|
||||
});
|
||||
Vehicle.belongsTo(FalukantUser, {
|
||||
foreignKey: 'falukantUserId',
|
||||
as: 'owner',
|
||||
});
|
||||
|
||||
RegionData.hasMany(Vehicle, {
|
||||
foreignKey: 'regionId',
|
||||
as: 'vehicles',
|
||||
});
|
||||
Vehicle.belongsTo(RegionData, {
|
||||
foreignKey: 'regionId',
|
||||
as: 'region',
|
||||
});
|
||||
|
||||
Transport.belongsTo(RegionData, {
|
||||
foreignKey: 'sourceRegionId',
|
||||
as: 'sourceRegion',
|
||||
});
|
||||
Transport.belongsTo(RegionData, {
|
||||
foreignKey: 'targetRegionId',
|
||||
as: 'targetRegion',
|
||||
});
|
||||
|
||||
RegionData.hasMany(Transport, {
|
||||
foreignKey: 'sourceRegionId',
|
||||
as: 'outgoingTransports',
|
||||
});
|
||||
RegionData.hasMany(Transport, {
|
||||
foreignKey: 'targetRegionId',
|
||||
as: 'incomingTransports',
|
||||
});
|
||||
|
||||
Transport.belongsTo(ProductType, {
|
||||
foreignKey: 'productId',
|
||||
as: 'productType',
|
||||
});
|
||||
ProductType.hasMany(Transport, {
|
||||
foreignKey: 'productId',
|
||||
as: 'transports',
|
||||
});
|
||||
|
||||
Transport.belongsTo(Vehicle, {
|
||||
foreignKey: 'vehicleId',
|
||||
as: 'vehicle',
|
||||
});
|
||||
Vehicle.hasMany(Transport, {
|
||||
foreignKey: 'vehicleId',
|
||||
as: 'transports',
|
||||
});
|
||||
|
||||
PromotionalGift.hasMany(PromotionalGiftCharacterTrait, { foreignKey: 'gift_id', as: 'characterTraits' });
|
||||
PromotionalGift.hasMany(PromotionalGiftMood, { foreignKey: 'gift_id', as: 'promotionalgiftmoods' });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user