40 lines
868 B
TypeScript
40 lines
868 B
TypeScript
import { PaginationArgs } from "sim-shared/domain/PaginationArgs.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() {
|
|
return async (args: {
|
|
id: number
|
|
}) => {
|
|
const order = await this.orderRepository.getOrderById(args)
|
|
return order
|
|
}
|
|
}
|
|
|
|
public getByQueueId() {
|
|
return async (args: {
|
|
correlation_id: string
|
|
}) => {
|
|
const order = await this.orderRepository.getOrderByQueueId(args)
|
|
return order
|
|
}
|
|
}
|
|
|
|
public getPending() {
|
|
return async (args: PaginationArgs & {
|
|
}) => {
|
|
return await this.orderRepository.getPendingOrders(args)
|
|
}
|
|
}
|
|
|
|
}
|