-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor associations into seperate verticals | gen clean up
- Loading branch information
1 parent
aff5bb7
commit 347310d
Showing
18 changed files
with
403 additions
and
285 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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,23 @@ | ||
package controllers | ||
|
||
import ( | ||
"github.com/GenerateNU/sac/backend/src/services" | ||
"github.com/gofiber/fiber/v2" | ||
) | ||
|
||
type ClubFollowerController struct { | ||
clubFollowerService services.ClubFollowerServiceInterface | ||
} | ||
|
||
func NewClubFollowerController(clubFollowerService services.ClubFollowerServiceInterface) *ClubFollowerController { | ||
return &ClubFollowerController{clubFollowerService: clubFollowerService} | ||
} | ||
|
||
func (cf *ClubFollowerController) GetUserFollowingClubs(c *fiber.Ctx) error { | ||
clubs, err := cf.clubFollowerService.GetUserFollowingClubs(c.Params("userID")) | ||
if err != nil { | ||
return err.FiberError(c) | ||
} | ||
|
||
return c.Status(fiber.StatusOK).JSON(&clubs) | ||
} |
This file contains 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
This file contains 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,38 @@ | ||
package controllers | ||
|
||
import ( | ||
"github.com/GenerateNU/sac/backend/src/services" | ||
"github.com/gofiber/fiber/v2" | ||
) | ||
|
||
type UserFollowerController struct { | ||
userFollowerService services.UserFollowerServiceInterface | ||
} | ||
|
||
func NewUserFollowerController(userFollowerService services.UserFollowerServiceInterface) *UserFollowerController { | ||
return &UserFollowerController{userFollowerService: userFollowerService} | ||
} | ||
|
||
func (uf *UserFollowerController) CreateFollowing(c *fiber.Ctx) error { | ||
err := uf.userFollowerService.CreateFollowing(c.Params("userID"), c.Params("clubID")) | ||
if err != nil { | ||
return err.FiberError(c) | ||
} | ||
return c.SendStatus(fiber.StatusCreated) | ||
} | ||
|
||
func (uf *UserFollowerController) DeleteFollowing(c *fiber.Ctx) error { | ||
err := uf.userFollowerService.DeleteFollowing(c.Params("userID"), c.Params("clubID")) | ||
if err != nil { | ||
return err.FiberError(c) | ||
} | ||
return c.SendStatus(fiber.StatusNoContent) | ||
} | ||
|
||
func (uf *UserFollowerController) GetAllFollowing(c *fiber.Ctx) error { | ||
clubs, err := uf.userFollowerService.GetFollowing(c.Params("userID")) | ||
if err != nil { | ||
return err.FiberError(c) | ||
} | ||
return c.Status(fiber.StatusOK).JSON(clubs) | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.