xpeditis2.0/apps/backend/src/domain/ports/out/shipment-counter.port.ts
David 0dc56ff1eb feat(bookings): reservation quota based on org plan + PAID bookings
- Nouvel endpoint GET /csv-bookings/reservation-quota: limite = vrai plan de
  l'org (pas l'override ADMIN PLATINIUM), used = bookings PAYES de l'annee
  (PENDING_BANK_TRANSFER/PENDING/ACCEPTED), limitReached.
- ShipmentCounter: countPaidShipmentsForOrganizationInYear.
- create-check compte desormais les payes (au lieu de tous).
- Frontend useReservationQuota consomme l'endpoint (fiable meme pour un admin
  dont l'overview renvoie PLATINIUM).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 17:36:15 +02:00

26 lines
825 B
TypeScript

/**
* Shipment Counter Port
*
* Counts total shipments (bookings + CSV bookings) for an organization
* within a given year. Used to enforce the Bronze plan's 12 shipments/year limit.
*/
export const SHIPMENT_COUNTER_PORT = 'SHIPMENT_COUNTER_PORT';
export interface ShipmentCounterPort {
/**
* Count all shipments (bookings + CSV bookings) created by an organization in a given year.
*/
countShipmentsForOrganizationInYear(organizationId: string, year: number): Promise<number>;
/**
* Count only PAID shipments (fee paid / payment declared / accepted) created by
* an organization in a given year. Unpaid drafts (PENDING_PAYMENT), rejected and
* cancelled bookings are excluded.
*/
countPaidShipmentsForOrganizationInYear(
organizationId: string,
year: number
): Promise<number>;
}