ENCOA-217: Adapted the invite system to now work based on Entities instead of Users/Groups
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import {Session} from "@/hooks/useSessions";
|
||||
import {Invite, InviteWithUsers} from "@/interfaces/invite";
|
||||
import { Entity } from "@/interfaces/entity";
|
||||
import {Invite, InviteWithEntity} from "@/interfaces/invite";
|
||||
import {User} from "@/interfaces/user";
|
||||
import client from "@/lib/mongodb";
|
||||
|
||||
@@ -12,7 +13,7 @@ export const getInvitesByInvitee = async (id: string, limit?: number) =>
|
||||
.limit(limit || 0)
|
||||
.toArray();
|
||||
|
||||
export const convertInvitersToUsers = async (invite: Invite): Promise<InviteWithUsers> => ({
|
||||
export const convertInvitersToEntity = async (invite: Invite): Promise<InviteWithEntity> => ({
|
||||
...invite,
|
||||
from: (await db.collection("users").findOne<User>({id: invite.from})) ?? undefined,
|
||||
entity: (await db.collection("entities").findOne<Entity>({id: invite.entity })) ?? undefined,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user