mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-20 21:49:07 +02:00
Merge pull request #108 from R0m1k3/1.1
Restore visibility of linked order and delivery information in calend…
This commit is contained in:
2 files changed
+32
-3
No files matched your search
+30
-2
@@ -1563,11 +1563,23 @@ export class MemStorage implements IStorage {
|
|||||||
async getOrder(id: number): Promise<OrderWithRelations | undefined> {
|
async getOrder(id: number): Promise<OrderWithRelations | undefined> {
|
||||||
const order = this.orders.get(id);
|
const order = this.orders.get(id);
|
||||||
if (!order) return undefined;
|
if (!order) return undefined;
|
||||||
|
|
||||||
|
// Récupérer les livraisons associées à cette commande
|
||||||
|
const associatedDeliveries = Array.from(this.deliveries.values())
|
||||||
|
.filter(delivery => delivery.orderId === id)
|
||||||
|
.map(delivery => ({
|
||||||
|
...delivery,
|
||||||
|
supplier: this.suppliers.get(delivery.supplierId),
|
||||||
|
group: this.groups.get(delivery.groupId),
|
||||||
|
creator: this.users.get(delivery.createdBy || '')
|
||||||
|
}));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...order,
|
...order,
|
||||||
supplier: this.suppliers.get(order.supplierId),
|
supplier: this.suppliers.get(order.supplierId),
|
||||||
group: this.groups.get(order.groupId),
|
group: this.groups.get(order.groupId),
|
||||||
creator: this.users.get(order.createdBy)
|
creator: this.users.get(order.createdBy),
|
||||||
|
deliveries: associatedDeliveries
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1636,11 +1648,27 @@ export class MemStorage implements IStorage {
|
|||||||
async getDelivery(id: number): Promise<DeliveryWithRelations | undefined> {
|
async getDelivery(id: number): Promise<DeliveryWithRelations | undefined> {
|
||||||
const delivery = this.deliveries.get(id);
|
const delivery = this.deliveries.get(id);
|
||||||
if (!delivery) return undefined;
|
if (!delivery) return undefined;
|
||||||
|
|
||||||
|
// Récupérer la commande associée si elle existe
|
||||||
|
let associatedOrder = undefined;
|
||||||
|
if (delivery.orderId) {
|
||||||
|
const order = this.orders.get(delivery.orderId);
|
||||||
|
if (order) {
|
||||||
|
associatedOrder = {
|
||||||
|
...order,
|
||||||
|
supplier: this.suppliers.get(order.supplierId),
|
||||||
|
group: this.groups.get(order.groupId),
|
||||||
|
creator: this.users.get(order.createdBy)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...delivery,
|
...delivery,
|
||||||
supplier: this.suppliers.get(delivery.supplierId),
|
supplier: this.suppliers.get(delivery.supplierId),
|
||||||
group: this.groups.get(delivery.groupId),
|
group: this.groups.get(delivery.groupId),
|
||||||
creator: this.users.get(delivery.createdBy || '')
|
creator: this.users.get(delivery.createdBy || ''),
|
||||||
|
order: associatedOrder
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -564,13 +564,14 @@ export type OrderWithRelations = Order & {
|
|||||||
supplier: Supplier;
|
supplier: Supplier;
|
||||||
group: Group;
|
group: Group;
|
||||||
creator: User;
|
creator: User;
|
||||||
|
deliveries?: DeliveryWithRelations[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type DeliveryWithRelations = Delivery & {
|
export type DeliveryWithRelations = Delivery & {
|
||||||
supplier: Supplier;
|
supplier: Supplier;
|
||||||
group: Group;
|
group: Group;
|
||||||
creator: User;
|
creator: User;
|
||||||
order?: Order;
|
order?: OrderWithRelations;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PublicityWithRelations = Publicity & {
|
export type PublicityWithRelations = Publicity & {
|
||||||
|
|||||||
Reference in new issue
Block a user