Compare commits
2 Commits
release-20
...
release-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
587480d140 | ||
|
|
74e6a50f14 |
@@ -126,9 +126,9 @@ class TaskScheduler:
|
|||||||
self.logger.info(f"Running task '{task_name}'")
|
self.logger.info(f"Running task '{task_name}'")
|
||||||
# Use task instance as a context manager to ensure
|
# Use task instance as a context manager to ensure
|
||||||
# a single database connection is used for the entire task
|
# a single database connection is used for the entire task
|
||||||
with task_info["instance"] as task_instance:
|
with task_info["instance"]:
|
||||||
# Execute the task instance's run method directly
|
# Execute the registered task function with its arguments
|
||||||
task_instance.run()
|
task_info["func"](*task_info["args"], **task_info["kwargs"])
|
||||||
self.logger.info(f"Task '{task_name}' completed")
|
self.logger.info(f"Task '{task_name}' completed")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.exception(f"Error running task '{task_name}': {e}")
|
self.logger.exception(f"Error running task '{task_name}': {e}")
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
BIN
web/src/assets/ogimage-bg.png
Normal file
BIN
web/src/assets/ogimage-bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 253 KiB |
File diff suppressed because one or more lines are too long
@@ -3,21 +3,21 @@ import { urlParamsToObject } from '../lib/urls'
|
|||||||
|
|
||||||
import type { APIRoute } from 'astro'
|
import type { APIRoute } from 'astro'
|
||||||
|
|
||||||
export const GET: APIRoute = ({ url }) => {
|
export const GET: APIRoute = (context) => {
|
||||||
const { template, ...props } = urlParamsToObject(url.searchParams)
|
const { template, ...props } = urlParamsToObject(context.url.searchParams)
|
||||||
|
|
||||||
if (!template) return ogImageTemplates.default()
|
if (!template) return ogImageTemplates.default({}, context)
|
||||||
|
|
||||||
if (!(template in ogImageTemplates)) {
|
if (!(template in ogImageTemplates)) {
|
||||||
console.error(`Invalid template: "${template}"`)
|
console.error(`Invalid template: "${template}"`)
|
||||||
return ogImageTemplates.default()
|
return ogImageTemplates.default({}, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = ogImageTemplates[template as keyof typeof ogImageTemplates](props)
|
const response = ogImageTemplates[template as keyof typeof ogImageTemplates](props, context)
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||||
if (!response) {
|
if (!response) {
|
||||||
console.error(`Cannot generate image for template: ${template} and props: ${JSON.stringify(props)}`)
|
console.error(`Cannot generate image for template: ${template} and props: ${JSON.stringify(props)}`)
|
||||||
return ogImageTemplates.default()
|
return ogImageTemplates.default({}, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|||||||
Reference in New Issue
Block a user