19 lines
779 B
TypeScript
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>;
|
|
}
|