[feat]: implemented API-football implementations - #171
Open
rijulpoudel wants to merge 43 commits into
Open
Conversation
Updated the names of the developers for clarity.
…reframes documentation
…page.png Updated path name because window couldn't use it
… from package-lock.json
main replaced config/reset.js with db/schema.sql + db/seedData.js + db/resetDatabase.js and renamed every users column (id -> user_id, password -> password_hash, points -> total_points, favorite_team moved out to the followed_teams table). This branch's GitHub OAuth work was built on the old names, so the merge needed more than a textual resolve. Schema (db/schema.sql is now the single source of truth): - password_hash is nullable — an OAuth account has no password of ours - added github_id and access_token; reused main's profile_image_url for the GitHub avatar instead of adding a second column - users_has_credential CHECK enforces password_hash OR github_id Code: - auth.js: githubid/avatarurl/accesstoken -> github_id/profile_image_url/ access_token; linking a GitHub account to an existing local one no longer overwrites that user's chosen username - usersController.js: main's column names + this branch's bcrypt compare; PUBLIC_COLUMNS keeps password_hash and access_token out of responses - server.js: kept the passport/session/cors setup, updated deserializeUser to the new columns, session secret now reads SESSION_SECRET - resetDatabase.js: bcrypt-hashes demo passwords instead of seeding plaintext, so `npm run reset` produces logins the API can verify - .env.example: documented the GitHub OAuth / session vars Verified: schema.sql applies cleanly against Postgres, the CHECK accepts an OAuth-only row and rejects a credential-less one, and a seeded hash round-trips through bcrypt.compare (all in a rolled-back transaction). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The merged schema made users.username NOT NULL UNIQUE, but the OAuth verify callback wrote the GitHub login into that column unconditionally. Any GitHub login matching a username already taken by a local signup raised a unique violation and 500'd the callback
Add a /signup page wired to POST /api/users, which previously had no UI.
…ate a session cookie/secret in .env before bootup
…docs and demo gifs
Frontend: core pages, Fixture Calendar, Team Follow, Profile Customization (excludes login, deferred to #16)
main rebuilt the frontend (Tailwind, Sidebar layout, new pages) while
deferring the login/auth pages to this branch, so the merge keeps main's
shell and re-applies the auth work on top of it.
Conflict resolutions:
- App.jsx main's route table, plus /login and /signup, with a new
RequireAuth guard wrapping the Sidebar layout.
- Home.jsx main's dashboard. The session check it used to do inline
now lives in RequireAuth, so every page is covered.
- Navigation deleted, as on main. Its sign-out moved into Sidebar.
- UsersAPI kept. main deleted services/ but left pages/Login.jsx
importing UsersAPI, so main cannot currently build; this
restores the module it needs.
- package.json union of both dependency sets, minus @picocss/pico, which
main had already dropped when it moved to Tailwind.
- vite.config main's version, keeping the note that only /api is proxied.
- .env.example union.
- lockfile regenerated from main's.
Routes changed from the auth branch's shape (/ = login, /home = app) to
main's (/ = dashboard, /login, /signup). The OAuth callback and its error
redirects were repointed accordingly.
Login.css and its --ml-* palette are kept as-is, scoped to .login-page so
the older colours cannot leak into the Tailwind theme. Restyling the auth
pages onto the design system is left as a follow-up.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Secure Login V2
Home and Profile both hardcoded DEMO_USER_ID = 1, so every signed-in user saw user 1's points, follows, and bio. Add a useSessionUser hook that reads the session hint RequireAuth already stores, and use it for the /api/users and /api/follows calls on both pages. Also fixes Profile's avatar round-trip: it now reads profile_image_url from the user fetch and the PATCH response instead of only trusting the Cloudinary URL, so the avatar survives a reload, and syncs the localStorage session hint so the Sidebar picks up the new avatar immediately. Home's live-match widget also picks up HT (halftime) matches, which the real API emits but the old LIVE-only check missed.
Discover's follow buttons were local-state-only and Sidebar's followed- teams list read from a static mock — neither reflected an actual follow. Discover now loads the session user's follows via GET /api/follows/user/:id and toggles them through the real POST/DELETE /api/follows endpoints (same handlers Profile already used), so following a team persists. Sidebar now sources its list from the same endpoint instead of mocks/followedTeams.js, with an honest "No teams followed yet" empty state, and picks up the session user through the shared useSessionUser hook instead of parsing localStorage itself. Note: this also carries forward the Sidebar profile-nav-link change already sitting in the working tree from a previous pass (per planning/frontend_audit.md) — no separate commit existed for it yet.
Matches.jsx rendered a static 9-fixture mock; the grid, tabs, and both "filter" controls were decorative. It now fetches GET /api/matches (the ?date= query param the server already supports) and adds a real date picker plus a client-side team/venue text filter over the live results. The mock's status set included FT, which the real API never emits (only LIVE | HT | UPCOMING) — the old FT-only Results filter would have silently gone empty and HT matches would have vanished from every tab. Live now covers LIVE and HT together, Results stays mapped to FT as an honest empty state until the backend emits it, and every tab shows a "no matches" message instead of a blank grid. The right-rail "Live Analytics Feed" and "Model Verdict" panels showed fabricated shot/possession numbers and a scripted prediction with no backing data — replaced with an explicit in-progress note. Per-match win-probability bars are also dropped from the grid: the real API has no probability field, so ProbabilityBar had nothing real to render.
MatchDetail always rendered the same hardcoded Argentina-vs-France fixture regardless of the URL, via getMockMatchDetail. It now fetches the real match by id, renders an honest "Match not found" state for unknown ids (matching the API's 404) instead of a fake match, and a loading/error state for the fetch itself. The real endpoint only returns the same 9 fields as the matches list (home/away/score/status/minute/date/venue) — no events, lineups, stats, possession, or competition name. Those tab sections, plus the "1,247 online" fan-chat panel, now show an explicit "isn't available from the API yet / in progress" message instead of the old fabricated event log, formations, and viewer count. The win-probability bar is dropped from the hero for the same reason (no probability field in the real response). "PLACE WAGER" is now a disabled, honestly-labeled control instead of a dead CTA — there's no wager concept in the schema yet. Comments and Highlights tabs are untouched (CommentThread / VideoPlayer are other teammates' placeholders, out of scope here).
Finalize frontend dev + structure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shalom will have to wire an actual page to call MatchesAPI/TeamsAPI/PlayersAPI and render the real data.