create project and create model and dashboard

This commit is contained in:
2025-12-11 10:16:43 +05:30
parent 2371202ac3
commit 2e62320167
55 changed files with 1072 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
# from app.models.user_model import User
# from app.services.db_service import db
# import logging
# class UserService:
# @staticmethod
# def register_user(name, email, password):
# user = User(name=name, email=email)
# user.set_password(password)
# db.session.add(user)
# db.session.commit()
# logging.info(f"New user registered: {email}")
# return user
# @staticmethod
# def validate_login(email, password):
# user = User.query.filter_by(email=email).first()
# if user and user.check_password(password):
# logging.info(f"Login success: {email}")
# return user
# logging.warning(f"Login failed for: {email}")
# return None
# @staticmethod
# def get_all_users():
# return User.query.all()
from app.services.db_service import DBService
from app.models.user_model import User
class UserService:
def get_all_users(self):
db = DBService().connect()
cursor = db.cursor(dictionary=True)
cursor.execute("SELECT id, name, email FROM users")
rows = cursor.fetchall()
users = [User(**row) for row in rows]
cursor.close()
db.close()
return users