view models and data structure
This commit is contained in:
parent
45fe7b34c3
commit
5faa4b7906
37 changed files with 157 additions and 516 deletions
|
@ -68,24 +68,14 @@ export const useDamageReportStore = defineStore("damageReport", {
|
|||
},
|
||||
async createDamageReport(damageReport: CreateDamageReportViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/damageReport`, {
|
||||
salutationId: damageReport.salutationId,
|
||||
firstname: damageReport.firstname,
|
||||
lastname: damageReport.lastname,
|
||||
nameaffix: damageReport.nameaffix,
|
||||
birthdate: damageReport.birthdate,
|
||||
internalId: damageReport.internalId,
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchDamageReports();
|
||||
return result;
|
||||
},
|
||||
async updateDamageReport(damageReport: UpdateDamageReportViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/damageReport/${damageReport.id}`, {
|
||||
salutationId: damageReport.salutationId,
|
||||
firstname: damageReport.firstname,
|
||||
lastname: damageReport.lastname,
|
||||
nameaffix: damageReport.nameaffix,
|
||||
birthdate: damageReport.birthdate,
|
||||
internalId: damageReport.internalId,
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchDamageReports();
|
||||
return result;
|
||||
|
|
|
@ -2,9 +2,8 @@ import { defineStore } from "pinia";
|
|||
import type {
|
||||
EquipmentViewModel,
|
||||
CreateEquipmentViewModel,
|
||||
EquipmentStatisticsViewModel,
|
||||
UpdateEquipmentViewModel,
|
||||
} from "@/viewmodels/admin/unit/equipmentType/equipment.models";
|
||||
} from "@/viewmodels/admin/unit/equipment/equipment.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
|
@ -16,7 +15,6 @@ export const useEquipmentStore = defineStore("equipment", {
|
|||
loading: "loading" as "loading" | "fetched" | "failed",
|
||||
activeEquipment: null as string | null,
|
||||
activeEquipmentObj: null as EquipmentViewModel | null,
|
||||
activeEquipmentStatistics: null as EquipmentStatisticsViewModel | null,
|
||||
loadingActive: "loading" as "loading" | "fetched" | "failed",
|
||||
};
|
||||
},
|
||||
|
@ -79,14 +77,6 @@ export const useEquipmentStore = defineStore("equipment", {
|
|||
fetchEquipmentById(id: string) {
|
||||
return http.get(`/admin/equipment/${id}`);
|
||||
},
|
||||
fetchEquipmentStatisticsByActiveId() {
|
||||
http
|
||||
.get(`/admin/equipment/${this.activeEquipment}/statistics`)
|
||||
.then((res) => {
|
||||
this.activeEquipmentStatistics = res.data;
|
||||
})
|
||||
.catch((err) => {});
|
||||
},
|
||||
async printEquipmentByActiveId() {
|
||||
return http.get(`/admin/equipment/${this.activeEquipment}/print`, {
|
||||
responseType: "blob",
|
||||
|
@ -97,24 +87,14 @@ export const useEquipmentStore = defineStore("equipment", {
|
|||
},
|
||||
async createEquipment(equipment: CreateEquipmentViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/equipment`, {
|
||||
salutationId: equipment.salutationId,
|
||||
firstname: equipment.firstname,
|
||||
lastname: equipment.lastname,
|
||||
nameaffix: equipment.nameaffix,
|
||||
birthdate: equipment.birthdate,
|
||||
internalId: equipment.internalId,
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchEquipments();
|
||||
return result;
|
||||
},
|
||||
async updateActiveEquipment(equipment: UpdateEquipmentViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/equipment/${equipment.id}`, {
|
||||
salutationId: equipment.salutationId,
|
||||
firstname: equipment.firstname,
|
||||
lastname: equipment.lastname,
|
||||
nameaffix: equipment.nameaffix,
|
||||
birthdate: equipment.birthdate,
|
||||
internalId: equipment.internalId,
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchEquipments();
|
||||
return result;
|
||||
|
|
|
@ -3,7 +3,7 @@ import type {
|
|||
EquipmentTypeViewModel,
|
||||
CreateEquipmentTypeViewModel,
|
||||
UpdateEquipmentTypeViewModel,
|
||||
} from "@/viewmodels/admin/unit/equipmentType.models";
|
||||
} from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
|
@ -79,24 +79,14 @@ export const useEquipmentTypeStore = defineStore("equipmentType", {
|
|||
},
|
||||
async createEquipmentType(equipmentType: CreateEquipmentTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/equipmentType`, {
|
||||
salutationId: equipmentType.salutationId,
|
||||
firstname: equipmentType.firstname,
|
||||
lastname: equipmentType.lastname,
|
||||
nameaffix: equipmentType.nameaffix,
|
||||
birthdate: equipmentType.birthdate,
|
||||
internalId: equipmentType.internalId,
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchEquipmentTypes();
|
||||
return result;
|
||||
},
|
||||
async updateActiveEquipmentType(equipmentType: UpdateEquipmentTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/equipmentType/${equipmentType.id}`, {
|
||||
salutationId: equipmentType.salutationId,
|
||||
firstname: equipmentType.firstname,
|
||||
lastname: equipmentType.lastname,
|
||||
nameaffix: equipmentType.nameaffix,
|
||||
birthdate: equipmentType.birthdate,
|
||||
internalId: equipmentType.internalId,
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchEquipmentTypes();
|
||||
return result;
|
||||
|
|
|
@ -87,12 +87,7 @@ export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
|||
},
|
||||
async createRespiratoryGear(respiratoryGear: CreateRespiratoryGearViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/respiratoryGear`, {
|
||||
salutationId: respiratoryGear.salutationId,
|
||||
firstname: respiratoryGear.firstname,
|
||||
lastname: respiratoryGear.lastname,
|
||||
nameaffix: respiratoryGear.nameaffix,
|
||||
birthdate: respiratoryGear.birthdate,
|
||||
internalId: respiratoryGear.internalId,
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchRespiratoryGears();
|
||||
return result;
|
||||
|
@ -101,12 +96,7 @@ export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
|||
respiratoryGear: UpdateRespiratoryGearViewModel
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/respiratoryGear/${respiratoryGear.id}`, {
|
||||
salutationId: respiratoryGear.salutationId,
|
||||
firstname: respiratoryGear.firstname,
|
||||
lastname: respiratoryGear.lastname,
|
||||
nameaffix: respiratoryGear.nameaffix,
|
||||
birthdate: respiratoryGear.birthdate,
|
||||
internalId: respiratoryGear.internalId,
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchRespiratoryGears();
|
||||
return result;
|
||||
|
|
|
@ -93,12 +93,7 @@ export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
|||
respiratoryMission: CreateRespiratoryMissionViewModel
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/respiratoryMission`, {
|
||||
salutationId: respiratoryMission.salutationId,
|
||||
firstname: respiratoryMission.firstname,
|
||||
lastname: respiratoryMission.lastname,
|
||||
nameaffix: respiratoryMission.nameaffix,
|
||||
birthdate: respiratoryMission.birthdate,
|
||||
internalId: respiratoryMission.internalId,
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchRespiratoryMissions();
|
||||
return result;
|
||||
|
@ -107,12 +102,7 @@ export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
|||
respiratoryMission: UpdateRespiratoryMissionViewModel
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/respiratoryMission/${respiratoryMission.id}`, {
|
||||
salutationId: respiratoryMission.salutationId,
|
||||
firstname: respiratoryMission.firstname,
|
||||
lastname: respiratoryMission.lastname,
|
||||
nameaffix: respiratoryMission.nameaffix,
|
||||
birthdate: respiratoryMission.birthdate,
|
||||
internalId: respiratoryMission.internalId,
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchRespiratoryMissions();
|
||||
return result;
|
||||
|
|
|
@ -93,12 +93,7 @@ export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
|||
respiratoryWearer: CreateRespiratoryWearerViewModel
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/respiratoryWearer`, {
|
||||
salutationId: respiratoryWearer.salutationId,
|
||||
firstname: respiratoryWearer.firstname,
|
||||
lastname: respiratoryWearer.lastname,
|
||||
nameaffix: respiratoryWearer.nameaffix,
|
||||
birthdate: respiratoryWearer.birthdate,
|
||||
internalId: respiratoryWearer.internalId,
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchRespiratoryWearers();
|
||||
return result;
|
||||
|
@ -107,12 +102,7 @@ export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
|||
respiratoryWearer: UpdateRespiratoryWearerViewModel
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/respiratoryWearer/${respiratoryWearer.id}`, {
|
||||
salutationId: respiratoryWearer.salutationId,
|
||||
firstname: respiratoryWearer.firstname,
|
||||
lastname: respiratoryWearer.lastname,
|
||||
nameaffix: respiratoryWearer.nameaffix,
|
||||
birthdate: respiratoryWearer.birthdate,
|
||||
internalId: respiratoryWearer.internalId,
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchRespiratoryWearers();
|
||||
return result;
|
||||
|
|
|
@ -2,7 +2,6 @@ import { defineStore } from "pinia";
|
|||
import type {
|
||||
VehicleViewModel,
|
||||
CreateVehicleViewModel,
|
||||
VehicleStatisticsViewModel,
|
||||
UpdateVehicleViewModel,
|
||||
} from "@/viewmodels/admin/unit/vehicle/vehicle.models";
|
||||
import { http } from "@/serverCom";
|
||||
|
@ -16,7 +15,6 @@ export const useVehicleStore = defineStore("vehicle", {
|
|||
loading: "loading" as "loading" | "fetched" | "failed",
|
||||
activeVehicle: null as string | null,
|
||||
activeVehicleObj: null as VehicleViewModel | null,
|
||||
activeVehicleStatistics: null as VehicleStatisticsViewModel | null,
|
||||
loadingActive: "loading" as "loading" | "fetched" | "failed",
|
||||
};
|
||||
},
|
||||
|
@ -79,14 +77,6 @@ export const useVehicleStore = defineStore("vehicle", {
|
|||
fetchVehicleById(id: string) {
|
||||
return http.get(`/admin/vehicle/${id}`);
|
||||
},
|
||||
fetchVehicleStatisticsByActiveId() {
|
||||
http
|
||||
.get(`/admin/vehicle/${this.activeVehicle}/statistics`)
|
||||
.then((res) => {
|
||||
this.activeVehicleStatistics = res.data;
|
||||
})
|
||||
.catch((err) => {});
|
||||
},
|
||||
async printVehicleByActiveId() {
|
||||
return http.get(`/admin/vehicle/${this.activeVehicle}/print`, {
|
||||
responseType: "blob",
|
||||
|
@ -97,24 +87,14 @@ export const useVehicleStore = defineStore("vehicle", {
|
|||
},
|
||||
async createVehicle(vehicle: CreateVehicleViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/vehicle`, {
|
||||
salutationId: vehicle.salutationId,
|
||||
firstname: vehicle.firstname,
|
||||
lastname: vehicle.lastname,
|
||||
nameaffix: vehicle.nameaffix,
|
||||
birthdate: vehicle.birthdate,
|
||||
internalId: vehicle.internalId,
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchVehicles();
|
||||
return result;
|
||||
},
|
||||
async updateActiveVehicle(vehicle: UpdateVehicleViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/vehicle/${vehicle.id}`, {
|
||||
salutationId: vehicle.salutationId,
|
||||
firstname: vehicle.firstname,
|
||||
lastname: vehicle.lastname,
|
||||
nameaffix: vehicle.nameaffix,
|
||||
birthdate: vehicle.birthdate,
|
||||
internalId: vehicle.internalId,
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchVehicles();
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue