Staff / Owner
Merged staff and owner settings
This commit is contained in:
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,
|
||||
|
||||
Reference in new issue
Block a user