File size: 528 Bytes
b7a7f32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from cruds.base import CRUDBase
from schemas.user_permission import UserPermissionCreate, UserPermissionUpdate
from models.user_permission import UserPermission
from models import User
from sqlalchemy.orm import Session


class CRUDUserPermission(
    CRUDBase[UserPermission, UserPermissionCreate, UserPermissionUpdate]
):
    def get_by_name(
        self, db: Session, *, name: str
    ):
        return db.query(self.model).filter(self.model.name == name).first()


crud_user_permission = CRUDUserPermission(UserPermission)