feat(ADM-018): completed feature
This commit is contained in:
18
project/src/modules/promotions/domain/ports.ts
Normal file
18
project/src/modules/promotions/domain/ports.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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>;
|
||||
}
|
||||
Reference in New Issue
Block a user