Update types
This commit is contained in:
parent
174a163cd3
commit
15700ae304
@ -16,9 +16,9 @@ type User = {
|
|||||||
|
|
||||||
type Product = {
|
type Product = {
|
||||||
id: string;
|
id: string;
|
||||||
productTitle: string;
|
title: string;
|
||||||
weight: number;
|
weight?: number;
|
||||||
img: string;
|
picture: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
};
|
};
|
||||||
@ -32,9 +32,9 @@ type Maker = {
|
|||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
email: string;
|
email: string;
|
||||||
phoneNumber: string;
|
phoneNumber?: string;
|
||||||
location: [number, number];
|
location: [number, number];
|
||||||
products: Product[];
|
stock: Product[];
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
};
|
};
|
||||||
@ -43,9 +43,9 @@ type Retailer = {
|
|||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
email: string;
|
email: string;
|
||||||
phoneNumber: string;
|
phoneNumber?: string;
|
||||||
location: [number, number];
|
location: [number, number];
|
||||||
products: Product[];
|
stock: Product[];
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
};
|
};
|
||||||
@ -55,15 +55,15 @@ type DispatchStatus = typeof DISPATCH_STATUS[number];
|
|||||||
|
|
||||||
type Dispatch = {
|
type Dispatch = {
|
||||||
id: string;
|
id: string;
|
||||||
dispatchesCode: string; //Human readable id
|
dispatchesCode?: string; //Human readable id
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
|
|
||||||
maker: Maker;
|
maker?: Maker;
|
||||||
retailer: Retailer;
|
retailer?: Retailer;
|
||||||
products: Product[];
|
products: Product[];
|
||||||
|
|
||||||
courier: User;
|
courier?: User;
|
||||||
|
|
||||||
timeSensitive: boolean;
|
timeSensitive: boolean;
|
||||||
status: DispatchStatus[];
|
status: DispatchStatus[];
|
||||||
|
@ -34,7 +34,7 @@ export interface Post {
|
|||||||
export interface User {
|
export interface User {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
phoneNumber: number;
|
phoneNumber?: number;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
email: string;
|
email: string;
|
||||||
@ -65,19 +65,19 @@ export interface Courier {
|
|||||||
}
|
}
|
||||||
export interface Dispatch {
|
export interface Dispatch {
|
||||||
id: string;
|
id: string;
|
||||||
dispatchesCode: string;
|
products: string[] | Product[];
|
||||||
products?: string[] | Product[];
|
|
||||||
courier?: string | Courier;
|
courier?: string | Courier;
|
||||||
maker?: string | Maker;
|
maker?: string | Maker;
|
||||||
retailer?: string | Retailer;
|
retailer?: string | Retailer;
|
||||||
status?: ('requested' | 'accepted' | 'archived')[];
|
status: ('requested' | 'accepted' | 'archived')[];
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
}
|
}
|
||||||
export interface Product {
|
export interface Product {
|
||||||
id: string;
|
id: string;
|
||||||
productTitle: string;
|
title: string;
|
||||||
picture?: string | Media;
|
picture: string | Media;
|
||||||
|
weight?: number;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
}
|
}
|
||||||
@ -88,8 +88,8 @@ export interface Maker {
|
|||||||
* @minItems 2
|
* @minItems 2
|
||||||
* @maxItems 2
|
* @maxItems 2
|
||||||
*/
|
*/
|
||||||
location?: [number, number];
|
location: [number, number];
|
||||||
products?: string[] | Product[];
|
stock?: string[] | Product[];
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
}
|
}
|
||||||
@ -100,8 +100,8 @@ export interface Retailer {
|
|||||||
* @minItems 2
|
* @minItems 2
|
||||||
* @maxItems 2
|
* @maxItems 2
|
||||||
*/
|
*/
|
||||||
location?: [number, number];
|
location: [number, number];
|
||||||
requestedProducts?: string[] | Product[];
|
stock?: string[] | Product[];
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
}
|
}
|
||||||
|
@ -9,17 +9,17 @@ const Dispatches: CollectionConfig = {
|
|||||||
read: () => true,
|
read: () => true,
|
||||||
},
|
},
|
||||||
fields: [
|
fields: [
|
||||||
{
|
// {
|
||||||
name: 'dispatchesCode',
|
// name: 'dispatchesCode',
|
||||||
type: 'text',
|
// type: 'text',
|
||||||
required: true,
|
// required: false,
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
name: 'products',
|
name: 'products',
|
||||||
type: 'relationship',
|
type: 'relationship',
|
||||||
relationTo: 'products',
|
relationTo: 'products',
|
||||||
hasMany: true // required
|
hasMany: true,
|
||||||
// required,
|
required: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'courier',
|
name: 'courier',
|
||||||
@ -46,6 +46,7 @@ const Dispatches: CollectionConfig = {
|
|||||||
name: 'status',
|
name: 'status',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
hasMany: true,
|
hasMany: true,
|
||||||
|
required: true,
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: 'Requested',
|
label: 'Requested',
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { CollectionConfig } from 'payload/types';
|
import { CollectionConfig } from 'payload/types';
|
||||||
import { geoPickerField } from "../customFields/geoPicker/field";
|
|
||||||
|
|
||||||
const Makers: CollectionConfig = {
|
const Makers: CollectionConfig = {
|
||||||
slug: 'makers',
|
slug: 'makers',
|
||||||
@ -11,21 +10,22 @@ const Makers: CollectionConfig = {
|
|||||||
},
|
},
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: 'name',
|
name: 'name',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'location',
|
name: 'location',
|
||||||
type: 'point',
|
type: 'point',
|
||||||
label: 'Location',
|
label: 'Location',
|
||||||
},
|
required: true
|
||||||
{
|
},
|
||||||
name: 'products',
|
{
|
||||||
type: 'relationship',
|
name: 'stock',
|
||||||
relationTo: 'products',
|
type: 'relationship',
|
||||||
hasMany: true,
|
relationTo: 'products',
|
||||||
}
|
hasMany: true,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ const Products: CollectionConfig = {
|
|||||||
},
|
},
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: 'productTitle',
|
name: 'title',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
@ -18,7 +18,15 @@ const Products: CollectionConfig = {
|
|||||||
name: 'picture',
|
name: 'picture',
|
||||||
type: 'relationship',
|
type: 'relationship',
|
||||||
relationTo: 'media',
|
relationTo: 'media',
|
||||||
hasMany: false
|
hasMany: false,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'weight',
|
||||||
|
label: 'Weight (kg)',
|
||||||
|
type: 'number',
|
||||||
|
hasMany: false,
|
||||||
|
required: false,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { CollectionConfig } from 'payload/types';
|
import { CollectionConfig } from 'payload/types';
|
||||||
|
import { geoPickerField } from "../customFields/geoPicker/field";
|
||||||
|
|
||||||
const Retailers: CollectionConfig = {
|
const Retailers: CollectionConfig = {
|
||||||
slug: 'retailers',
|
slug: 'retailers',
|
||||||
@ -18,9 +19,10 @@ const Retailers: CollectionConfig = {
|
|||||||
name: 'location',
|
name: 'location',
|
||||||
type: 'point',
|
type: 'point',
|
||||||
label: 'Location',
|
label: 'Location',
|
||||||
|
required: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'requestedProducts',
|
name: 'stock',
|
||||||
type: 'relationship',
|
type: 'relationship',
|
||||||
relationTo: 'products',
|
relationTo: 'products',
|
||||||
hasMany: true,
|
hasMany: true,
|
||||||
|
@ -19,13 +19,8 @@ const Users: CollectionConfig = {
|
|||||||
{
|
{
|
||||||
name: 'phoneNumber',
|
name: 'phoneNumber',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
required: true
|
required: false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'email',
|
|
||||||
type: 'email',
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user