Register GetSetting as an operation
parent: tbd commit: 6a85805
Showing 2 changed files with 10 insertions and 2 deletions
giterated-daemon/src/backend/git.rs
@@ -179,6 +179,7 @@ impl GitBackend { | ||
179 | 179 | user: &User, |
180 | 180 | repository_name: &str, |
181 | 181 | ) -> Result<GitRepository, GitBackendError> { |
182 | // TODO: Patch for use with new GetValue system | |
182 | 183 | if let Ok(repository) = sqlx::query_as!(GitRepository, |
183 | 184 | r#"SELECT owner_user, name, description, visibility as "visibility: _", default_branch FROM repositories WHERE owner_user = $1 AND name = $2"#, |
184 | 185 | user.to_string(), repository_name) |
@@ -831,7 +832,10 @@ impl RepositoryBackend for GitBackend { | ||
831 | 832 | if let Some(search) = &request.search { |
832 | 833 | // TODO: Caching |
833 | 834 | // Search by sorting using a simple fuzzy search algorithm |
834 | filtered_branches.sort_by(|(n1, _, _, _), (n2, _, _, _)| strsim::damerau_levenshtein(search, n1).cmp(&strsim::damerau_levenshtein(search, n2))); | |
835 | filtered_branches.sort_by(|(n1, _, _, _), (n2, _, _, _)| { | |
836 | strsim::damerau_levenshtein(search, n1) | |
837 | .cmp(&strsim::damerau_levenshtein(search, n2)) | |
838 | }); | |
835 | 839 | } else { |
836 | 840 | // Sort the branches by commit date |
837 | 841 | filtered_branches.sort_by(|(_, _, _, c1), (_, _, _, c2)| c2.time.cmp(&c1.time)); |
giterated-stack/src/meta/mod.rs
@@ -4,7 +4,7 @@ use futures_util::{future::LocalBoxFuture, FutureExt}; | ||
4 | 4 | use giterated_models::{ |
5 | 5 | object::GiteratedObject, |
6 | 6 | operation::GiteratedOperation, |
7 | settings::{SetSetting, Setting}, | |
7 | settings::{GetSetting, SetSetting, Setting}, | |
8 | 8 | value::{GetValue, GetValueTyped, GiteratedObjectValue}, |
9 | 9 | }; |
10 | 10 | use serde_json::Value; |
@@ -119,6 +119,10 @@ impl RuntimeMetadata { | ||
119 | 119 | ObjectOperationPair::from_types::<O, SetSetting>(), |
120 | 120 | OperationMeta::new::<O, SetSetting>(), |
121 | 121 | ); |
122 | self.operations.insert( | |
123 | ObjectOperationPair::from_types::<O, GetSetting>(), | |
124 | OperationMeta::new::<O, GetSetting>(), | |
125 | ); | |
122 | 126 | } |
123 | 127 | |
124 | 128 | pub fn append(&mut self, other: Self) { |