restruct: types organization

This commit is contained in:
2024-12-02 17:03:33 +01:00
parent 56ae593d5e
commit 346d20fc08
11 changed files with 98 additions and 8 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ import { useStore } from '../../store';
import imageMixin from '../../mixins/imageMixin';
import stockMixin from '../../mixins/stockMixin';
import { IRealComposition, VehicleGroupType } from '../../types';
import { IRealComposition, VehicleGroupType } from '../../types/common.types';
function getVehicleType(stockType: string): VehicleGroupType {
if (/^E/.test(stockType)) return 'loco-electric';
+1 -1
View File
@@ -126,7 +126,7 @@ import imageMixin from '../../mixins/imageMixin';
import { useStore } from '../../store';
import stockPreviewMixin from '../../mixins/stockPreviewMixin';
import stockMixin from '../../mixins/stockMixin';
import { LocoGroupType, WagonGroupType } from '../../types';
import { LocoGroupType, WagonGroupType } from '../../types/common.types';
export default defineComponent({
mixins: [imageMixin, stockPreviewMixin, stockMixin],
+1 -1
View File
@@ -118,7 +118,7 @@ import { defineComponent } from 'vue';
import { useStore } from '../../store';
import stockMixin from '../../mixins/stockMixin';
import { ICargo, ICarWagon, IStock } from '../../types';
import { ICargo, ICarWagon, IStock } from '../../types/common.types';
import { isTractionUnit } from '../../utils/vehicleUtils';
import generatorDataJSON from '../../data/generatorData.json';
+1 -1
View File
@@ -98,7 +98,7 @@
import { defineComponent } from 'vue';
import { useStore } from '../../store';
import stockPreviewMixin from '../../mixins/stockPreviewMixin';
import { IVehicle } from '../../types';
import { IVehicle } from '../../types/common.types';
import { isTractionUnit } from '../../utils/vehicleUtils';
import stockMixin from '../../mixins/stockMixin';
import imageMixin from '../../mixins/imageMixin';
+3
View File
@@ -0,0 +1,3 @@
class ApiStockManager {
}
+1 -1
View File
@@ -1,6 +1,6 @@
import { defineComponent } from 'vue';
import { useStore } from '../store';
import { ICarWagon, ILocomotive, IStock, ICargo, IVehicle } from '../types';
import { ICarWagon, ILocomotive, IStock, ICargo, IVehicle } from '../types/common.types';
import { isTractionUnit } from '../utils/vehicleUtils';
export default defineComponent({
+1 -1
View File
@@ -1,6 +1,6 @@
import { defineComponent } from 'vue';
import { useStore } from '../store';
import { ICarWagon, ILocomotive, IStock, IVehicle, LocoGroupType, WagonGroupType } from '../types';
import { ICarWagon, ILocomotive, IStock, IVehicle, LocoGroupType, WagonGroupType } from '../types/common.types';
import { isTractionUnit } from '../utils/vehicleUtils';
export default defineComponent({
+1 -1
View File
@@ -9,7 +9,7 @@ import {
LocoGroupType,
WagonGroupType,
IVehicleData,
} from './types';
} from './types/common.types';
import { defineStore } from 'pinia';
import {
acceptableWeight,
+87
View File
@@ -0,0 +1,87 @@
// API namespace
export namespace API {
export interface ActiveData {
trains: Train[];
activeSceneries: ActiveScenery[];
}
}
export interface ActiveScenery {
dispatcherId: number;
dispatcherName: string;
dispatcherIsSupporter: boolean;
stationName: string;
stationHash: string;
region: string;
maxUsers: number;
currentUsers: number;
spawn: number;
lastSeen: number;
dispatcherExp: number;
nameFromHeader: string;
spawnString?: string;
networkConnectionString: string;
isOnline: number;
dispatcherRate: number;
dispatcherStatus: number;
}
export interface Train {
id: string;
trainNo: number;
mass: number;
speed: number;
length: number;
distance: number;
stockString: string;
driverName: string;
driverId: number;
driverIsSupporter: boolean;
driverLevel: number;
currentStationHash: string;
currentStationName: string;
signal: string;
connectedTrack: string;
online: number;
lastSeen: number;
region: string;
isTimeout: boolean;
timetable?: Timetable;
}
export interface Timetable {
SKR: boolean;
TWR: boolean;
hasDangerousCargo: boolean;
hasExtraDeliveries: boolean;
warningNotes: string;
category: string;
stopList: TimetableStop[];
route: string;
timetableId: number;
sceneries: string[];
path: string;
}
export interface TimetableStop {
stopName: string;
stopNameRAW: string;
stopType: string;
stopDistance: number;
pointId: string;
comments?: (null | string)[];
mainStop: boolean;
arrivalLine?: string;
arrivalTimestamp: number;
arrivalRealTimestamp: number;
arrivalDelay: number;
departureLine?: string;
departureTimestamp: number;
departureRealTimestamp: number;
departureDelay: number;
beginsHere: boolean;
terminatesHere: boolean;
confirmed: number;
stopped: number;
stopTime?: number;
}
+1 -1
View File
@@ -6,7 +6,7 @@ import {
IVehiclesAPIResponse,
LocoGroupType,
WagonGroupType,
} from '../types';
} from '../types/common.types';
import {
MassLimitLocoType,
SpeedLimitLocoType,