forked from codejam-io/codejam
-
Notifications
You must be signed in to change notification settings - Fork 3
Merge my-team branch #7
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
Open
ezstarr
wants to merge
72
commits into
main
Choose a base branch
from
my-team
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
a395d9a
Add debug flags to backend
EvieePy 1ffffd0
Add Debug user
EvieePy 0829122
route for browsing teams
ezstarr ad857f9
Fix teams/browse endpoint
EvieePy f6ae698
fix debugcow, userId check, and order of operations in team views
ezstarr d9ea0b7
Merge branch 'main' of https://github.com/TimeEnjoyed/codejam2024 int…
ezstarr b9e8c24
Merge branch 'main' of https://github.com/TimeEnjoyed/codejam2024 int…
ezstarr 1863983
add avatar_url string to debugcow args in oauth
ezstarr 29d6eb6
separate sendTeamInfo route from getTeamInfo
ezstarr 4244584
added: login modal
ezstarr b96c965
added: getTeamInfo separeated from sendTeamInfo for MemberJoin
ezstarr edfaaa7
cleaned two files
ezstarr 4172f43
cleaned up strange formats
ezstarr 5210c25
changed StatusBadRequest to StatusUnauthorized
ezstarr 68539a9
Add redirect after login
EvieePy bbaf8a4
Fix potential abuse vector in redirect.
EvieePy a5bf8b1
Fix ! check on hasPrefix
EvieePy cabb3b3
Add missing stateCode token check
EvieePy c13e798
change team_members schema to prevent user_id duplicates in teams
ezstarr 0db23ed
added: Toaster to create team and join team
ezstarr 48b40ff
cleaned up comments, added package-lock.json
ezstarr 7afef69
joinPublicTeam now returns teamId an error
ezstarr 10a9793
team visibility set to public by default via CodeJamTeam
ezstarr 0c3296c
add: avatars to browse teams view
ezstarr aa0982d
Add animated v static avatars
EvieePy d5d7aee
fix: avatars display in TeamBrowse. may have confusion with url/id st…
ezstarr 2ea3bec
fix: navbar pfp works now, both gif and png
ezstarr 67ceb6c
fix: getUserTeams query includes avatar_id
ezstarr 975495c
fix: browseTeams disables join button if user already joined team
ezstarr 82bf723
add: browse/teams shows owner
ezstarr 0f3a3c2
add: users teams show avatar
ezstarr d273eb5
fix: getUserTeams query bug
ezstarr 6344575
add: userTeams edit team button if owner
ezstarr eae4d4a
added: EditTeam page with preloaded form data
ezstarr 6395dde
rename EditTeam.svelte to TeamEdit
ezstarr 24f3af4
WIP: removeTeamMember option
ezstarr 4ec3410
WIP: removeTeamMember table
ezstarr caa97ac
fix: give loadAvatarUrls a default value
ezstarr a3c53e3
fix: query to getUserTeams gets non-owner members as well
ezstarr 351d7f2
fix: added subquery to getUserTeams to display owner and members of u…
ezstarr bb284c6
clean up/formatting
ezstarr 6574123
fix: teamMember property names to match for EditTeam and backend
ezstarr b89d166
fix: header/nav ui
ezstarr bfa181c
fix: rename Members to TeamMembers in the response
ezstarr 8c8b00e
fix: backend of members joining via invite code
ezstarr 54569d2
formatting mainly
ezstarr 040f956
add: invite link to team edit page
ezstarr 7695203
added: allow discord users without avatars to log in
ezstarr bd4562a
change: getUserTeams renamed to getUserOwned Teams
ezstarr d23c95f
fix: revert getUserOwnedTeams to getUserTeams
ezstarr 446d253
add: added createdon field to getTeams query
ezstarr 301a18c
fix: getuserteams queries both when user is owner and non owner
ezstarr 1ebdd1c
moved: db structs moved to separate file. userTeams now displays owne…
ezstarr d5facdf
fix: userTeams team order, invite toast/redirect
ezstarr c0a0feb
fix: getUserTeams query
ezstarr 5003b6e
fix: invite link checks if user already in team
ezstarr 83be5c3
fix: 1 typo
ezstarr beb7dfd
add: copy invite link; edit link, formatting
ezstarr fbd65cb
add: owner info to myteam page
ezstarr 0d04cd2
add: only show edit btn when loggedinuser is owner
ezstarr c5adabc
fix: url of invite link
ezstarr 06d48db
fix: owners can remove team members appropriately
ezstarr d711654
fix: if allTeams is null, set to [];
ezstarr 38f4db0
add: CodeJamTeamExtended model/class; fix: user can successfully upda…
ezstarr 19e1689
fix: typo
ezstarr 1ac653a
fix: invite link url
ezstarr 67a7c0a
remove example file
ezstarr 491cb05
fix: formatting
ezstarr f8be8e6
Merge branch 'main' of https://github.com/TimeEnjoyed/codejam2024 int…
ezstarr e3ae671
fix: small formatting
ezstarr 122ac57
fix: when userstore displayname loads
ezstarr d664d84
fix: when userstore display name shows(when the page loads?)
ezstarr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| .idea/ | ||
| *.iml | ||
|
|
||
| node_modules | ||
|
|
||
| # VSCODE | ||
| .vscode/ | ||
|
|
||
|
|
||
13 changes: 7 additions & 6 deletions
13
backend/app/database/migrations/00000004_team_members.up.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| CREATE TABLE IF NOT EXISTS team_members ( | ||
| id UUID DEFAULT uuid_generate_v4() PRIMARY KEY, | ||
| team_id UUID references teams(id) ON DELETE CASCADE, | ||
| user_id UUID references users(id) ON DELETE CASCADE, | ||
| role TEXT NOT NULL, | ||
| created_on TIMESTAMP WITH TIME ZONE DEFAULT (now() AT TIME ZONE('utc')) | ||
| team_id UUID NOT NULL references teams(id) ON DELETE CASCADE, | ||
| user_id UUID NOT NULL references users(id) ON DELETE CASCADE, | ||
| team_role TEXT NOT NULL, | ||
| created_on TIMESTAMP WITH TIME ZONE DEFAULT (now() AT TIME ZONE('utc')), | ||
| PRIMARY KEY (team_id, user_id) | ||
| ); | ||
|
|
||
| ALTER TABLE teams DROP COLUMN IF EXISTS owner_user_id; | ||
| ALTER TABLE teams DROP COLUMN IF EXISTS owner_user_id; | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| package database | ||
|
|
||
| import ( | ||
| "github.com/jackc/pgx/v5/pgtype" | ||
| ) | ||
|
|
||
| type DBTeam struct { | ||
| Id pgtype.UUID `db:"id"` | ||
| EventId pgtype.UUID `db:"event_id"` | ||
| Name string `db:"name"` | ||
| Visibility string `db:"visibility"` | ||
| Timezone string `db:"timezone"` | ||
| Technologies string `db:"technologies"` | ||
| Availability string `db:"availability"` | ||
| Description string `db:"description"` | ||
| CreatedOn pgtype.Timestamptz `db:"created_on"` | ||
| InviteCode string `db:"invite_code"` | ||
| } | ||
|
|
||
| type CreateTeamMember struct { | ||
| UserId pgtype.UUID `db:"user_id"` | ||
| TeamId pgtype.UUID `db:"team_id"` | ||
| TeamRole string `db:"team_role"` | ||
| } | ||
|
|
||
| // has all the user info & role to pass to be read client-side | ||
| type DBTeamMemberInfo struct { | ||
| DBUser // embed the DBUser fields into the struct | ||
| TeamRole string `db:"team_role"` | ||
| } | ||
|
|
||
| type DBTeamMember struct { | ||
| TeamId pgtype.UUID `db:"team_id"` | ||
| UserId pgtype.UUID `db:"user_id"` | ||
| TeamRole string `db:"team_role"` | ||
| CreatedOn pgtype.Timestamp `db:"user_created_on"` | ||
| } | ||
|
|
||
| type DBUserTeams struct { | ||
| DBTeam | ||
| DisplayName string `db:"display_name"` | ||
| TeamRole string `db:"team_role"` | ||
| AvatarId string `db:"avatar_id"` | ||
| } | ||
|
|
||
| type DBTeamAndTeamMember struct { | ||
| Id pgtype.UUID `db:"id"` | ||
| EventId pgtype.UUID `db:"event_id"` | ||
| Name string `db:"name"` | ||
| Visibility string `db:"visibility"` | ||
| Timezone string `db:"timezone"` | ||
| Technologies string `db:"technologies"` | ||
| Availability string `db:"availability"` | ||
| Description string `db:"description"` | ||
| CreatedOn pgtype.Timestamptz `db:"team_created_on"` | ||
| InviteCode string `db:"invite_code"` | ||
| MembershipCreatedOn pgtype.Timestamptz `db:"membership_created_on"` | ||
| TeamId pgtype.UUID `db:"team_id"` | ||
| UserId pgtype.UUID `db:"user_id"` | ||
| TeamRole string `db:"team_role"` | ||
| DisplayName string `db:"display_name"` | ||
| AvatarId string `db:"avatar_id"` | ||
| ServiceUserId string `db:"service_user_id"` | ||
| } | ||
|
|
||
| type UITeam struct { | ||
| Id pgtype.UUID `db:"id"` | ||
| EventId pgtype.UUID `db:"event_id"` | ||
| Name string `db:"name"` | ||
| Visibility string `db:"visibility"` | ||
| Timezone string `db:"timezone"` | ||
| Technologies string `db:"technologies"` | ||
| Availability string `db:"availability"` | ||
| Description string `db:"description"` | ||
| CreatedOn pgtype.Timestamptz `db:"team_created_on"` | ||
| InviteCode string `db:"invite_code"` | ||
| } | ||
|
|
||
| type UITeamMember struct { | ||
| TeamId pgtype.UUID `db:"team_id"` | ||
| UserId pgtype.UUID `db:"user_id"` | ||
| MembershipCreatedOn pgtype.Timestamptz `db:"membership_created_on"` | ||
| TeamRole string `db:"team_role"` | ||
| } | ||
|
|
||
| type TeamMember struct { | ||
| UITeamMember | ||
| DisplayName string `db:"display_name"` | ||
| AvatarId string `db:"avatar_id"` | ||
| ServiceUserId string `db:"service_user_id"` | ||
| } | ||
|
|
||
| type TeamAndMembers struct { | ||
| UITeam | ||
| TeamMembers []TeamMember | ||
| } | ||
|
|
||
| type UserTeamMember struct { | ||
| UserId pgtype.UUID `json:"UserId"` | ||
| DisplayName string `json:"DisplayName"` | ||
| TeamRole string `json:"TeamRole"` | ||
| AvatarId string `json:"AvatarId"` | ||
| ServiceUserId string `json:"ServiceUserId"` | ||
| UserCreatedOn pgtype.Timestamptz `json:"UserCreatedOn"` | ||
| } | ||
|
|
||
| type UserTeam struct { | ||
| Id pgtype.UUID `json:"Id"` | ||
| EventId pgtype.UUID `json:"EventId"` | ||
| Name string `json:"Name"` | ||
| Description string `json:"Description"` | ||
| Visibility string `json:"Visibility"` | ||
| Technologies string `json:"Technologies"` | ||
| Availability string `json:"Availability"` | ||
| TeamCreatedOn pgtype.Timestamptz `json:"TeamCreatedOn"` | ||
| InviteCode string `json:"InviteCode"` | ||
| TeamMembers []UserTeamMember `json:"TeamMembers"` | ||
| } | ||
|
|
||
| type UserTeamAndMembers struct { | ||
| Id pgtype.UUID `db:"id"` | ||
| EventId pgtype.UUID `db:"event_id"` | ||
| Name string `db:"name"` | ||
| Visibility string `db:"visibility"` | ||
| Timezone string `db:"timezone"` | ||
| Technologies string `db:"technologies"` | ||
| Availability string `db:"availability"` | ||
| Description string `db:"description"` | ||
| TeamCreatedOn pgtype.Timestamptz `db:"team_created_on"` | ||
| InviteCode string `db:"invite_code"` | ||
| TeamId pgtype.UUID `db:"team_id"` | ||
| UserId pgtype.UUID `db:"user_id"` | ||
| TeamRole string `db:"team_role"` | ||
| MembershipCreatedOn pgtype.Timestamptz `db:"membership_created_on"` | ||
| DisplayName string `db:"display_name"` | ||
| AvatarId string `db:"avatar_id"` | ||
| ServiceUserId string `db:"service_user_id"` | ||
| CurrentUserRole string `db:"current_user_role"` | ||
| } | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a mandatory change, but I would consider splitting the UI and DB structs into different files. With the DB structs under the database package and the UI structs under the "server" package.