refactor: create team service (#22036)

* refactor: create team service

* refactor: finish

* tests: add unit test for team service

* Add alternative approach to testing

---------

Co-authored-by: Hariom <[email protected]>
Co-authored-by: Benny Joo <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-07-04 07:45:44 +00:00
1 parent f40a1c92ef
commit 0cdd7c9605
12 files changed
+421 -176

No files matched your search

@@ -5,6 +5,7 @@ import { unstable_cache } from "next/cache";
import { TeamsListing } from "@calcom/features/ee/teams/components/TeamsListing";
import { TeamRepository } from "@calcom/lib/server/repository/team";
import { TeamService } from "@calcom/lib/server/service/team";
import { meRouter } from "@calcom/trpc/server/routers/viewer/me/_router";
import { TRPCError } from "@trpc/server";
@@ -37,7 +38,7 @@ export const ServerTeamsListing = async ({
if (token) {
try {
teamNameFromInvite = await TeamRepository.inviteMemberByToken(token, userId);
teamNameFromInvite = await TeamService.inviteMemberByToken(token, userId);
} catch (e) {
errorMsgFromInvite = "Error while fetching teams";
if (e instanceof TRPCError) errorMsgFromInvite = e.message;