Fix eslint
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
import { Mail, Rocket } from "lucide-react";
|
|
||||||
import {
|
import {
|
||||||
RocketLaunchIcon,
|
RocketLaunchIcon,
|
||||||
EnvelopeIcon,
|
EnvelopeIcon,
|
||||||
@@ -9,7 +8,6 @@ import {
|
|||||||
ChatBubbleOvalLeftEllipsisIcon,
|
ChatBubbleOvalLeftEllipsisIcon,
|
||||||
BellAlertIcon,
|
BellAlertIcon,
|
||||||
} from "@heroicons/react/24/solid";
|
} from "@heroicons/react/24/solid";
|
||||||
import { Code } from "@unsend/ui/src/code";
|
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
return (
|
return (
|
||||||
@@ -31,8 +29,6 @@ export default function Home() {
|
|||||||
<motion.a
|
<motion.a
|
||||||
className="bg-white text-black py-2 px-6 rounded-full cursor-pointer flex gap-2"
|
className="bg-white text-black py-2 px-6 rounded-full cursor-pointer flex gap-2"
|
||||||
whileHover={{ scale: 1.2 }}
|
whileHover={{ scale: 1.2 }}
|
||||||
onHoverStart={(e) => {}}
|
|
||||||
onHoverEnd={(e) => {}}
|
|
||||||
transition={{ type: "spring", stiffness: 400, damping: 10 }}
|
transition={{ type: "spring", stiffness: 400, damping: 10 }}
|
||||||
href="https://app.youform.io/forms/caja89vr"
|
href="https://app.youform.io/forms/caja89vr"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
@@ -141,8 +137,6 @@ email.send({
|
|||||||
<motion.a
|
<motion.a
|
||||||
className="bg-white text-black py-2 px-6 rounded-full cursor-pointer flex gap-2"
|
className="bg-white text-black py-2 px-6 rounded-full cursor-pointer flex gap-2"
|
||||||
whileHover={{ scale: 1.2 }}
|
whileHover={{ scale: 1.2 }}
|
||||||
onHoverStart={(e) => {}}
|
|
||||||
onHoverEnd={(e) => {}}
|
|
||||||
transition={{ type: "spring", stiffness: 400, damping: 10 }}
|
transition={{ type: "spring", stiffness: 400, damping: 10 }}
|
||||||
href="https://app.youform.io/forms/caja89vr"
|
href="https://app.youform.io/forms/caja89vr"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
@@ -49,6 +49,7 @@
|
|||||||
"zod": "^3.22.4"
|
"zod": "^3.22.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@next/eslint-plugin-next": "^14.2.2",
|
||||||
"@types/eslint": "^8.56.2",
|
"@types/eslint": "^8.56.2",
|
||||||
"@types/mime-types": "^2.1.4",
|
"@types/mime-types": "^2.1.4",
|
||||||
"@types/node": "^20.11.20",
|
"@types/node": "^20.11.20",
|
||||||
|
@@ -6,7 +6,6 @@ import { Label } from "@unsend/ui/src/label";
|
|||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
DialogDescription,
|
|
||||||
DialogFooter,
|
DialogFooter,
|
||||||
DialogHeader,
|
DialogHeader,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
|
@@ -9,7 +9,6 @@ import {
|
|||||||
TableRow,
|
TableRow,
|
||||||
} from "@unsend/ui/src/table";
|
} from "@unsend/ui/src/table";
|
||||||
import { formatDistanceToNow } from "date-fns";
|
import { formatDistanceToNow } from "date-fns";
|
||||||
import Link from "next/link";
|
|
||||||
import { api } from "~/trpc/react";
|
import { api } from "~/trpc/react";
|
||||||
|
|
||||||
export default function ApiList() {
|
export default function ApiList() {
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import type { Metadata } from "next";
|
|
||||||
import ApiList from "./api-list";
|
import ApiList from "./api-list";
|
||||||
import AddApiKey from "./add-api-key";
|
import AddApiKey from "./add-api-key";
|
||||||
|
|
||||||
|
@@ -1,11 +1,4 @@
|
|||||||
import {
|
import { AreaChart, Area, XAxis, YAxis, Tooltip } from "recharts";
|
||||||
AreaChart,
|
|
||||||
Area,
|
|
||||||
XAxis,
|
|
||||||
YAxis,
|
|
||||||
CartesianGrid,
|
|
||||||
Tooltip,
|
|
||||||
} from "recharts";
|
|
||||||
|
|
||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
|
@@ -1,30 +1,5 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import Link from "next/link";
|
|
||||||
import {
|
|
||||||
Bell,
|
|
||||||
CircleUser,
|
|
||||||
Home,
|
|
||||||
LineChart,
|
|
||||||
Menu,
|
|
||||||
Package,
|
|
||||||
Package2,
|
|
||||||
Search,
|
|
||||||
ShoppingCart,
|
|
||||||
Users,
|
|
||||||
} from "lucide-react";
|
|
||||||
import { Button } from "@unsend/ui/src/button";
|
|
||||||
|
|
||||||
import {
|
|
||||||
DropdownMenu,
|
|
||||||
DropdownMenuContent,
|
|
||||||
DropdownMenuItem,
|
|
||||||
DropdownMenuLabel,
|
|
||||||
DropdownMenuSeparator,
|
|
||||||
DropdownMenuTrigger,
|
|
||||||
} from "@unsend/ui/src/dropdown-menu";
|
|
||||||
import { Input } from "@unsend/ui/src/input";
|
|
||||||
import { Sheet, SheetContent, SheetTrigger } from "@unsend/ui/src/sheet";
|
|
||||||
import DashboardChart from "./dashboard-chart";
|
import DashboardChart from "./dashboard-chart";
|
||||||
|
|
||||||
export default function Dashboard() {
|
export default function Dashboard() {
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import type { Metadata } from "next";
|
|
||||||
import { api } from "~/trpc/react";
|
import { api } from "~/trpc/react";
|
||||||
import { Domain, DomainStatus } from "@prisma/client";
|
import { Domain, DomainStatus } from "@prisma/client";
|
||||||
import {
|
import {
|
||||||
@@ -12,7 +11,6 @@ import {
|
|||||||
BreadcrumbSeparator,
|
BreadcrumbSeparator,
|
||||||
} from "@unsend/ui/src/breadcrumb";
|
} from "@unsend/ui/src/breadcrumb";
|
||||||
import { DomainStatusBadge } from "../domain-badge";
|
import { DomainStatusBadge } from "../domain-badge";
|
||||||
import { formatDistanceToNow } from "date-fns";
|
|
||||||
import {
|
import {
|
||||||
Table,
|
Table,
|
||||||
TableBody,
|
TableBody,
|
||||||
@@ -26,7 +24,6 @@ import { CheckIcon, ClipboardCopy } from "lucide-react";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Switch } from "@unsend/ui/src/switch";
|
import { Switch } from "@unsend/ui/src/switch";
|
||||||
import DeleteDomain from "./delete-domain";
|
import DeleteDomain from "./delete-domain";
|
||||||
import { DkimStatus } from "@aws-sdk/client-sesv2";
|
|
||||||
import SendTestMail from "./send-test-mail";
|
import SendTestMail from "./send-test-mail";
|
||||||
|
|
||||||
export default function DomainItemPage({
|
export default function DomainItemPage({
|
||||||
|
@@ -4,8 +4,6 @@ import { Button } from "@unsend/ui/src/button";
|
|||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
DialogDescription,
|
|
||||||
DialogFooter,
|
|
||||||
DialogHeader,
|
DialogHeader,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
DialogTrigger,
|
DialogTrigger,
|
||||||
@@ -13,9 +11,8 @@ import {
|
|||||||
import { api } from "~/trpc/react";
|
import { api } from "~/trpc/react";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { Domain } from "@prisma/client";
|
import { Domain } from "@prisma/client";
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { toast } from "@unsend/ui/src/toaster";
|
import { toast } from "@unsend/ui/src/toaster";
|
||||||
import { Send, SendHorizonal } from "lucide-react";
|
import { SendHorizonal } from "lucide-react";
|
||||||
import { Code } from "@unsend/ui/src/code";
|
import { Code } from "@unsend/ui/src/code";
|
||||||
|
|
||||||
const jsCode = `const requestOptions = {
|
const jsCode = `const requestOptions = {
|
||||||
@@ -112,14 +109,11 @@ if (curl_errno($ch)) {
|
|||||||
|
|
||||||
export const SendTestMail: React.FC<{ domain: Domain }> = ({ domain }) => {
|
export const SendTestMail: React.FC<{ domain: Domain }> = ({ domain }) => {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const [domainName, setDomainName] = useState("");
|
|
||||||
const sendTestEmailFromDomainMutation =
|
const sendTestEmailFromDomainMutation =
|
||||||
api.domain.sendTestEmailFromDomain.useMutation();
|
api.domain.sendTestEmailFromDomain.useMutation();
|
||||||
|
|
||||||
const utils = api.useUtils();
|
const utils = api.useUtils();
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
function handleSendTestEmail() {
|
function handleSendTestEmail() {
|
||||||
sendTestEmailFromDomainMutation.mutate(
|
sendTestEmailFromDomainMutation.mutate(
|
||||||
{
|
{
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Domain, DomainStatus } from "@prisma/client";
|
import { Domain } from "@prisma/client";
|
||||||
import { formatDistanceToNow } from "date-fns";
|
import { formatDistanceToNow } from "date-fns";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { Switch } from "@unsend/ui/src/switch";
|
import { Switch } from "@unsend/ui/src/switch";
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import type { Metadata } from "next";
|
|
||||||
import DomainsList from "./domain-list";
|
import DomainsList from "./domain-list";
|
||||||
import AddDomain from "./add-domain";
|
import AddDomain from "./add-domain";
|
||||||
|
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect } from "react";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { api } from "~/trpc/react";
|
import { api } from "~/trpc/react";
|
||||||
import { Separator } from "@unsend/ui/src/separator";
|
import { Separator } from "@unsend/ui/src/separator";
|
||||||
import { EmailStatusBadge, EmailStatusIcon } from "./email-status-badge";
|
import { EmailStatusBadge, EmailStatusIcon } from "./email-status-badge";
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import Link from "next/link";
|
|
||||||
import {
|
import {
|
||||||
Table,
|
Table,
|
||||||
TableHeader,
|
TableHeader,
|
||||||
@@ -9,7 +8,6 @@ import {
|
|||||||
TableBody,
|
TableBody,
|
||||||
TableCell,
|
TableCell,
|
||||||
} from "@unsend/ui/src/table";
|
} from "@unsend/ui/src/table";
|
||||||
import { Badge } from "@unsend/ui/src/badge";
|
|
||||||
import { api } from "~/trpc/react";
|
import { api } from "~/trpc/react";
|
||||||
import {
|
import {
|
||||||
Mail,
|
Mail,
|
||||||
@@ -22,10 +20,7 @@ import {
|
|||||||
import { formatDistanceToNow } from "date-fns";
|
import { formatDistanceToNow } from "date-fns";
|
||||||
import { EmailStatus } from "@prisma/client";
|
import { EmailStatus } from "@prisma/client";
|
||||||
import { EmailStatusBadge } from "./email-status-badge";
|
import { EmailStatusBadge } from "./email-status-badge";
|
||||||
import { useState } from "react";
|
|
||||||
import EmailDetails from "./email-details";
|
import EmailDetails from "./email-details";
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { useSearchParams } from "next/navigation"; // Adjust the import based on your project setup
|
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
import { useUrlState } from "~/hooks/useUrlState";
|
import { useUrlState } from "~/hooks/useUrlState";
|
||||||
import { Button } from "@unsend/ui/src/button";
|
import { Button } from "@unsend/ui/src/button";
|
||||||
@@ -34,7 +29,6 @@ import {
|
|||||||
SelectContent,
|
SelectContent,
|
||||||
SelectItem,
|
SelectItem,
|
||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
SelectValue,
|
|
||||||
} from "@unsend/ui/src/select";
|
} from "@unsend/ui/src/select";
|
||||||
|
|
||||||
/* Stupid hydrating error. And I so stupid to understand the stupid NextJS docs. Because they stupid change it everyday */
|
/* Stupid hydrating error. And I so stupid to understand the stupid NextJS docs. Because they stupid change it everyday */
|
||||||
|
@@ -22,6 +22,7 @@ export const EmailStatusBadge: React.FC<{ status: EmailStatus }> = ({
|
|||||||
break;
|
break;
|
||||||
case "DELIVERY_DELAYED":
|
case "DELIVERY_DELAYED":
|
||||||
badgeColor = "bg-yellow-500/10 text-yellow-600 border-yellow-600/10";
|
badgeColor = "bg-yellow-500/10 text-yellow-600 border-yellow-600/10";
|
||||||
|
break;
|
||||||
case "COMPLAINED":
|
case "COMPLAINED":
|
||||||
badgeColor = "bg-yellow-500/10 text-yellow-600 border-yellow-600/10";
|
badgeColor = "bg-yellow-500/10 text-yellow-600 border-yellow-600/10";
|
||||||
break;
|
break;
|
||||||
@@ -64,6 +65,7 @@ export const EmailStatusIcon: React.FC<{ status: EmailStatus }> = ({
|
|||||||
case "DELIVERY_DELAYED":
|
case "DELIVERY_DELAYED":
|
||||||
outsideColor = "bg-yellow-500/40";
|
outsideColor = "bg-yellow-500/40";
|
||||||
insideColor = "bg-yellow-500";
|
insideColor = "bg-yellow-500";
|
||||||
|
break;
|
||||||
case "COMPLAINED":
|
case "COMPLAINED":
|
||||||
outsideColor = "bg-yellow-500/40";
|
outsideColor = "bg-yellow-500/40";
|
||||||
insideColor = "bg-yellow-500";
|
insideColor = "bg-yellow-500";
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
import type { Metadata } from "next";
|
|
||||||
import { Suspense } from "react";
|
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
|
|
||||||
const EmailList = dynamic(
|
const EmailList = dynamic(
|
||||||
|
@@ -1,14 +1,12 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import {
|
import {
|
||||||
Bell,
|
|
||||||
BellRing,
|
BellRing,
|
||||||
BookUser,
|
BookUser,
|
||||||
CircleUser,
|
CircleUser,
|
||||||
Code,
|
Code,
|
||||||
Globe,
|
Globe,
|
||||||
Home,
|
Home,
|
||||||
KeyRound,
|
|
||||||
LayoutDashboard,
|
LayoutDashboard,
|
||||||
LineChart,
|
LineChart,
|
||||||
Mail,
|
Mail,
|
||||||
@@ -16,7 +14,6 @@ import {
|
|||||||
MessageSquareMore,
|
MessageSquareMore,
|
||||||
Package,
|
Package,
|
||||||
Package2,
|
Package2,
|
||||||
Search,
|
|
||||||
ShoppingCart,
|
ShoppingCart,
|
||||||
Users,
|
Users,
|
||||||
Volume2,
|
Volume2,
|
||||||
@@ -31,13 +28,11 @@ import {
|
|||||||
DropdownMenuSeparator,
|
DropdownMenuSeparator,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from "@unsend/ui/src/dropdown-menu";
|
} from "@unsend/ui/src/dropdown-menu";
|
||||||
import { Input } from "@unsend/ui/src/input";
|
|
||||||
import { Sheet, SheetContent, SheetTrigger } from "@unsend/ui/src/sheet";
|
import { Sheet, SheetContent, SheetTrigger } from "@unsend/ui/src/sheet";
|
||||||
|
|
||||||
import { NextAuthProvider } from "~/providers/next-auth";
|
import { NextAuthProvider } from "~/providers/next-auth";
|
||||||
import { getServerAuthSession } from "~/server/auth";
|
import { getServerAuthSession } from "~/server/auth";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { NavButton } from "./nav-button";
|
import { NavButton } from "./nav-button";
|
||||||
|
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
|
@@ -2,6 +2,5 @@ import NextAuth from "next-auth";
|
|||||||
|
|
||||||
import { authOptions } from "~/server/auth";
|
import { authOptions } from "~/server/auth";
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
||||||
const handler = NextAuth(authOptions);
|
const handler = NextAuth(authOptions);
|
||||||
export { handler as GET, handler as POST };
|
export { handler as GET, handler as POST };
|
||||||
|
@@ -32,7 +32,7 @@ export async function POST(req: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleSubscription(message: any) {
|
async function handleSubscription(message: any) {
|
||||||
const subResponse = await fetch(message.SubscribeURL, {
|
await fetch(message.SubscribeURL, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
||||||
import { getServerAuthSession } from "~/server/auth";
|
import { getServerAuthSession } from "~/server/auth";
|
||||||
import { api } from "~/trpc/server";
|
|
||||||
import { Button } from "@unsend/ui/src/button";
|
import { Button } from "@unsend/ui/src/button";
|
||||||
import { SendHorizonal } from "lucide-react";
|
import { SendHorizonal } from "lucide-react";
|
||||||
|
|
||||||
|
@@ -1,14 +1,7 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import {
|
import { createTRPCRouter, teamProcedure } from "~/server/api/trpc";
|
||||||
createTRPCRouter,
|
|
||||||
protectedProcedure,
|
|
||||||
publicProcedure,
|
|
||||||
teamProcedure,
|
|
||||||
} from "~/server/api/trpc";
|
|
||||||
import { db } from "~/server/db";
|
|
||||||
import { addApiKey } from "~/server/service/api-service";
|
import { addApiKey } from "~/server/service/api-service";
|
||||||
import { createDomain, getDomain } from "~/server/service/domain-service";
|
|
||||||
|
|
||||||
export const apiRouter = createTRPCRouter({
|
export const apiRouter = createTRPCRouter({
|
||||||
createToken: teamProcedure
|
createToken: teamProcedure
|
||||||
|
@@ -1,11 +1,6 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import {
|
import { createTRPCRouter, teamProcedure } from "~/server/api/trpc";
|
||||||
createTRPCRouter,
|
|
||||||
protectedProcedure,
|
|
||||||
publicProcedure,
|
|
||||||
teamProcedure,
|
|
||||||
} from "~/server/api/trpc";
|
|
||||||
import { db } from "~/server/db";
|
import { db } from "~/server/db";
|
||||||
import {
|
import {
|
||||||
createDomain,
|
createDomain,
|
||||||
@@ -37,7 +32,7 @@ export const domainRouter = createTRPCRouter({
|
|||||||
|
|
||||||
getDomain: teamProcedure
|
getDomain: teamProcedure
|
||||||
.input(z.object({ id: z.number() }))
|
.input(z.object({ id: z.number() }))
|
||||||
.query(async ({ ctx, input }) => {
|
.query(async ({ input }) => {
|
||||||
return getDomain(input.id);
|
return getDomain(input.id);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@@ -49,7 +44,7 @@ export const domainRouter = createTRPCRouter({
|
|||||||
openTracking: z.boolean().optional(),
|
openTracking: z.boolean().optional(),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.mutation(async ({ ctx, input }) => {
|
.mutation(async ({ input }) => {
|
||||||
return updateDomain(input.id, {
|
return updateDomain(input.id, {
|
||||||
clickTracking: input.clickTracking,
|
clickTracking: input.clickTracking,
|
||||||
openTracking: input.openTracking,
|
openTracking: input.openTracking,
|
||||||
@@ -58,7 +53,7 @@ export const domainRouter = createTRPCRouter({
|
|||||||
|
|
||||||
deleteDomain: teamProcedure
|
deleteDomain: teamProcedure
|
||||||
.input(z.object({ id: z.number() }))
|
.input(z.object({ id: z.number() }))
|
||||||
.mutation(async ({ ctx, input }) => {
|
.mutation(async ({ input }) => {
|
||||||
await deleteDomain(input.id);
|
await deleteDomain(input.id);
|
||||||
return { success: true };
|
return { success: true };
|
||||||
}),
|
}),
|
||||||
|
@@ -53,7 +53,7 @@ export const emailRouter = createTRPCRouter({
|
|||||||
|
|
||||||
getEmail: teamProcedure
|
getEmail: teamProcedure
|
||||||
.input(z.object({ id: z.string() }))
|
.input(z.object({ id: z.string() }))
|
||||||
.query(async ({ ctx, input }) => {
|
.query(async ({ input }) => {
|
||||||
const email = await db.email.findUnique({
|
const email = await db.email.findUnique({
|
||||||
where: {
|
where: {
|
||||||
id: input.id,
|
id: input.id,
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
import { initTRPC, TRPCError } from "@trpc/server";
|
import { initTRPC, TRPCError } from "@trpc/server";
|
||||||
import superjson from "superjson";
|
import superjson from "superjson";
|
||||||
import { z, ZodError } from "zod";
|
import { ZodError } from "zod";
|
||||||
|
|
||||||
import { getServerAuthSession } from "~/server/auth";
|
import { getServerAuthSession } from "~/server/auth";
|
||||||
import { db } from "~/server/db";
|
import { db } from "~/server/db";
|
||||||
@@ -107,20 +107,18 @@ export const protectedProcedure = t.procedure.use(({ ctx, next }) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
export const teamProcedure = protectedProcedure.use(
|
export const teamProcedure = protectedProcedure.use(async ({ ctx, next }) => {
|
||||||
async ({ ctx, next, input }) => {
|
const teamUser = await db.teamUser.findFirst({
|
||||||
const teamUser = await db.teamUser.findFirst({
|
where: { userId: ctx.session.user.id },
|
||||||
where: { userId: ctx.session.user.id },
|
include: { team: true },
|
||||||
include: { team: true },
|
});
|
||||||
});
|
if (!teamUser) {
|
||||||
if (!teamUser) {
|
throw new TRPCError({ code: "NOT_FOUND", message: "Team not found" });
|
||||||
throw new TRPCError({ code: "NOT_FOUND", message: "Team not found" });
|
|
||||||
}
|
|
||||||
return next({
|
|
||||||
ctx: {
|
|
||||||
team: teamUser.team,
|
|
||||||
session: { ...ctx.session, user: ctx.session.user },
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
);
|
return next({
|
||||||
|
ctx: {
|
||||||
|
team: teamUser.team,
|
||||||
|
session: { ...ctx.session, user: ctx.session.user },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -17,6 +17,7 @@ import { db } from "~/server/db";
|
|||||||
* @see https://next-auth.js.org/getting-started/typescript#module-augmentation
|
* @see https://next-auth.js.org/getting-started/typescript#module-augmentation
|
||||||
*/
|
*/
|
||||||
declare module "next-auth" {
|
declare module "next-auth" {
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
interface Session extends DefaultSession {
|
interface Session extends DefaultSession {
|
||||||
user: {
|
user: {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -25,6 +26,7 @@ declare module "next-auth" {
|
|||||||
} & DefaultSession["user"];
|
} & DefaultSession["user"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
interface User {
|
interface User {
|
||||||
id: number;
|
id: number;
|
||||||
}
|
}
|
||||||
|
@@ -159,6 +159,7 @@ export async function sendEmailWithAttachments({
|
|||||||
to,
|
to,
|
||||||
from,
|
from,
|
||||||
subject,
|
subject,
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
text,
|
text,
|
||||||
html,
|
html,
|
||||||
attachments,
|
attachments,
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
import { JsonValue } from "@prisma/client/runtime/library";
|
|
||||||
import { db } from "../db";
|
|
||||||
import { APP_SETTINGS } from "~/utils/constants";
|
import { APP_SETTINGS } from "~/utils/constants";
|
||||||
import { createTopic, subscribeEndpoint } from "./sns";
|
import { createTopic, subscribeEndpoint } from "./sns";
|
||||||
import { env } from "~/env";
|
import { env } from "~/env";
|
||||||
|
@@ -8,6 +8,7 @@ const createPrismaClient = () =>
|
|||||||
env.NODE_ENV === "development" ? ["query", "error", "warn"] : ["error"],
|
env.NODE_ENV === "development" ? ["query", "error", "warn"] : ["error"],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
const globalForPrisma = globalThis as unknown as {
|
const globalForPrisma = globalThis as unknown as {
|
||||||
prisma: ReturnType<typeof createPrismaClient> | undefined;
|
prisma: ReturnType<typeof createPrismaClient> | undefined;
|
||||||
};
|
};
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
import { createRoute, z } from "@hono/zod-openapi";
|
import { createRoute, z } from "@hono/zod-openapi";
|
||||||
import { DomainSchema } from "~/lib/zod/domain-schema";
|
|
||||||
import { PublicAPIApp } from "../hono";
|
import { PublicAPIApp } from "../hono";
|
||||||
import { db } from "../../db";
|
|
||||||
import { getTeamFromToken } from "../auth";
|
import { getTeamFromToken } from "../auth";
|
||||||
import { sendEmail } from "~/server/service/email-service";
|
import { sendEmail } from "~/server/service/email-service";
|
||||||
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
import { Context } from "hono";
|
import { Context } from "hono";
|
||||||
import { bearerAuth } from "hono/bearer-auth";
|
|
||||||
import { hashToken } from "../auth";
|
import { hashToken } from "../auth";
|
||||||
import { db } from "../db";
|
import { db } from "../db";
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { EmailStatus } from "@prisma/client";
|
import { EmailStatus } from "@prisma/client";
|
||||||
import { SesEvent, SesEventDataKey, SesEventType } from "~/types/aws-types";
|
import { SesEvent, SesEventDataKey } from "~/types/aws-types";
|
||||||
import { db } from "../db";
|
import { db } from "../db";
|
||||||
|
|
||||||
export async function parseSesHook(data: SesEvent) {
|
export async function parseSesHook(data: SesEvent) {
|
||||||
|
@@ -3,9 +3,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"~/*": [
|
"~/*": ["./src/*"]
|
||||||
"./src/*"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
{
|
{
|
||||||
@@ -20,9 +18,8 @@
|
|||||||
"**/*.tsx",
|
"**/*.tsx",
|
||||||
"**/*.cjs",
|
"**/*.cjs",
|
||||||
"**/*.js",
|
"**/*.js",
|
||||||
".next/types/**/*.ts"
|
".next/types/**/*.ts",
|
||||||
|
".eslintrc.cjs"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": ["node_modules"]
|
||||||
"node_modules"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
@@ -8,12 +8,13 @@
|
|||||||
"react-internal.js"
|
"react-internal.js"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vercel/style-guide": "^5.2.0",
|
"@next/eslint-plugin-next": "^14.2.2",
|
||||||
"eslint-config-turbo": "^1.12.4",
|
|
||||||
"eslint-config-prettier": "^9.1.0",
|
|
||||||
"eslint-plugin-only-warn": "^1.1.0",
|
|
||||||
"@typescript-eslint/parser": "^7.1.0",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^7.1.0",
|
"@typescript-eslint/eslint-plugin": "^7.1.0",
|
||||||
|
"@typescript-eslint/parser": "^7.1.0",
|
||||||
|
"@vercel/style-guide": "^5.2.0",
|
||||||
|
"eslint-config-prettier": "^9.1.0",
|
||||||
|
"eslint-config-turbo": "^1.12.4",
|
||||||
|
"eslint-plugin-only-warn": "^1.1.0",
|
||||||
"typescript": "^5.3.3"
|
"typescript": "^5.3.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
3
packages/eslint-config/react-internal.js
vendored
3
packages/eslint-config/react-internal.js
vendored
@@ -40,4 +40,7 @@ module.exports = {
|
|||||||
// Force ESLint to detect .tsx files
|
// Force ESLint to detect .tsx files
|
||||||
{ files: ["*.js?(x)", "*.ts?(x)"] },
|
{ files: ["*.js?(x)", "*.ts?(x)"] },
|
||||||
],
|
],
|
||||||
|
rules: {
|
||||||
|
"no-redeclare": "off",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@@ -8,7 +8,8 @@
|
|||||||
"src"
|
"src"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint . --max-warnings 0"
|
"lint": "eslint . --max-warnings 0",
|
||||||
|
"lint:fix": "eslint . --fix"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/eslint": "^8.56.5",
|
"@types/eslint": "^8.56.5",
|
||||||
|
@@ -3,6 +3,6 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "dist"
|
"outDir": "dist"
|
||||||
},
|
},
|
||||||
"include": ["src", "index.ts"],
|
"include": ["**/*.tsx", "**/*.ts"],
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist"]
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,6 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "dist"
|
"outDir": "dist"
|
||||||
},
|
},
|
||||||
"include": ["src", "turbo"],
|
"include": ["src", "turbo", "**/*.ts", "**/*.tsx"],
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist"]
|
||||||
}
|
}
|
||||||
|
19
pnpm-lock.yaml
generated
19
pnpm-lock.yaml
generated
@@ -179,6 +179,9 @@ importers:
|
|||||||
specifier: ^3.22.4
|
specifier: ^3.22.4
|
||||||
version: 3.22.4
|
version: 3.22.4
|
||||||
devDependencies:
|
devDependencies:
|
||||||
|
'@next/eslint-plugin-next':
|
||||||
|
specifier: ^14.2.2
|
||||||
|
version: 14.2.2
|
||||||
'@types/eslint':
|
'@types/eslint':
|
||||||
specifier: ^8.56.2
|
specifier: ^8.56.2
|
||||||
version: 8.56.5
|
version: 8.56.5
|
||||||
@@ -233,6 +236,9 @@ importers:
|
|||||||
|
|
||||||
packages/eslint-config:
|
packages/eslint-config:
|
||||||
devDependencies:
|
devDependencies:
|
||||||
|
'@next/eslint-plugin-next':
|
||||||
|
specifier: ^14.2.2
|
||||||
|
version: 14.2.2
|
||||||
'@typescript-eslint/eslint-plugin':
|
'@typescript-eslint/eslint-plugin':
|
||||||
specifier: ^7.1.0
|
specifier: ^7.1.0
|
||||||
version: 7.2.0(@typescript-eslint/parser@7.2.0)(eslint@8.57.0)(typescript@5.4.2)
|
version: 7.2.0(@typescript-eslint/parser@7.2.0)(eslint@8.57.0)(typescript@5.4.2)
|
||||||
@@ -241,7 +247,7 @@ importers:
|
|||||||
version: 7.2.0(eslint@8.57.0)(typescript@5.4.2)
|
version: 7.2.0(eslint@8.57.0)(typescript@5.4.2)
|
||||||
'@vercel/style-guide':
|
'@vercel/style-guide':
|
||||||
specifier: ^5.2.0
|
specifier: ^5.2.0
|
||||||
version: 5.2.0(eslint@8.57.0)(prettier@3.2.5)(typescript@5.4.2)
|
version: 5.2.0(@next/eslint-plugin-next@14.2.2)(eslint@8.57.0)(prettier@3.2.5)(typescript@5.4.2)
|
||||||
eslint-config-prettier:
|
eslint-config-prettier:
|
||||||
specifier: ^9.1.0
|
specifier: ^9.1.0
|
||||||
version: 9.1.0(eslint@8.57.0)
|
version: 9.1.0(eslint@8.57.0)
|
||||||
@@ -1634,6 +1640,12 @@ packages:
|
|||||||
glob: 10.3.10
|
glob: 10.3.10
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/@next/eslint-plugin-next@14.2.2:
|
||||||
|
resolution: {integrity: sha512-q+Ec2648JtBpKiu/FSJm8HAsFXlNvioHeBCbTP12T1SGcHYwhqHULSfQgFkPgHDu3kzNp2Kem4J54bK4rPQ5SQ==}
|
||||||
|
dependencies:
|
||||||
|
glob: 10.3.10
|
||||||
|
dev: true
|
||||||
|
|
||||||
/@next/swc-darwin-arm64@14.1.4:
|
/@next/swc-darwin-arm64@14.1.4:
|
||||||
resolution: {integrity: sha512-ubmUkbmW65nIAOmoxT1IROZdmmJMmdYvXIe8211send9ZYJu+SqxSnJM4TrPj9wmL6g9Atvj0S/2cFmMSS99jg==}
|
resolution: {integrity: sha512-ubmUkbmW65nIAOmoxT1IROZdmmJMmdYvXIe8211send9ZYJu+SqxSnJM4TrPj9wmL6g9Atvj0S/2cFmMSS99jg==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
@@ -3494,7 +3506,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==}
|
resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@vercel/style-guide@5.2.0(eslint@8.57.0)(prettier@3.2.5)(typescript@5.4.2):
|
/@vercel/style-guide@5.2.0(@next/eslint-plugin-next@14.2.2)(eslint@8.57.0)(prettier@3.2.5)(typescript@5.4.2):
|
||||||
resolution: {integrity: sha512-fNSKEaZvSkiBoF6XEefs8CcgAV9K9e+MbcsDZjUsktHycKdA0jvjAzQi1W/FzLS+Nr5zZ6oejCwq/97dHUKe0g==}
|
resolution: {integrity: sha512-fNSKEaZvSkiBoF6XEefs8CcgAV9K9e+MbcsDZjUsktHycKdA0jvjAzQi1W/FzLS+Nr5zZ6oejCwq/97dHUKe0g==}
|
||||||
engines: {node: '>=16'}
|
engines: {node: '>=16'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -3514,6 +3526,7 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@babel/core': 7.24.0
|
'@babel/core': 7.24.0
|
||||||
'@babel/eslint-parser': 7.23.10(@babel/core@7.24.0)(eslint@8.57.0)
|
'@babel/eslint-parser': 7.23.10(@babel/core@7.24.0)(eslint@8.57.0)
|
||||||
|
'@next/eslint-plugin-next': 14.2.2
|
||||||
'@rushstack/eslint-patch': 1.7.2
|
'@rushstack/eslint-patch': 1.7.2
|
||||||
'@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)(typescript@5.4.2)
|
'@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)(typescript@5.4.2)
|
||||||
'@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.4.2)
|
'@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.4.2)
|
||||||
@@ -4470,7 +4483,7 @@ packages:
|
|||||||
enhanced-resolve: 5.16.0
|
enhanced-resolve: 5.16.0
|
||||||
eslint: 8.57.0
|
eslint: 8.57.0
|
||||||
eslint-module-utils: 2.8.1(@typescript-eslint/parser@6.21.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0)
|
eslint-module-utils: 2.8.1(@typescript-eslint/parser@6.21.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0)
|
||||||
eslint-plugin-import: 2.29.1(eslint@8.57.0)
|
eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.2.0)(eslint@8.57.0)
|
||||||
fast-glob: 3.3.2
|
fast-glob: 3.3.2
|
||||||
get-tsconfig: 4.7.3
|
get-tsconfig: 4.7.3
|
||||||
is-core-module: 2.13.1
|
is-core-module: 2.13.1
|
||||||
|
@@ -25,7 +25,12 @@
|
|||||||
"AWS_ACCESS_KEY",
|
"AWS_ACCESS_KEY",
|
||||||
"APP_URL",
|
"APP_URL",
|
||||||
"SNS_TOPIC",
|
"SNS_TOPIC",
|
||||||
"NEXTAUTH_SECRET"
|
"NEXTAUTH_SECRET",
|
||||||
|
"NODE_ENV",
|
||||||
|
"VERCEL_URL",
|
||||||
|
"VERCEL",
|
||||||
|
"SKIP_ENV_VALIDATION",
|
||||||
|
"PORT"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
|
Reference in New Issue
Block a user