perf: server-fetch data for all pages in /settings/my-account (#20712)

* wip

* fix type check

* refactor "/settings/my-account/profile"

* refactor "settings/my-account/general"

* refactor "/settings/my-accouunt/calendars"

* refactor "/settings/my-account/appearance"

* fix: type-check

---------

Co-authored-by: Amit Sharma <[email protected]>
Co-authored-by: Amit Sharma <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-07-24 22:36:40 +01:00
1 parent 6259b0b3cb
commit 6b9115dfde
32 files changed
+721 -524

No files matched your search

@@ -1,4 +1,5 @@
import { prisma } from "@calcom/prisma";
import { MembershipRepository } from "@calcom/lib/server/repository/membership";
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
type HasTeamPlanOptions = {
ctx: {
@@ -6,18 +7,11 @@ type HasTeamPlanOptions = {
};
};
export const hasTeamPlanHandler = async ({ ctx: { user } }: HasTeamPlanOptions) => {
const hasTeamPlan = await prisma.membership.findFirst({
where: {
accepted: true,
userId: user.id,
team: {
slug: {
not: null,
},
},
},
});
export const hasTeamPlanHandler = async ({ ctx }: HasTeamPlanOptions) => {
const userId = ctx.user.id;
const hasTeamPlan = await MembershipRepository.findFirstAcceptedMembershipByUserId(userId);
return { hasTeamPlan: !!hasTeamPlan };
};