2025-10-30 12:39:30 +00:00
|
|
|
import { OrderBy } from "./OrderBy";
|
|
|
|
|
import { OrderType, OrderTypes } from "./OrderType";
|
|
|
|
|
|
|
|
|
|
export class Order {
|
2025-11-16 19:29:07 +00:00
|
|
|
constructor(
|
|
|
|
|
public readonly orderBy: OrderBy,
|
|
|
|
|
public readonly orderType: OrderType
|
|
|
|
|
) {}
|
2025-10-30 12:39:30 +00:00
|
|
|
|
2025-11-16 19:29:07 +00:00
|
|
|
static none(): Order {
|
|
|
|
|
return new Order(new OrderBy(""), new OrderType(OrderTypes.NONE));
|
|
|
|
|
}
|
2025-10-30 12:39:30 +00:00
|
|
|
|
2025-11-16 19:29:07 +00:00
|
|
|
static fromPrimitives(orderBy: string | null, orderType: string | null): Order {
|
|
|
|
|
return orderBy !== null
|
|
|
|
|
? new Order(new OrderBy(orderBy), new OrderType(orderType as OrderTypes))
|
|
|
|
|
: Order.none();
|
|
|
|
|
}
|
2025-10-30 12:39:30 +00:00
|
|
|
|
2025-11-16 19:29:07 +00:00
|
|
|
isNone(): boolean {
|
|
|
|
|
return this.orderType.isNone();
|
|
|
|
|
}
|
2025-10-30 12:39:30 +00:00
|
|
|
}
|