initial commit
This commit is contained in:
@@ -1,21 +1,5 @@
|
||||
import { getMilers, assignMilerToBooking } from '@/api/doormile/endpoints';
|
||||
import { notifyMiler } from '@/api/doormile/endpoints';
|
||||
|
||||
const normMilerName = (n) => (n || '').toString().trim().toLowerCase();
|
||||
|
||||
export const buildMilerLookup = (milers) => {
|
||||
const byUserId = new Map((milers || []).map((m) => [String(m.userid), m]));
|
||||
const byProfileId = new Map((milers || []).map((m) => [String(m.milerprofileid), m]));
|
||||
const byName = new Map();
|
||||
(milers || []).forEach((m) => {
|
||||
[m.displayname, m.authname].forEach((n) => {
|
||||
const key = normMilerName(n);
|
||||
if (key && !byName.has(key)) byName.set(key, m);
|
||||
});
|
||||
});
|
||||
return { byUserId, byProfileId, byName };
|
||||
};
|
||||
|
||||
import { getMilers, assignMilerToBooking } from 'pages/api/doormileApi';
|
||||
import { buildMilerLookup, notifyRider } from 'pages/api/api';
|
||||
|
||||
// ==============================|| Doormile AI — assigning a rider ||============================== //
|
||||
//
|
||||
@@ -125,7 +109,7 @@ export const executeAssign = async (booking, rider) => {
|
||||
|
||||
if (rider.milerprofileid) {
|
||||
try {
|
||||
await notifyMiler(rider.milerprofileid);
|
||||
await notifyRider(rider.milerprofileid);
|
||||
notified = true;
|
||||
sourceCalls.push({
|
||||
name: 'notifyRider',
|
||||
@@ -240,7 +224,7 @@ export const executeRepeatAssign = async (createdPairs, rows) => {
|
||||
if (rider?.milerprofileid) {
|
||||
try {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await notifyMiler(rider.milerprofileid);
|
||||
await notifyRider(rider.milerprofileid);
|
||||
notified += 1;
|
||||
} catch {
|
||||
// Notification failure never fails the assignment — the order IS
|
||||
|
||||
Reference in New Issue
Block a user