Compare commits

..

2 Commits

Author SHA1 Message Date
pluja
74e6a50f14 fix karma trigger 2025-05-19 21:51:45 +00:00
pluja
3eb9b28ea0 triggers fix and ogimages 2025-05-19 21:38:37 +00:00
3 changed files with 21 additions and 29 deletions

View File

@@ -8,6 +8,7 @@ DROP TRIGGER IF EXISTS comment_suspicious_change_trigger ON "Comment";
DROP TRIGGER IF EXISTS comment_upvote_change_trigger ON "Comment";
DROP TRIGGER IF EXISTS comment_vote_change_trigger ON "CommentVote";
DROP TRIGGER IF EXISTS suggestion_status_change_trigger ON "ServiceSuggestion";
DROP TRIGGER IF EXISTS manual_karma_adjustment_trigger ON "KarmaTransaction";
-- Drop existing functions
DROP FUNCTION IF EXISTS handle_comment_upvote_change();
@@ -19,26 +20,30 @@ DROP FUNCTION IF EXISTS handle_comment_vote_change();
DROP FUNCTION IF EXISTS insert_karma_transaction();
DROP FUNCTION IF EXISTS update_user_karma();
DROP FUNCTION IF EXISTS handle_suggestion_status_change();
DROP FUNCTION IF EXISTS handle_manual_karma_adjustment();
-- Helper function to insert karma transaction
CREATE OR REPLACE FUNCTION insert_karma_transaction(
p_user_id INT,
p_points INT,
p_action "KarmaTransactionAction",
p_action TEXT,
p_comment_id INT,
p_description TEXT,
p_suggestion_id INT DEFAULT NULL
) RETURNS VOID AS $$
BEGIN
INSERT INTO "KarmaTransaction" (
"userId", "points", "action", "commentId",
"suggestionId",
"description", "processed", "createdAt"
)
"userId", "points", "action", "commentId", "suggestionId", "description", "processed", "createdAt"
)
VALUES (
p_user_id, p_points, p_action, p_comment_id,
p_user_id,
p_points,
p_action::"KarmaTransactionAction",
p_comment_id,
p_suggestion_id,
p_description, true, NOW()
p_description,
true,
NOW()
);
END;
$$ LANGUAGE plpgsql;

BIN
web/src/assets/ogimage.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

File diff suppressed because one or more lines are too long