aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Database
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-04-15 21:31:11 -0700
committerFuwn <[email protected]>2024-04-15 21:31:11 -0700
commit5f7f738c6775f75d920a3b0289227bf018e0689f (patch)
treee81c729903019212049078f6c3348f6d45f5ca16 /src/lib/Database
parentfeat: replace hover cover with image tooltip (diff)
downloaddue.moe-5f7f738c6775f75d920a3b0289227bf018e0689f.tar.xz
due.moe-5f7f738c6775f75d920a3b0289227bf018e0689f.zip
fix(badges): empty fields
Diffstat (limited to 'src/lib/Database')
-rw-r--r--src/lib/Database/userBadges.ts34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/lib/Database/userBadges.ts b/src/lib/Database/userBadges.ts
index 36bf7955..5d90404d 100644
--- a/src/lib/Database/userBadges.ts
+++ b/src/lib/Database/userBadges.ts
@@ -4,13 +4,13 @@ import supabase from './supabase';
export interface Badge {
post?: string;
image?: string;
- description?: string;
+ description?: string | null;
id?: number;
time?: string;
- category?: string;
- hidden?: boolean;
- source: string;
- designer: string;
+ category?: string | null;
+ hidden?: boolean | false;
+ source?: string | null;
+ designer?: string | null;
}
export const getUserBadges = async (userId: number): Promise<Badge[]> => {
@@ -32,19 +32,17 @@ export const addUserBadge = async (userId: number, badge: Badge) => {
if (post === undefined || image === undefined) return;
if (time) {
- await supabase
- .from('user_badges')
- .insert({
- user_id: userId,
- post,
- image,
- description,
- time,
- category,
- hidden,
- source,
- designer
- });
+ await supabase.from('user_badges').insert({
+ user_id: userId,
+ post,
+ image,
+ description,
+ time,
+ category,
+ hidden,
+ source,
+ designer
+ });
} else {
await supabase
.from('user_badges')