Basic rest implementation for connecting user to sales-person

This commit is contained in:
Simon Goller 2024-05-09 14:16:47 +02:00
parent e3ec694876
commit bf94ec33de
10 changed files with 181 additions and 1 deletions

View file

@ -91,6 +91,18 @@ impl dao::PermissionDao for PermissionDaoImpl {
.map_db_error()?;
Ok(())
}
async fn find_user(&self, username: &str) -> Result<Option<dao::UserEntity>, DaoError> {
let result = query!(
r"SELECT name FROM user WHERE name = ?",
username
)
.fetch_optional(self.pool.as_ref())
.await
.map_db_error()?;
Ok(result.map(|row| dao::UserEntity {
name: row.name.clone().into(),
}))
}
async fn create_role(&self, role: &dao::RoleEntity, process: &str) -> Result<(), DaoError> {
let name = role.name.as_ref();