Staff / Owner

Merged staff and owner settings
This commit is contained in:
Stefan Lazic committed 2026-08-05 16:35:52 +01:00
1 parent cf3a28f3cd
commit 3300045d9e
23 files changed
+693 -236

No files matched your search

@@ -26,11 +26,12 @@ export const getActingBusinessContext = cache(async () => {
const staffProfile = await prisma.staffProfile.findUnique({
where: { userId: session.user.id },
select: { businessId: true, business: { select: { name: true, timezone: true } } },
select: { id: true, businessId: true, business: { select: { name: true, timezone: true } } },
});
if (staffProfile) {
return {
userId: session.user.id,
staffId: staffProfile.id,
businessId: staffProfile.businessId,
businessName: staffProfile.business.name,
businessTimezone: staffProfile.business.timezone,
@@ -42,6 +43,11 @@ export const getActingBusinessContext = cache(async () => {
const business = await getPrimaryBusiness();
return {
userId: session.user.id,
// A Super Administrator has no StaffProfile by design (see isSuperAdmin) —
// null here is what lets callers tell "acting as real staff" apart from
// "acting as a Super Administrator with no personal staff identity",
// e.g. to withhold note authorship (see CustomerNotes' actingStaffId).
staffId: null,
businessId: business.id,
businessName: business.name,
businessTimezone: business.timezone,