Skip to content

Commit

Permalink
style: add godocs
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandrMatsko committed Nov 19, 2024
1 parent c4095ef commit 8075259
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api/constants.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package api

// SortOrder represents the sorting order for entities.
type SortOrder string

const (
NoSortOrder SortOrder = ""
AscSortOrder SortOrder = "asc"
// NoSortOrder means that entities may be unsorted.
NoSortOrder SortOrder = ""
// AscSortOrder means that entities should be ordered ascending (example: from 1 to 9).
AscSortOrder SortOrder = "asc"
// DescSortOrder means that entities should be ordered descending (example: from 9 to 1).
DescSortOrder SortOrder = "desc"
)
6 changes: 6 additions & 0 deletions api/dto/team.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,27 +95,33 @@ func (TeamMembers) Render(w http.ResponseWriter, r *http.Request) error {
return nil
}

// TeamSettings is a structure that contains info about team: contacts and subscriptions.
type TeamSettings struct {
TeamID string `json:"team_id" example:"d5d98eb3-ee18-4f75-9364-244f67e23b54"`
Contacts []moira.ContactData `json:"contacts"`
Subscriptions []moira.SubscriptionData `json:"subscriptions"`
}

// Render is a function that implements chi Renderer interface for TeamSettings.
func (TeamSettings) Render(w http.ResponseWriter, r *http.Request) error {
return nil
}

// TeamsList is a structure that represents a list of existing teams in db.
type TeamsList struct {
List []TeamModel `json:"list"`
Page *int64 `json:"page,omitempty" format:"int64" extensions:"x-nullable"`
Size *int64 `json:"size,omitempty" format:"int64" extensions:"x-nullable"`
Total *int64 `json:"total,omitempty" format:"int64" extensions:"x-nullable"`
}

// Render is a function that implements chi Renderer interface for TeamsList.
func (TeamsList) Render(w http.ResponseWriter, r *http.Request) error {
return nil
}

// NewTeamsList constructs TeamsList out of []moira.Team.
// TeamsList.Page, TeamsList.Size and TeamsList.Total are not filled.
func NewTeamsList(teams []moira.Team) TeamsList {
models := make([]TeamModel, 0, len(teams))

Expand Down

0 comments on commit 8075259

Please sign in to comment.