mirror of
https://github.com/Spythere/station-manager-2.0.git
synced 2026-05-03 05:28:13 +00:00
refactor: revamped vehicle manager adjusted for new API, improved file structure
This commit is contained in:
@@ -1,4 +1,14 @@
|
||||
export type VehicleAPIResponse = IVehicle[];
|
||||
export type VehicleAPIResponse = IVehicleAPI[];
|
||||
export type VehicleGroupAPIResponse = IVehicleGroup[];
|
||||
|
||||
export interface IVehicleAPI {
|
||||
id: number;
|
||||
name: string;
|
||||
type: string;
|
||||
cabinName?: string;
|
||||
restrictions?: IVehicleRestrictions;
|
||||
vehicleGroupsId: number;
|
||||
}
|
||||
|
||||
export interface IVehicle {
|
||||
id: number;
|
||||
@@ -6,7 +16,6 @@ export interface IVehicle {
|
||||
type: string;
|
||||
cabinName?: string;
|
||||
restrictions?: IVehicleRestrictions;
|
||||
vehicleGroupsId: number;
|
||||
group: IVehicleGroup;
|
||||
}
|
||||
|
||||
@@ -15,14 +24,24 @@ export interface IVehicleRestrictions {
|
||||
teamOnly?: boolean;
|
||||
}
|
||||
|
||||
export interface IVehicleGroupMassSpeeds {
|
||||
none: number;
|
||||
passenger: Record<number, number> | null;
|
||||
cargo: Record<number, number> | null;
|
||||
}
|
||||
|
||||
export interface IVehicleGroup {
|
||||
id: number;
|
||||
name: string;
|
||||
speed: number;
|
||||
speedLoaded: number | null;
|
||||
speedLoco: number | null;
|
||||
length: number;
|
||||
weight: number;
|
||||
cargoTypes?: IVehicleCargoType[];
|
||||
locoProps?: IVehicleLocoProps;
|
||||
cargoTypes: IVehicleCargoType[] | null;
|
||||
locoProps: IVehicleLocoProps | null;
|
||||
massSpeeds: IVehicleGroupMassSpeeds | null;
|
||||
_count: { vehicles: number };
|
||||
}
|
||||
|
||||
export interface IVehicleCargoType {
|
||||
@@ -37,17 +56,21 @@ export interface IVehicleLocoProps {
|
||||
|
||||
export interface IVehicleTableRow {
|
||||
vehicleRef: IVehicle;
|
||||
pendingChanges: Partial<IVehicle>;
|
||||
// pendingChanges: Partial<IVehicle>;
|
||||
}
|
||||
|
||||
export interface IVehicleGroupTableRow {
|
||||
vehicleGroupRef: IVehicleGroup;
|
||||
// pendingChanges: Partial<IVehicleGroup>;
|
||||
}
|
||||
|
||||
export enum VehicleEditRowKey {
|
||||
NAME = 'name',
|
||||
TYPE = 'type',
|
||||
CABIN = 'cabinName',
|
||||
|
||||
}
|
||||
|
||||
export enum VehicleEditRestrictionKey {
|
||||
SPONSOR_ONLY = "sponsorOnly",
|
||||
TEAM_ONLY = "teamOnly"
|
||||
}
|
||||
SPONSOR_ONLY = 'sponsorOnly',
|
||||
TEAM_ONLY = 'teamOnly',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user