feat(api): complete unified v2 mobile surface
This commit is contained in:
@@ -10,13 +10,21 @@ function createMobileQueryService() {
|
||||
getClientDashboard: async () => ({ businessName: 'Google Cafes' }),
|
||||
getClientSession: async () => ({ business: { businessId: 'b1' } }),
|
||||
getCoverageStats: async () => ({ totalCoveragePercentage: 100 }),
|
||||
getCoverageReport: async () => ({ items: [{ shiftId: 'coverage-1' }] }),
|
||||
getCurrentAttendanceStatus: async () => ({ attendanceStatus: 'NOT_CLOCKED_IN' }),
|
||||
getCurrentBill: async () => ({ currentBillCents: 1000 }),
|
||||
getDailyOpsReport: async () => ({ totals: { workedAssignments: 4 } }),
|
||||
getForecastReport: async () => ({ totals: { projectedCoveragePercentage: 92 } }),
|
||||
getNoShowReport: async () => ({ totals: { noShows: 1 } }),
|
||||
getPaymentChart: async () => ([{ amountCents: 100 }]),
|
||||
getPaymentsSummary: async () => ({ totalEarningsCents: 500 }),
|
||||
getPersonalInfo: async () => ({ firstName: 'Ana' }),
|
||||
getPerformanceReport: async () => ({ totals: { averageRating: 4.8 } }),
|
||||
getProfileSectionsStatus: async () => ({ personalInfoCompleted: true }),
|
||||
getPrivacySettings: async () => ({ profileVisibility: 'TEAM_ONLY' }),
|
||||
getReportSummary: async () => ({ reportDate: '2026-03-13', totals: { orders: 3 } }),
|
||||
getSavings: async () => ({ savingsCents: 200 }),
|
||||
getSpendReport: async () => ({ totals: { amountCents: 2000 } }),
|
||||
getSpendBreakdown: async () => ([{ category: 'Barista', amountCents: 1000 }]),
|
||||
getStaffDashboard: async () => ({ staffName: 'Ana Barista' }),
|
||||
getStaffProfileCompletion: async () => ({ completed: true }),
|
||||
@@ -28,25 +36,34 @@ function createMobileQueryService() {
|
||||
listCertificates: async () => ([{ certificateId: 'cert-1' }]),
|
||||
listCostCenters: async () => ([{ costCenterId: 'cc-1' }]),
|
||||
listCoverageByDate: async () => ([{ shiftId: 'coverage-1' }]),
|
||||
listCoreTeam: async () => ([{ staffId: 'core-1' }]),
|
||||
listCompletedShifts: async () => ([{ shiftId: 'completed-1' }]),
|
||||
listEmergencyContacts: async () => ([{ contactId: 'ec-1' }]),
|
||||
listFaqCategories: async () => ([{ id: 'faq-1', title: 'Clock in' }]),
|
||||
listHubManagers: async () => ([{ managerId: 'm1' }]),
|
||||
listHubs: async () => ([{ hubId: 'hub-1' }]),
|
||||
listIndustries: async () => (['CATERING']),
|
||||
listInvoiceHistory: async () => ([{ invoiceId: 'inv-1' }]),
|
||||
listOpenShifts: async () => ([{ shiftId: 'open-1' }]),
|
||||
getOrderReorderPreview: async () => ({ orderId: 'order-1', lines: 2 }),
|
||||
listOrderItemsByDateRange: async () => ([{ itemId: 'item-1' }]),
|
||||
listPaymentsHistory: async () => ([{ paymentId: 'pay-1' }]),
|
||||
listPendingAssignments: async () => ([{ assignmentId: 'asg-1' }]),
|
||||
listPendingInvoices: async () => ([{ invoiceId: 'pending-1' }]),
|
||||
listProfileDocuments: async () => ([{ staffDocumentId: 'doc-1' }]),
|
||||
listRecentReorders: async () => ([{ id: 'order-1' }]),
|
||||
listBusinessTeamMembers: async () => ([{ userId: 'u-1' }]),
|
||||
listSkills: async () => (['BARISTA']),
|
||||
listStaffAvailability: async () => ([{ dayOfWeek: 1 }]),
|
||||
listStaffBankAccounts: async () => ([{ accountId: 'acc-2' }]),
|
||||
listStaffBenefits: async () => ([{ benefitId: 'benefit-1' }]),
|
||||
listTaxForms: async () => ([{ formType: 'W4' }]),
|
||||
listAttireChecklist: async () => ([{ documentId: 'attire-1' }]),
|
||||
listTimeCardEntries: async () => ([{ entryId: 'tc-1' }]),
|
||||
listTodayShifts: async () => ([{ shiftId: 'today-1' }]),
|
||||
listVendorRoles: async () => ([{ roleId: 'role-1' }]),
|
||||
listVendors: async () => ([{ vendorId: 'vendor-1' }]),
|
||||
searchFaqs: async () => ([{ id: 'faq-2', title: 'Payments' }]),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -89,3 +106,43 @@ test('GET /query/staff/shifts/:shiftId returns injected shift detail', async ()
|
||||
assert.equal(res.status, 200);
|
||||
assert.equal(res.body.shiftId, 'shift-1');
|
||||
});
|
||||
|
||||
test('GET /query/client/reports/summary returns injected report summary', async () => {
|
||||
const app = createApp({ mobileQueryService: createMobileQueryService() });
|
||||
const res = await request(app)
|
||||
.get('/query/client/reports/summary?date=2026-03-13')
|
||||
.set('Authorization', 'Bearer test-token');
|
||||
|
||||
assert.equal(res.status, 200);
|
||||
assert.equal(res.body.totals.orders, 3);
|
||||
});
|
||||
|
||||
test('GET /query/client/coverage/core-team returns injected core team list', async () => {
|
||||
const app = createApp({ mobileQueryService: createMobileQueryService() });
|
||||
const res = await request(app)
|
||||
.get('/query/client/coverage/core-team?date=2026-03-13')
|
||||
.set('Authorization', 'Bearer test-token');
|
||||
|
||||
assert.equal(res.status, 200);
|
||||
assert.equal(res.body.items[0].staffId, 'core-1');
|
||||
});
|
||||
|
||||
test('GET /query/staff/profile/tax-forms returns injected tax forms', async () => {
|
||||
const app = createApp({ mobileQueryService: createMobileQueryService() });
|
||||
const res = await request(app)
|
||||
.get('/query/staff/profile/tax-forms')
|
||||
.set('Authorization', 'Bearer test-token');
|
||||
|
||||
assert.equal(res.status, 200);
|
||||
assert.equal(res.body.items[0].formType, 'W4');
|
||||
});
|
||||
|
||||
test('GET /query/staff/faqs/search returns injected faq search results', async () => {
|
||||
const app = createApp({ mobileQueryService: createMobileQueryService() });
|
||||
const res = await request(app)
|
||||
.get('/query/staff/faqs/search?q=payments')
|
||||
.set('Authorization', 'Bearer test-token');
|
||||
|
||||
assert.equal(res.status, 200);
|
||||
assert.equal(res.body.items[0].title, 'Payments');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user