This commit is contained in:
+9
-3
@@ -1100,7 +1100,7 @@ def api_categories():
|
||||
try:
|
||||
with db.conn.cursor() as cursor:
|
||||
cursor.execute("""
|
||||
SELECT AUTO_ID, ID, TITLE, description
|
||||
SELECT AUTO_ID, ID, TITLE, description, marked_for_publication, is_tg_published
|
||||
FROM categories
|
||||
ORDER BY TITLE, ID
|
||||
""")
|
||||
@@ -1112,7 +1112,9 @@ def api_categories():
|
||||
'auto_id': cat['AUTO_ID'],
|
||||
'id': cat['ID'],
|
||||
'title': cat['TITLE'] or '',
|
||||
'description': cat['description'] or ''
|
||||
'description': cat['description'] or '',
|
||||
'marked_for_publication': bool(cat['marked_for_publication']) if cat['marked_for_publication'] is not None else False,
|
||||
'is_tg_published': bool(cat['is_tg_published']) if cat['is_tg_published'] is not None else False
|
||||
})
|
||||
|
||||
return jsonify(categories_list)
|
||||
@@ -1129,7 +1131,7 @@ def api_category_details(category_id):
|
||||
try:
|
||||
with db.conn.cursor() as cursor:
|
||||
cursor.execute("""
|
||||
SELECT AUTO_ID, ID, TITLE, description, image_url
|
||||
SELECT AUTO_ID, ID, TITLE, description, image_url, tg_id, is_tg_published, tg_published_date, marked_for_publication
|
||||
FROM categories
|
||||
WHERE ID = %s
|
||||
""", (category_id,))
|
||||
@@ -1153,6 +1155,10 @@ def api_category_details(category_id):
|
||||
'title': category['TITLE'] or '',
|
||||
'description': category['description'] or '',
|
||||
'image_url': category['image_url'] or '',
|
||||
'tg_id': category['tg_id'],
|
||||
'is_tg_published': bool(category['is_tg_published']) if category['is_tg_published'] is not None else False,
|
||||
'tg_published_date': category['tg_published_date'].isoformat() if category['tg_published_date'] else None,
|
||||
'marked_for_publication': bool(category['marked_for_publication']) if category['marked_for_publication'] is not None else False,
|
||||
'event_count': event_count
|
||||
})
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user