fix: check profiles from user.profiles apiv2 (#16235)
This commit is contained in:
1 parent
25ae1493c3
commit
a6d2e46b3d
4 files changed
+29
-5
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { UsersRepository } from "@/modules/users/users.repository";
|
||||
import { UsersRepository, UserWithProfile } from "@/modules/users/users.repository";
|
||||
import { Injectable } from "@nestjs/common";
|
||||
|
||||
import { User } from "@calcom/prisma/client";
|
||||
@@ -21,4 +21,16 @@ export class UsersService {
|
||||
|
||||
return users;
|
||||
}
|
||||
|
||||
getUserMainProfile(user: UserWithProfile) {
|
||||
return (
|
||||
user?.movedToProfile ||
|
||||
user.profiles?.find((p) => p.organizationId === user.organizationId) ||
|
||||
user.profiles?.[0]
|
||||
);
|
||||
}
|
||||
|
||||
getUserProfileByOrgId(user: UserWithProfile, organizationId: number) {
|
||||
return user.profiles?.find((p) => p.organizationId === organizationId);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user