Skip to content

Commit

Permalink
🐛 fix: Removed unused tRPC procedures
Browse files Browse the repository at this point in the history
  • Loading branch information
aryanprince committed Feb 7, 2024
1 parent 417efe3 commit 4deeef4
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 173 deletions.
43 changes: 0 additions & 43 deletions apps/finance/src/app/_components/create-post.tsx

This file was deleted.

22 changes: 0 additions & 22 deletions apps/finance/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { unstable_noStore as noStore } from "next/cache";
import Link from "next/link";

import { CreatePost } from "~/app/_components/create-post";
import { getServerAuthSession } from "~/server/auth";
import { api } from "~/trpc/server";

Expand Down Expand Up @@ -57,28 +56,7 @@ export default async function Home() {
</Link>
</div>
</div>

<CrudShowcase />
</div>
</main>
);
}

async function CrudShowcase() {
const session = await getServerAuthSession();
if (!session?.user) return null;

const latestPost = await api.post.getLatest.query();

return (
<div className="w-full max-w-xs">
{latestPost ? (
<p className="truncate">Your most recent post: {latestPost.name}</p>
) : (
<p>You have no posts yet.</p>
)}

<CreatePost />
</div>
);
}
21 changes: 0 additions & 21 deletions apps/finance/src/server/api/routers/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,6 @@ export const postRouter = createTRPCRouter({
};
}),

create: protectedProcedure
.input(z.object({ name: z.string().min(1) }))
.mutation(async ({ ctx, input }) => {
// simulate a slow db call
await new Promise((resolve) => setTimeout(resolve, 1000));

return ctx.db.post.create({
data: {
name: input.name,
createdBy: { connect: { id: ctx.session.user.id } },
},
});
}),

getLatest: protectedProcedure.query(({ ctx }) => {
return ctx.db.post.findFirst({
orderBy: { createdAt: "desc" },
where: { createdBy: { id: ctx.session.user.id } },
});
}),

getSecretMessage: protectedProcedure.query(() => {
return "you can now see this secret message!";
}),
Expand Down
43 changes: 0 additions & 43 deletions apps/library/src/app/_components/create-post.tsx

This file was deleted.

24 changes: 1 addition & 23 deletions apps/library/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { unstable_noStore as noStore } from "next/cache";
import Link from "next/link";

import { CreatePost } from "~/app/_components/create-post";
import { getServerAuthSession } from "~/server/auth";
import { api } from "~/trpc/server";

Expand Down Expand Up @@ -57,28 +56,7 @@ export default async function Home() {
</Link>
</div>
</div>

<CrudShowcase />
</div>
</main>
);
}

async function CrudShowcase() {
const session = await getServerAuthSession();
if (!session?.user) return null;

const latestPost = await api.post.getLatest.query();

return (
<div className="w-full max-w-xs">
{latestPost ? (
<p className="truncate">Your most recent post: {latestPost.name}</p>
) : (
<p>You have no posts yet.</p>
)}

<CreatePost />
</div>
);
}
}
21 changes: 0 additions & 21 deletions apps/library/src/server/api/routers/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,6 @@ export const postRouter = createTRPCRouter({
};
}),

create: protectedProcedure
.input(z.object({ name: z.string().min(1) }))
.mutation(async ({ ctx, input }) => {
// simulate a slow db call
await new Promise((resolve) => setTimeout(resolve, 1000));

return ctx.db.post.create({
data: {
name: input.name,
createdBy: { connect: { id: ctx.session.user.id } },
},
});
}),

getLatest: protectedProcedure.query(({ ctx }) => {
return ctx.db.post.findFirst({
orderBy: { createdAt: "desc" },
where: { createdBy: { id: ctx.session.user.id } },
});
}),

getSecretMessage: protectedProcedure.query(() => {
return "you can now see this secret message!";
}),
Expand Down

0 comments on commit 4deeef4

Please sign in to comment.