forked from mirrors/homebox
feat: items-editor (#5)
* format readme * update logo * format html * add logo to docs * repository for document and document tokens * add attachments type and repository * autogenerate types via scripts * use autogenerated types * attachment type updates * add insured and quantity fields for items * implement HasID interface for entities * implement label updates for items * implement service update method * WIP item update client side actions * check err on attachment * finish types for basic items editor * remove unused var * house keeping
This commit is contained in:
parent
fbc364dcd2
commit
95ab14b866
125 changed files with 15626 additions and 1791 deletions
|
@ -1,29 +1,20 @@
|
|||
import { BaseAPI, route } from "../base";
|
||||
import { Item } from "./items";
|
||||
import { Details, OutType, Results } from "./types";
|
||||
|
||||
export type LocationCreate = Details;
|
||||
|
||||
export type Location = LocationCreate &
|
||||
OutType & {
|
||||
groupId: string;
|
||||
items: Item[];
|
||||
itemCount: number;
|
||||
};
|
||||
import { LocationCount, LocationCreate, LocationOut } from "../types/data-contracts";
|
||||
import { Results } from "./types";
|
||||
|
||||
export type LocationUpdate = LocationCreate;
|
||||
|
||||
export class LocationsApi extends BaseAPI {
|
||||
getAll() {
|
||||
return this.http.get<Results<Location>>({ url: route("/locations") });
|
||||
return this.http.get<Results<LocationCount>>({ url: route("/locations") });
|
||||
}
|
||||
|
||||
create(body: LocationCreate) {
|
||||
return this.http.post<LocationCreate, Location>({ url: route("/locations"), body });
|
||||
return this.http.post<LocationCreate, LocationOut>({ url: route("/locations"), body });
|
||||
}
|
||||
|
||||
get(id: string) {
|
||||
return this.http.get<Location>({ url: route(`/locations/${id}`) });
|
||||
return this.http.get<LocationOut>({ url: route(`/locations/${id}`) });
|
||||
}
|
||||
|
||||
delete(id: string) {
|
||||
|
@ -31,6 +22,6 @@ export class LocationsApi extends BaseAPI {
|
|||
}
|
||||
|
||||
update(id: string, body: LocationUpdate) {
|
||||
return this.http.put<LocationUpdate, Location>({ url: route(`/locations/${id}`), body });
|
||||
return this.http.put<LocationUpdate, LocationOut>({ url: route(`/locations/${id}`), body });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue