38 lines
784 B
TypeScript
38 lines
784 B
TypeScript
|
|
import { PaginationArgs } from "#domain/common.js";
|
||
|
|
import { OrderRepository } from "sim-shared/infrastructure/OrderRepository.js";
|
||
|
|
|
||
|
|
|
||
|
|
export class OrderUsecases {
|
||
|
|
private orderRepository: OrderRepository;
|
||
|
|
constructor(args: {
|
||
|
|
orderRepository: OrderRepository
|
||
|
|
}
|
||
|
|
) {
|
||
|
|
this.orderRepository = args.orderRepository
|
||
|
|
}
|
||
|
|
|
||
|
|
public getById(args: {
|
||
|
|
id: number
|
||
|
|
}) {
|
||
|
|
return async () => {
|
||
|
|
return await this.orderRepository.getOrderById(args)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public getByQueueId(args: {
|
||
|
|
message_id: string
|
||
|
|
}) {
|
||
|
|
return async () => {
|
||
|
|
return await this.orderRepository.getOrderByQueueId(args)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public getPending(args: PaginationArgs & {
|
||
|
|
}) {
|
||
|
|
return async () => {
|
||
|
|
return await this.orderRepository.getPendingOrders(args)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|