Show upload progress and fix credit concurrency user scope
- Replace image upload POST with XHR progress tracking - Keep upload state until Convex sync completes - Pass owner userId through image generation to decrement concurrency correctly
This commit is contained in:
@@ -833,15 +833,18 @@ export const incrementUsage = internalMutation({
|
||||
* (commit/release übernehmen das bei aktivierten Credits).
|
||||
*/
|
||||
export const decrementConcurrency = internalMutation({
|
||||
args: {},
|
||||
handler: async (ctx) => {
|
||||
const user = await requireAuth(ctx);
|
||||
args: {
|
||||
userId: v.optional(v.string()),
|
||||
},
|
||||
handler: async (ctx, args) => {
|
||||
const resolvedUserId =
|
||||
args.userId ?? (await requireAuth(ctx)).userId;
|
||||
const today = new Date().toISOString().split("T")[0];
|
||||
|
||||
const usage = await ctx.db
|
||||
.query("dailyUsage")
|
||||
.withIndex("by_user_date", (q) =>
|
||||
q.eq("userId", user.userId).eq("date", today)
|
||||
q.eq("userId", resolvedUserId).eq("date", today)
|
||||
)
|
||||
.unique();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user