feat: allow nested relationships for locations and items (#102)

Basic implementation that allows organizing Locations and Items within each other.
This commit is contained in:
Hayden 2022-10-23 20:54:39 -08:00 committed by GitHub
parent fe6cd431a6
commit a4b4fe3454
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 2329 additions and 126 deletions

View file

@ -1,9 +1,7 @@
import { BaseAPI, route } from "../base";
import { LocationOutCount, LocationCreate, LocationOut } from "../types/data-contracts";
import { LocationOutCount, LocationCreate, LocationOut, LocationUpdate } from "../types/data-contracts";
import { Results } from "../types/non-generated";
export type LocationUpdate = LocationCreate;
export class LocationsApi extends BaseAPI {
getAll() {
return this.http.get<Results<LocationOutCount>>({ url: route("/locations") });

View file

@ -49,6 +49,7 @@ export interface ItemCreate {
/** Edges */
locationId: string;
name: string;
parentId: string | null;
}
export interface ItemField {
@ -63,10 +64,9 @@ export interface ItemField {
export interface ItemOut {
attachments: ItemAttachment[];
children: ItemSummary[];
createdAt: Date;
description: string;
/** Future */
fields: ItemField[];
id: string;
insured: boolean;
@ -76,13 +76,14 @@ export interface ItemOut {
lifetimeWarranty: boolean;
/** Edges */
location: LocationSummary;
location: LocationSummary | null;
manufacturer: string;
modelNumber: string;
name: string;
/** Extras */
notes: string;
parent: ItemSummary | null;
purchaseFrom: string;
/** @example 0 */
@ -113,7 +114,7 @@ export interface ItemSummary {
labels: LabelSummary[];
/** Edges */
location: LocationSummary;
location: LocationSummary | null;
name: string;
quantity: number;
updatedAt: Date;
@ -137,6 +138,7 @@ export interface ItemUpdate {
/** Extras */
notes: string;
parentId: string | null;
purchaseFrom: string;
/** @example 0 */
@ -189,11 +191,13 @@ export interface LocationCreate {
}
export interface LocationOut {
children: LocationSummary[];
createdAt: Date;
description: string;
id: string;
items: ItemSummary[];
name: string;
parent: LocationSummary;
updatedAt: Date;
}
@ -214,6 +218,13 @@ export interface LocationSummary {
updatedAt: Date;
}
export interface LocationUpdate {
description: string;
id: string;
name: string;
parentId: string | null;
}
export interface PaginationResultRepoItemSummary {
items: ItemSummary[];
page: number;