* 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 <74371312+Amit91848@users.noreply.github.com> Co-authored-by: Amit Sharma <samit91848@gmail.com>
28 lines
763 B
TypeScript
28 lines
763 B
TypeScript
"use server";
|
|
|
|
import { revalidateTag, unstable_cache } from "next/cache";
|
|
|
|
import { NEXTJS_CACHE_TTL } from "@calcom/lib/constants";
|
|
import { MembershipRepository } from "@calcom/lib/server/repository/membership";
|
|
|
|
const CACHE_TAGS = {
|
|
HAS_TEAM_PLAN: "MembershipRepository.findFirstAcceptedMembershipByUserId",
|
|
} as const;
|
|
|
|
export const getCachedHasTeamPlan = unstable_cache(
|
|
async (userId: number) => {
|
|
const hasTeamPlan = await MembershipRepository.findFirstAcceptedMembershipByUserId(userId);
|
|
|
|
return { hasTeamPlan: !!hasTeamPlan };
|
|
},
|
|
["getCachedHasTeamPlan"],
|
|
{
|
|
revalidate: NEXTJS_CACHE_TTL,
|
|
tags: [CACHE_TAGS.HAS_TEAM_PLAN],
|
|
}
|
|
);
|
|
|
|
export const revalidateHasTeamPlan = async () => {
|
|
revalidateTag(CACHE_TAGS.HAS_TEAM_PLAN);
|
|
};
|