API (api-v2)

Customers, staff & shop

The CRM, staff and role administration, the in-app notification inbox, and onboarding lookups.


Customers

Tables:

  • customer (with nickname)
  • customer_address, customer_tag
  • shop_customer: links a storefront login to a CRM row
RouteGuard
/merchant/customer/v1/get-shop-customersperm customers.view
create-customerwide customers.write
get-customer, update-customer, delete-customer, create/update/delete-customer-address, set-default-customer-addressoScoped
  • There's no deduplication; the POS warns on duplicate phones instead.
  • Editing a customer never rewrites order snapshots.
  • Order count and total spent are derived.
  • Deleting a customer keeps their orders.
  • POS-side routes are on POS & shifts.

Staff & roles

Tables:

  • shop_staff: birthday and emergency contact were added in #80
  • shop_staff_role, shop_staff_role_permission, shop_staff_role_category
  • shop_staff_assignment + shop_staff_assignment_location: several roles per person, each scoped to branches (#73)
  • shop_staff_location: legacy
  • staff_shift_rule: the weekly rota (API only; the dashboard UI was removed)
  • staff_discount_pin
RouteGuard
/merchant/staff/v1/get-shop-staff, get-shop-staff-rolesperm staff.manage
create/update/delete-staff, create/update/delete-staff-role, set-staff-shifts, PIN routesowner
get-staff-permissionsauthenticated (the permission catalogue, grouped)

Rules:

  • canSignIn links the staff row to a users account and requires an email.
  • An assignment's mode is all or specific locations. The dashboard saves "every branch ticked" as all, so future branches are included.
  • A role that staff still hold can't be deleted (409). The same role can't be assigned twice to one person.
  • A role scoped to specific branches can't perform shop-wide writes (prices, categories, discounts, sections, customers), because those need requireShopWidePermission.
  • Catalogue scope: shop_staff_role_category roots, including descendants. Empty means the whole catalogue.
  • Rota: a shift that ends before it starts crosses midnight, and overlapping shifts are a 409.

No get-staff-by-id

There's no single-staff read. The dashboard's staff editor finds the record by searching the first page of staff, so a deep link to a staff member beyond page one won't load.

Notifications

Tables: notification, merchant_notification, merchant_notification_preference

RouteGuard
/merchant/notifications/v1/list, unread-count, mark-read, mark-all-read, preferences, update-preferencesperm orders.view

This is an in-app inbox only. Only order cancellation produces notifications today. There's no push, email or socket delivery, and the dashboard has no inbox UI yet.

Onboarding & lookups

Table: shop_dismissed_alert

RouteGuard
get-languages, get-currencies, get-weight-units, get-dimension-unitsauthenticated
get-guide, get-shop-alerts, dismiss-shop-alertowner
  • The setup guide has seven completion flags. Alerts appear only once the guide is complete.
  • The dashboard sends x-language-id (looked up from get-languages, not hard-coded) on every request, and names come back already localized.
Previous
POS & shifts