def create_employee(session: DBSession, user: RequestCreateEmployeeDto) -> DBEmployee: user = DBEmployee( first_name=user.first_name, last_name=user.last_name ) session.add_model(user, need_flush=True) return user
def create_employee(session: DBSession, employee: RequestCreateEmployeeDto) -> DBEmployee: new_employee = DBEmployee( first_name=employee.first_name, last_name=employee.last_name, ) session.add_model(new_employee) return new_employee
def create_employee(session: DBSession, employee: RequestCreateEmployeeDto, hashed_password: bytes) -> DBEmployee: new_employee = DBEmployee( login=employee.login, password=hashed_password, first_name=employee.first_name, last_name=employee.last_name, ) if session.get_employee_by_login(new_employee.login) is not None: raise DBEmployeeExistsException session.add_model(new_employee) return new_employee