feat(F-103): completed feature
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user