Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
omzetten vanuit DAO: admin #45
Browse files Browse the repository at this point in the history
  • Loading branch information
lbarraga committed Mar 5, 2024
1 parent 885f895 commit 28cdf58
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions backend/domain/logic/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from sqlalchemy.orm import Session

from db.models.models import Admin
from domain.models.AdminDataclass import AdminDataclass


def create_admin(session: Session, name: str, email: str) -> AdminDataclass:
new_admin: Admin = Admin(name=name, email=email)
session.add(new_admin)
session.commit()
return new_admin.to_domain_model()


def is_user_admin(session: Session, user_id: int) -> bool:
admin = session.get(Admin, user_id)
return admin is not None

0 comments on commit 28cdf58

Please sign in to comment.