mirror of
https://github.com/soconnor0919/beenvoice.git
synced 2025-12-13 01:24:44 -05:00
- Add comprehensive CSV import system with drag-and-drop upload and validation - Create UniversalTable component with advanced filtering, searching, and batch actions - Implement invoice management (view, edit, delete) with professional PDF export - Add client management with full CRUD operations - Set up authentication with NextAuth.js and email/password login - Configure database schema with users, clients, invoices, and invoice_items tables - Build responsive UI with shadcn/ui components and emerald branding - Add type-safe API layer with tRPC and Zod validation - Include proper error handling and user feedback with toast notifications - Set up development environment with Bun, TypeScript, and Tailwind CSS
40 lines
963 B
TypeScript
40 lines
963 B
TypeScript
import { z } from "zod";
|
|
|
|
import {
|
|
createTRPCRouter,
|
|
protectedProcedure,
|
|
publicProcedure,
|
|
} from "~/server/api/trpc";
|
|
import { posts } from "~/server/db/schema";
|
|
|
|
export const postRouter = createTRPCRouter({
|
|
hello: publicProcedure
|
|
.input(z.object({ text: z.string() }))
|
|
.query(({ input }) => {
|
|
return {
|
|
greeting: `Hello ${input.text}`,
|
|
};
|
|
}),
|
|
|
|
create: protectedProcedure
|
|
.input(z.object({ name: z.string().min(1) }))
|
|
.mutation(async ({ ctx, input }) => {
|
|
await ctx.db.insert(posts).values({
|
|
name: input.name,
|
|
createdById: ctx.session.user.id,
|
|
});
|
|
}),
|
|
|
|
getLatest: protectedProcedure.query(async ({ ctx }) => {
|
|
const post = await ctx.db.query.posts.findFirst({
|
|
orderBy: (posts, { desc }) => [desc(posts.createdAt)],
|
|
});
|
|
|
|
return post ?? null;
|
|
}),
|
|
|
|
getSecretMessage: protectedProcedure.query(() => {
|
|
return "you can now see this secret message!";
|
|
}),
|
|
});
|