Skip to content
Open
Show file tree
Hide file tree
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 Jun 25, 2024
1ffffd0
Add Debug user
EvieePy Jun 25, 2024
0829122
route for browsing teams
ezstarr Jun 25, 2024
ad857f9
Fix teams/browse endpoint
EvieePy Jun 25, 2024
f6ae698
fix debugcow, userId check, and order of operations in team views
ezstarr Jun 25, 2024
d9ea0b7
Merge branch 'main' of https://github.com/TimeEnjoyed/codejam2024 int…
ezstarr Jun 25, 2024
b9e8c24
Merge branch 'main' of https://github.com/TimeEnjoyed/codejam2024 int…
ezstarr Jun 26, 2024
1863983
add avatar_url string to debugcow args in oauth
ezstarr Jun 27, 2024
29d6eb6
separate sendTeamInfo route from getTeamInfo
ezstarr Aug 1, 2024
4244584
added: login modal
ezstarr Aug 15, 2024
b96c965
added: getTeamInfo separeated from sendTeamInfo for MemberJoin
ezstarr Aug 15, 2024
edfaaa7
cleaned two files
ezstarr Aug 15, 2024
4172f43
cleaned up strange formats
ezstarr Aug 15, 2024
5210c25
changed StatusBadRequest to StatusUnauthorized
ezstarr Aug 16, 2024
68539a9
Add redirect after login
EvieePy Aug 16, 2024
bbaf8a4
Fix potential abuse vector in redirect.
EvieePy Aug 16, 2024
a5bf8b1
Fix ! check on hasPrefix
EvieePy Aug 16, 2024
cabb3b3
Add missing stateCode token check
EvieePy Aug 16, 2024
c13e798
change team_members schema to prevent user_id duplicates in teams
ezstarr Aug 30, 2024
0db23ed
added: Toaster to create team and join team
ezstarr Sep 5, 2024
48b40ff
cleaned up comments, added package-lock.json
ezstarr Sep 5, 2024
7afef69
joinPublicTeam now returns teamId an error
ezstarr Sep 5, 2024
10a9793
team visibility set to public by default via CodeJamTeam
ezstarr Sep 5, 2024
0c3296c
add: avatars to browse teams view
ezstarr Sep 26, 2024
aa0982d
Add animated v static avatars
EvieePy Sep 26, 2024
d5d7aee
fix: avatars display in TeamBrowse. may have confusion with url/id st…
ezstarr Sep 28, 2024
2ea3bec
fix: navbar pfp works now, both gif and png
ezstarr Sep 29, 2024
67ceb6c
fix: getUserTeams query includes avatar_id
ezstarr Sep 29, 2024
975495c
fix: browseTeams disables join button if user already joined team
ezstarr Oct 3, 2024
82bf723
add: browse/teams shows owner
ezstarr Oct 4, 2024
0f3a3c2
add: users teams show avatar
ezstarr Oct 4, 2024
d273eb5
fix: getUserTeams query bug
ezstarr Oct 4, 2024
6344575
add: userTeams edit team button if owner
ezstarr Oct 4, 2024
eae4d4a
added: EditTeam page with preloaded form data
ezstarr Oct 5, 2024
6395dde
rename EditTeam.svelte to TeamEdit
ezstarr Oct 5, 2024
24f3af4
WIP: removeTeamMember option
ezstarr Oct 8, 2024
4ec3410
WIP: removeTeamMember table
ezstarr Oct 8, 2024
caa97ac
fix: give loadAvatarUrls a default value
ezstarr Oct 9, 2024
a3c53e3
fix: query to getUserTeams gets non-owner members as well
ezstarr Oct 9, 2024
351d7f2
fix: added subquery to getUserTeams to display owner and members of u…
ezstarr Oct 9, 2024
bb284c6
clean up/formatting
ezstarr Oct 9, 2024
6574123
fix: teamMember property names to match for EditTeam and backend
ezstarr Oct 9, 2024
b89d166
fix: header/nav ui
ezstarr Oct 10, 2024
bfa181c
fix: rename Members to TeamMembers in the response
ezstarr Oct 21, 2024
8c8b00e
fix: backend of members joining via invite code
ezstarr Oct 21, 2024
54569d2
formatting mainly
ezstarr Oct 21, 2024
040f956
add: invite link to team edit page
ezstarr Oct 21, 2024
7695203
added: allow discord users without avatars to log in
ezstarr Oct 23, 2024
bd4562a
change: getUserTeams renamed to getUserOwned Teams
ezstarr Oct 23, 2024
d23c95f
fix: revert getUserOwnedTeams to getUserTeams
ezstarr Oct 23, 2024
446d253
add: added createdon field to getTeams query
ezstarr Oct 24, 2024
301a18c
fix: getuserteams queries both when user is owner and non owner
ezstarr Oct 24, 2024
1ebdd1c
moved: db structs moved to separate file. userTeams now displays owne…
ezstarr Oct 26, 2024
d5facdf
fix: userTeams team order, invite toast/redirect
ezstarr Oct 26, 2024
c0a0feb
fix: getUserTeams query
ezstarr Oct 26, 2024
5003b6e
fix: invite link checks if user already in team
ezstarr Oct 26, 2024
83be5c3
fix: 1 typo
ezstarr Oct 26, 2024
beb7dfd
add: copy invite link; edit link, formatting
ezstarr Oct 28, 2024
fbd65cb
add: owner info to myteam page
ezstarr Oct 28, 2024
0d04cd2
add: only show edit btn when loggedinuser is owner
ezstarr Oct 28, 2024
c5adabc
fix: url of invite link
ezstarr Oct 28, 2024
06d48db
fix: owners can remove team members appropriately
ezstarr Oct 29, 2024
d711654
fix: if allTeams is null, set to [];
ezstarr Oct 31, 2024
38f4db0
add: CodeJamTeamExtended model/class; fix: user can successfully upda…
ezstarr Nov 6, 2024
19e1689
fix: typo
ezstarr Nov 11, 2024
1ac653a
fix: invite link url
ezstarr Nov 11, 2024
67a7c0a
remove example file
ezstarr Nov 11, 2024
491cb05
fix: formatting
ezstarr Nov 11, 2024
f8be8e6
Merge branch 'main' of https://github.com/TimeEnjoyed/codejam2024 int…
ezstarr Nov 11, 2024
e3ae671
fix: small formatting
ezstarr Nov 11, 2024
122ac57
fix: when userstore displayname loads
ezstarr Nov 11, 2024
d664d84
fix: when userstore display name shows(when the page loads?)
ezstarr Nov 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.idea/
*.iml

node_modules

# VSCODE
.vscode/

Expand Down
13 changes: 7 additions & 6 deletions backend/app/database/migrations/00000004_team_members.up.sql
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;

139 changes: 139 additions & 0 deletions backend/app/database/structs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
package database
Copy link
Collaborator

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.


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"`
}
Loading