feat(art): promote donation art submission to semi-special
This commit is contained in:
@@ -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("");
|
||||
|
||||
@@ -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
@@ -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", {
|
||||
|
||||
Reference in New Issue
Block a user