Skip to content
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

Adding combined person content and person saved tables. #5251

Merged
merged 67 commits into from
Jan 5, 2025

Conversation

dessalines
Copy link
Member

Context #2444

Must come after #5231

Notes:

  • I've removed the content fetch from GetPersonDetails, into its own paged API action: ListPersonContent. Seemed strange to get a person's details, moderated communities, and then a paged content fetch.
  • I've removed the saved_only option from post and comment views, and created a dedicate API action (ListPersonSaved) to fetch combined saved content (posts and comments).
    • We've decided on removing duplicated individual type fetches where the combined routes are preferred, and there was a lot of unecessary complication with published order (IE when the item was saved, not when it was created), that I was able to remove.

dessalines and others added 30 commits November 26, 2024 09:27
* add pagination cursor

* store timestamp instead of id in cursor (partial)

* Revert "store timestamp instead of id in cursor (partial)"

This reverts commit 89359dd.

* use paginated query builder
- Separating the profile fetch from its combined content fetch.
- Starting to separate saved_only into its own combined view.
@@ -184,10 +184,6 @@ impl Saveable for CommentSaved {
comment_saved_form: &CommentSavedForm,
) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
let comment_saved_form = (
comment_saved_form,
comment_actions::saved.eq(now().nullable()),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to force this, now that I added a default Utc::now() in the derive_new.

Comment on lines +38 to +43
pub trait InternalToCombinedView {
type CombinedView;

/// Maps the combined DB row to an enum
fn map_to_enum(&self) -> Option<Self::CombinedView>;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made this into a trait.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor cleanup in this file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main changes are in these two files. Its not that important for anyone to read through them, as the joins to build these internal views complicated to read through.

The main thing is that I've added tests to try to catch every case and filter.

Comment on lines +324 to +328
.service(
scope("/person")
.route("", get().to(read_person))
.route("/content", get().to(list_person_content)),
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/person/content seemed like a good place for this new route.

@dessalines dessalines marked this pull request as ready for review December 19, 2024 23:41
@dessalines
Copy link
Member Author

@Nutomic @dullbananas and anyone else who can help review, this one needs to be merged before the other combineds.

@dessalines dessalines marked this pull request as draft January 3, 2025 19:11
@dessalines dessalines requested a review from dullbananas January 3, 2025 19:33
@dessalines dessalines marked this pull request as ready for review January 3, 2025 19:34
@dessalines dessalines merged commit 0bfbd74 into main Jan 5, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants