fix(resources): wire missing created_by and updated_by

This commit is contained in:
Edouard Vanbelle
2026-07-20 19:52:51 +02:00
parent 4873a5e837
commit 931e27d09c
21 changed files with 140 additions and 47 deletions
+5
View File
@@ -127,6 +127,11 @@ pub struct FavoriteResourceRow {
/// folder rows. Routes into `FileDto::content_hash` and feeds
/// `File::compute_etag` to populate `FileDto::etag`.
pub blob_hash: Option<String>,
/// §14 provenance — who created the row. `None` when the creator
/// was deleted (FK `ON DELETE SET NULL`).
pub created_by: Option<Uuid>,
/// §14 provenance — who last touched the row.
pub updated_by: Option<Uuid>,
/// `true` when `owner_id == requesting user_id`.
pub is_owner: bool,
pub favorited_at: DateTime<Utc>,
+7
View File
@@ -219,6 +219,13 @@ pub struct FolderResourceRow {
/// on the REST `/api/folders/{id}/resources` listing so API
/// consumers can issue conditional requests against listed files.
pub blob_hash: Option<String>,
/// §14 provenance — who created the row. `None` when the creator was
/// deleted (FK `ON DELETE SET NULL`). Populates
/// `FileDto::created_by` / `FolderDto::created_by` on the listing so
/// the UI can render the owner column without a follow-up query.
pub created_by: Option<Uuid>,
/// §14 provenance — who last touched the row.
pub updated_by: Option<Uuid>,
// Pre-computed sort fields — returned by the SQL for cursor construction.
/// `LOWER(name)` used by `name`/`type` sorts.
pub sort_str: String,
+10
View File
@@ -112,6 +112,16 @@ pub struct RecentResourceRow {
/// folder rows. Feeds `File::compute_etag` so this listing's
/// `etag` matches GET/HEAD/PROPFIND for the same file.
pub blob_hash: Option<String>,
/// §14 provenance — who created the row. `None` when the creator
/// was deleted (FK `ON DELETE SET NULL`). Powers the owner column
/// on the `/recent` UI (aligned with `/files` and `/favorites`
/// for cross-surface consistency, rather than the finer-grained
/// but noisier "who touched this last" signal).
pub created_by: Option<Uuid>,
/// §14 provenance — who last touched the row. Not currently
/// consumed by the UI but surfaced for API parity with the other
/// listing endpoints.
pub updated_by: Option<Uuid>,
/// `true` when `owner_id == requesting user_id`.
pub is_owner: bool,
pub accessed_at: DateTime<Utc>,
+6
View File
@@ -71,6 +71,12 @@ pub struct TrashResourceRow {
/// same file (restorable trash items are conditional-request
/// targets too).
pub blob_hash: Option<String>,
/// §14 provenance — who created the row. `None` when the creator
/// was deleted (FK `ON DELETE SET NULL`).
pub created_by: Option<Uuid>,
/// §14 provenance — who last touched the row (includes the trash
/// action itself, which stamps `updated_by = caller_id`).
pub updated_by: Option<Uuid>,
pub trashed_at: DateTime<Utc>,
pub deletion_date: DateTime<Utc>,
/// Original location path (for folders: `path`; for files: `parent.path || '/' || name`).
+4 -6
View File
@@ -888,9 +888,8 @@ fn row_to_item_dto(row: TrashResourceRow) -> TrashResourceItemDto {
icon_class: intern_display("fas fa-folder"),
icon_special_class: intern_display("folder-icon"),
category: intern_display("Folder"),
// §14 provenance not selected by the trash listing query.
created_by: None,
updated_by: None,
created_by: row.created_by,
updated_by: row.updated_by,
};
TrashResourceItemDto {
resource_type: ResourceTypeDto::Folder,
@@ -932,9 +931,8 @@ fn row_to_item_dto(row: TrashResourceRow) -> TrashResourceItemDto {
sort_date: None,
content_hash,
etag,
// §14 provenance not selected by the trash listing query.
created_by: None,
updated_by: None,
created_by: row.created_by,
updated_by: row.updated_by,
};
TrashResourceItemDto {
resource_type: ResourceTypeDto::File,