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

feat: search album by name #13434

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

feat: search album by name #13434

wants to merge 6 commits into from

Conversation

martabal
Copy link
Member

This new searchAlbum endpoint behaves like the searchPerson endpoint. It returns a list of albums based on the beginning of the album name you are searching for. Currently, album search based on name is done on the client side, which is not ideal when you have hundreds or thousands of albums.

@martabal martabal force-pushed the feat/search-album-by-name branch 4 times, most recently from 296f79e to 843eb4f Compare October 14, 2024 14:11
@@ -302,4 +302,47 @@ export class AlbumRepository implements IAlbumRepository {

return result.affected;
}

@GenerateSql({ params: [DummyValue.UUID, DummyValue.STRING, undefined] })
getByName(userId: string, albumName: string, shared?: boolean): Promise<AlbumEntity[]> {
Copy link
Member

Choose a reason for hiding this comment

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

This should be paginated, no? Only returning the first 1k results is optimistic 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

It would be nice but I don't think that really matters: the goal of this endpoint is not to get all albums.

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO we should try to have all of our endpoints behave in a similar manner. Search person vs search album vs search something else should all have the same method signatures.

Copy link
Member

@danieldietzler danieldietzler Oct 14, 2024

Choose a reason for hiding this comment

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

I strongly agree and there are people out there with >10k albums, for whom a search result may very well include >1k albums. I think it's bad just not supporting that.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's bad just not supporting that.

I agree. But that's for a future PR 😝

Copy link
Member

Choose a reason for hiding this comment

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

I agree. But that's for a future PR 😝

Why? :P

Copy link
Member Author

Choose a reason for hiding this comment

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

Why? :P

Because I agree with @jrasm91 too. Do we want the same method signatures or not ?

Copy link
Member

Choose a reason for hiding this comment

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

Hm that's fair.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well... I added pagination for both endpoints.

Copy link
Member

Choose a reason for hiding this comment

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

LOL. Thank you very much! :)

Copy link
Member

@danieldietzler danieldietzler left a comment

Choose a reason for hiding this comment

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

LGTM, it'd be awesome if you could add (at least) unit tests though. :)

@martabal martabal force-pushed the feat/search-album-by-name branch from 843eb4f to f391adf Compare October 14, 2024 18:22
@martabal martabal force-pushed the feat/search-album-by-name branch 4 times, most recently from 87fa15f to 1751e5f Compare October 14, 2024 19:11
@martabal martabal requested a review from bo0tzz as a code owner October 14, 2024 19:15
@martabal martabal force-pushed the feat/search-album-by-name branch 2 times, most recently from 1751e5f to 5889faa Compare October 14, 2024 19:15
@martabal martabal removed the request for review from bo0tzz October 14, 2024 19:16
@martabal
Copy link
Member Author

@danieldietzler So the API for searchPerson has changed but only the web uses that endpoint. Should we add a breaking change label ?

@danieldietzler
Copy link
Member

@danieldietzler So the API for searchPerson has changed but only the web uses that endpoint. Should we add a breaking change label ?

Yup, we probably should. It's great that we don't have mobile conflicts though

@martabal martabal marked this pull request as draft October 14, 2024 21:19
@martabal martabal marked this pull request as ready for review October 14, 2024 21:25
@martabal martabal force-pushed the feat/search-album-by-name branch 3 times, most recently from b9c5144 to c0a39fa Compare October 15, 2024 11:01
@martabal martabal force-pushed the feat/search-album-by-name branch from c0a39fa to 274de40 Compare October 16, 2024 21:33
@martabal martabal force-pushed the feat/search-album-by-name branch from b843db3 to db1915c Compare October 16, 2024 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants