(inviteId: string)
| 79 | } |
| 80 | |
| 81 | export async function getInviteById(inviteId: string) { |
| 82 | const res = await db.invite.findUnique({ |
| 83 | where: { |
| 84 | id: inviteId, |
| 85 | }, |
| 86 | include: { |
| 87 | organization: { |
| 88 | select: { |
| 89 | id: true, |
| 90 | name: true, |
| 91 | }, |
| 92 | }, |
| 93 | }, |
| 94 | }); |
| 95 | |
| 96 | return { |
| 97 | ...res, |
| 98 | isExpired: res?.expiresAt && res.expiresAt < new Date(), |
| 99 | }; |
| 100 | } |
| 101 | |
| 102 | export async function getMembers(organizationId: string) { |
| 103 | const [members, access] = await Promise.all([ |