Sync time entries with invoice lines and harden auth for mobile.
Link clocked time to invoice items with bidirectional sync, add entry editing on web, broaden session cookie detection for Expo clients, and handle API rate limits without signing users out. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
putObject,
|
||||
RECEIPT_MAX_BYTES,
|
||||
} from "~/lib/object-storage";
|
||||
import { parseReceiptText } from "~/lib/receipt-parse";
|
||||
|
||||
export { EXPENSE_CATEGORIES };
|
||||
|
||||
@@ -431,8 +432,7 @@ export const expensesRouter = createTRPCRouter({
|
||||
});
|
||||
|
||||
if (
|
||||
!receipt ||
|
||||
receipt.expense.createdById !== ctx.session.user.id
|
||||
receipt?.expense.createdById !== ctx.session.user.id
|
||||
) {
|
||||
throw new TRPCError({
|
||||
code: "NOT_FOUND",
|
||||
@@ -447,4 +447,16 @@ export const expensesRouter = createTRPCRouter({
|
||||
|
||||
return { success: true };
|
||||
}),
|
||||
|
||||
suggestFromReceiptText: protectedProcedure
|
||||
.input(z.object({ text: z.string().min(1).max(20_000) }))
|
||||
.mutation(({ input }) => {
|
||||
const parsed = parseReceiptText(input.text);
|
||||
return {
|
||||
amount: parsed.amount,
|
||||
date: parsed.date,
|
||||
description: parsed.vendor,
|
||||
rawLines: parsed.rawLines,
|
||||
};
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user