refactor: use OOP #6

Merged
pufereq merged 15 commits from refactor/use-oop into develop 2025-08-25 17:56:23 +00:00
7 changed files with 237 additions and 52 deletions
Showing only changes of commit d91f135d53 - Show all commits

View File

@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
from __future__ import annotations
import flask_login
class User(flask_login.UserMixin):
"""Represents a user for authentication purposes."""
def __init__(self, id: str) -> None:
super().__init__()
self.id = id
def get_id(self) -> str:
"""Return the unique identifier for the user."""
return self.id
def __str__(self) -> str:
return f"User(id={self.id})"
def __repr__(self) -> str:
return f"User(id={self.id})"
def load_user(user_id):
if user_id == "admin":
return User("admin")
return None