Skip to content

Teams - #240

Open
Floha258 wants to merge 17 commits into
mainfrom
teams2
Open

Teams#240
Floha258 wants to merge 17 commits into
mainfrom
teams2

Conversation

@Floha258

Copy link
Copy Markdown
Collaborator

No description provided.

@Floha258
Floha258 requested a review from cjs8487 August 30, 2026 22:05
@Floha258 Floha258 self-assigned this Aug 30, 2026
@Floha258 Floha258 mentioned this pull request Aug 30, 2026

@cjs8487 cjs8487 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thinking a little bit from the frontend perspective, I have a handful of stray thoughts

  • I'm back to thinking that maybe we should treat spectators as an implicit team. It would allow consumers to not have to think about spectators as a separate entity (since they'd all be grouped under the spectator team) but with the existence of a toggle for teams, I think this becomes awkward
  • I call it out in a few spots, but it may be worth considering if we should include which player on a team performed an action alongside the action, both in the database and in generated chat messages. Doing it in the database if we want this will likely save headache in protocol v2.

Other miscellaneous comments

  • Please use array.forEach instead of for (const elem of array). I know a lot of development environments have regressed back to suggesting that style of loop, but it's not the way we've been writing loops in this codebase. technically, it can require a polyfill, but we're not running the APi in the browser so it's not a major concern. ESLint would typically flag this if it was working correctly, at least in browser projects
  • There's quite a few places where the usage of helper methods is inconsistent. Go through with a fine toothed comb and make sure that helpers added in later iterations were properly used everywhere so there's no gotchas in 6 months when we inevitably need to make a change to it.
  • It's possible I missed it in the sea of changes, but I don't see any handling for creating a team if aplayer switches from spectating to playing, or handling them leaving a team if they switch from playing to sepctatin. Both of these are existing options and separate actions, so we should take care to not break them

Comment thread api/src/core/Player.ts Outdated
Comment thread api/.eslintrc Outdated
Comment thread api/src/core/Room.ts
Comment thread api/src/core/Room.ts Outdated
Comment thread api/prisma/migrations/20260515200019_refactor_for_teams/data-migration.ts Outdated
Comment thread api/src/core/Room.ts Outdated
Comment thread api/src/core/Room.ts Outdated
Comment thread api/src/core/Room.ts Outdated
Comment thread api/src/core/Room.ts Outdated
Comment thread api/src/core/Room.ts Outdated

@cjs8487 cjs8487 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Sent my first review too early :/

} from '../../database/Rooms';

jest.mock('../../database/Rooms', () => ({
addChangeColorAction: jest.fn().mockResolvedValue(undefined),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I've been putting mocks for the database directly into the respective mocks folder, and calling the module level mock for it from the setup script. This lets all the tests use the same mocks, which generally is the better paradigm, unless a test suite really needs specific mocks that don't match the other test. If you don't do it here, I may very well end up moving it, but I'd rather if we started some consistency

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Which mocks folder? I've neither seen one in main nor in your test branch. Needles to say it's not in my branch either

@cjs8487 cjs8487 linked an issue Sep 4, 2026 that may be closed by this pull request
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.

Teams: Backend Support

2 participants