ENCOA-272
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import {Type, User, CorporateUser, AgentUser, Group} from "@/interfaces/user";
|
||||
import { Type, User, CorporateUser, AgentUser, Group } from "@/interfaces/user";
|
||||
|
||||
export const USER_TYPE_LABELS: {[key in Type]: string} = {
|
||||
export const USER_TYPE_LABELS: { [key in Type]: string } = {
|
||||
student: "Student",
|
||||
teacher: "Teacher",
|
||||
corporate: "Corporate",
|
||||
@@ -19,8 +19,8 @@ export function isAgentUser(user: User): user is AgentUser {
|
||||
}
|
||||
|
||||
export function getUserCompanyName(user: User, users: User[], groups: Group[]) {
|
||||
if (isCorporateUser(user)) return user.corporateInformation?.companyInformation?.name || user.name;
|
||||
if (isAgentUser(user)) return user.agentInformation?.companyName || user.name;
|
||||
if (isCorporateUser(user)) return user.name;
|
||||
|
||||
const belongingGroups = groups.filter((x) => x.participants.includes(user?.id));
|
||||
const belongingGroupsAdmins = belongingGroups.map((x) => users.find((u) => u.id === x.admin)).filter((x) => !!x && isCorporateUser(x));
|
||||
@@ -28,7 +28,7 @@ export function getUserCompanyName(user: User, users: User[], groups: Group[]) {
|
||||
if (belongingGroupsAdmins.length === 0) return "";
|
||||
|
||||
const admin = belongingGroupsAdmins[0] as CorporateUser;
|
||||
return admin.corporateInformation?.companyInformation.name || admin.name;
|
||||
return admin.name;
|
||||
}
|
||||
|
||||
export function getCorporateUser(user: User, users: User[], groups: Group[]) {
|
||||
|
||||
Reference in New Issue
Block a user