mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
feat: optimize dynamic list service.
feat: inactive mode for accounts, items, customers and vendors services.
This commit is contained in:
@@ -47,6 +47,7 @@ export interface IAccountResponse extends IAccount {
|
||||
|
||||
export interface IAccountsFilter extends IDynamicListFilterDTO {
|
||||
stringifiedFilterRoles?: string,
|
||||
onlyInactive: boolean;
|
||||
};
|
||||
|
||||
export interface IAccountType {
|
||||
|
||||
@@ -62,6 +62,8 @@ export interface IBill {
|
||||
|
||||
export interface IBillsFilter extends IDynamicListFilterDTO {
|
||||
stringifiedFilterRoles?: string;
|
||||
page: number;
|
||||
pageSize: number;
|
||||
}
|
||||
|
||||
export interface IBillsService {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { IModel, ISortOrder } from "./Model";
|
||||
|
||||
export interface IDynamicFilter {
|
||||
setTableName(tableName: string): void;
|
||||
setModel(model: IModel): void;
|
||||
buildQuery(): void;
|
||||
getResponseMeta();
|
||||
}
|
||||
|
||||
export interface IFilterRole {
|
||||
@@ -10,19 +13,19 @@ export interface IFilterRole {
|
||||
index?: number;
|
||||
comparator?: string;
|
||||
}
|
||||
|
||||
export interface IDynamicListFilterDTO {
|
||||
export interface IDynamicListFilter {
|
||||
customViewId?: number;
|
||||
filterRoles?: IFilterRole[];
|
||||
columnSortBy: string;
|
||||
columnSortBy: ISortOrder;
|
||||
sortOrder: string;
|
||||
stringifiedFilterRoles: string;
|
||||
}
|
||||
|
||||
export interface IDynamicListService {
|
||||
dynamicList(
|
||||
tenantId: number,
|
||||
model: any,
|
||||
filter: IDynamicListFilterDTO
|
||||
filter: IDynamicListFilter
|
||||
): Promise<any>;
|
||||
handlerErrorsToResponse(error, req, res, next): void;
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ export interface IItemsFilter extends IDynamicListFilterDTO {
|
||||
stringifiedFilterRoles?: string,
|
||||
page: number,
|
||||
pageSize: number,
|
||||
inactiveMode: boolean,
|
||||
};
|
||||
|
||||
export interface IItemsAutoCompleteFilter {
|
||||
|
||||
@@ -7,7 +7,9 @@ export interface IJournalReportQuery {
|
||||
noCents: boolean,
|
||||
divideOn1000: boolean,
|
||||
},
|
||||
transactionTypes: string | string[],
|
||||
transactionType: string,
|
||||
transactionId: string,
|
||||
|
||||
accountsIds: number | number[],
|
||||
fromRange: number,
|
||||
toRange: number,
|
||||
|
||||
@@ -1,17 +1,72 @@
|
||||
|
||||
|
||||
export interface IModel {
|
||||
name: string,
|
||||
tableName: string,
|
||||
fields: { [key: string]: any, },
|
||||
};
|
||||
name: string;
|
||||
tableName: string;
|
||||
fields: { [key: string]: any };
|
||||
}
|
||||
|
||||
export interface IFilterMeta {
|
||||
sortOrder: string,
|
||||
sortBy: string,
|
||||
};
|
||||
sortOrder: string;
|
||||
sortBy: string;
|
||||
}
|
||||
|
||||
export interface IPaginationMeta {
|
||||
pageSize: number,
|
||||
page: number,
|
||||
};
|
||||
pageSize: number;
|
||||
page: number;
|
||||
}
|
||||
|
||||
export interface IModelMetaDefaultSort {
|
||||
sortOrder: ISortOrder;
|
||||
sortField: string;
|
||||
}
|
||||
|
||||
export type IModelColumnType =
|
||||
| 'text'
|
||||
| 'number'
|
||||
| 'enumeration'
|
||||
| 'boolean'
|
||||
| 'relation';
|
||||
|
||||
export type ISortOrder = 'DESC' | 'ASC';
|
||||
|
||||
export interface IModelMetaFieldCommon {
|
||||
name: string;
|
||||
column: string;
|
||||
columnable?: boolean;
|
||||
fieldType: IModelColumnType;
|
||||
customQuery?: Function;
|
||||
}
|
||||
|
||||
export interface IModelMetaFieldNumber {
|
||||
fieldType: 'number';
|
||||
minLength?: number;
|
||||
maxLength?: number;
|
||||
}
|
||||
|
||||
export interface IModelMetaFieldOther {
|
||||
fieldType: 'text' | 'boolean';
|
||||
}
|
||||
|
||||
export type IModelMetaField = IModelMetaFieldCommon &
|
||||
(IModelMetaFieldOther | IModelMetaEnumerationField | IModelMetaRelationField);
|
||||
|
||||
export interface IModelMetaEnumerationOption {
|
||||
key: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface IModelMetaEnumerationField {
|
||||
fieldType: 'enumeration';
|
||||
options: IModelMetaEnumerationOption[];
|
||||
}
|
||||
|
||||
export interface IModelMetaRelationField {
|
||||
fieldType: 'relation';
|
||||
relationToModel: IModel;
|
||||
relationToField: string;
|
||||
}
|
||||
|
||||
export interface IModelMeta {
|
||||
defaultFilterField: string;
|
||||
defaultSort: IModelMetaDefaultSort;
|
||||
fields: { [key: string]: IModelMetaField };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user