88 lines
1.6 KiB
TypeScript
88 lines
1.6 KiB
TypeScript
import { CollectionConfig } from 'payload/types';
|
|
|
|
const Dispatches: CollectionConfig = {
|
|
slug: 'dispatches',
|
|
admin: {
|
|
useAsTitle: 'dispatchesCode',
|
|
},
|
|
access: {
|
|
read: () => true,
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'dispatchesCode',
|
|
type: 'text',
|
|
required: true,
|
|
},
|
|
{
|
|
name: 'products',
|
|
type: 'relationship',
|
|
relationTo: 'products',
|
|
hasMany: true // required
|
|
// required,
|
|
},
|
|
{
|
|
name: 'courier',
|
|
type: 'relationship',
|
|
relationTo: 'couriers',
|
|
hasMany: false,
|
|
required: false
|
|
},
|
|
{
|
|
name: 'maker',
|
|
type: 'relationship',
|
|
relationTo: 'makers',
|
|
hasMany: false,
|
|
required: false
|
|
},
|
|
{
|
|
name: 'retailer',
|
|
type: 'relationship',
|
|
relationTo: 'retailers',
|
|
hasMany: false,
|
|
required: false
|
|
},
|
|
{
|
|
name: 'status',
|
|
type: 'select',
|
|
hasMany: true,
|
|
options: [
|
|
{
|
|
label: 'Requested',
|
|
value: 'requested',
|
|
},
|
|
{
|
|
label: 'Accepted',
|
|
value: 'accepted',
|
|
},
|
|
{
|
|
label: 'Archived',
|
|
value: 'archived',
|
|
},
|
|
],
|
|
}
|
|
],
|
|
};
|
|
|
|
export default Dispatches;
|
|
|
|
// type Dispatch = {
|
|
// id: string;
|
|
// dispatchesCode: string; //Human readable id
|
|
// createdAt: string;
|
|
// updatedAt: string;
|
|
|
|
// maker: Maker;
|
|
// retailer: Retailer;
|
|
// products: Product[];
|
|
|
|
// courier: User;
|
|
|
|
// timeSensitive: boolean;
|
|
// status: DispatchStatus[];
|
|
|
|
// departureDate: string;
|
|
// arrivalDate: string;
|
|
// weightAllowance: number;
|
|
// }
|