This commit is contained in:
+66
@@ -677,6 +677,28 @@ def api_toggle_event_publication(event_id):
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
@bp.route('/api/events/mark_all_for_publication', methods=['POST'])
|
||||
@login_required
|
||||
def api_mark_all_events_for_publication():
|
||||
"""Отмечает все события для публикации"""
|
||||
db = get_db()
|
||||
try:
|
||||
with db.conn.cursor() as cursor:
|
||||
cursor.execute("""
|
||||
UPDATE events
|
||||
SET marked_to_publication = 1
|
||||
WHERE marked_to_publication = 0
|
||||
""")
|
||||
count = cursor.rowcount
|
||||
db.conn.commit()
|
||||
client_ip = get_client_ip()
|
||||
log_event(f"Отмечено для публикации: {count} событий, IP {client_ip}")
|
||||
return jsonify({'success': True, 'count': count})
|
||||
except Exception as e:
|
||||
return jsonify({'success': False, 'error': str(e)}), 500
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
@bp.route('/api/events', methods=['POST'])
|
||||
@login_required
|
||||
def api_add_event():
|
||||
@@ -804,6 +826,28 @@ def api_toggle_publication(post_id):
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
@bp.route('/api/posts/mark_all_for_publication', methods=['POST'])
|
||||
@login_required
|
||||
def api_mark_all_posts_for_publication():
|
||||
"""Отмечает все посты для публикации"""
|
||||
db = get_db()
|
||||
try:
|
||||
with db.conn.cursor() as cursor:
|
||||
cursor.execute("""
|
||||
UPDATE posts
|
||||
SET marked_to_publication = 1
|
||||
WHERE marked_to_publication = 0
|
||||
""")
|
||||
count = cursor.rowcount
|
||||
db.conn.commit()
|
||||
client_ip = get_client_ip()
|
||||
log_event(f"Отмечено для публикации: {count} постов, IP {client_ip}")
|
||||
return jsonify({'success': True, 'count': count})
|
||||
except Exception as e:
|
||||
return jsonify({'success': False, 'error': str(e)}), 500
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
@bp.route('/api/posts', methods=['POST'])
|
||||
@login_required
|
||||
def api_add_post():
|
||||
@@ -1408,6 +1452,28 @@ def api_toggle_category_publication(category_id):
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
@bp.route('/api/categories/mark_all_for_publication', methods=['POST'])
|
||||
@login_required
|
||||
def api_mark_all_categories_for_publication():
|
||||
"""Отмечает все категории для публикации"""
|
||||
db = get_db()
|
||||
try:
|
||||
with db.conn.cursor() as cursor:
|
||||
cursor.execute("""
|
||||
UPDATE categories
|
||||
SET marked_for_publication = 1
|
||||
WHERE marked_for_publication = 0
|
||||
""")
|
||||
count = cursor.rowcount
|
||||
db.conn.commit()
|
||||
client_ip = get_client_ip()
|
||||
log_event(f"Отмечено для публикации: {count} площадок, IP {client_ip}")
|
||||
return jsonify({'success': True, 'count': count})
|
||||
except Exception as e:
|
||||
return jsonify({'success': False, 'error': str(e)}), 500
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
@bp.route('/api/categories/<category_id>/events_count')
|
||||
@login_required
|
||||
def api_category_events_count(category_id):
|
||||
|
||||
Reference in New Issue
Block a user