feat(fileDto, folderDto): add is_favorite + is_shared
- provide is_shared and is_favorite information in DTO, information propagated as badge/buttons per items
regarding performances I try to be minimalis on SQL to prevent any perf regression
- remove old set of sharedids and favoriteids (was not functionnal anymore)
- fix date picker (no past selection) in grant
- fix contextmenu close on /files section
This commit is contained in:
@@ -50,6 +50,26 @@ impl FavoritesService {
|
||||
) -> Result<HashSet<String>> {
|
||||
self.repo.batch_check_favorites(user_id, items).await
|
||||
}
|
||||
|
||||
/// Shared enrichment helper — computes `is_favorite` + `is_shared`
|
||||
/// for a single resource so single-item handlers (get / rename /
|
||||
/// move / upload / delta upload / photos / bulk get by ids) can
|
||||
/// populate the two wire-contract flags on FileDto / FolderDto
|
||||
/// before Json emission. Delegates straight to the repository
|
||||
/// port; kept on `FavoritesService` because the port already
|
||||
/// lives on that service and callers already hold it in DI.
|
||||
///
|
||||
/// `resource_type` MUST be `"file"` or `"folder"`.
|
||||
pub async fn caller_flags(
|
||||
&self,
|
||||
caller_id: Uuid,
|
||||
resource_type: &str,
|
||||
resource_id: Uuid,
|
||||
) -> Result<(bool, bool)> {
|
||||
self.repo
|
||||
.caller_flags(caller_id, resource_type, resource_id)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
impl FavoritesUseCase for FavoritesService {
|
||||
|
||||
Reference in New Issue
Block a user