UNPKG

@openinc/parse-server-opendash

Version:
43 lines (42 loc) 1.55 kB
import { Maintenance_Ticket, Maintenance_Ticket_Material, Maintenance_Ticket_Source } from "../types"; type FilterParams = { attribute: "objectId" | "state" | "issuecategory" | "user" | "role" | "userRole" | "createdUser" | "source" | "project" | "title"; /** * the objectId of the attribute to filter by */ value: string; }; type FetchObject = { filterBy?: { junction?: "and" | "or"; filter: FilterParams[]; }; sortBy?: string; limit?: number; skip?: number; order?: "asc" | "desc"; }; export type FetchParams = { junction: "and" | "or"; config: Array<FetchObject>; }; export declare function init(name: string): Promise<void>; /** * Fetches the material for a ticket * @param ticket */ export declare function getTicketMaterial(ticket: Maintenance_Ticket): Promise<Maintenance_Ticket_Material | undefined>; /** * Fetches the source for a ticket * @param ticket */ export declare function getTicketSource(ticket: Maintenance_Ticket): Promise<Maintenance_Ticket_Source | undefined>; /** * Creates a distinct array based on the getId function and can afterwards filter the array * @param arr the array to get distinct values from * @param getId the identifier function to get the id of the item * @param filter the filter function to filter the array afterwards * @returns an array with distinct values based on the getId function */ export declare function arrayToDistinct<T>(arr: Array<T>, getId: (item: T) => string, filter?: (item: T) => boolean): Array<T>; export {};