Files
backend/src/auth/auth.types.ts
T

26 lines
539 B
TypeScript

import { UserRole } from '@prisma/client';
export type AuthUser = {
id: string;
cellNumber: string;
role: UserRole;
firstName: string;
lastName: string;
storeId?: string | null;
};
export function isStoreAdmin(role: UserRole): boolean {
return role === UserRole.STORE_ADMIN;
}
export function isSuperAdmin(role: UserRole): boolean {
return role === UserRole.SUPER_ADMIN;
}
export function displayName(user: {
firstName: string;
lastName: string;
}): string {
return `${user.firstName} ${user.lastName}`.trim();
}