feat(validation): complete validation editor and master data modules
This commit is contained in:
parent
2b5c765e41
commit
f73a24df13
73 changed files with 10194 additions and 0 deletions
30
validation-suite/backend/mercury/app/db/seed.py
Normal file
30
validation-suite/backend/mercury/app/db/seed.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from sqlalchemy import select
|
||||
|
||||
from app.core.config import settings
|
||||
from app.core.security import hash_password
|
||||
from app.db.session import SessionLocal
|
||||
from app.models.user import User, UserRole
|
||||
|
||||
|
||||
def seed_admin() -> None:
|
||||
with SessionLocal() as session:
|
||||
existing = session.scalar(select(User).where(User.email == settings.admin_email.lower()))
|
||||
if existing is not None:
|
||||
return
|
||||
session.add(
|
||||
User(
|
||||
email=settings.admin_email.lower(),
|
||||
full_name="Validation Suite Administrator",
|
||||
role=UserRole.admin,
|
||||
password_hash=hash_password(settings.admin_password),
|
||||
is_active=True,
|
||||
)
|
||||
)
|
||||
session.commit()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
seed_admin()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue