[ВОЛК] редактируемость факта и даты публикации площадки
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
+9
-4
@@ -1306,15 +1306,17 @@ def api_create_category():
|
||||
data = request.json
|
||||
with db.conn.cursor() as cursor:
|
||||
cursor.execute("""
|
||||
INSERT INTO categories (ID, TITLE, description, image_url, tg_id, marked_for_publication)
|
||||
VALUES (%s, %s, %s, %s, %s, %s)
|
||||
INSERT INTO categories (ID, TITLE, description, image_url, tg_id, marked_for_publication, is_tg_published, tg_published_date)
|
||||
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)
|
||||
""", (
|
||||
data.get('id'),
|
||||
data.get('title', ''),
|
||||
data.get('description', ''),
|
||||
data.get('image_url', ''),
|
||||
data.get('tg_id'),
|
||||
bool(data.get('marked_for_publication', False))
|
||||
bool(data.get('marked_for_publication', False)),
|
||||
bool(data.get('is_tg_published', False)),
|
||||
data.get('tg_published_date') or None
|
||||
))
|
||||
db.conn.commit()
|
||||
client_ip = get_client_ip()
|
||||
@@ -1356,7 +1358,8 @@ def api_update_category(category_id):
|
||||
# Обновляем категорию, включая ID если он изменился
|
||||
cursor.execute("""
|
||||
UPDATE categories
|
||||
SET ID = %s, TITLE = %s, description = %s, image_url = %s, tg_id = %s, marked_for_publication = %s
|
||||
SET ID = %s, TITLE = %s, description = %s, image_url = %s, tg_id = %s,
|
||||
marked_for_publication = %s, is_tg_published = %s, tg_published_date = %s
|
||||
WHERE AUTO_ID = %s
|
||||
""", (
|
||||
new_id,
|
||||
@@ -1365,6 +1368,8 @@ def api_update_category(category_id):
|
||||
data.get('image_url', ''),
|
||||
data.get('tg_id'),
|
||||
bool(data.get('marked_for_publication', False)),
|
||||
bool(data.get('is_tg_published', False)),
|
||||
data.get('tg_published_date') or None,
|
||||
auto_id
|
||||
))
|
||||
db.conn.commit()
|
||||
|
||||
Reference in New Issue
Block a user