mirror of
https://github.com/hay-kot/homebox.git
synced 2025-05-27 23:52:32 +00:00
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:
parent
1b20a69c5e
commit
30014a77ca
31 changed files with 751 additions and 346 deletions
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
export type Results<T> = {
|
||||
items: T[];
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue