General fixes. Still far from good or working

This commit is contained in:
2026-01-11 13:21:01 -05:00
parent 0a361f51a1
commit 67daefb919
83 changed files with 733 additions and 1053 deletions

View File

@@ -1,8 +1,8 @@
import { Auth } from "convex/server";
import { v } from "convex/values";
import { Auth } from 'convex/server';
import { v } from 'convex/values';
import { internal } from "../convex/_generated/api";
import { mutation, query } from "./_generated/server";
import { internal } from '../convex/_generated/api';
import { mutation, query } from './_generated/server';
export const getUserId = async (ctx: { auth: Auth }) => {
return (await ctx.auth.getUserIdentity())?.subject;
@@ -16,8 +16,8 @@ export const getNotes = query({
if (!userId) return null;
const notes = await ctx.db
.query("notes")
.filter((q) => q.eq(q.field("userId"), userId))
.query('notes')
.filter((q) => q.eq(q.field('userId'), userId))
.collect();
return notes;
@@ -27,7 +27,7 @@ export const getNotes = query({
// Get note for a specific note
export const getNote = query({
args: {
id: v.optional(v.id("notes")),
id: v.optional(v.id('notes')),
},
handler: async (ctx, args) => {
const { id } = args;
@@ -46,8 +46,8 @@ export const createNote = mutation({
},
handler: async (ctx, { title, content, isSummary }) => {
const userId = await getUserId(ctx);
if (!userId) throw new Error("User not found");
const noteId = await ctx.db.insert("notes", { userId, title, content });
if (!userId) throw new Error('User not found');
const noteId = await ctx.db.insert('notes', { userId, title, content });
if (isSummary) {
await ctx.scheduler.runAfter(0, internal.openai.summary, {
@@ -63,7 +63,7 @@ export const createNote = mutation({
export const deleteNote = mutation({
args: {
noteId: v.id("notes"),
noteId: v.id('notes'),
},
handler: async (ctx, args) => {
await ctx.db.delete(args.noteId);