Skip to content

Conversation

@YahyaAsmara
Copy link

Things I did:

  • Add teamCode field to organization table for unique team codes
  • Create team router with create mutation
  • Validate team names (alphanumeric, spaces, hyphens, underscores only - especially no emojis)
  • Team creator is automatically added as owner/leader

Things I did not do as much yet:

  • Test if all instances/teams/names works as intended
  • Test if current logic makes sense (maybe missing 1 or 2 edge cases)

Things I have questions of:

  • I have used https://nodejs.org/api/crypto.html currently but I am not sure if there is a better alternative
  • I am not sure if we still want to do 4 char teamId's or not. I currently have set it at 8.

Copy link
Contributor

Choose a reason for hiding this comment

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

you have some biome errors - check pipeline and fix those pls.

id: crypto.randomUUID(),
organizationId: teamId,
userId,
role: "owner",
Copy link
Contributor

Choose a reason for hiding this comment

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

consider making this an enum instead of hardcoding strings

})
.returning();

// Add the creator as the team leader
Copy link
Contributor

Choose a reason for hiding this comment

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

consider wrapping this insert and the team insert in a transaction so that they act atomically.

https://stackoverflow.com/questions/974596/what-is-a-database-transaction

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.

2 participants