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

Make tRPC procedure for user and tournament searching #26

Closed
L-Mario564 opened this issue Mar 17, 2024 · 5 comments · Fixed by #39
Closed

Make tRPC procedure for user and tournament searching #26

L-Mario564 opened this issue Mar 17, 2024 · 5 comments · Fixed by #39
Assignees
Labels
depends on issue Another issue has to be addressed before doing this one trpc tRPC related issues

Comments

@L-Mario564
Copy link
Contributor

L-Mario564 commented Mar 17, 2024

Issue #23 and #37 has to be addressed before doing this issue.

Why?

Any user should be able to search for other users and any published tournaments.

How?

The input would be a string, and the procedure would return an array of users and an array of tournaments.

Searching for users

Each user must return: User.id, User.osuUserId, OsuUser.username. The user must be able to search users using the following fields:

Only if exact match ({field} = {search_str}):

  • User.id
  • User.osuUserId
  • User.discordUserId

Relative search ({field} ilike '%{search_str}%'):

  • OsuUser.username

Conditions:

  • Users must be ordered alphabetically by osu! username, ascending.
  • Banned users should not show up in the results.
  • 10 results limit.

Searching for tournaments

Each tournament must return: Tournament.url_slug, Tournament.name, Tournament.acronym, Tournament.logoMetadata, Tournament.bannerMetadata. The user must be able to search tournaments using the following fields:

Only if exact match ({field} = {search_str}):

  • Tournament.id

Relative search ({field} ilike '%{search_str}%'):

  • Tournament.name
  • Tournament.acronym
  • Tournament.url_slug

Conditions:

  • Tournaments must be ordered alphabetically by name, ascending.
  • Tournaments marked as deleted should not show up.
  • Tournaments that aren't public yet should not show up.
  • 10 results limit.

Other considerations

Apply database indexes if needed to improve query performance.

@L-Mario564 L-Mario564 added trpc tRPC related issues depends on issue Another issue has to be addressed before doing this one labels Mar 17, 2024
@ArtemOsuskyi ArtemOsuskyi self-assigned this Mar 18, 2024
@L-Mario564 L-Mario564 removed the depends on issue Another issue has to be addressed before doing this one label Mar 22, 2024
@ArtemOsuskyi
Copy link
Collaborator

Tournaments that aren't public yet should not show up.

It seems tournaments don't have any field to define if they're public or not. How should it be handled?

@L-Mario564
Copy link
Contributor Author

It seems tournaments don't have any field to define if they're public or not. How should it be handled?

The Tournament table has a dates field which is JSON. The structure for that JSON has it so it's an object that has a publish property which is supposed to store the timestamp (in milliseconds) in which the tournament will be public, meaning that if the publish date is in the past, then it means that the tournament has become public. I made a server util function for handling past and future dates within queries.

@L-Mario564
Copy link
Contributor Author

Might consider moving the publish and conclude dates into their own separate fields in the Tournament table, to make indexing those fields easier and also querying them easier.

@ArtemOsuskyi
Copy link
Collaborator

Yeah it sounds more logical to have them separated. Let's go with that

@L-Mario564
Copy link
Contributor Author

Alright, I'll create a separate issue for that then, and we'll solve that one first before this one.

@L-Mario564 L-Mario564 added the depends on issue Another issue has to be addressed before doing this one label Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
depends on issue Another issue has to be addressed before doing this one trpc tRPC related issues
Projects
Development

Successfully merging a pull request may close this issue.

2 participants