-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
6838 add prefs repo layer #6885
base: develop
Are you sure you want to change the base?
Conversation
#[derive(PartialEq, Debug, Clone, Default)] | ||
pub struct Preference { | ||
pub preference_row: PreferenceRow, | ||
pub store_row: StoreRow, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're not useing this store row for anything, and it's not clear to me that you will need it.
I think probably safer to just remove it for now, and only add it in when it's required for something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here: 5bccdaa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noice! I'd do the little refactor that you mentioned that LachΓ© mentioned and fn delete
should update the changelog
} | ||
} | ||
|
||
pub type PreferenceJoin = (PreferenceRow, StoreRow); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I need to remove StoreRow here as well?
let result = final_query | ||
.load::<PreferenceJoin>(self.connection.lock().connection())? | ||
.into_iter() | ||
.map(|(preference_row, _store_row)| Preference { preference_row }) | ||
.collect(); | ||
|
||
Ok(result) | ||
} | ||
} | ||
|
||
type BoxedPreferenceQuery = IntoBoxed<'static, InnerJoin<preference::table, store::table>, DBType>; | ||
|
||
fn create_filtered_query(filter: Option<PreferenceFilter>) -> BoxedPreferenceQuery { | ||
let mut query = preference::table.inner_join(store::table).into_boxed(); | ||
|
||
if let Some(f) = filter { | ||
let PreferenceFilter { id } = f; | ||
|
||
apply_equal_filter!(query, id, preference::id); | ||
} | ||
query | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I need to remove StoreRow here as well? I thought we needed storeRow to access store_id?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
luks gud
} | ||
|
||
pub fn delete(&self, preference_id: &str) -> Result<Option<i64>, RepositoryError> { | ||
let old_row = self.find_one_by_id(preference_id)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey look it came in use! I knew it'd have something to do with sync π
Fixes #6838
π©π»βπ» What does this PR do?
Add preference to changelogtable and Add repo layer for preference table
π Any notes for the reviewer?
π§ͺ Testing
π Documentation
1.
2.
π Reviewer Checklist
The PR Reviewer(s) should fill out this section before approving the PR
Breaking Changes
Issue Review
Tests Pass