WFDASH-WEBAPP/src/lib/rep-visibility.ts

13 lines
469 B
TypeScript

/**
* `users.user_type` is a PB multi-select. "REP" is the existing
* convention for marking a sales rep — see the identical pattern in
* `src/lib/server/tv-dashboard-service.ts` (`TV_REP_ROLES` / `isRep`).
*/
export const REP_USER_TYPE = "REP";
export function isRepUser(userType: unknown): boolean {
if (!Array.isArray(userType)) return false;
return userType.some(
(value) => typeof value === "string" && value.toUpperCase() === REP_USER_TYPE,
);
}