Fix queries

This commit is contained in:
toqvist 2024-04-03 19:11:33 +02:00
parent cb26b8edcd
commit 225d45307a
9 changed files with 2869 additions and 2101 deletions

View File

@ -0,0 +1 @@
PAYLOAD_URL=http://localhost:3001

View File

@ -18,9 +18,11 @@
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-slot": "^1.0.2",
"@tanstack/react-query": "^5.28.14",
"@types/leaflet": "^1.9.8",
"@types/react": "^18.2.74",
"@types/react-dom": "^18.2.23",
"astro": "^4.5.13",
"axios": "^1.6.8",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"css-select": "5.1.0",

View File

@ -5,18 +5,8 @@ import { KiosMap } from "@/components/KiosMap"
export const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
retry: false,
staleTime: 30000,
refetchOnReconnect: true,
refetchOnMount: true,
networkMode: "online",
},
mutations: {
networkMode: "offlineFirst",
retry: 1,
},
},
});
@ -27,10 +17,10 @@ interface AppProps {
export const App: React.FC<AppProps> = (props) => {
return (
<div className="app">
<QueryClientProvider client={queryClient}>
{props.children}
<KiosMap></KiosMap>
</QueryClientProvider>
<QueryClientProvider client={queryClient}>
{props.children}
<KiosMap/>
</QueryClientProvider>
</div>
);
}

View File

@ -1,8 +1,13 @@
import React, { useEffect } from 'react';
import { MapContainer, TileLayer, Marker, Popup, Polyline, LayerGroup, GeoJSON } from 'react-leaflet';
import { MapContainer, TileLayer, Marker, CircleMarker, Popup, Polyline, LayerGroup, GeoJSON, } from 'react-leaflet';
// import 'leaflet/dist/leaflet.css';
import L from 'leaflet';
import { useQuery, useMutation, useQueryClient, queryOptions } from "@tanstack/react-query";
import { queryClient } from "@/components/App"
import axios from "axios";
//Todo: Move types to own file
type Product = {
@ -35,113 +40,182 @@ type Retailer = {
updatedAt: string;
};
interface Courier {
id: string;
name: string;
startingPoint: string;
destination: string;
departureDate: string;
arrivalDate: string;
weightAllowance: number;
createdAt: string;
updatedAt: string;
}
interface Dispatch {
id: string;
dispatchesCode: string;
products: Product[];
typeOfTransportation: string[];
courier: Courier;
timeSensitive: boolean;
status: string[];
createdAt: string;
updatedAt: string;
}
//Todo: update fetch url endpoints
//Todo: Move queryclient and hooks to own file
const ROOT_URL = "http://localhost:3001"
const getMakers = async () => {
const response = await fetch("https://kios-admin.lumbung.space/api/makers");
const makers: Maker[] = (await response.json()).docs;
console.log(makers)
const url = `${ROOT_URL}/api/makers`
console.log("Fetching url:", url)
const response = await axios.get(url);
const makers = response.data.docs;
console.log(`Fetch result from ${url}`, makers)
return makers;
}
const useGetMakers = () => {
return useQuery<Maker[]>({
queryFn: () => getMakers(),
queryKey: ['makers']
queryKey: ['makers'],
enabled: true
})
}
const getRetailers = async () => {
const response = await fetch("https://kios-admin.lumbung.space/api/makers");
const makers: Maker[] = (await response.json()).docs;
return makers;
const url = `${ROOT_URL}/api/retailers`
console.log("Fetching url:", url)
const response = await axios.get(url);
const retailers = response.data.docs;
console.log(`Fetch result from ${url}`, retailers)
return retailers;
}
const useGetRetailers = () => {
return useQuery<Dispatch[]>({
queryFn: () => getRetailers(),
queryKey: ['retailers'],
enabled: true
})
}
const getDispatches = async () => {
const url = `${ROOT_URL}/api/dispatches`
console.log("Fetching url:", url)
const response = await axios.get(url);
const dispatches = response.data.docs;
console.log(`Fetch result from ${url}`, dispatches)
return dispatches;
}
const useGetDispatches = () => {
return useQuery<Dispatch[]>({
queryFn: () => getRetailers(),
queryKey: ['retailers'],
enabled: true
})
}
export const KiosMap = () => {
const { data: makers, isLoading: isLoadingMakers, isError } = useGetMakers();
const retailers = false
const { data: makers, isLoading: isLoadingMakers } = useGetMakers();
const { data: retailers, isLoading: isLoadingRetailers } = useGetRetailers();
const { data: dispatches, isLoading: isLoadingDispatches } = useGetDispatches();
// const blackDotIcon = L.divIcon({
// className: 'black-dot',
// iconSize: [20, 20],
// iconAnchor: [10, 10]
// });
const blackDotIcon = L.divIcon({
className: 'black-dot',
iconSize: [20, 20],
iconAnchor: [10, 10]
});
return (
<MapContainer
id="map"
// center={[-6.1815, 106.8228]}
center={[-6.1815, 106.8228]}
//zoom={3}
style={{ width: '100%', paddingBottom: '70%', marginBottom: '80px' }}
className="w-full"
>
<TileLayer url="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
// maxZoom={19}
// attribution='&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
maxZoom={19}
attribution='&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
/>
{makers &&
<LayerGroup>
{makers.map((maker: any, index: number) => (
<Marker
<CircleMarker
key={index}
position={[maker.location[0], maker.location[1]]}
//icon={blackDotIcon}
center={[maker.location[0], maker.location[1]]}
fillColor='black'
>
<Popup>{maker.name}</Popup>
</Marker>
</CircleMarker>
))}
</LayerGroup>
}
{/* {retailers
{retailers &&
<LayerGroup>
{data.retailers.map((retailer: any, index: number) => (
<Marker key={index} position={[retailer.location[0], retailer.location[1]]} icon={blackDotIcon}>
<Popup>{retailer.name}</Popup>
</Marker>
))}
</LayerGroup>
} */}
{retailers.map((retailer: any, index: number) => (
<CircleMarker
key={index}
center={[retailer.location[0], retailer.location[1]]}
fillColor='black'
>
<Popup>{retailer.name}</Popup>
</CircleMarker>
))}
</LayerGroup>
}
{dispatches &&
<LayerGroup>
{dispatches.map((dispatch: any, index: number) => {
const start = dispatch.startingPoint.location;
const end = dispatch.endPoint.location;
{/* <LayerGroup>
{data.dispatches.map((dispatch: any, index: number) => {
const start = dispatch.startingPoint.location;
const end = dispatch.endPoint.location;
let productsString = '';
dispatch.products.forEach((product: any, i: number) => {
productsString += product.productTitle + (i + 1 < dispatch.products.length ? ', ' : '');
});
let productsString = '';
dispatch.products.forEach((product: any, i: number) => {
productsString += product.productTitle + (i + 1 < dispatch.products.length ? ', ' : '');
});
const myDashArray =
dispatch.status === 'routeRequested' ? '20, 10' :
dispatch.status === 'completed' ? '1, 5' :
'0, 0';
const myDashArray =
dispatch.status === 'routeRequested' ? '20, 10' :
dispatch.status === 'completed' ? '1, 5' :
'0, 0';
return (
<div key={index}>
<Marker position={[start[0], start[1]]}
//icon={blackDotIcon}
>
<Popup>{dispatch.startingPoint.name}</Popup>
</Marker>
<Marker position={[end[0], end[1]]}
//icon={blackDotIcon}
>
<Popup>{dispatch.endPoint.name}</Popup>
</Marker>
<Polyline
positions={[[start[0], start[1]], [end[0], end[1]]]}
color="#000"
dashArray={myDashArray} />
</div>
);
})}
</LayerGroup> */}
return (
<div key={index}>
<Marker position={[start[0], start[1]]}
//icon={blackDotIcon}
>
<Popup>{dispatch.startingPoint.name}</Popup>
</Marker>
<Marker position={[end[0], end[1]]}
//icon={blackDotIcon}
>
<Popup>{dispatch.endPoint.name}</Popup>
</Marker>
<Polyline
positions={[[start[0], start[1]], [end[0], end[1]]]}
color="#000"
dashArray={myDashArray} />
</div>
);
})}
</LayerGroup>
}
</MapContainer >
);
};

View File

@ -860,6 +860,11 @@
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4"
integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==
"@types/geojson@*":
version "7946.0.14"
resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.14.tgz#319b63ad6df705ee2a65a73ef042c8271e696613"
integrity sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==
"@types/hast@^3.0.0":
version "3.0.4"
resolved "https://registry.yarnpkg.com/@types/hast/-/hast-3.0.4.tgz#1d6b39993b82cea6ad783945b0508c25903e15aa"
@ -867,6 +872,13 @@
dependencies:
"@types/unist" "*"
"@types/leaflet@^1.9.8":
version "1.9.8"
resolved "https://registry.yarnpkg.com/@types/leaflet/-/leaflet-1.9.8.tgz#32162a8eaf305c63267e99470b9603b5883e63e8"
integrity sha512-EXdsL4EhoUtGm2GC2ZYtXn+Fzc6pluVgagvo2VC1RHWToLGlTRwVYoDpqS/7QXa01rmDyBjJk3Catpf60VMkwg==
dependencies:
"@types/geojson" "*"
"@types/mdast@^4.0.0":
version "4.0.3"
resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-4.0.3.tgz#1e011ff013566e919a4232d1701ad30d70cab333"
@ -1124,6 +1136,11 @@ astro@^4.5.13:
optionalDependencies:
sharp "^0.32.6"
asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==
autoprefixer@^10.4.15:
version "10.4.19"
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.19.tgz#ad25a856e82ee9d7898c59583c1afeb3fa65f89f"
@ -1143,6 +1160,15 @@ available-typed-arrays@^1.0.7:
dependencies:
possible-typed-array-names "^1.0.0"
axios@^1.6.8:
version "1.6.8"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.8.tgz#66d294951f5d988a00e87a0ffb955316a619ea66"
integrity sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==
dependencies:
follow-redirects "^1.15.6"
form-data "^4.0.0"
proxy-from-env "^1.1.0"
axobject-query@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-4.0.0.tgz#04a4c90dce33cc5d606c76d6216e3b250ff70dab"
@ -1456,6 +1482,13 @@ color@^4.2.3:
color-convert "^2.0.1"
color-string "^1.9.0"
combined-stream@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
dependencies:
delayed-stream "~1.0.0"
comma-separated-tokens@^2.0.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz#4e89c9458acb61bc8fef19f4529973b2392839ee"
@ -1584,6 +1617,11 @@ define-properties@^1.2.1:
has-property-descriptors "^1.0.0"
object-keys "^1.1.1"
delayed-stream@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==
dequal@^2.0.0, dequal@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be"
@ -1953,6 +1991,11 @@ flattie@^1.1.0:
resolved "https://registry.yarnpkg.com/flattie/-/flattie-1.1.1.tgz#88182235723113667d36217fec55359275d6fe3d"
integrity sha512-9UbaD6XdAL97+k/n+N7JwX46K/M6Zc6KcFYskrYL8wbBV/Uyk0CTAMY0VT+qiK5PM7AIc9aTWYtq65U7T+aCNQ==
follow-redirects@^1.15.6:
version "1.15.6"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b"
integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==
for-each@^0.3.3:
version "0.3.3"
resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"
@ -1968,6 +2011,15 @@ foreground-child@^3.1.0:
cross-spawn "^7.0.0"
signal-exit "^4.0.1"
form-data@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.8"
mime-types "^2.1.12"
fraction.js@^4.3.7:
version "4.3.7"
resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.3.7.tgz#06ca0085157e42fda7f9e726e79fefc4068840f7"
@ -3129,6 +3181,18 @@ micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5:
braces "^3.0.2"
picomatch "^2.3.1"
mime-db@1.52.0:
version "1.52.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==
mime-types@^2.1.12:
version "2.1.35"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a"
integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==
dependencies:
mime-db "1.52.0"
mime@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/mime/-/mime-3.0.0.tgz#b374550dca3a0c18443b0c950a6a58f1931cf7a7"
@ -3588,6 +3652,11 @@ property-information@^6.0.0:
resolved "https://registry.yarnpkg.com/property-information/-/property-information-6.5.0.tgz#6212fbb52ba757e92ef4fb9d657563b933b7ffec"
integrity sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==
proxy-from-env@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==
pump@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64"
@ -4601,9 +4670,9 @@ vfile@^6.0.0, vfile@^6.0.1:
vfile-message "^4.0.0"
vite@^5.1.4:
version "5.2.7"
resolved "https://registry.yarnpkg.com/vite/-/vite-5.2.7.tgz#e1b8a985eb54fcb9467d7f7f009d87485016df6e"
integrity sha512-k14PWOKLI6pMaSzAuGtT+Cf0YmIx12z9YGon39onaJNy8DLBfBJrzg9FQEmkAM5lpHBZs9wksWAsyF/HkpEwJA==
version "5.2.8"
resolved "https://registry.yarnpkg.com/vite/-/vite-5.2.8.tgz#a99e09939f1a502992381395ce93efa40a2844aa"
integrity sha512-OyZR+c1CE8yeHw5V5t59aXsUPPVTHMDjEZz8MgguLL/Q7NblxhZUlTu9xSPqlsUO/y+X7dlU05jdhvyycD55DA==
dependencies:
esbuild "^0.20.1"
postcss "^8.4.38"

View File

@ -13,6 +13,7 @@
"generate:types": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts node -r tsconfig-paths/register node_modules/payload/dist/bin/index.js generate:types"
},
"dependencies": {
"cors": "^2.8.5",
"cross-env": "^7.0.3",
"dotenv": "^16.3.1",
"express": "^4.17.1",

View File

@ -1,5 +1,6 @@
import express from "express";
import payload from "payload";
import cors from "cors";
require("dotenv").config();
const app = express();
@ -17,5 +18,11 @@ payload.init({
},
});
const corsOptions = {
origin: 'http://localhost:3000',
};
app.use(cors(corsOptions));
app.use("/media", express.static("media"));
app.listen(process.env.PAYLOAD_PORT);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,355 @@
{
"docs": [
{
"id": "660a8a0701275c2f8eb88344",
"dispatchesCode": "Tropical Tap Water",
"products": [
{
"id": "660a87b201275c2f8eb88302",
"productTitle": "Tote Bags",
"createdAt": "2024-04-01T10:08:50.417Z",
"updatedAt": "2024-04-01T10:08:50.417Z"
}
],
"typeOfTransportation": ["air"],
"courier": {
"id": "660a899501275c2f8eb8831b",
"name": "Daniel Aguilar Ruvalcaba",
"startingPoint": "Indonesia",
"destination": "Mexico",
"departureDate": "2024-04-15T06:00:00.000Z",
"arrivalDate": "2024-04-16T06:00:00.000Z",
"weightAllowance": 5,
"createdAt": "2024-04-01T10:16:53.455Z",
"updatedAt": "2024-04-01T10:16:53.455Z"
},
"timeSensitive": false,
"status": ["routeRequested"],
"createdAt": "2024-04-01T10:18:47.302Z",
"updatedAt": "2024-04-01T10:18:47.302Z"
},
{
"id": "66028d2a01275c2f8eb87e3a",
"dispatchesCode": "HQL-571",
"products": [
{
"id": "66028ee601275c2f8eb87e93",
"productTitle": "Acts of Departure: Dispatches from The Last Emporium",
"createdAt": "2024-03-26T09:01:26.239Z",
"updatedAt": "2024-03-26T09:01:26.239Z"
}
],
"startingPoint": {
"id": "66028ec901275c2f8eb87e76",
"name": "Display Distribute",
"location": [114.19163986185993, 22.31656075733971],
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"createdAt": "2024-03-26T09:00:57.371Z",
"updatedAt": "2024-03-26T09:00:57.371Z"
},
"endPoint": {
"id": "65b0cf25afcaf765bddf4540",
"name": "Retailer one",
"location": [2.45, 48.9],
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"createdAt": "2024-01-24T08:49:41.635Z",
"updatedAt": "2024-01-24T08:49:41.635Z"
},
"typeOfTransportation": ["air"],
"courier": {
"id": "66028b3801275c2f8eb87e22",
"name": "Shuang",
"startingPoint": "Chongqing",
"destination": "Hong Kong",
"departureDate": "2024-03-26T16:00:00.000Z",
"arrivalDate": "2024-03-27T16:00:00.000Z",
"weightAllowance": 2,
"createdAt": "2024-03-26T08:45:44.841Z",
"updatedAt": "2024-03-26T09:04:46.105Z"
},
"status": ["completed"],
"createdAt": "2024-03-26T08:54:02.444Z",
"updatedAt": "2024-03-26T09:05:05.667Z"
},
{
"id": "65db4a5af1b7d726bba2ebe4",
"dispatchesCode": "007",
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"startingPoint": {
"id": "65b0cff2afcaf765bddf45a8",
"name": "Maker 3",
"location": [106, -6.2],
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"createdAt": "2024-01-24T08:53:06.945Z",
"updatedAt": "2024-01-24T08:53:06.945Z"
},
"endPoint": {
"id": "65b0cf25afcaf765bddf4540",
"name": "Retailer one",
"location": [2.45, 48.9],
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"createdAt": "2024-01-24T08:49:41.635Z",
"updatedAt": "2024-01-24T08:49:41.635Z"
},
"courier": {
"id": "65b0ced0afcaf765bddf4503",
"name": "Joost the Courier",
"createdAt": "2024-01-24T08:48:16.461Z",
"updatedAt": "2024-01-24T08:48:16.461Z"
},
"timeSensitive": true,
"status": ["routeRequested"],
"createdAt": "2024-02-25T14:10:34.727Z",
"updatedAt": "2024-02-25T19:24:29.046Z",
"typeOfTransportation": ["car"]
},
{
"id": "65b0d0aeafcaf765bddf4671",
"dispatchesCode": "004",
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"startingPoint": {
"id": "65b0cfd9afcaf765bddf4596",
"name": "Maker Two",
"location": [0.128, 51.5],
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"createdAt": "2024-01-24T08:52:41.057Z",
"updatedAt": "2024-01-24T08:52:41.057Z"
},
"endPoint": {
"id": "65b0cf7eafcaf765bddf4564",
"name": "Retailer 3",
"location": [9.19, 45.5],
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"createdAt": "2024-01-24T08:51:10.008Z",
"updatedAt": "2024-01-24T08:51:10.008Z"
},
"courier": {
"id": "65b0ced0afcaf765bddf4503",
"name": "Joost the Courier",
"createdAt": "2024-01-24T08:48:16.461Z",
"updatedAt": "2024-01-24T08:48:16.461Z"
},
"status": ["routeRequested"],
"createdAt": "2024-01-24T08:56:14.210Z",
"updatedAt": "2024-01-24T08:56:14.210Z"
},
{
"id": "65b0d099afcaf765bddf4640",
"dispatchesCode": "003",
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"startingPoint": {
"id": "65b0cff2afcaf765bddf45a8",
"name": "Maker 3",
"location": [106, -6.2],
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"createdAt": "2024-01-24T08:53:06.945Z",
"updatedAt": "2024-01-24T08:53:06.945Z"
},
"endPoint": {
"id": "65b0cf6bafcaf765bddf4552",
"name": "Retailer two",
"location": [-74, 40.7],
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"createdAt": "2024-01-24T08:50:51.876Z",
"updatedAt": "2024-01-24T08:50:51.876Z"
},
"courier": {
"id": "65b0ced0afcaf765bddf4503",
"name": "Joost the Courier",
"createdAt": "2024-01-24T08:48:16.461Z",
"updatedAt": "2024-01-24T08:48:16.461Z"
},
"status": ["completed"],
"createdAt": "2024-01-24T08:55:53.951Z",
"updatedAt": "2024-01-24T08:55:53.951Z"
},
{
"id": "65b0d07cafcaf765bddf460f",
"dispatchesCode": "002",
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"startingPoint": {
"id": "65b0d00dafcaf765bddf45ba",
"name": "Fahad the Artist",
"location": [-6.84, 33.9],
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"createdAt": "2024-01-24T08:53:33.106Z",
"updatedAt": "2024-01-24T08:53:33.106Z"
},
"endPoint": {
"id": "65b0cf25afcaf765bddf4540",
"name": "Retailer one",
"location": [2.45, 48.9],
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"createdAt": "2024-01-24T08:49:41.635Z",
"updatedAt": "2024-01-24T08:49:41.635Z"
},
"courier": {
"id": "65b0ced0afcaf765bddf4503",
"name": "Joost the Courier",
"createdAt": "2024-01-24T08:48:16.461Z",
"updatedAt": "2024-01-24T08:48:16.461Z"
},
"status": ["routeRequested"],
"createdAt": "2024-01-24T08:55:24.797Z",
"updatedAt": "2024-01-24T08:55:24.797Z"
},
{
"id": "65b0d05cafcaf765bddf45de",
"dispatchesCode": "Random-string-maybe-better-to-use-the-ID",
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"startingPoint": {
"id": "65b0cfd9afcaf765bddf4596",
"name": "Maker Two",
"location": [0.128, 51.5],
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"createdAt": "2024-01-24T08:52:41.057Z",
"updatedAt": "2024-01-24T08:52:41.057Z"
},
"endPoint": {
"id": "65b0cf7eafcaf765bddf4564",
"name": "Retailer 3",
"location": [9.19, 45.5],
"products": [
{
"id": "65b0cefaafcaf765bddf4527",
"productTitle": "Product one",
"createdAt": "2024-01-24T08:48:58.369Z",
"updatedAt": "2024-01-24T08:48:58.369Z"
}
],
"createdAt": "2024-01-24T08:51:10.008Z",
"updatedAt": "2024-01-24T08:51:10.008Z"
},
"courier": {
"id": "65b0ced0afcaf765bddf4503",
"name": "Joost the Courier",
"createdAt": "2024-01-24T08:48:16.461Z",
"updatedAt": "2024-01-24T08:48:16.461Z"
},
"status": ["inTransit"],
"createdAt": "2024-01-24T08:54:52.811Z",
"updatedAt": "2024-01-24T08:54:52.811Z"
}
],
"totalDocs": 7,
"limit": 10,
"totalPages": 1,
"page": 1,
"pagingCounter": 1,
"hasPrevPage": false,
"hasNextPage": false,
"prevPage": null,
"nextPage": null
}