From 80752596b47a01c71e19687489947b7afb148ed9 Mon Sep 17 00:00:00 2001 From: AleksandrMatsko Date: Tue, 19 Nov 2024 13:19:41 +0700 Subject: [PATCH] style: add godocs --- api/constants.go | 8 ++++++-- api/dto/team.go | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/api/constants.go b/api/constants.go index 8be18bf9e..2cf6ed7de 100644 --- a/api/constants.go +++ b/api/constants.go @@ -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" ) diff --git a/api/dto/team.go b/api/dto/team.go index 8618346e0..622e42edf 100644 --- a/api/dto/team.go +++ b/api/dto/team.go @@ -95,16 +95,19 @@ 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"` @@ -112,10 +115,13 @@ type TeamsList struct { 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))