fix: Remove hosts - verify event type belongs to event type (#25321)
* Add check that event type belongs to team * Add `findAcceptedMembershipsByUserIdsInTeam` to `MembershipRepository` * Validate that passed `userIds` belong to a team * Add tests * Typo fix
This commit is contained in:
1 parent
5cb1d4aad0
commit
dd7c553cc3
3 files changed
+375
-1
No files matched your search
@@ -134,6 +134,22 @@ export class MembershipRepository {
|
||||
});
|
||||
}
|
||||
|
||||
static async findAcceptedMembershipsByUserIdsInTeam({
|
||||
userIds,
|
||||
teamId,
|
||||
}: {
|
||||
userIds: number[];
|
||||
teamId: number;
|
||||
}) {
|
||||
return prisma.membership.findMany({
|
||||
where: {
|
||||
userId: { in: userIds },
|
||||
accepted: true,
|
||||
teamId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
static async createMany(data: IMembership[]) {
|
||||
return await prisma.membership.createMany({
|
||||
data: data.map((item) => ({
|
||||
|
||||
Reference in new issue
Block a user