Skip to content

Commit

Permalink
prepare for team follow
Browse files Browse the repository at this point in the history
  • Loading branch information
konrad2002 committed Apr 17, 2024
1 parent 0db72f3 commit 5d0452e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
14 changes: 13 additions & 1 deletion model/following.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@ import (
"time"
)

type Following struct {
type FollowingAthlete struct {
AthleteId primitive.ObjectID `json:"athlete_id" bson:"athlete_id"`
AddedAt time.Time `json:"added_at,omitempty" bson:"added_at,omitempty"`
}

// FollowingTeam TODO make teams followable
type FollowingTeam struct {
TeamId primitive.ObjectID `json:"team_id" bson:"team_id"`
AddedAt time.Time `json:"added_at,omitempty" bson:"added_at,omitempty"`
}

// Following TODO use merged struct
type Following struct {
FollowingAthletes []FollowingAthlete `json:"following_athletes,omitempty" bson:"following_athletes,omitempty"`
FollowingTeams []FollowingTeam `json:"following_teams,omitempty" bson:"following_teams,omitempty"`
}
2 changes: 1 addition & 1 deletion model/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
type User struct {
Identifier primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
KeycloakId string `json:"keycloak_id,omitempty" bson:"keycloak_id,omitempty"`
Following []Following `json:"following,omitempty" bson:"following,omitempty"`
Following []FollowingAthlete `json:"following,omitempty" bson:"following,omitempty"`
OwnAthleteId *primitive.ObjectID `json:"own_athlete_id,omitempty" bson:"own_athlete_id,omitempty"`
Settings Settings `json:"settings,omitempty" bson:"settings,omitempty"`
Meetings []string `json:"meetings,omitempty" bson:"meetings,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion service/user_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func ModifyFollowForUser(id uuid.UUID, athleteId primitive.ObjectID, follow bool
}

if follow {
user.Following = append(user.Following, model.Following{
user.Following = append(user.Following, model.FollowingAthlete{
AthleteId: athleteId,
AddedAt: time.Now(),
})
Expand Down

0 comments on commit 5d0452e

Please sign in to comment.