feat(*): first mvp

This commit is contained in:
h
2026-01-20 21:54:48 +01:00
parent b9703da2fc
commit ec17f5e0fd
52 changed files with 2599 additions and 576 deletions

View File

@@ -0,0 +1,45 @@
import { v } from 'convex/values';
import { mutation, query } from './_generated/server';
export const list = query({
args: {},
returns: v.array(
v.object({
_id: v.id('pendingGenerations'),
_creationTime: v.number(),
userId: v.id('users'),
chatId: v.id('chats'),
userMessage: v.string(),
createdAt: v.number()
})
),
handler: async (ctx) => {
return await ctx.db.query('pendingGenerations').collect();
}
});
export const create = mutation({
args: {
userId: v.id('users'),
chatId: v.id('chats'),
userMessage: v.string()
},
returns: v.id('pendingGenerations'),
handler: async (ctx, args) => {
return await ctx.db.insert('pendingGenerations', {
userId: args.userId,
chatId: args.chatId,
userMessage: args.userMessage,
createdAt: Date.now()
});
}
});
export const remove = mutation({
args: { id: v.id('pendingGenerations') },
returns: v.null(),
handler: async (ctx, args) => {
await ctx.db.delete(args.id);
return null;
}
});