feat(art): promote donation art submission to semi-special

This commit is contained in:
2026-06-10 23:47:36 +07:00 Unverified
parent c0bd94f6f6
commit d3f7ca410f
3 changed files with 15 additions and 9 deletions
+4 -1
View File
@@ -58,6 +58,7 @@ export function SidebarLink({
queue: number | null;
comment: string;
uid: string;
promoted: boolean;
};
className?: string;
}) {
@@ -103,7 +104,8 @@ export function SidebarLink({
className={cn(
className,
id === submission.id && "bg-accent text-accent-foreground",
submission.queue === null && "border-2 border-yellow-400",
(submission.queue === null || submission.promoted) &&
"border-2 border-yellow-400",
)}
prefetch
onClick={(ev) => {
@@ -250,6 +252,7 @@ export function SubmissionList({
queue: number | null;
comment: string;
uid: string;
promoted: boolean;
}[];
}) {
const [query, setQuery] = useState("");
+7 -7
View File
@@ -210,13 +210,13 @@ export default async function () {
uid: $.uid,
queue: null as unknown as undefined,
})
// .onConflictDoUpdate({
// target: submissions.uid,
// set: {
// queue: null as unknown as undefined,
// },
// })
.onConflictDoNothing();
.onConflictDoUpdate({
target: submissions.uid,
set: {
promoted: true,
},
});
// .onConflictDoNothing();
// .catch(() => "conflict");
// if (res === "conflict") {
// tx.rollback();
+4 -1
View File
@@ -81,6 +81,8 @@ export const settings = pgTable("settings", {
//#region Artifact
export const artifact = pgSchema("artifact");
const nullableSerial = serial();
(nullableSerial as any).config.notNull = false;
export const submissions = artifact.table("submissions", {
id: text().primaryKey().$defaultFn(uuidv7),
@@ -93,10 +95,11 @@ export const submissions = artifact.table("submissions", {
onDelete: "cascade",
onUpdate: "cascade",
}),
queue: serial(), // NULL for Spacial Queue
queue: nullableSerial, // NULL for Spacial Queue
editToken: text().notNull().$defaultFn(uuidv7),
edits: integer().notNull().default(0),
checked: boolean().notNull().default(false),
promoted: boolean().notNull().default(false),
});
export const cards = artifact.table("cards", {