mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-17 10:56:19 +02:00
📢 Add Featurebase (#796)
This commit is contained in:
parent
5532723d23
commit
222947292b
8 changed files with 151 additions and 157 deletions
|
@ -1,37 +0,0 @@
|
|||
import { prisma } from "@rallly/database";
|
||||
import { sendRawEmail } from "@rallly/emails";
|
||||
import { z } from "zod";
|
||||
|
||||
import { publicProcedure, router } from "../trpc";
|
||||
|
||||
export const feedback = router({
|
||||
send: publicProcedure
|
||||
.input(z.object({ content: z.string() }))
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
let replyTo: string | undefined;
|
||||
let name = "Guest";
|
||||
|
||||
if (!ctx.user.isGuest) {
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { id: ctx.user.id },
|
||||
select: { email: true, name: true },
|
||||
});
|
||||
|
||||
if (user) {
|
||||
replyTo = user.email;
|
||||
name = user.name;
|
||||
}
|
||||
}
|
||||
|
||||
await sendRawEmail({
|
||||
to: process.env.NEXT_PUBLIC_FEEDBACK_EMAIL,
|
||||
from: {
|
||||
name: "Rallly Feedback Form",
|
||||
address: process.env.SUPPORT_EMAIL ?? "",
|
||||
},
|
||||
subject: "Feedback",
|
||||
replyTo,
|
||||
text: `${name} says:\n\n${input.content}`,
|
||||
});
|
||||
}),
|
||||
});
|
|
@ -1,6 +1,5 @@
|
|||
import { mergeRouters, router } from "../trpc";
|
||||
import { auth } from "./auth";
|
||||
import { feedback } from "./feedback";
|
||||
import { polls } from "./polls";
|
||||
import { user } from "./user";
|
||||
import { userPreferences } from "./user-preferences";
|
||||
|
@ -12,7 +11,6 @@ export const appRouter = mergeRouters(
|
|||
auth,
|
||||
polls,
|
||||
user,
|
||||
feedback,
|
||||
userPreferences,
|
||||
}),
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue