Add indexed to getFeatures in item.service.ts
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Mark van der Wal 2022-02-04 18:25:05 +01:00
parent f4ba89920c
commit 2f0362e730

View File

@ -24,7 +24,7 @@ export class ItemService {
return this.httpClient.get<{ [id: string]: IItemType }>(`${this.ApiEndpoint()}/api/v1/itemtypes/`); return this.httpClient.get<{ [id: string]: IItemType }>(`${this.ApiEndpoint()}/api/v1/itemtypes/`);
} }
getFeatures(extent: number[], crs: string, searchText?: string, searchTags?:string,startDate?:Date,endDate?:Date,itemType?:string,parentCode?:string,dataFilter?:string,level?:number): Observable<any> { getFeatures(extent: number[], crs: string, searchText?: string, searchTags?:string,startDate?:Date,endDate?:Date,itemType?:string,parentCode?:string,dataFilter?:string,level?:number,indexed?:boolean): Observable<any> {
var params = new HttpParams(); var params = new HttpParams();
params = params.append("crs", crs); params = params.append("crs", crs);
if (extent) params =params.append("bbox", extent.join(",")); if (extent) params =params.append("bbox", extent.join(","));
@ -42,6 +42,7 @@ export class ItemService {
if (parentCode) params = params.append("pc", parentCode); if (parentCode) params = params.append("pc", parentCode);
if (dataFilter) params = params.append("df", dataFilter); if (dataFilter) params = params.append("df", dataFilter);
if (level) params = params.append("lvl", level.toString()); if (level) params = params.append("lvl", level.toString());
if (indexed) params = params.append("ind", level.toString());
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/features/`, {params:params}); return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/features/`, {params:params});
} }
@ -73,10 +74,10 @@ export class ItemService {
getItemList(itemType?: string, dataFilter?: any, level?: number, atItemLocationItemCode?: string, indexed?: boolean, validToday?: boolean): Observable<IItem[]> { getItemList(itemType?: string, dataFilter?: any, level?: number, atItemLocationItemCode?: string, indexed?: boolean, validToday?: boolean): Observable<IItem[]> {
var params = new HttpParams(); var params = new HttpParams();
if(itemType) params = params.append("it", itemType); if(itemType) params = params.append("it", itemType);
if(dataFilter) params = params.append("df", JSON.stringify(dataFilter)); if(dataFilter) params = params.append("df", JSON.stringify(dataFilter));
if(atItemLocationItemCode) params = params.append("ail",atItemLocationItemCode); if(atItemLocationItemCode) params = params.append("ail",atItemLocationItemCode);
if(indexed) params = params.append("ind",indexed?"true":"false"); if(indexed) params = params.append("ind",indexed?"true":"false");
if (level) params = params.append("lvl", level.toFixed()); if (level) params = params.append("lvl", level.toFixed());
if (validToday) params = params.append("vt", validToday ? "true" : "false"); if (validToday) params = params.append("vt", validToday ? "true" : "false");
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/`, { params: params }); return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/`, { params: params });
@ -127,11 +128,11 @@ export class ItemService {
else else
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${code}/features`, { params: params }); return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${code}/features`, { params: params });
} }
postItem(item:IItem): Observable<IItem> { postItem(item:IItem): Observable<IItem> {
return this.httpClient.post<IItem>(`${this.ApiEndpoint()}/api/v1/items`,item); return this.httpClient.post<IItem>(`${this.ApiEndpoint()}/api/v1/items`,item);
} }
putItem(item:IItem): Observable<IItem> { putItem(item:IItem): Observable<IItem> {
return this.httpClient.put<IItem>(`${this.ApiEndpoint()}/api/v1/items/${item.code}`,item); return this.httpClient.put<IItem>(`${this.ApiEndpoint()}/api/v1/items/${item.code}`,item);
} }
@ -158,7 +159,7 @@ export class ItemService {
postItemTask(item: IItem, task: IItemTask): Observable<IItemTask> { postItemTask(item: IItem, task: IItemTask): Observable<IItemTask> {
return this.httpClient.post<IItemTask>(`${this.ApiEndpoint()}/api/v1/items/${item.code}/tasks`, task); return this.httpClient.post<IItemTask>(`${this.ApiEndpoint()}/api/v1/items/${item.code}/tasks`, task);
} }
getItemTaskList(itemcode: string, unfinishedOnly?: boolean): Observable<IItemTask[]> { getItemTaskList(itemcode: string, unfinishedOnly?: boolean): Observable<IItemTask[]> {
var params = new HttpParams(); var params = new HttpParams();
if (unfinishedOnly) params = params.append("unfinishedOnly", unfinishedOnly.toString()); if (unfinishedOnly) params = params.append("unfinishedOnly", unfinishedOnly.toString());
@ -167,8 +168,8 @@ export class ItemService {
getItemListUsingRelationship(itemType: string, relationshipItemType: string, relationshipDataFilter: any): Observable<IItem[]> { getItemListUsingRelationship(itemType: string, relationshipItemType: string, relationshipDataFilter: any): Observable<IItem[]> {
var params = new HttpParams(); var params = new HttpParams();
params = params.append("it", itemType); params = params.append("it", itemType);
params = params.append("rsit", relationshipItemType); params = params.append("rsit", relationshipItemType);
params = params.append("rsdf", JSON.stringify(relationshipDataFilter)); params = params.append("rsdf", JSON.stringify(relationshipDataFilter));
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/userelationship`, { params: params }); return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/userelationship`, { params: params });
} }
@ -177,4 +178,4 @@ export class ItemService {
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${itemCode}/value/layer/${layerIndex}?c=${x},${y}&crs=${crs}`); return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${itemCode}/value/layer/${layerIndex}?c=${x},${y}&crs=${crs}`);
} }
} }