Create a basic frontend and an endpoint to get video stream.
This commit is contained in:
@@ -53,10 +53,10 @@ impl LibraryItemSqliteRepository {
|
||||
WHERE parent_folder_id IS NULL",
|
||||
)?;
|
||||
let rows = prepared_statement.query([])?;
|
||||
rows.map(Self::map_to_library_item).collect::<Vec<LibraryItemEntity>>()
|
||||
rows.map(Self::map_to_entity).collect::<Vec<LibraryItemEntity>>()
|
||||
}
|
||||
|
||||
fn map_to_library_item(row: &Row) -> Result<LibraryItemEntity, Error> {
|
||||
fn map_to_entity(row: &Row) -> Result<LibraryItemEntity, Error> {
|
||||
let id_text: String = row.get(0)?;
|
||||
let type_as_number: i8 = row.get(2)?;
|
||||
Ok(
|
||||
@@ -185,6 +185,26 @@ impl LibraryItemSqliteRepository {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
pub fn find_by_id(&self, library_item_id: Uuid) -> Result<Option<LibraryItemEntity>, Error> {
|
||||
let database_connection = self.get_connection();
|
||||
|
||||
let mut prepared_statement = database_connection.prepare(
|
||||
"SELECT
|
||||
id,
|
||||
name,
|
||||
type,
|
||||
parent_folder_id
|
||||
FROM library_item
|
||||
WHERE id = ?1;"
|
||||
)?;
|
||||
let mut rows = prepared_statement.query([library_item_id.to_string()])?;
|
||||
|
||||
if let Some(row) = rows.next()? {
|
||||
Ok(Some(Self::map_to_entity(&row)?))
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
fn map_to_raw_entity(row: &Row) -> Result<LibraryItemRawEntity, Error> {
|
||||
let id_text: String = row.get(0)?;
|
||||
@@ -199,4 +219,4 @@ impl LibraryItemSqliteRepository {
|
||||
};
|
||||
Ok(raw_entity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user