v3: allow users to edit dump thumbnail, fixed some linter errors in the frontend
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 41s
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 41s
This commit is contained in:
@@ -79,6 +79,7 @@ export interface DumpRow {
|
||||
vote_count: number;
|
||||
comment_count: number;
|
||||
is_private: number;
|
||||
custom_thumbnail_mime: string | null;
|
||||
[key: string]: SQLOutputValue; // Index signature
|
||||
}
|
||||
|
||||
@@ -126,7 +127,10 @@ export function isDumpRow(obj: unknown): obj is DumpRow {
|
||||
(typeof obj.file_size === "number" || obj.file_size === null) &&
|
||||
"vote_count" in obj && typeof obj.vote_count === "number" &&
|
||||
"comment_count" in obj && typeof obj.comment_count === "number" &&
|
||||
"is_private" in obj && typeof obj.is_private === "number";
|
||||
"is_private" in obj && typeof obj.is_private === "number" &&
|
||||
"custom_thumbnail_mime" in obj &&
|
||||
(typeof obj.custom_thumbnail_mime === "string" ||
|
||||
obj.custom_thumbnail_mime === null);
|
||||
}
|
||||
|
||||
export function isUserRow(obj: unknown): obj is UserRow {
|
||||
@@ -172,6 +176,7 @@ export function dumpRowToApi(row: DumpRow): Dump {
|
||||
voteCount: row.vote_count,
|
||||
commentCount: row.comment_count,
|
||||
isPrivate: Boolean(row.is_private),
|
||||
thumbnailMime: row.custom_thumbnail_mime ?? undefined,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -193,6 +198,7 @@ export function dumpApiToRow(dump: Dump): DumpRow {
|
||||
vote_count: dump.voteCount,
|
||||
comment_count: dump.commentCount,
|
||||
is_private: dump.isPrivate ? 1 : 0,
|
||||
custom_thumbnail_mime: dump.thumbnailMime ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ export interface Dump {
|
||||
voteCount: number;
|
||||
commentCount: number;
|
||||
isPrivate: boolean;
|
||||
thumbnailMime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user