feat: Add thumbnail management for albums and people, implement face embedding functionality
This commit is contained in:
@@ -215,4 +215,34 @@ impl PersonService for PersonServiceImpl {
|
||||
|
||||
self.person_repo.delete(source_person_id).await
|
||||
}
|
||||
|
||||
async fn set_person_thumbnail(
|
||||
&self,
|
||||
person_id: Uuid,
|
||||
face_region_id: Uuid,
|
||||
user_id: Uuid,
|
||||
) -> CoreResult<()> {
|
||||
self.auth_service
|
||||
.check_permission(Some(user_id), authz::Permission::EditPerson(person_id))
|
||||
.await?;
|
||||
|
||||
let face_region =
|
||||
self.face_repo
|
||||
.find_by_id(face_region_id)
|
||||
.await?
|
||||
.ok_or(CoreError::NotFound(
|
||||
"FaceRegion".to_string(),
|
||||
face_region_id,
|
||||
))?;
|
||||
|
||||
if face_region.person_id != Some(person_id) {
|
||||
return Err(CoreError::Validation(
|
||||
"FaceRegion does not belong to the specified person".to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
self.person_repo
|
||||
.set_thumbnail_media_id(person_id, face_region.media_id)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user