add sqlite db; add todos :-(; show current cameras

This commit is contained in:
2025-08-02 17:46:56 +02:00
parent 3f61f675e9
commit fe89c86004
14 changed files with 1653 additions and 31 deletions

24
src/model/camera.rs Normal file
View File

@@ -0,0 +1,24 @@
use crate::Backend;
use serde::{Deserialize, Serialize};
use sqlx::FromRow;
#[derive(FromRow, Debug, Serialize, Deserialize)]
pub struct Camera {
pub uuid: String,
pub desc: String,
pub name: String,
}
impl Backend {
pub(crate) async fn amount_total_cameras(&self) -> i64 {
match self {
Backend::Sqlite(db) => {
sqlx::query!("SELECT COUNT(*) as count FROM camera")
.fetch_one(db)
.await
.unwrap()
.count
}
}
}
}