sensors is separate API with td

This commit is contained in:
2026-11-01 12:07:04 +01:00
parent b7048b401d
commit 85179c8a80
24 changed files with 1229 additions and 321 deletions
+25
View File
@@ -0,0 +1,25 @@
from datetime import datetime, timezone
from flask_login import UserMixin
from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import check_password_hash, generate_password_hash
user_db = SQLAlchemy()
class User(UserMixin, user_db.Model):
__tablename__ = "user"
id = user_db.Column(user_db.Integer, primary_key=True)
username = user_db.Column(user_db.String(80), nullable=False, unique=True)
password_hash = user_db.Column(user_db.String(255), nullable=False)
is_admin = user_db.Column(user_db.Boolean, nullable=False, default=False)
created_at = user_db.Column(
user_db.DateTime, default=lambda: datetime.now(timezone.utc)
)
def set_password(self, password: str) -> None:
self.password_hash = generate_password_hash(password)
def check_password(self, password: str) -> bool:
return check_password_hash(self.password_hash, password)