Documentation ¶
Index ¶
- func ClubRouter(clubParams types.RouteParams) fiber.Router
- func ClubRoutes(clubParams types.RouteParams)
- func CreateClub(db *gorm.DB, userId uuid.UUID, club models.Club) (*models.Club, error)
- func DeleteClub(db *gorm.DB, id uuid.UUID) error
- func GetClubs(db *gorm.DB, pageInfo fiberpaginate.PageInfo) ([]models.Club, error)
- func UpdateClub(db *gorm.DB, id uuid.UUID, club models.Club) (*models.Club, error)
- type ClubController
- type ClubService
- func (c *ClubService) CreateClub(userID uuid.UUID, clubBody CreateClubRequestBody) (*models.Club, error)
- func (c *ClubService) DeleteClub(id string) error
- func (c *ClubService) GetClub(id string) (*models.Club, error)
- func (c *ClubService) GetClubs(pagination fiberpaginate.PageInfo) ([]models.Club, error)
- func (c *ClubService) UpdateClub(id string, clubBody UpdateClubRequestBody) (*models.Club, error)
- type ClubServiceInterface
- type CreateClubRequestBody
- type UpdateClubRequestBody
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClubRouter ¶
func ClubRouter(clubParams types.RouteParams) fiber.Router
func ClubRoutes ¶
func ClubRoutes(clubParams types.RouteParams)
func CreateClub ¶
Types ¶
type ClubController ¶
type ClubController struct {
// contains filtered or unexported fields
}
func NewClubController ¶
func NewClubController(clubService ClubServiceInterface) *ClubController
func (*ClubController) CreateClub ¶
func (cl *ClubController) CreateClub(c *fiber.Ctx) error
CreateClub godoc
@Summary Create a club @Description Creates a club @ID create-club @Tags club @Accept json @Produce json @Param club body CreateClubRequestBody true "Club" @Success 201 {object} models.Club @Failure 400 {object} error @Failure 401 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /clubs/ [post]
func (*ClubController) DeleteClub ¶
func (cl *ClubController) DeleteClub(c *fiber.Ctx) error
DeleteClub godoc
@Summary Delete a club @Description Deletes a club @ID delete-club @Tags club @Produce json @Param clubID path string true "Club ID" @Success 204 {string} utilities.SuccessResponse @Failure 400 {object} error @Failure 401 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /clubs/{clubID}/ [delete]
func (*ClubController) GetClub ¶
func (cl *ClubController) GetClub(c *fiber.Ctx) error
GetClub godoc
@Summary Retrieve a club @Description Retrieves a club @ID get-club @Tags club @Produce json @Param clubID path string true "Club ID" @Success 200 {object} models.Club @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /clubs/{clubID}/ [get]
func (*ClubController) GetClubs ¶
func (cl *ClubController) GetClubs(c *fiber.Ctx) error
GetClubs godoc
@Summary Retrieve all clubs @Description Retrieves all clubs @ID get-all-clubs @Tags club @Produce json @Param limit query int false "Limit" @Param page query int false "Page" @Success 200 {object} []models.Club @Failure 400 {object} error @Failure 500 {object} error @Router /clubs/ [get]
func (*ClubController) UpdateClub ¶
func (cl *ClubController) UpdateClub(c *fiber.Ctx) error
UpdateClub godoc
@Summary Update a club @Description Updates a club @ID update-club @Tags club @Accept json @Produce json @Param clubID path string true "Club ID" @Param club body UpdateClubRequestBody true "Club" @Success 200 {object} models.Club @Failure 400 {object} error @Failure 401 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /clubs/{clubID}/ [patch]
type ClubService ¶
type ClubService struct {
types.ServiceParams
}
func (*ClubService) CreateClub ¶
func (c *ClubService) CreateClub(userID uuid.UUID, clubBody CreateClubRequestBody) (*models.Club, error)
func (*ClubService) DeleteClub ¶
func (c *ClubService) DeleteClub(id string) error
func (*ClubService) GetClubs ¶
func (c *ClubService) GetClubs(pagination fiberpaginate.PageInfo) ([]models.Club, error)
func (*ClubService) UpdateClub ¶
func (c *ClubService) UpdateClub(id string, clubBody UpdateClubRequestBody) (*models.Club, error)
type ClubServiceInterface ¶
type ClubServiceInterface interface { GetClubs(pageInfo fiberpaginate.PageInfo) ([]models.Club, error) GetClub(id string) (*models.Club, error) CreateClub(userID uuid.UUID, clubBody CreateClubRequestBody) (*models.Club, error) UpdateClub(id string, clubBody UpdateClubRequestBody) (*models.Club, error) DeleteClub(id string) error }
func NewClubService ¶
func NewClubService(serviceParams types.ServiceParams) ClubServiceInterface
type CreateClubRequestBody ¶
type CreateClubRequestBody struct { Name string `json:"name" validate:"required,max=255"` Preview string `json:"preview" validate:"required,max=255"` Description string `json:"description" validate:"required,http_url,s3_url,max=255"` IsRecruiting bool `json:"is_recruiting" validate:"required"` RecruitmentCycle models.RecruitmentCycle `json:"recruitment_cycle" validate:"required,max=255,oneof=fall spring fallSpring always"` RecruitmentType models.RecruitmentType `json:"recruitment_type" validate:"required,max=255,oneof=unrestricted tryout application"` WeeklyTimeCommitment *int `json:"weekly_time_commitment" validate:"omitempty,min=1"` OneWordToDescribeUs string `json:"one_word_to_describe_us" validate:"omitempty,max=255"` ApplicationLink string `json:"application_link" validate:"required,max=255,http_url"` Logo string `json:"logo" validate:"omitempty,http_url,s3_url,max=255"` }
type UpdateClubRequestBody ¶
type UpdateClubRequestBody struct { Name string `json:"name" validate:"omitempty,max=255"` Preview string `json:"preview" validate:"omitempty,max=255"` Description string `json:"description" validate:"omitempty,http_url,s3_url,max=255"` IsRecruiting bool `json:"is_recruiting" validate:"omitempty"` RecruitmentCycle models.RecruitmentCycle `json:"recruitment_cycle" validate:"required,max=255,oneof=fall spring fallSpring always"` RecruitmentType models.RecruitmentType `json:"recruitment_type" validate:"required,max=255,oneof=unrestricted tryout application"` WeeklyTimeCommitment *int `json:"weekly_time_commitment" validate:"omitempty,min=1"` OneWordToDescribeUs string `json:"one_word_to_describe_us" validate:"omitempty,max=255"` ApplicationLink string `json:"application_link" validate:"omitempty,required,max=255,http_url"` Logo string `json:"logo" validate:"omitempty,s3_url,max=255,http_url"` }