Implement the repository for library item entity.
This commit is contained in:
@@ -49,4 +49,13 @@ impl LibraryItemEntity {
|
||||
unknown_value => Err(Error::new(ErrorKind::InvalidData, format!("Unknown library item type value from database: {unknown_value}")))
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn to_library_item(&self) -> Result<LibraryItem, Error> {
|
||||
let library_item = LibraryItem {
|
||||
id: self.id.clone(),
|
||||
name: self.name.clone(),
|
||||
r#type: Self::map_type_from_i8(self.r#type)?
|
||||
};
|
||||
Ok(library_item)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user