Phase 1 · Audit

Zaahi Platform Audit

What the booking platform already does, what it only appears to do, and what genuinely is not there — read from the code rather than from the screens.

13 November 2026 API build 2026-11-12.3 26 database tables 44 API endpoints 49 test suites

The headline

Most of this brief is already built. The platform has a real CRM, real email marketing with open and click tracking, real consent handling, Square payments with webhook verification, and two-way calendar sync. Rebuilding any of that would be throwing away working code.

What it does not have is the loyalty layer, the waitlist, staff scheduling, and a second and third payment provider. Those are genuinely absent — not broken, not stubbed, absent.

The audit also turned up one thing that needed fixing before anything else, so I fixed it.

Found and fixed: staff roles were decorative

Severity · high · now closed

The platform has had four staff roles since staff accounts were added — super-admin, manager, customer-service, read-only. They were stored on the account and shown in the admin screen. They were enforced in exactly one file: admin-users.php, which keeps staff management to an owner.

Every other protected endpoint called Auth::require_(), which asks two questions: is there a session, and did this write carry its form token. Neither is a question about the role.

So an account created as read-only could do nearly anything. I proved it before changing a line. Signed in as read-only, against a real server:

  • created a customer — 200 OK, record written
  • reached the Square, Microsoft and Twilio credential endpoints — refused only for sending an empty form, not for lack of authority
  • ran the booking backfill — 200 OK, executed

The admin screen hid those buttons. A hidden button is not a permission; it is a suggestion that anyone with developer tools or curl can decline.

What changed

One permission map now lives in Auth.php, readable in one screen, and every guarded endpoint asks it. A refusal names the role you are signed in as and the role the action needs, so staff are not left guessing.

ActionOwnerManagerCustomer serviceRead-only
See the studio's screensyesyesyesyes
Create and edit customersyesyesyesno
Delete, purge or bulk-import customersyesyesnono
Send a campaign to the listyesyesnono
Chase a payment, run the backfillyesyesyesno
Attach or correct a paymentyesnonono
Change Square, Microsoft or Twilio credentialsyesnonono
Add or remove staffyesnonono

A session opened with the studio passcode keeps full authority. It is the way back in if an owner is locked out, and it is already what the staff screen treats it as. The narrowing applies to named staff accounts, which is where the problem was.

Pinned by tests/permissions.php, 24 assertions. Removing the check turns 11 of them red.

Status of the brief, section by section

Read from the code. built means working and under test. partial means real but incomplete. absent means there is nothing there.

builtEmail marketing Campaigns, block-based templates, scheduling, segmentation, previews, open and click tracking, bounce handling, suppression list. Opens and clicks are stored separately, so a click is never counted as an open.
partialVideo in email Uploaded files become animated GIF reels that autoplay in Gmail, Apple Mail and mobile. Pasted Vimeo and YouTube links stay a still thumbnail, because their frames are not ours to read. Automatic multi-clip reel generation is not built.
partialPayments Square only, with hosted card fields, signed webhooks, idempotency and server-side verification. Deposits, balances and prepay discounts are real. Stripe is a client-side stub with no server. PayPal, tips, and issuing refunds from the platform are absent — refunds are recorded when Square reports one, never initiated here.
builtCRM Server-owned customer records, CSV import with duplicate protection, search, filters, tags, notes, consent per channel, audit trail, soft delete and restore.
partialClient history Bookings link to customers by email and the imported baseline from your spreadsheet is kept separately from live figures. What is missing is the arithmetic: nothing computes a customer's real spend, booking count or last visit from the bookings table. See the lifetime value section below.
builtConfirmations and reminders Fixed yesterday. Client confirmation, studio notification, calendar hold, and the reminder ladder at 14 days, 7 days, 48 hours and 24 hours. Timing is configurable in the pricing data rather than in a screen.
absentWaitlist No table, no endpoint, no screen. Nothing to build on.
builtCalendar sync Two-way already: external feeds are ingested and blocked out, and the studio's own bookings publish to an outbound iCal feed that Apple Calendar, Peerspace and Giggster can subscribe to. Not OAuth — a published iCloud link is read-only by Apple's design, which the platform states rather than works around. Google and Outlook OAuth would be an addition, not a replacement.
partialStaff management Accounts, passwords, four roles, forced password change, audit trail — and as of today, enforced permissions. Absent: per-staff working hours, availability, individual calendars, service assignment, and the six-role structure in the brief.
absentLoyalty Recurring bookings, session packages, memberships with recurring billing, gift certificates, coupons, add-ons and upselling. None of it exists. The word "package" in the code means a production bundle for one shoot, not a block of sessions.
absentNotification centre There is an audit log and an activity view, but no read/unread centre for staff.
partialDashboard Exists with bookings, revenue and activity. Absent: no-show rate, tips, deposits held, waitlist activity, staff availability — mostly because the data behind them does not exist yet.
builtArchitecture PHP 8 with SQLite via PDO, additive migrations, server-side storage for everything that matters, nothing load-bearing in localStorage. The single-file HTML is a build artifact; the source is the js/ and api/ tree.

Your three recommendations

All three are worth building and they share one piece of groundwork, which is why I would do them together rather than scattered across phases.

1 · Lifetime value

Needs a customer value rollup: total spent, bookings, average value, last visit, computed from the bookings table rather than stored and left to drift. The imported CSV baseline stays separate and labelled, as it is now — a figure from your spreadsheet and a figure this platform earned are different claims.

Honest caveat on "estimated future revenue". With a few bookings per client, any projection is arithmetic dressed as a forecast. I would show observed cadence and spend, and label a projection as an estimate with its basis visible, or leave it out.

2 · Rebooking engine

Falls straight out of the same rollup: median gap between a client's bookings, then an invitation at a proportion of it. Needs a suppression rule so a client who already has a future booking is never invited, and it must obey the existing consent gate.

Worth doing after the rollup exists, not before.

3 · Membership levels

Today customers.type is binary: member or guest. Five tiers needs a real column plus the rules that move people between them, and a decision from you: are tiers earned from spend, granted by hand, or both?

Tiers that carry discounts also touch pricing, which is the one area where a mistake costs money on every booking. I would keep the first version to access and priority, and add discounts once the tier data has been right for a month.

Suggested order

The brief's own phasing is sound. I would reorder two things: permissions came first because it was open, and the loyalty layer comes earlier than Phase 7 because your three recommendations depend on it.

done

Staff permissions enforced on the server

Closed today. 24 assertions.

next

Customer value rollup, membership tiers, rebooking

Your three recommendations, built on one shared computation. Tier rules and the earned-versus-granted question need a decision from you first.one working session

3

Loyalty mechanics

Session packages, coupons, add-ons at checkout, gift certificates. Each is a table, an endpoint and a checkout hook. Coupons and add-ons touch pricing, so they want their own test suite before they touch a live total.substantial

4

Waitlist

Join, position, cancellation detection, timed claim link, and a lock so two people cannot claim one slot. The lock is the hard part and the reason this is its own phase.moderate

5

Staff scheduling

Working hours, availability, per-staff calendars, service assignment, and the wider role structure. Builds on the permission work.substantial

6

Payment providers and money handling

Stripe and PayPal server-side, tips, refunds issued from the platform, offline payments. Needs accounts and credentials from you before any of it can be tested.substantial, gated on accounts

7

Recurring bookings and memberships with billing

Recurring billing is the highest-risk thing in the brief: it charges cards on a schedule with nobody watching. It goes last, after the single-charge path has been right for a while.substantial

8

Notification centre and dashboard

Worth doing once the events it would show exist, rather than building a centre that reports three kinds of thing.moderate

What needs something from you

Standing on test coverage

Every claim of "built" above means there is a suite behind it that runs against a real PHP server and a real browser. Nothing is counted as working because a screen looks right.

AreaSuiteAssertions
Staff permissionspermissions.php24
Booking workflow end to endbooking-flow.php65
Consent and A2P complianceconsent.php173
CRM and importscustomers.php165
Reminders and the payment chasereminders.php108
Email composition and sendingemail-compose.php89
Everything else43 further suites1,623

2,247 assertions in total. Each fix made during this audit was checked by reverting it and confirming the suite goes red — a test that passes either way is decoration.