diff --git a/giterated-daemon/src/database_backend/handler.rs b/giterated-daemon/src/database_backend/handler.rs index b45cd0f..ac1f4c6 100644 --- a/giterated-daemon/src/database_backend/handler.rs +++ b/giterated-daemon/src/database_backend/handler.rs @@ -396,3 +396,11 @@ pub async fn instance_create_repository_request( .await .as_internal_error() } + +pub async fn repository_latest_commit( + _repository: Repository, + _state: DatabaseBackend, + _operation_state: StackOperationState, +) -> Result> { + Ok(LatestCommit(None)) +} diff --git a/giterated-daemon/src/database_backend/mod.rs b/giterated-daemon/src/database_backend/mod.rs index ed1d86b..cb10d7e 100644 --- a/giterated-daemon/src/database_backend/mod.rs +++ b/giterated-daemon/src/database_backend/mod.rs @@ -25,7 +25,7 @@ use self::handler::{ instance_registration_request, repository_commit_before, repository_commit_by_id, repository_diff, repository_diff_patch, repository_file_from_id, repository_file_from_path, repository_get_branches, repository_get_statistics, repository_info, - repository_last_commit_of_file, user_get_repositories, + repository_last_commit_of_file, repository_latest_commit, user_get_repositories, }; /// A backend implementation which attempts to resolve data from the instance's database. @@ -75,6 +75,8 @@ impl DatabaseBackend { .value_setting::() .value_setting::(); + builder.value(repository_latest_commit); + builder .operation(user_get_repositories) .operation(instance_registration_request) diff --git a/giterated-stack/src/substack.rs b/giterated-stack/src/substack.rs index df4bd91..6cfad65 100644 --- a/giterated-stack/src/substack.rs +++ b/giterated-stack/src/substack.rs @@ -7,7 +7,7 @@ use giterated_models::{ object::{GiteratedObject, ObjectRequest, ObjectResponse}, operation::GiteratedOperation, settings::Setting, - value::{GetValueTyped, GiteratedObjectValue}, + value::GiteratedObjectValue, }; use tracing::{info, trace}; @@ -219,17 +219,12 @@ impl SubstackBuilder { /// # Type Registration /// This will register the provided [`GiteratedObjectValue`] type for its matching / specified /// object type. It will **not** register the object type automatically. - pub fn value(&mut self, handler: F) -> &mut Self + pub fn value(&mut self, handler: F) -> &mut Self where O: GiteratedObject + 'static, V: GiteratedObjectValue + 'static + Clone, - F: IntoGiteratedHandler< - (O, GetValueTyped), - A, - S, - StackOperationState, - Result>, - > + Send + F: IntoGiteratedHandler<(O,), A, S, StackOperationState, Result>> + + Send + Sync, E: Into + 'static + std::fmt::Debug + Clone, F: 'static, @@ -238,16 +233,11 @@ impl SubstackBuilder { let wrapped = wrapped.map( |(any_object,): &(AnyObject,), _state: &StackOperationState| { - Ok(( - any_object - .0 - .downcast_ref::() - .ok_or_else(|| OperationError::Internal(DowncastError.into()))? - .clone(), - GetValueTyped { - ty: std::marker::PhantomData, - }, - )) + Ok((any_object + .0 + .downcast_ref::() + .ok_or_else(|| OperationError::Internal(DowncastError.into()))? + .clone(),)) }, );