feat: added Rating Template to Workflows (#14215)

Co-authored-by: alishaz-polymath <[email protected]>
Co-authored-by: Syed Ali Shahbaz <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-04-04 09:58:52 -07:00
1 parent 844076badb
commit 9bd3a362a2
22 files changed
+845 -408

No files matched your search

@@ -2,10 +2,12 @@ import publicProcedure from "../../procedures/publicProcedure";
import { importHandler, router } from "../../trpc";
import { slotsRouter } from "../viewer/slots/_router";
import { i18nInputSchema } from "./i18n.schema";
import { ZNoShowInputSchema } from "./noShow.schema";
import { event } from "./procedures/event";
import { session } from "./procedures/session";
import { ZSamlTenantProductInputSchema } from "./samlTenantProduct.schema";
import { ZStripeCheckoutSessionInputSchema } from "./stripeCheckoutSession.schema";
import { ZSubmitRatingInputSchema } from "./submitRating.schema";
const NAMESPACE = "publicViewer";
@@ -22,6 +24,14 @@ export const publicViewerRouter = router({
const handler = await importHandler(namespaced("countryCode"), () => import("./countryCode.handler"));
return handler(opts);
}),
submitRating: publicProcedure.input(ZSubmitRatingInputSchema).mutation(async (opts) => {
const handler = await importHandler(namespaced("submitRating"), () => import("./submitRating.handler"));
return handler(opts);
}),
noShow: publicProcedure.input(ZNoShowInputSchema).mutation(async (opts) => {
const handler = await importHandler(namespaced("noShow"), () => import("./noShow.handler"));
return handler(opts);
}),
samlTenantProduct: publicProcedure.input(ZSamlTenantProductInputSchema).mutation(async (opts) => {
const handler = await importHandler(
namespaced("samlTenantProduct"),
@@ -0,0 +1,21 @@
import { prisma } from "@calcom/prisma";
import type { TNoShowInputSchema } from "./noShow.schema";
type NoShowOptions = {
input: TNoShowInputSchema;
};
export const noShowHandler = async ({ input }: NoShowOptions) => {
const { bookingUid } = input;
await prisma.booking.update({
where: {
uid: bookingUid,
},
data: {
noShowHost: true,
},
});
};
export default noShowHandler;
@@ -0,0 +1,7 @@
import { z } from "zod";
export const ZNoShowInputSchema = z.object({
bookingUid: z.string(),
});
export type TNoShowInputSchema = z.infer<typeof ZNoShowInputSchema>;
@@ -0,0 +1,22 @@
import { prisma } from "@calcom/prisma";
import type { TSubmitRatingInputSchema } from "./submitRating.schema";
type SubmitRatingOptions = {
input: TSubmitRatingInputSchema;
};
export const submitRatingHandler = async ({ input }: SubmitRatingOptions) => {
const { bookingUid, rating, comment } = input;
await prisma.booking.update({
where: {
uid: bookingUid,
},
data: {
rating: rating,
ratingFeedback: comment,
},
});
};
export default submitRatingHandler;
@@ -0,0 +1,9 @@
import { z } from "zod";
export const ZSubmitRatingInputSchema = z.object({
bookingUid: z.string(),
rating: z.number(),
comment: z.string().optional(),
});
export type TSubmitRatingInputSchema = z.infer<typeof ZSubmitRatingInputSchema>;