Skip to content
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

Finished follower endpoints #142

Merged
merged 9 commits into from
Feb 11, 2024
Merged

Finished follower endpoints #142

merged 9 commits into from
Feb 11, 2024

Conversation

zacklassetter
Copy link
Contributor

@zacklassetter zacklassetter commented Feb 2, 2024

Description

SAC-26

Please include a summary of the changes and the related issue. Please also
include relevant motivation, context, and images!

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. If they are unit
tests, provide the file name the tests are in. If they are not unit tests,
describe how you tested the change.

We manually tested all of the endpoints and wrote unit tests

Checklist

  • I have performed a self-review of my code
  • I have reached out to another developer to review my code
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes

Copy link
Contributor

@DOOduneye DOOduneye left a comment

Choose a reason for hiding this comment

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

minor nits

}

func (cf *ClubFollowerController) GetUserFollowingClubs(c *fiber.Ctx) error {
clubs, err := cf.clubFollowerService.GetUserFollowingClubs(c.Params("userID"))
Copy link
Contributor

Choose a reason for hiding this comment

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

this value changes for everyone, we should standardize this value, especially as the middleware just checks for "id' @garrettladley @zacklassetter @in-mai-space

}

func (uf *UserFollowerController) CreateFollowing(c *fiber.Ctx) error {
err := uf.userFollowerService.CreateFollowing(c.Params("userID"), c.Params("clubID"))
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

@@ -48,7 +48,7 @@ type User struct {

Tag []Tag `gorm:"many2many:user_tags;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"`
Member []Club `gorm:"many2many:user_club_members;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"`
Follower []Club `gorm:"many2many:user_club_followers;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"`
Follower []Club `gorm:"many2many:user_club_followers;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"clubs_followed,omitempty" validate:"-"`
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want to send a list of followers? or should it only be passed when requested? might be unnecessary information

@@ -119,6 +135,17 @@ func clubRoutes(router fiber.Router, clubService services.ClubServiceInterface,
clubsID.Get("/", clubController.GetClub)
clubsID.Patch("/", middlewareService.Authorize(types.ClubWrite), clubController.UpdateClub)
clubsID.Delete("/", middlewareService.Authorize(types.ClubDelete), clubController.DeleteClub)
clubs.Get("/:id", clubController.GetClub)
Copy link
Contributor

Choose a reason for hiding this comment

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

why define these endpoints?

}

// Get all following for a user

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

return &errors.ClubNotFound
}
// What to return here?
// Should we return User or Success message?
Copy link
Contributor

Choose a reason for hiding this comment

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

return nil

@garrettladley garrettladley merged commit 6ca4f11 into main Feb 11, 2024
5 checks passed
@garrettladley garrettladley deleted the SAC-26-Follower-CRUD branch February 11, 2024 19:01
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.

4 participants