chore: Removing away (DB related, not slot related) from code (#14673)

* chore: Removing away (DB related, not slot related) from code

* Remove more isAway/away, eg. references
This commit is contained in:
Alex van Andel authored and GitHub committed 2024-04-20 02:23:34 +01:00
1 parent 8904f20eb8
commit a15cad4d03
20 files changed
+1 -97

No files matched your search

@@ -54,7 +54,6 @@ export async function getUserFromSession(ctx: TRPCContextInner, session: Maybe<S
identityProviderId: true,
brandColor: true,
darkBrandColor: true,
away: true,
movedToProfileId: true,
selectedCalendars: {
select: {
@@ -3,7 +3,6 @@ import { router } from "../../trpc";
import { ZAddSecondaryEmailInputSchema } from "./addSecondaryEmail.schema";
import { ZAppByIdInputSchema } from "./appById.schema";
import { ZAppCredentialsByTypeInputSchema } from "./appCredentialsByType.schema";
import { ZAwayInputSchema } from "./away.schema";
import { ZConnectAndJoinInputSchema } from "./connectAndJoin.schema";
import { ZConnectedCalendarsInputSchema } from "./connectedCalendars.schema";
import { ZDeleteCredentialInputSchema } from "./deleteCredential.schema";
@@ -28,7 +27,6 @@ type AppsRouterHandlerCache = {
shouldVerifyEmail?: typeof import("./shouldVerifyEmail.handler").shouldVerifyEmailHandler;
deleteMe?: typeof import("./deleteMe.handler").deleteMeHandler;
deleteMeWithoutPassword?: typeof import("./deleteMeWithoutPassword.handler").deleteMeWithoutPasswordHandler;
away?: typeof import("./away.handler").awayHandler;
connectedCalendars?: typeof import("./connectedCalendars.handler").connectedCalendarsHandler;
setDestinationCalendar?: typeof import("./setDestinationCalendar.handler").setDestinationCalendarHandler;
integrations?: typeof import("./integrations.handler").integrationsHandler;
@@ -91,19 +89,6 @@ export const loggedInViewerRouter = router({
return UNSTABLE_HANDLER_CACHE.deleteMeWithoutPassword({ ctx });
}),
away: authedProcedure.input(ZAwayInputSchema).mutation(async ({ ctx, input }) => {
if (!UNSTABLE_HANDLER_CACHE.away) {
UNSTABLE_HANDLER_CACHE.away = (await import("./away.handler")).awayHandler;
}
// Unreachable code but required for type safety
if (!UNSTABLE_HANDLER_CACHE.away) {
throw new Error("Failed to load handler");
}
return UNSTABLE_HANDLER_CACHE.away({ ctx, input });
}),
connectedCalendars: authedProcedure.input(ZConnectedCalendarsInputSchema).query(async ({ ctx, input }) => {
if (!UNSTABLE_HANDLER_CACHE.connectedCalendars) {
UNSTABLE_HANDLER_CACHE.connectedCalendars = (
@@ -1,22 +0,0 @@
import { prisma } from "@calcom/prisma";
import type { TrpcSessionUser } from "@calcom/trpc/server/trpc";
import type { TAwayInputSchema } from "./away.schema";
type AwayOptions = {
ctx: {
user: NonNullable<TrpcSessionUser>;
};
input: TAwayInputSchema;
};
export const awayHandler = async ({ ctx, input }: AwayOptions) => {
await prisma.user.update({
where: {
email: ctx.user.email,
},
data: {
away: input.away,
},
});
};
@@ -1,7 +0,0 @@
import { z } from "zod";
export const ZAwayInputSchema = z.object({
away: z.boolean(),
});
export type TAwayInputSchema = z.infer<typeof ZAwayInputSchema>;
@@ -97,7 +97,6 @@ export const meHandler = async ({ ctx, input }: MeOptions) => {
identityProviderEmail,
brandColor: user.brandColor,
darkBrandColor: user.darkBrandColor,
away: user.away,
bio: user.bio,
weekStart: user.weekStart,
theme: user.theme,