Files
mercadodevida/project/src/modules/promotions/domain/ports.ts
2026-08-17 22:23:10 +02:00

19 lines
779 B
TypeScript

import type { NewPromotion, Promotion, PromotionDiscount } from './promotion.js';
export interface PromotionService {
create(input: NewPromotion): Promise<Promotion>;
calculateDiscount(code: string, cartTotalCents: number, now?: Date): Promise<PromotionDiscount>;
validateCode(code: string, now?: Date): Promise<Promotion>;
list(): Promise<Promotion[]>;
update(code: string, patch: Partial<NewPromotion>): Promise<Promotion>;
delete(code: string): Promise<void>;
}
export interface PromotionRepository {
findByCode(code: string): Promise<Promotion | undefined>;
create(input: NewPromotion): Promise<Promotion>;
findAll(): Promise<Promotion[]>;
update(code: string, patch: Partial<NewPromotion>): Promise<Promotion>;
delete(code: string): Promise<void>;
}