Skip to content

Commit d2f6aec

Browse files
committed
lint
1 parent 0c5047d commit d2f6aec

1 file changed

Lines changed: 0 additions & 83 deletions

File tree

‎src/services/distributionService.ts‎

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { Prisma, ShipmentStatus } from "@prisma/client";
1414
import { Filters } from "@/types/api/filter.types";
1515
import { buildQueryWithPagination, buildWhereFromFilters } from "@/util/table";
1616
import { hasShippingIdentifier } from "@/util/shipping";
17-
import { WishlistService } from "./wishlistService";
1817

1918
export default class DistributionService {
2019
static async getAllDistributions(
@@ -672,93 +671,11 @@ export default class DistributionService {
672671

673672
if (data.pending === false && currentDistribution.pending === true) {
674673
await this.createShipmentsForDistribution(distributionId);
675-
// await this.populateUnfulfilledWishlists(distributionId);
676674
}
677675

678676
return updatedDistribution;
679677
}
680678

681-
// private static async populateUnfulfilledWishlists(
682-
// distributionId: number
683-
// ): Promise<void> {
684-
// try {
685-
// const distribution = await db.distribution.findUnique({
686-
// where: { id: distributionId },
687-
// include: {
688-
// allocations: {
689-
// include: {
690-
// lineItem: {
691-
// include: {
692-
// generalItem: true,
693-
// },
694-
// },
695-
// },
696-
// },
697-
// },
698-
// });
699-
700-
// if (!distribution || !distribution.partnerId) return;
701-
702-
// const partnerId = distribution.partnerId;
703-
704-
// const allocatedByGeneralItemId = new Map<number, number>();
705-
// for (const allocation of distribution.allocations) {
706-
// const generalItem = allocation.lineItem.generalItem;
707-
// if (!generalItem) continue;
708-
// const current = allocatedByGeneralItemId.get(generalItem.id) ?? 0;
709-
// allocatedByGeneralItemId.set(
710-
// generalItem.id,
711-
// current + allocation.lineItem.quantity
712-
// );
713-
// }
714-
715-
// if (allocatedByGeneralItemId.size === 0) return;
716-
717-
// // Fetch all partner requests for the general items in this distribution
718-
// const generalItemIds = Array.from(allocatedByGeneralItemId.keys());
719-
// const requests = await db.generalItemRequest.findMany({
720-
// where: {
721-
// partnerId,
722-
// generalItemId: { in: generalItemIds },
723-
// },
724-
// });
725-
726-
// if (requests.length === 0) return;
727-
728-
// const unfulfilledEntries: Array<{
729-
// requestId: number;
730-
// finalQuantity: number;
731-
// }> = [];
732-
733-
// for (const request of requests) {
734-
// const allocated =
735-
// allocatedByGeneralItemId.get(request.generalItemId) ?? 0;
736-
// if (allocated < request.quantity) {
737-
// await db.generalItemRequest.update({
738-
// where: { id: request.id },
739-
// data: { finalQuantity: allocated },
740-
// });
741-
// unfulfilledEntries.push({
742-
// requestId: request.id,
743-
// finalQuantity: allocated,
744-
// });
745-
// }
746-
// }
747-
748-
// if (unfulfilledEntries.length > 0) {
749-
// await WishlistService.createUnfulfilledWishlistEntries(
750-
// unfulfilledEntries
751-
// );
752-
// }
753-
// } catch (error) {
754-
// console.error(
755-
// "Failed to populate unfulfilled wishlists for distribution:",
756-
// distributionId,
757-
// error
758-
// );
759-
// }
760-
// }
761-
762679
private static async createShipmentsForDistribution(distributionId: number) {
763680
const allocations = await db.allocation.findMany({
764681
where: { distributionId },

0 commit comments

Comments
 (0)