treewide: better cross-device sync capabilities; in-database storage
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Id99798df6f7e4470caae8a193c2654aa6a6a6964
This commit is contained in:
parent
5521488a93
commit
f34c78b238
41 changed files with 8781 additions and 138 deletions
|
|
@ -27,6 +27,12 @@ pub struct TimelineQuery {
|
|||
pub group_by: GroupBy,
|
||||
pub year: Option<i32>,
|
||||
pub month: Option<u32>,
|
||||
#[serde(default = "default_timeline_limit")]
|
||||
pub limit: u64,
|
||||
}
|
||||
|
||||
fn default_timeline_limit() -> u64 {
|
||||
10000
|
||||
}
|
||||
|
||||
/// Timeline group response
|
||||
|
|
@ -62,12 +68,12 @@ pub async fn get_timeline(
|
|||
State(state): State<AppState>,
|
||||
Query(query): Query<TimelineQuery>,
|
||||
) -> Result<impl IntoResponse, ApiError> {
|
||||
// Query photos with date_taken
|
||||
// Query photos with date_taken (limit is configurable, defaults to 10000)
|
||||
let all_media = state
|
||||
.storage
|
||||
.list_media(&pinakes_core::model::Pagination {
|
||||
offset: 0,
|
||||
limit: 10000, // TODO: Make this more efficient with streaming
|
||||
limit: query.limit.min(50000), // Cap at 50000 for safety
|
||||
sort: Some("date_taken DESC".to_string()),
|
||||
})
|
||||
.await?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue