From 89698ab3a138ad48610c8c5a7a6d1828e0af77a1 Mon Sep 17 00:00:00 2001 From: Jason Boyett Date: Fri, 16 Feb 2024 16:42:56 -0600 Subject: [PATCH] fixing build errors --- apps/nextjs/next.config.mjs | 13 ++++++------- apps/nextjs/src/pages/admin/index.tsx | 3 ++- apps/nextjs/src/stores/useMutateUser.ts | 6 +++--- packages/api/src/router/index.ts | 2 -- packages/api/src/router/post.ts | 16 ---------------- 5 files changed, 11 insertions(+), 29 deletions(-) delete mode 100644 packages/api/src/router/post.ts diff --git a/apps/nextjs/next.config.mjs b/apps/nextjs/next.config.mjs index cceffc6..b7bec3e 100644 --- a/apps/nextjs/next.config.mjs +++ b/apps/nextjs/next.config.mjs @@ -1,11 +1,10 @@ -// @ts-check /** * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. * This is especially useful for Docker builds. */ -!process.env.SKIP_ENV_VALIDATION && (await import("./src/env/server.mjs")); +!process.env.SKIP_ENV_VALIDATION && (await import('./src/env/server.mjs')) -import { PrismaPlugin } from "@prisma/nextjs-monorepo-workaround-plugin"; +import { PrismaPlugin } from '@prisma/nextjs-monorepo-workaround-plugin' /** @type {import("next").NextConfig} */ const config = { @@ -13,15 +12,15 @@ const config = { if (isServer) { config.plugins = [...config.plugins, new PrismaPlugin()] } - return config + return config }, reactStrictMode: true, swcMinify: true, - transpilePackages: ["@acme/api", "@acme/db"], + transpilePackages: ['@acme/api', '@acme/db'], // We already do linting on GH actions eslint: { ignoreDuringBuilds: !!process.env.CI, }, -}; +} -export default config; +export default config diff --git a/apps/nextjs/src/pages/admin/index.tsx b/apps/nextjs/src/pages/admin/index.tsx index a704a03..99ef23c 100644 --- a/apps/nextjs/src/pages/admin/index.tsx +++ b/apps/nextjs/src/pages/admin/index.tsx @@ -1,8 +1,9 @@ import { useEffect, useState } from 'react' import { trpc } from '../../utils/trpc' -import { useRouter } from 'next/router' +import { SingletonRouter, useRouter } from 'next/router' import Sidebar from '../../components/sidebar' import { useClerk } from '@clerk/nextjs' +import { navigate } from '@acme/helpers' export default function Page() { const router = useRouter() diff --git a/apps/nextjs/src/stores/useMutateUser.ts b/apps/nextjs/src/stores/useMutateUser.ts index 17fec56..e7f370b 100644 --- a/apps/nextjs/src/stores/useMutateUser.ts +++ b/apps/nextjs/src/stores/useMutateUser.ts @@ -1,12 +1,12 @@ import useUserStore from './userStore' import { useEffect, useState } from 'react' -import { api } from '~/utils/api' -import type { User } from '~/utils/types' +import { trpc } from '../utils/trpc' +import type { User } from '@acme/types' const useMutateUser = () => { const store = useUserStore() const [user, setUser] = useState() - const { mutate } = api.user.setUser.useMutation() + const { mutate } = trpc.user.set.useMutation() useEffect(() => { if (!user) return mutate(user) diff --git a/packages/api/src/router/index.ts b/packages/api/src/router/index.ts index 79e6fd4..620cddc 100644 --- a/packages/api/src/router/index.ts +++ b/packages/api/src/router/index.ts @@ -1,5 +1,4 @@ import { router } from '../trpc' -import { postRouter } from './post' import { authRouter } from './auth' import { userRouter } from './user' import { collectionRouter } from './collection' @@ -7,7 +6,6 @@ import { excercisePropsRouter } from './exercises' import { buildSpeedTestRouter } from './builders' export const appRouter = router({ - post: postRouter, auth: authRouter, user: userRouter, excercise: excercisePropsRouter, diff --git a/packages/api/src/router/post.ts b/packages/api/src/router/post.ts deleted file mode 100644 index edd571d..0000000 --- a/packages/api/src/router/post.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { router, publicProcedure, protectedProcedure } from '../trpc' -import { z } from 'zod' - -export const postRouter = router({ - all: publicProcedure.query(({ ctx }) => { - return ctx.prisma.post.findMany() - }), - byId: publicProcedure.input(z.string()).query(({ ctx, input }) => { - return ctx.prisma.post.findFirst({ where: { id: input } }) - }), - create: protectedProcedure - .input(z.object({ title: z.string(), content: z.string() })) - .mutation(({ ctx, input }) => { - return ctx.prisma.post.create({ data: input }) - }), -})