94 lines
1.6 KiB
TypeScript
94 lines
1.6 KiB
TypeScript
export interface User {
|
|
name: string;
|
|
id: string;
|
|
email: string;
|
|
phoneNumber: string;
|
|
}
|
|
|
|
export interface Node {
|
|
name: string;
|
|
id: string;
|
|
}
|
|
|
|
export interface Media {
|
|
id: string;
|
|
alt?: string;
|
|
updatedAt: string;
|
|
createdAt: string;
|
|
url?: string;
|
|
filename?: string;
|
|
mimeType?: string;
|
|
filesize?: number;
|
|
width?: number;
|
|
height?: number;
|
|
}
|
|
|
|
export interface Product extends Node {
|
|
id: string;
|
|
name: string;
|
|
weight?: number;
|
|
picture: Media;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
};
|
|
|
|
// export interface Location = {
|
|
// latitude: number;
|
|
// longitude: number;
|
|
// }
|
|
|
|
export interface Maker extends Node {
|
|
email: string;
|
|
phoneNumber?: string;
|
|
location: [number, number];
|
|
stock: Product[];
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
admins: User[];
|
|
};
|
|
|
|
export interface Retailer extends Node {
|
|
email: string;
|
|
phoneNumber?: string;
|
|
location: [number, number];
|
|
stock: Product[];
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
admins: User[];
|
|
};
|
|
|
|
const DISPATCH_STATUS = ['requested', 'accepted', 'archived'] as const;
|
|
export type DispatchStatus = typeof DISPATCH_STATUS[number];
|
|
|
|
export interface Dispatch {
|
|
id?: string;
|
|
code?: string; //Human readable id
|
|
createdAt?: string;
|
|
updatedAt?: string;
|
|
|
|
maker: Maker;
|
|
retailer: Retailer;
|
|
products: Product[];
|
|
|
|
courier?: User;
|
|
|
|
timeSensitive: boolean;
|
|
status: DispatchStatus;
|
|
|
|
departureDate?: string;
|
|
arrivalDate?: string;
|
|
}
|
|
|
|
export interface CreateDispatch {
|
|
code?: string; //Human readable id
|
|
|
|
maker: Maker | string;
|
|
retailer: Retailer | string;
|
|
products: Product[] | string[] ;
|
|
|
|
courier?: User;
|
|
|
|
timeSensitive: boolean;
|
|
status: DispatchStatus;
|
|
}
|