fix karma trigger
This commit is contained in:
@@ -26,21 +26,24 @@ DROP FUNCTION IF EXISTS handle_manual_karma_adjustment();
|
|||||||
CREATE OR REPLACE FUNCTION insert_karma_transaction(
|
CREATE OR REPLACE FUNCTION insert_karma_transaction(
|
||||||
p_user_id INT,
|
p_user_id INT,
|
||||||
p_points INT,
|
p_points INT,
|
||||||
p_action "KarmaTransactionAction",
|
p_action TEXT,
|
||||||
p_comment_id INT,
|
p_comment_id INT,
|
||||||
p_description TEXT,
|
p_description TEXT,
|
||||||
p_suggestion_id INT DEFAULT NULL
|
p_suggestion_id INT DEFAULT NULL
|
||||||
) RETURNS VOID AS $$
|
) RETURNS VOID AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
INSERT INTO "KarmaTransaction" (
|
INSERT INTO "KarmaTransaction" (
|
||||||
"userId", "points", "action", "commentId",
|
"userId", "points", "action", "commentId", "suggestionId", "description", "processed", "createdAt"
|
||||||
"suggestionId",
|
)
|
||||||
"description", "processed", "createdAt"
|
|
||||||
)
|
|
||||||
VALUES (
|
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_suggestion_id,
|
||||||
p_description, true, NOW()
|
p_description,
|
||||||
|
true,
|
||||||
|
NOW()
|
||||||
);
|
);
|
||||||
END;
|
END;
|
||||||
$$ LANGUAGE plpgsql;
|
$$ LANGUAGE plpgsql;
|
||||||
|
|||||||
Reference in New Issue
Block a user