60 lines
1.4 KiB
TypeScript
60 lines
1.4 KiB
TypeScript
export const baseUrl = process.env.BASICURL || "";
|
|
export const tokenSecret = process.env.TOKENSECRET || "";
|
|
export const cookieObject: any = {
|
|
httpOnly: true,
|
|
path: "/",
|
|
sameSite: "none",
|
|
secure: true,
|
|
maxAge: 3600,
|
|
priority: "high",
|
|
};
|
|
|
|
interface FilterListInterface {
|
|
page?: number | null | undefined;
|
|
size?: number | null | undefined;
|
|
orderField?: string | null | undefined;
|
|
orderType?: string | null | undefined;
|
|
includeJoins?: any[] | null | undefined;
|
|
query?: any | null | undefined;
|
|
}
|
|
|
|
class FilterList {
|
|
page: number;
|
|
size: number;
|
|
orderField: string;
|
|
orderType: string;
|
|
includeJoins: any[];
|
|
query: any;
|
|
constructor({
|
|
page = 1,
|
|
size = 5,
|
|
orderField = "id",
|
|
orderType = "asc",
|
|
includeJoins = [],
|
|
query = {},
|
|
}: FilterListInterface = {}) {
|
|
this.page = page ?? 1;
|
|
this.size = size ?? 5;
|
|
this.orderField = orderField ?? "uu_id";
|
|
this.orderType = orderType ?? "asc";
|
|
this.orderType = this.orderType.startsWith("a") ? "asc" : "desc";
|
|
this.includeJoins = includeJoins ?? [];
|
|
this.query = query ?? {};
|
|
}
|
|
filter() {
|
|
return {
|
|
page: this.page,
|
|
size: this.size,
|
|
order_field: this.orderField,
|
|
order_type: this.orderType,
|
|
include_joins: this.includeJoins,
|
|
query: this.query,
|
|
};
|
|
}
|
|
}
|
|
|
|
const defaultFilterList = new FilterList({});
|
|
|
|
export { FilterList, defaultFilterList };
|
|
export type { FilterListInterface };
|