feat(F-103): completed feature

This commit is contained in:
chattie
2026-08-21 07:55:18 +02:00
parent 5177a851aa
commit c07776822d
40 changed files with 886 additions and 156 deletions

View File

@@ -26,6 +26,19 @@ export class OrderService implements OrderServicePort {
return this.repo.findAll();
}
async searchOrders(filters: {
state?: string;
q?: string;
limit: number;
offset: number;
}): Promise<{ items: OrderView[]; total: number }> {
if (!this.repo.search) {
const all = await this.repo.findAll();
return { items: all.slice(filters.offset, filters.offset + filters.limit), total: all.length };
}
return this.repo.search(filters);
}
async transition(id: string, next: OrderState, userId: string): Promise<OrderView> {
const existing = await this.repo.findByIdAndUserId(id, userId);
if (!existing) throw new OrderNotFoundError();