feat: wire remaining handlers — tag, quota, register asset, sidecar, processing
14 new endpoints: POST tags, GET quota, POST register, 6 sidecar, 7 processing. DTOs, AppState groups, LogSidecarWriter, full bootstrap wiring.
This commit is contained in:
@@ -4,9 +4,16 @@ use crate::{
|
||||
extractors::{JwtClaims, UploadedAsset},
|
||||
state::AppState,
|
||||
};
|
||||
use api_types::responses::{AssetResponse, IngestResponse, TimelineResponse};
|
||||
use api_types::{
|
||||
requests::{RegisterAssetRequest, TagAssetRequest},
|
||||
responses::{AssetResponse, IngestResponse, TagResponse, TimelineResponse},
|
||||
};
|
||||
use application::{
|
||||
catalog::{GetAssetQuery, GetTimelineQuery, ReadAssetFileQuery, UpdateMetadataCommand},
|
||||
catalog::{
|
||||
GetAssetQuery, GetTimelineQuery, ReadAssetFileQuery, RegisterAssetCommand,
|
||||
UpdateMetadataCommand,
|
||||
},
|
||||
organization::TagAssetCommand,
|
||||
storage::IngestAssetCommand,
|
||||
};
|
||||
use axum::{
|
||||
@@ -16,7 +23,11 @@ use axum::{
|
||||
http::{StatusCode, header},
|
||||
response::Response,
|
||||
};
|
||||
use domain::value_objects::{MetadataValue, StructuredData, SystemId};
|
||||
use domain::{
|
||||
catalog::entities::AssetType,
|
||||
errors::DomainError,
|
||||
value_objects::{MetadataValue, StructuredData, SystemId},
|
||||
};
|
||||
|
||||
#[derive(Debug, serde::Deserialize)]
|
||||
pub struct TimelineParams {
|
||||
@@ -124,3 +135,51 @@ pub async fn serve_file(
|
||||
.body(Body::from(result.data))
|
||||
.map_err(|e| AppError::from(domain::errors::DomainError::Internal(e.to_string())))
|
||||
}
|
||||
|
||||
pub async fn tag_asset(
|
||||
State(state): State<AppState>,
|
||||
claims: JwtClaims,
|
||||
Path((asset_id,)): Path<(uuid::Uuid,)>,
|
||||
Json(req): Json<TagAssetRequest>,
|
||||
) -> Result<(StatusCode, Json<TagResponse>), AppError> {
|
||||
let cmd = TagAssetCommand {
|
||||
asset_id: SystemId::from_uuid(asset_id),
|
||||
tag_name: req.tag_name,
|
||||
user_id: claims.user_id,
|
||||
};
|
||||
let (tag, _asset_tag) = state.organization.tag_asset.execute(cmd).await?;
|
||||
Ok((StatusCode::CREATED, Json(TagResponse::from_domain(&tag))))
|
||||
}
|
||||
|
||||
fn parse_asset_type(s: &str) -> Result<AssetType, AppError> {
|
||||
match s {
|
||||
"image" => Ok(AssetType::Image),
|
||||
"video" => Ok(AssetType::Video),
|
||||
"live_photo" => Ok(AssetType::LivePhoto),
|
||||
_ => Err(AppError::from(DomainError::Validation(format!(
|
||||
"Invalid asset type: {s}"
|
||||
)))),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn register_asset(
|
||||
State(state): State<AppState>,
|
||||
claims: JwtClaims,
|
||||
Json(req): Json<RegisterAssetRequest>,
|
||||
) -> Result<(StatusCode, Json<AssetResponse>), AppError> {
|
||||
let asset_type = parse_asset_type(&req.asset_type)?;
|
||||
let cmd = RegisterAssetCommand {
|
||||
volume_id: SystemId::from_uuid(req.volume_id),
|
||||
relative_path: req.relative_path,
|
||||
checksum: req.checksum,
|
||||
asset_type,
|
||||
mime_type: req.mime_type,
|
||||
file_size: req.file_size,
|
||||
owner_id: claims.user_id,
|
||||
};
|
||||
let (asset, _dup_group) = state.catalog.register_asset.execute(cmd).await?;
|
||||
Ok((
|
||||
StatusCode::CREATED,
|
||||
Json(AssetResponse::from_domain(&asset, &StructuredData::new())),
|
||||
))
|
||||
}
|
||||
|
||||
@@ -2,5 +2,7 @@ pub mod albums;
|
||||
pub mod assets;
|
||||
pub mod auth;
|
||||
pub mod health;
|
||||
pub mod processing;
|
||||
pub mod sharing;
|
||||
pub mod sidecar;
|
||||
pub mod storage;
|
||||
|
||||
197
crates/presentation/src/handlers/processing.rs
Normal file
197
crates/presentation/src/handlers/processing.rs
Normal file
@@ -0,0 +1,197 @@
|
||||
use crate::{errors::AppError, extractors::JwtClaims, state::AppState};
|
||||
use api_types::{
|
||||
requests::{
|
||||
CompleteJobRequest, ConfigurePipelineRequest, EnqueueJobRequest, FailJobRequest,
|
||||
ManagePluginRequest,
|
||||
},
|
||||
responses::{BatchProgressResponse, JobResponse, PipelineResponse, PluginResponse},
|
||||
};
|
||||
use application::processing::{
|
||||
CompleteJobCommand, ConfigurePipelineCommand, EnqueueJobCommand, FailJobCommand,
|
||||
ManagePluginCommand, PipelineStepConfig, PluginAction, ReportBatchProgressQuery,
|
||||
StartJobCommand,
|
||||
};
|
||||
use axum::{
|
||||
Json,
|
||||
extract::{Path, State},
|
||||
http::StatusCode,
|
||||
};
|
||||
use domain::{
|
||||
entities::{JobType, PluginType},
|
||||
errors::DomainError,
|
||||
value_objects::{MetadataValue, StructuredData, SystemId},
|
||||
};
|
||||
|
||||
fn parse_job_type(s: &str) -> JobType {
|
||||
match s {
|
||||
"scan_directory" => JobType::ScanDirectory,
|
||||
"extract_metadata" => JobType::ExtractMetadata,
|
||||
"generate_derivative" => JobType::GenerateDerivative,
|
||||
"sync_sidecar" => JobType::SyncSidecar,
|
||||
"detect_duplicates" => JobType::DetectDuplicates,
|
||||
other => JobType::Custom(other.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_plugin_type(s: &str) -> Result<PluginType, AppError> {
|
||||
match s {
|
||||
"media_processor" => Ok(PluginType::MediaProcessor),
|
||||
"scheduled_task" => Ok(PluginType::ScheduledTask),
|
||||
"sidecar_writer" => Ok(PluginType::SidecarWriter),
|
||||
_ => Err(AppError::from(DomainError::Validation(format!(
|
||||
"Invalid plugin type: {s}"
|
||||
)))),
|
||||
}
|
||||
}
|
||||
|
||||
fn hashmap_to_structured(
|
||||
map: &std::collections::HashMap<String, serde_json::Value>,
|
||||
) -> StructuredData {
|
||||
let mut sd = StructuredData::new();
|
||||
for (k, v) in map {
|
||||
sd.insert(k.clone(), MetadataValue::from(v.clone()));
|
||||
}
|
||||
sd
|
||||
}
|
||||
|
||||
pub async fn enqueue_job(
|
||||
State(state): State<AppState>,
|
||||
_claims: JwtClaims,
|
||||
Json(req): Json<EnqueueJobRequest>,
|
||||
) -> Result<(StatusCode, Json<JobResponse>), AppError> {
|
||||
let payload = req
|
||||
.payload
|
||||
.as_ref()
|
||||
.map(hashmap_to_structured)
|
||||
.unwrap_or_default();
|
||||
|
||||
let cmd = EnqueueJobCommand {
|
||||
job_type: parse_job_type(&req.job_type),
|
||||
priority: req.priority.unwrap_or(0),
|
||||
payload,
|
||||
target_asset_id: req.target_asset_id.map(SystemId::from_uuid),
|
||||
batch_id: req.batch_id.map(SystemId::from_uuid),
|
||||
};
|
||||
let job = state.processing.enqueue_job.execute(cmd).await?;
|
||||
Ok((StatusCode::CREATED, Json(JobResponse::from_domain(&job))))
|
||||
}
|
||||
|
||||
pub async fn start_job(
|
||||
State(state): State<AppState>,
|
||||
_claims: JwtClaims,
|
||||
Path((job_id,)): Path<(uuid::Uuid,)>,
|
||||
) -> Result<Json<JobResponse>, AppError> {
|
||||
let cmd = StartJobCommand {
|
||||
job_id: SystemId::from_uuid(job_id),
|
||||
};
|
||||
let job = state.processing.start_job.execute(cmd).await?;
|
||||
Ok(Json(JobResponse::from_domain(&job)))
|
||||
}
|
||||
|
||||
pub async fn complete_job(
|
||||
State(state): State<AppState>,
|
||||
_claims: JwtClaims,
|
||||
Path((job_id,)): Path<(uuid::Uuid,)>,
|
||||
Json(req): Json<CompleteJobRequest>,
|
||||
) -> Result<Json<JobResponse>, AppError> {
|
||||
let cmd = CompleteJobCommand {
|
||||
job_id: SystemId::from_uuid(job_id),
|
||||
result: hashmap_to_structured(&req.result),
|
||||
};
|
||||
let job = state.processing.complete_job.execute(cmd).await?;
|
||||
Ok(Json(JobResponse::from_domain(&job)))
|
||||
}
|
||||
|
||||
pub async fn fail_job(
|
||||
State(state): State<AppState>,
|
||||
_claims: JwtClaims,
|
||||
Path((job_id,)): Path<(uuid::Uuid,)>,
|
||||
Json(req): Json<FailJobRequest>,
|
||||
) -> Result<Json<JobResponse>, AppError> {
|
||||
let cmd = FailJobCommand {
|
||||
job_id: SystemId::from_uuid(job_id),
|
||||
error: req.error,
|
||||
};
|
||||
let job = state.processing.fail_job.execute(cmd).await?;
|
||||
Ok(Json(JobResponse::from_domain(&job)))
|
||||
}
|
||||
|
||||
pub async fn batch_progress(
|
||||
State(state): State<AppState>,
|
||||
_claims: JwtClaims,
|
||||
Path((batch_id,)): Path<(uuid::Uuid,)>,
|
||||
) -> Result<Json<BatchProgressResponse>, AppError> {
|
||||
let query = ReportBatchProgressQuery {
|
||||
batch_id: SystemId::from_uuid(batch_id),
|
||||
};
|
||||
let progress = state.processing.batch_progress.execute(query).await?;
|
||||
Ok(Json(BatchProgressResponse::from_domain(&progress)))
|
||||
}
|
||||
|
||||
pub async fn manage_plugin(
|
||||
State(state): State<AppState>,
|
||||
_claims: JwtClaims,
|
||||
Json(req): Json<ManagePluginRequest>,
|
||||
) -> Result<(StatusCode, Json<PluginResponse>), AppError> {
|
||||
let action = match req.action.as_str() {
|
||||
"create" => {
|
||||
let name = req.name.ok_or_else(|| {
|
||||
AppError::from(DomainError::Validation("name required for create".into()))
|
||||
})?;
|
||||
let pt = req.plugin_type.as_deref().unwrap_or("media_processor");
|
||||
let plugin_type = parse_plugin_type(pt)?;
|
||||
let config = req
|
||||
.config
|
||||
.as_ref()
|
||||
.map(hashmap_to_structured)
|
||||
.unwrap_or_default();
|
||||
PluginAction::Create {
|
||||
name,
|
||||
plugin_type,
|
||||
config,
|
||||
}
|
||||
}
|
||||
"enable" => PluginAction::Enable,
|
||||
"disable" => PluginAction::Disable,
|
||||
other => {
|
||||
return Err(AppError::from(DomainError::Validation(format!(
|
||||
"Invalid plugin action: {other}. Use create, enable, or disable"
|
||||
))));
|
||||
}
|
||||
};
|
||||
|
||||
let cmd = ManagePluginCommand {
|
||||
plugin_id: req.plugin_id.map(SystemId::from_uuid),
|
||||
action,
|
||||
};
|
||||
let plugin = state.processing.manage_plugin.execute(cmd).await?;
|
||||
Ok((
|
||||
StatusCode::CREATED,
|
||||
Json(PluginResponse::from_domain(&plugin)),
|
||||
))
|
||||
}
|
||||
|
||||
pub async fn configure_pipeline(
|
||||
State(state): State<AppState>,
|
||||
_claims: JwtClaims,
|
||||
Json(req): Json<ConfigurePipelineRequest>,
|
||||
) -> Result<(StatusCode, Json<PipelineResponse>), AppError> {
|
||||
let steps = req
|
||||
.steps
|
||||
.iter()
|
||||
.map(|s| PipelineStepConfig {
|
||||
plugin_id: SystemId::from_uuid(s.plugin_id),
|
||||
config: hashmap_to_structured(&s.config),
|
||||
})
|
||||
.collect();
|
||||
|
||||
let cmd = ConfigurePipelineCommand {
|
||||
trigger_event: req.trigger_event,
|
||||
steps,
|
||||
};
|
||||
let pipeline = state.processing.configure_pipeline.execute(cmd).await?;
|
||||
Ok((
|
||||
StatusCode::CREATED,
|
||||
Json(PipelineResponse::from_domain(&pipeline)),
|
||||
))
|
||||
}
|
||||
103
crates/presentation/src/handlers/sidecar.rs
Normal file
103
crates/presentation/src/handlers/sidecar.rs
Normal file
@@ -0,0 +1,103 @@
|
||||
use crate::{errors::AppError, extractors::JwtClaims, state::AppState};
|
||||
use api_types::responses::{DetectChangesResponse, SidecarExportResponse, SidecarImportResponse};
|
||||
use application::sidecar::{
|
||||
DetectExternalChangesCommand, ExportSidecarCommand, FullExportCommand, FullImportCommand,
|
||||
ImportSidecarCommand, ResolveConflictCommand,
|
||||
};
|
||||
use axum::{
|
||||
Json,
|
||||
extract::{Path, State},
|
||||
};
|
||||
use domain::{entities::ConflictPolicy, errors::DomainError, value_objects::SystemId};
|
||||
|
||||
fn parse_conflict_policy(s: &str) -> Result<ConflictPolicy, AppError> {
|
||||
match s {
|
||||
"db_wins" => Ok(ConflictPolicy::DbWins),
|
||||
"file_wins" => Ok(ConflictPolicy::FileWins),
|
||||
_ => Err(AppError::from(DomainError::Validation(format!(
|
||||
"Invalid conflict policy: {s}. Use db_wins or file_wins"
|
||||
)))),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn export_sidecar(
|
||||
State(state): State<AppState>,
|
||||
_claims: JwtClaims,
|
||||
Path((asset_id,)): Path<(uuid::Uuid,)>,
|
||||
) -> Result<Json<SidecarExportResponse>, AppError> {
|
||||
let cmd = ExportSidecarCommand {
|
||||
asset_id: SystemId::from_uuid(asset_id),
|
||||
};
|
||||
let record = state.sidecar.export.execute(cmd).await?;
|
||||
Ok(Json(SidecarExportResponse::from_domain(&record)))
|
||||
}
|
||||
|
||||
pub async fn detect_changes(
|
||||
State(state): State<AppState>,
|
||||
_claims: JwtClaims,
|
||||
) -> Result<Json<DetectChangesResponse>, AppError> {
|
||||
let count = state
|
||||
.sidecar
|
||||
.detect_changes
|
||||
.execute(DetectExternalChangesCommand)
|
||||
.await?;
|
||||
Ok(Json(DetectChangesResponse {
|
||||
changed_count: count,
|
||||
}))
|
||||
}
|
||||
|
||||
pub async fn import_sidecar(
|
||||
State(state): State<AppState>,
|
||||
_claims: JwtClaims,
|
||||
Path((asset_id,)): Path<(uuid::Uuid,)>,
|
||||
) -> Result<Json<SidecarImportResponse>, AppError> {
|
||||
let cmd = ImportSidecarCommand {
|
||||
asset_id: SystemId::from_uuid(asset_id),
|
||||
};
|
||||
let metadata = state.sidecar.import.execute(cmd).await?;
|
||||
Ok(Json(SidecarImportResponse {
|
||||
asset_id: *metadata.asset_id.as_uuid(),
|
||||
status: "imported".to_string(),
|
||||
}))
|
||||
}
|
||||
|
||||
pub async fn resolve_conflict(
|
||||
State(state): State<AppState>,
|
||||
_claims: JwtClaims,
|
||||
Path((asset_id,)): Path<(uuid::Uuid,)>,
|
||||
Json(req): Json<api_types::requests::ResolveConflictRequest>,
|
||||
) -> Result<Json<SidecarExportResponse>, AppError> {
|
||||
let policy = parse_conflict_policy(&req.policy)?;
|
||||
let cmd = ResolveConflictCommand {
|
||||
asset_id: SystemId::from_uuid(asset_id),
|
||||
policy,
|
||||
};
|
||||
let record = state.sidecar.resolve.execute(cmd).await?;
|
||||
Ok(Json(SidecarExportResponse::from_domain(&record)))
|
||||
}
|
||||
|
||||
pub async fn full_export(
|
||||
State(state): State<AppState>,
|
||||
claims: JwtClaims,
|
||||
) -> Result<Json<DetectChangesResponse>, AppError> {
|
||||
let cmd = FullExportCommand {
|
||||
owner_id: claims.user_id,
|
||||
};
|
||||
let count = state.sidecar.full_export.execute(cmd).await?;
|
||||
Ok(Json(DetectChangesResponse {
|
||||
changed_count: count,
|
||||
}))
|
||||
}
|
||||
|
||||
pub async fn full_import(
|
||||
State(state): State<AppState>,
|
||||
claims: JwtClaims,
|
||||
) -> Result<Json<DetectChangesResponse>, AppError> {
|
||||
let cmd = FullImportCommand {
|
||||
owner_id: claims.user_id,
|
||||
};
|
||||
let count = state.sidecar.full_import.execute(cmd).await?;
|
||||
Ok(Json(DetectChangesResponse {
|
||||
changed_count: count,
|
||||
}))
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
use crate::{errors::AppError, extractors::JwtClaims, state::AppState};
|
||||
use api_types::{
|
||||
requests::{RegisterLibraryPathRequest, RegisterVolumeRequest},
|
||||
responses::{LibraryPathResponse, VolumeResponse},
|
||||
requests::{CheckQuotaParams, RegisterLibraryPathRequest, RegisterVolumeRequest},
|
||||
responses::{LibraryPathResponse, QuotaCheckResponse, VolumeResponse},
|
||||
};
|
||||
use application::storage::{RegisterLibraryPathCommand, RegisterVolumeCommand};
|
||||
use axum::{Json, extract::State, http::StatusCode};
|
||||
use domain::value_objects::SystemId;
|
||||
use application::storage::{CheckQuotaQuery, RegisterLibraryPathCommand, RegisterVolumeCommand};
|
||||
use axum::{
|
||||
Json,
|
||||
extract::{Query, State},
|
||||
http::StatusCode,
|
||||
};
|
||||
use domain::{entities::UsageType, errors::DomainError, value_objects::SystemId};
|
||||
|
||||
pub async fn register_volume(
|
||||
State(state): State<AppState>,
|
||||
@@ -41,3 +45,38 @@ pub async fn register_library_path(
|
||||
Json(LibraryPathResponse::from_domain(&path)),
|
||||
))
|
||||
}
|
||||
|
||||
const DEFAULT_QUOTA_USAGE_TYPE: &str = "storage_bytes";
|
||||
const DEFAULT_QUOTA_AMOUNT: u64 = 0;
|
||||
|
||||
fn parse_usage_type(s: &str) -> Result<UsageType, AppError> {
|
||||
match s {
|
||||
"storage_bytes" => Ok(UsageType::StorageBytes),
|
||||
"process_jobs" => Ok(UsageType::ProcessJobs),
|
||||
"api_calls" => Ok(UsageType::ApiCalls),
|
||||
"indexing_size" => Ok(UsageType::IndexingSize),
|
||||
_ => Err(AppError::from(DomainError::Validation(format!(
|
||||
"Invalid usage type: {s}"
|
||||
)))),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn check_quota(
|
||||
State(state): State<AppState>,
|
||||
claims: JwtClaims,
|
||||
Query(params): Query<CheckQuotaParams>,
|
||||
) -> Result<Json<QuotaCheckResponse>, AppError> {
|
||||
let usage_type = parse_usage_type(
|
||||
params
|
||||
.usage_type
|
||||
.as_deref()
|
||||
.unwrap_or(DEFAULT_QUOTA_USAGE_TYPE),
|
||||
)?;
|
||||
let query = CheckQuotaQuery {
|
||||
user_id: claims.user_id,
|
||||
usage_type,
|
||||
requested_amount: params.amount.unwrap_or(DEFAULT_QUOTA_AMOUNT),
|
||||
};
|
||||
let result = state.storage.check_quota.execute(query).await?;
|
||||
Ok(Json(QuotaCheckResponse::from_domain(&result)))
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
handlers::{albums, assets, auth, health, sharing, storage},
|
||||
handlers::{albums, assets, auth, health, processing, sharing, sidecar, storage},
|
||||
openapi::openapi_router,
|
||||
state::AppState,
|
||||
};
|
||||
@@ -24,10 +24,12 @@ pub fn api_v1_router() -> Router<AppState> {
|
||||
)
|
||||
// assets
|
||||
.route("/assets/ingest", post(assets::ingest))
|
||||
.route("/assets/register", post(assets::register_asset))
|
||||
.route("/assets/timeline", get(assets::timeline))
|
||||
.route("/assets/{id}", get(assets::get_asset))
|
||||
.route("/assets/{id}/metadata", put(assets::update_metadata))
|
||||
.route("/assets/{id}/file", get(assets::serve_file))
|
||||
.route("/assets/{id}/tags", post(assets::tag_asset))
|
||||
// sharing
|
||||
.route("/sharing", post(sharing::share_resource))
|
||||
.route("/sharing/links", post(sharing::generate_link))
|
||||
@@ -39,6 +41,25 @@ pub fn api_v1_router() -> Router<AppState> {
|
||||
"/storage/library-paths",
|
||||
post(storage::register_library_path),
|
||||
)
|
||||
.route("/storage/quota", get(storage::check_quota))
|
||||
// sidecar
|
||||
.route("/sidecar/export/{asset_id}", post(sidecar::export_sidecar))
|
||||
.route("/sidecar/detect-changes", post(sidecar::detect_changes))
|
||||
.route("/sidecar/import/{asset_id}", post(sidecar::import_sidecar))
|
||||
.route(
|
||||
"/sidecar/resolve/{asset_id}",
|
||||
post(sidecar::resolve_conflict),
|
||||
)
|
||||
.route("/sidecar/full-export", post(sidecar::full_export))
|
||||
.route("/sidecar/full-import", post(sidecar::full_import))
|
||||
// processing
|
||||
.route("/jobs", post(processing::enqueue_job))
|
||||
.route("/jobs/{id}/start", post(processing::start_job))
|
||||
.route("/jobs/{id}/complete", post(processing::complete_job))
|
||||
.route("/jobs/{id}/fail", post(processing::fail_job))
|
||||
.route("/jobs/batches/{id}", get(processing::batch_progress))
|
||||
.route("/plugins", post(processing::manage_plugin))
|
||||
.route("/pipelines", post(processing::configure_pipeline))
|
||||
}
|
||||
|
||||
pub fn app_router() -> Router<AppState> {
|
||||
|
||||
@@ -1,14 +1,29 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use application::{
|
||||
catalog::{GetAssetHandler, GetTimelineHandler, ReadAssetFileHandler, UpdateMetadataHandler},
|
||||
catalog::{
|
||||
GetAssetHandler, GetTimelineHandler, ReadAssetFileHandler, RegisterAssetHandler,
|
||||
UpdateMetadataHandler,
|
||||
},
|
||||
identity::{GetProfileHandler, LoginUserHandler, RegisterUserHandler},
|
||||
organization::{CreateAlbumHandler, GetAlbumHandler, ManageAlbumEntriesHandler},
|
||||
organization::{
|
||||
CreateAlbumHandler, GetAlbumHandler, ManageAlbumEntriesHandler, TagAssetHandler,
|
||||
},
|
||||
processing::{
|
||||
CompleteJobHandler, ConfigurePipelineHandler, EnqueueJobHandler, FailJobHandler,
|
||||
ManagePluginHandler, ReportBatchProgressHandler, StartJobHandler,
|
||||
},
|
||||
sharing::{
|
||||
AccessSharedResourceHandler, GenerateShareLinkHandler, RevokeShareHandler,
|
||||
ShareResourceHandler,
|
||||
},
|
||||
storage::{IngestAssetHandler, RegisterLibraryPathHandler, RegisterVolumeHandler},
|
||||
sidecar::{
|
||||
DetectExternalChangesHandler, ExportSidecarHandler, FullExportHandler, FullImportHandler,
|
||||
ImportSidecarHandler, ResolveConflictHandler,
|
||||
},
|
||||
storage::{
|
||||
CheckQuotaHandler, IngestAssetHandler, RegisterLibraryPathHandler, RegisterVolumeHandler,
|
||||
},
|
||||
};
|
||||
use domain::ports::TokenIssuer;
|
||||
|
||||
@@ -26,6 +41,7 @@ pub struct CatalogHandlers {
|
||||
pub get_timeline: Arc<GetTimelineHandler>,
|
||||
pub update_metadata: Arc<UpdateMetadataHandler>,
|
||||
pub read_asset_file: Arc<ReadAssetFileHandler>,
|
||||
pub register_asset: Arc<RegisterAssetHandler>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -33,12 +49,14 @@ pub struct OrganizationHandlers {
|
||||
pub create_album: Arc<CreateAlbumHandler>,
|
||||
pub get_album: Arc<GetAlbumHandler>,
|
||||
pub manage_album_entries: Arc<ManageAlbumEntriesHandler>,
|
||||
pub tag_asset: Arc<TagAssetHandler>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct StorageHandlers {
|
||||
pub register_volume: Arc<RegisterVolumeHandler>,
|
||||
pub register_library_path: Arc<RegisterLibraryPathHandler>,
|
||||
pub check_quota: Arc<CheckQuotaHandler>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -49,6 +67,27 @@ pub struct SharingHandlers {
|
||||
pub access: Arc<AccessSharedResourceHandler>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SidecarHandlers {
|
||||
pub export: Arc<ExportSidecarHandler>,
|
||||
pub detect_changes: Arc<DetectExternalChangesHandler>,
|
||||
pub import: Arc<ImportSidecarHandler>,
|
||||
pub resolve: Arc<ResolveConflictHandler>,
|
||||
pub full_export: Arc<FullExportHandler>,
|
||||
pub full_import: Arc<FullImportHandler>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ProcessingHandlers {
|
||||
pub enqueue_job: Arc<EnqueueJobHandler>,
|
||||
pub start_job: Arc<StartJobHandler>,
|
||||
pub complete_job: Arc<CompleteJobHandler>,
|
||||
pub fail_job: Arc<FailJobHandler>,
|
||||
pub batch_progress: Arc<ReportBatchProgressHandler>,
|
||||
pub manage_plugin: Arc<ManagePluginHandler>,
|
||||
pub configure_pipeline: Arc<ConfigurePipelineHandler>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct AppState {
|
||||
pub identity: IdentityHandlers,
|
||||
@@ -56,5 +95,7 @@ pub struct AppState {
|
||||
pub organization: OrganizationHandlers,
|
||||
pub storage: StorageHandlers,
|
||||
pub sharing: SharingHandlers,
|
||||
pub sidecar: SidecarHandlers,
|
||||
pub processing: ProcessingHandlers,
|
||||
pub token_issuer: Arc<dyn TokenIssuer>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user