Task: Implement the Admin model with authentication and password handling as described in the tests’ documentation.
What to implement
A SQLAlchemy Admin model with at least the following fields:
id: primary key
username: string (unique)
password: string (stores a hashed password)
Class methods and instance methods:
Admin.make_password(plaintext) -> str
Return a bcrypt-hashed string suitable for storage, using Flask-Bcrypt.
Admin.authenticate(session, username, password) -> Admin or None
If there are no Admin records in the database, create a new Admin with the given username and password (store the hashed password) and return it.
If there is at least one Admin:
If an Admin with the given username exists and the provided password matches the stored hash, return that Admin.
If the username does not exist or the password does not match, return None.
Do not create a new Admin when an Admin already exists and the credentials don’t match.
Admin.check_password(self, plaintext) -> bool
Return True if the provided plaintext password matches the stored hashed password, using Flask-Bcrypt check_password_hash.
Behavioral requirements based on tests
On the very first authentication (no Admins in DB), Admin.authenticate(db_session, username, password) should create and return the new Admin.
If at least one Admin exists, Admin.authenticate(db_session, username, password) should only return an Admin when the credentials match an existing record; otherwise it should return None and not create new Admins.
Admin.make_password should produce a hash that check_password_hash can verify.
Admin.check_password should accurately verify plaintext against the stored hash.
Notes
The implementation should integrate with the existing database/session pattern used in the tests (accepts a session-like object, e.g., db_session).
Ensure compatibility with the test helper create(db_session, Admin, username=...) pattern, i.e., the model should work with standard SQLAlchemy CRUD via the session.
Place the implementation in the /app/ directory of the project.