feat(content_hash): propagate etag and hash_content to */resources
This commit is contained in:
@@ -125,6 +125,10 @@ pub struct FavoriteResourceRow {
|
||||
pub resource_created_at: DateTime<Utc>,
|
||||
pub modified_at: DateTime<Utc>,
|
||||
pub owner_id: Uuid,
|
||||
/// Raw BLAKE3 content hash. `Some(_)` for file rows, `None` for
|
||||
/// folder rows. Routes into `FileDto::content_hash` and feeds
|
||||
/// `File::compute_etag` to populate `FileDto::etag`.
|
||||
pub blob_hash: Option<String>,
|
||||
/// `true` when `owner_id == requesting user_id`.
|
||||
pub is_owner: bool,
|
||||
pub favorited_at: DateTime<Utc>,
|
||||
|
||||
@@ -181,6 +181,11 @@ pub struct FolderResourceRow {
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub modified_at: DateTime<Utc>,
|
||||
pub owner_id: Uuid,
|
||||
/// Raw BLAKE3 content hash. `Some(_)` for file rows, `None` for
|
||||
/// folder rows. Populates `FileDto::content_hash` + `FileDto::etag`
|
||||
/// on the REST `/api/folders/{id}/resources` listing so API
|
||||
/// consumers can issue conditional requests against listed files.
|
||||
pub blob_hash: Option<String>,
|
||||
// Pre-computed sort fields — returned by the SQL for cursor construction.
|
||||
/// `LOWER(name)` used by `name`/`type` sorts.
|
||||
pub sort_str: String,
|
||||
|
||||
@@ -105,6 +105,10 @@ pub struct RecentResourceRow {
|
||||
pub resource_created_at: DateTime<Utc>,
|
||||
pub modified_at: DateTime<Utc>,
|
||||
pub owner_id: Uuid,
|
||||
/// Raw BLAKE3 content hash. `Some(_)` for file rows, `None` for
|
||||
/// folder rows. Feeds `File::compute_etag` so this listing's
|
||||
/// `etag` matches GET/HEAD/PROPFIND for the same file.
|
||||
pub blob_hash: Option<String>,
|
||||
/// `true` when `owner_id == requesting user_id`.
|
||||
pub is_owner: bool,
|
||||
pub accessed_at: DateTime<Utc>,
|
||||
|
||||
@@ -127,6 +127,13 @@ pub struct SearchFileResultDto {
|
||||
pub icon_special_class: String,
|
||||
/// Content category: "document", "image", "video", "audio", "archive", "code", "other"
|
||||
pub category: String,
|
||||
/// Raw BLAKE3 content hash. Feeds `FileDto::content_hash` and
|
||||
/// `File::compute_etag` when search results are converted to
|
||||
/// `FileDto` (NC REPORT/SEARCH response). Defaults to `String::new()`
|
||||
/// for backward-compatible deserialisation of cached results
|
||||
/// that pre-date the column.
|
||||
#[serde(default)]
|
||||
pub blob_hash: String,
|
||||
}
|
||||
|
||||
/// A folder search result enriched with server-computed metadata
|
||||
|
||||
@@ -61,6 +61,12 @@ pub struct TrashResourceRow {
|
||||
pub resource_created_at: DateTime<Utc>,
|
||||
pub modified_at: DateTime<Utc>,
|
||||
pub owner_id: Uuid,
|
||||
/// Raw BLAKE3 content hash. `Some(_)` for file rows, `None` for
|
||||
/// folder rows. Feeds `File::compute_etag` so the trash listing's
|
||||
/// `etag` matches what GET/HEAD/PROPFIND would return for the
|
||||
/// same file (restorable trash items are conditional-request
|
||||
/// targets too).
|
||||
pub blob_hash: Option<String>,
|
||||
pub trashed_at: DateTime<Utc>,
|
||||
pub deletion_date: DateTime<Utc>,
|
||||
/// Original location path (for folders: `path`; for files: `parent.path || '/' || name`).
|
||||
|
||||
Reference in New Issue
Block a user