v3: follows, notifications, invite-only registration, unread markers
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { APIErrorCode, APIException } from "../model/interfaces.ts";
|
||||
import { db } from "../model/db.ts";
|
||||
import { notifyDumpOwnerUpvote } from "./notification-service.ts";
|
||||
|
||||
export function castVote(dumpId: string, userId: string): number {
|
||||
try {
|
||||
@@ -14,6 +15,7 @@ export function castVote(dumpId: string, userId: string): number {
|
||||
`SELECT vote_count FROM dumps WHERE id = ?;`,
|
||||
).get(dumpId) as { vote_count: number } | undefined;
|
||||
db.exec("COMMIT;");
|
||||
notifyDumpOwnerUpvote(userId, dumpId);
|
||||
return row?.vote_count ?? 0;
|
||||
} catch (err) {
|
||||
db.exec("ROLLBACK;");
|
||||
|
||||
Reference in New Issue
Block a user