Update form to look better & add automatic lunch toggle

This commit is contained in:
2025-09-17 21:22:16 -05:00
parent 3d85e0c2e9
commit 87c128f7c5
8 changed files with 79 additions and 46 deletions

View File

@@ -34,7 +34,7 @@ export const getUser = query(async (ctx) => {
name: user.name ?? null,
image,
lunchTime: user.lunchTime ?? null,
automaticLunch: user.automaticLunch ?? false as boolean,
automaticLunch: user.automaticLunch ?? (false as boolean),
};
});
@@ -46,7 +46,7 @@ export const getAllUsers = query(async (ctx) => {
name: u.name ?? null,
image: u.image ?? null,
lunchTime: u.lunchTime ?? null,
automaticLUnch: u.automaticLunch ?? false as boolean,
automaticLUnch: u.automaticLunch ?? (false as boolean),
}));
});
@@ -123,12 +123,11 @@ export const updateUserAutomaticLunch = mutation({
if (!userId) throw new ConvexError('Not authenticated.');
const user = await ctx.db.get(userId);
if (!user) throw new ConvexError('User not found.');
if (user.automaticLunch === automaticLunch)
return { success: true };
if (user.automaticLunch === automaticLunch) return { success: true };
await ctx.db.patch(userId, { automaticLunch });
return { success: true };
},
})
});
export const validatePassword = (password: string): boolean => {
if (