ruz-bot/daemons/api.py
Administrator 5b76f3528c api
2022-10-22 13:06:59 +03:00

19 lines
635 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from flask import Flask
import settings
from helpers.mongo import mongo
def api():
app = Flask(__name__)
@app.route('/stats', methods=['GET'])
def stats():
return {
"Всего пользователей": mongo.users_collection.count_documents({}),
"Подписано на уведомления": mongo.users_collection.count_documents({"notify_minutes": {"$ne": None}}),
"Отправлено уведомлений за сегодня": mongo.lessons_collection.count_documents({"notified": True})
}
app.run(host="0.0.0.0", port=1238, debug=settings.DEBUG)