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

Alex/implement admin league operation #489

Merged
merged 51 commits into from
Nov 21, 2024

Conversation

alexappleget
Copy link
Contributor

@alexappleget alexappleget commented Aug 30, 2024

Closes #480

Shashi requested that I only do these things:

  • Render the table
  • Get the specific data for this table and show it

Let me break down what I did and why.

  1. getAllLeagueEntries(); apiFunction:
    - in order to get the numbered data for the entries, I had to create an apiFunction to get this and return the length of entries.
    - I set the Query.limit to 5000 because appwrite only returns 25 by default (there was more than 25 to bring back).
    - the reason it is filtering is because I can't actually query 'league' in the database because it is considered a relationship. So, I had to filter and grab entry.league(the relationship) that is matched with the leagueId that I pass in.

  2. For the page.tsx the fetchData is what is needed to grab certain data to pass into the table to be rendered.
    - the first function gets the number of total entries and entries that aren't eliminated
    - the second function gets info from all leagues the user is a part of
    - the combinedData is there because I was getting data from 2 separate collections in the database. Then, I HAD to combine them into 1 to be able to pass into the table's data={}.

  3. The IEntryWithLeague props extends ILeague because it uses almost all props in ILeague
    - then I created 2 new props to let it know that I will be receiving them also into the table
    - then I am able to define the table column header as IEntryWithLeague because it uses all those props

  4. The cell: {row} grabs the props by their names, so it knows what data it is grabbing to display its value.
    - because of fetchData, the table columns works closely with the data props and knows what to display

  5. the accessorKey is the actual identity of the prop it is grabbing

  6. Some will have as number at the end, to handle type errors and let the table know that I am specifically rendering a number value.

  7. The reason for sortingFn for some columns and not all is because originally survivors and participants were a string[] and I grabbed the .length of them. So to accurately sort i had to add the sorting code in.

Recording.2024-10-17.174658.mp4

Copy link

appwrite bot commented Aug 30, 2024

Gridiron Survivor Application 6616ea581ef9f5521c7d

Function ID Status Action
Your function has been successfully deployed.

Project name: Gridiron Survivor Application
Project ID: 6616ea581ef9f5521c7d

Function ID Status Action
userAuth 6626fef885a9f630442b ready Ready View Logs

Only deployments on the production branch are activated automatically. If you'd like to activate this deployment, navigate to your deployments. Learn more about Appwrite Function deployments.

💡 Did you know?
You can use Avatars API to generate QR code for any text or URLs

Copy link

vercel bot commented Aug 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gridiron-survivor ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 21, 2024 0:07am
gridiron-survivor-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 21, 2024 0:07am

…errors. The table row can't be a direct child of the header.
cell: ({ row }) => <div>{row.getValue('text2')}</div>,
cell: ({ row }): JSX.Element => {
const participants = row.getValue('participants') as string[];
return <p>{participants.length}</p>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: would span be better for this?

choir241
choir241 previously approved these changes Nov 11, 2024
@shashilo shashilo merged commit c972ef2 into develop Nov 21, 2024
5 checks passed
@shashilo shashilo deleted the alex/implement-admin-league-operation branch November 21, 2024 21:39
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.

FEE: Implement Admin League Operations with Backend API Integration
4 participants