feat: expanded search for items (#46)

* expanded search for items

* range domain from email to example

* implement pagination for items
This commit is contained in:
Hayden 2022-10-12 21:13:07 -08:00 committed by GitHub
parent 1b20a69c5e
commit 30014a77ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 751 additions and 346 deletions

View file

@ -8,12 +8,19 @@ import {
ItemSummary,
ItemUpdate,
} from "../types/data-contracts";
import { AttachmentTypes } from "../types/non-generated";
import { Results } from "./types";
import { AttachmentTypes, PaginationResult } from "../types/non-generated";
export type ItemsQuery = {
page?: number;
pageSize?: number;
locations?: string[];
labels?: string[];
q?: string;
};
export class ItemsApi extends BaseAPI {
getAll() {
return this.http.get<Results<ItemSummary>>({ url: route("/items") });
getAll(q: ItemsQuery = {}) {
return this.http.get<PaginationResult<ItemSummary>>({ url: route("/items", q) });
}
create(item: ItemCreate) {

View file

@ -1,6 +1,6 @@
import { BaseAPI, route } from "../base";
import { LabelCreate, LabelOut } from "../types/data-contracts";
import { Results } from "./types";
import { Results } from "../types/non-generated";
export class LabelsApi extends BaseAPI {
getAll() {

View file

@ -1,6 +1,6 @@
import { BaseAPI, route } from "../base";
import { LocationOutCount, LocationCreate, LocationOut } from "../types/data-contracts";
import { Results } from "./types";
import { Results } from "../types/non-generated";
export type LocationUpdate = LocationCreate;

View file

@ -1,3 +0,0 @@
export type Results<T> = {
items: T[];
};