Add read-only Synology Photos people filtering
This commit is contained in:
@@ -63,6 +63,11 @@ from pigway_frame_flow.providers.photo_sources import (
|
||||
PhotoSourceInput,
|
||||
PhotoSourceView,
|
||||
)
|
||||
from pigway_frame_flow.providers.synology_photos import (
|
||||
PhotosConnection,
|
||||
PhotosLogin,
|
||||
PhotosPerson,
|
||||
)
|
||||
from pigway_frame_flow.providers.weather import ConfigurableWeatherProvider
|
||||
from pigway_frame_flow.renderers.images import Assets, convert
|
||||
from pigway_frame_flow.renderers.templates import TemplateRenderer
|
||||
@@ -543,6 +548,46 @@ def create_app(settings=None, start_worker=True):
|
||||
def asset_file(asset_id: str):
|
||||
return FileResponse(assets.path(asset_id), media_type="image/jpeg")
|
||||
|
||||
@app.get(
|
||||
"/api/v1/integrations/synology-photos",
|
||||
response_model=PhotosConnection,
|
||||
tags=["Photo sources"],
|
||||
dependencies=[Depends(require("admin"))],
|
||||
)
|
||||
def photos_connection():
|
||||
return service.photo_sources.synology.status()
|
||||
|
||||
@app.post(
|
||||
"/api/v1/integrations/synology-photos",
|
||||
response_model=PhotosConnection,
|
||||
tags=["Photo sources"],
|
||||
dependencies=[Depends(require("admin"))],
|
||||
)
|
||||
def connect_photos(payload: PhotosLogin):
|
||||
result = service.photo_sources.synology.connect(payload)
|
||||
service.photo_sources.cache.clear()
|
||||
return result
|
||||
|
||||
@app.delete(
|
||||
"/api/v1/integrations/synology-photos",
|
||||
response_model=PhotosConnection,
|
||||
tags=["Photo sources"],
|
||||
dependencies=[Depends(require("admin"))],
|
||||
)
|
||||
def disconnect_photos():
|
||||
result = service.photo_sources.synology.disconnect()
|
||||
service.photo_sources.cache.clear()
|
||||
return result
|
||||
|
||||
@app.get(
|
||||
"/api/v1/integrations/synology-photos/people",
|
||||
response_model=list[PhotosPerson],
|
||||
tags=["Photo sources"],
|
||||
dependencies=[Depends(require("admin"))],
|
||||
)
|
||||
def photos_people():
|
||||
return service.photo_sources.synology.people()
|
||||
|
||||
@app.get(
|
||||
"/api/v1/photo-sources",
|
||||
response_model=list[PhotoSourceView],
|
||||
|
||||
Reference in New Issue
Block a user