Skip to content

Commit

Permalink
Standardize go variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenWeathers committed Oct 3, 2024
1 parent c4bddb4 commit 608baec
Show file tree
Hide file tree
Showing 101 changed files with 4,160 additions and 4,163 deletions.
4 changes: 2 additions & 2 deletions docs/swagger/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6383,7 +6383,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
"description": "Remove a battle from the team",
"description": "Remove a poker game from the team",
"produces": [
"application/json"
],
Expand All @@ -6401,7 +6401,7 @@ const docTemplate = `{
},
{
"type": "string",
"description": "the battle ID",
"description": "the game ID",
"name": "battleId",
"in": "path",
"required": true
Expand Down
4 changes: 2 additions & 2 deletions docs/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -6375,7 +6375,7 @@
"ApiKeyAuth": []
}
],
"description": "Remove a battle from the team",
"description": "Remove a poker game from the team",
"produces": [
"application/json"
],
Expand All @@ -6393,7 +6393,7 @@
},
{
"type": "string",
"description": "the battle ID",
"description": "the game ID",
"name": "battleId",
"in": "path",
"required": true
Expand Down
4 changes: 2 additions & 2 deletions docs/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5880,14 +5880,14 @@ paths:
- team
/teams/{teamId}/battles/{battleId}:
delete:
description: Remove a battle from the team
description: Remove a poker game from the team
parameters:
- description: the team ID
in: path
name: teamId
required: true
type: string
- description: the battle ID
- description: the game ID
in: path
name: battleId
required: true
Expand Down
8 changes: 4 additions & 4 deletions internal/cookie/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ func createJsonCookieValue(value any) (string, error) {
}

// CreateUserCookie creates the users CookieService
func (s *CookieService) CreateUserCookie(w http.ResponseWriter, UserID string) error {
return s.CreateCookie(w, s.config.SecureCookieName, UserID, int(time.Hour.Seconds()*24*365))
func (s *CookieService) CreateUserCookie(w http.ResponseWriter, userID string) error {
return s.CreateCookie(w, s.config.SecureCookieName, userID, int(time.Hour.Seconds()*24*365))
}

// CreateSessionCookie creates the user's session CookieService
func (s *CookieService) CreateSessionCookie(w http.ResponseWriter, SessionID string) error {
return s.CreateCookie(w, s.config.SessionCookieName, SessionID, int(time.Hour.Seconds()*24*30))
func (s *CookieService) CreateSessionCookie(w http.ResponseWriter, sessionID string) error {
return s.CreateCookie(w, s.config.SessionCookieName, sessionID, int(time.Hour.Seconds()*24*30))
}

// CreateUserUICookie creates the user's frontend UI cookie
Expand Down
72 changes: 36 additions & 36 deletions internal/db/admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Service struct {

// GetAppStats gets counts of common application metrics such as users and poker games
func (d *Service) GetAppStats(ctx context.Context) (*thunderdome.ApplicationStats, error) {
var Appstats thunderdome.ApplicationStats
var appStats thunderdome.ApplicationStats

err := d.DB.QueryRowContext(ctx, `
SELECT
Expand Down Expand Up @@ -57,44 +57,44 @@ func (d *Service) GetAppStats(ctx context.Context) (*thunderdome.ApplicationStat
(SELECT COUNT(*) FROM thunderdome.retro_template WHERE team_id IS NOT NULL) AS team_retro_template_count
;`,
).Scan(
&Appstats.UnregisteredCount,
&Appstats.RegisteredCount,
&Appstats.PokerCount,
&Appstats.PokerStoryCount,
&Appstats.OrganizationCount,
&Appstats.DepartmentCount,
&Appstats.TeamCount,
&Appstats.APIKeyCount,
&Appstats.ActivePokerCount,
&Appstats.ActivePokerUserCount,
&Appstats.TeamCheckinsCount,
&Appstats.RetroCount,
&Appstats.ActiveRetroCount,
&Appstats.ActiveRetroUserCount,
&Appstats.RetroItemCount,
&Appstats.RetroActionCount,
&Appstats.StoryboardCount,
&Appstats.ActiveStoryboardCount,
&Appstats.ActiveStoryboardUserCount,
&Appstats.StoryboardGoalCount,
&Appstats.StoryboardColumnCount,
&Appstats.StoryboardStoryCount,
&Appstats.StoryboardPersonaCount,
&Appstats.EstimationScaleCount,
&Appstats.PublicEstimationScaleCount,
&Appstats.OrganizationEstimationScaleCount,
&Appstats.TeamEstimationScaleCount,
&Appstats.UserSubscriptionActiveCount,
&Appstats.TeamSubscriptionActiveCount,
&Appstats.OrgSubscriptionActiveCount,
&Appstats.RetroTemplateCount,
&Appstats.PublicRetroTemplateCount,
&Appstats.OrganizationRetroTemplateCount,
&Appstats.TeamRetroTemplateCount,
&appStats.UnregisteredCount,
&appStats.RegisteredCount,
&appStats.PokerCount,
&appStats.PokerStoryCount,
&appStats.OrganizationCount,
&appStats.DepartmentCount,
&appStats.TeamCount,
&appStats.APIKeyCount,
&appStats.ActivePokerCount,
&appStats.ActivePokerUserCount,
&appStats.TeamCheckinsCount,
&appStats.RetroCount,
&appStats.ActiveRetroCount,
&appStats.ActiveRetroUserCount,
&appStats.RetroItemCount,
&appStats.RetroActionCount,
&appStats.StoryboardCount,
&appStats.ActiveStoryboardCount,
&appStats.ActiveStoryboardUserCount,
&appStats.StoryboardGoalCount,
&appStats.StoryboardColumnCount,
&appStats.StoryboardStoryCount,
&appStats.StoryboardPersonaCount,
&appStats.EstimationScaleCount,
&appStats.PublicEstimationScaleCount,
&appStats.OrganizationEstimationScaleCount,
&appStats.TeamEstimationScaleCount,
&appStats.UserSubscriptionActiveCount,
&appStats.TeamSubscriptionActiveCount,
&appStats.OrgSubscriptionActiveCount,
&appStats.RetroTemplateCount,
&appStats.PublicRetroTemplateCount,
&appStats.OrganizationRetroTemplateCount,
&appStats.TeamRetroTemplateCount,
)
if err != nil {
return nil, fmt.Errorf("unable to get application stats: %v", err)
}

return &Appstats, nil
return &appStats, nil
}
62 changes: 31 additions & 31 deletions internal/db/alert/alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Service struct {

// GetActiveAlerts gets a list of active global alerts
func (d *Service) GetActiveAlerts(ctx context.Context) []interface{} {
Alerts := make([]interface{}, 0)
alerts := make([]interface{}, 0)

rows, err := d.DB.QueryContext(ctx,
`SELECT id, name, type, content, active, allow_dismiss, registered_only FROM thunderdome.alert WHERE active IS TRUE;`,
Expand All @@ -31,7 +31,7 @@ func (d *Service) GetActiveAlerts(ctx context.Context) []interface{} {
var a thunderdome.Alert

if err := rows.Scan(
&a.Id,
&a.ID,
&a.Name,
&a.Type,
&a.Content,
Expand All @@ -41,23 +41,23 @@ func (d *Service) GetActiveAlerts(ctx context.Context) []interface{} {
); err != nil {
d.Logger.Ctx(ctx).Error("GetActiveAlerts row scan error", zap.Error(err))
} else {
Alerts = append(Alerts, &a)
alerts = append(alerts, &a)
}
}
}

return Alerts
return alerts
}

// AlertsList gets a list of global alerts
func (d *Service) AlertsList(ctx context.Context, Limit int, Offset int) ([]*thunderdome.Alert, int, error) {
Alerts := make([]*thunderdome.Alert, 0)
var AlertCount int
func (d *Service) AlertsList(ctx context.Context, limit int, offset int) ([]*thunderdome.Alert, int, error) {
alerts := make([]*thunderdome.Alert, 0)
var alertCount int

e := d.DB.QueryRowContext(ctx,
"SELECT COUNT(*) FROM thunderdome.alert;",
).Scan(
&AlertCount,
&alertCount,
)
if e != nil {
d.Logger.Ctx(ctx).Error("AlertsList query scan error", zap.Error(e))
Expand All @@ -69,8 +69,8 @@ func (d *Service) AlertsList(ctx context.Context, Limit int, Offset int) ([]*thu
LIMIT $1
OFFSET $2;
`,
Limit,
Offset,
limit,
offset,
)

if err == nil {
Expand All @@ -79,7 +79,7 @@ func (d *Service) AlertsList(ctx context.Context, Limit int, Offset int) ([]*thu
var a thunderdome.Alert

if err := rows.Scan(
&a.Id,
&a.ID,
&a.Name,
&a.Type,
&a.Content,
Expand All @@ -89,28 +89,28 @@ func (d *Service) AlertsList(ctx context.Context, Limit int, Offset int) ([]*thu
&a.CreatedDate,
&a.UpdatedDate,
); err != nil {
return nil, AlertCount, fmt.Errorf("AlertsList row scan error: %v", err)
return nil, alertCount, fmt.Errorf("AlertsList row scan error: %v", err)
} else {
Alerts = append(Alerts, &a)
alerts = append(alerts, &a)
}
}
}

return Alerts, AlertCount, err
return alerts, alertCount, err
}

// AlertsCreate creates a global alert
func (d *Service) AlertsCreate(ctx context.Context, Name string, Type string, Content string, Active bool, AllowDismiss bool, RegisteredOnly bool) error {
func (d *Service) AlertsCreate(ctx context.Context, name string, alertType string, content string, active bool, allowDismiss bool, registeredOnly bool) error {
if _, err := d.DB.ExecContext(ctx,
`INSERT INTO thunderdome.alert (name, type, content, active, allow_dismiss, registered_only)
VALUES ($1, $2, $3, $4, $5, $6);
`,
Name,
Type,
Content,
Active,
AllowDismiss,
RegisteredOnly,
name,
alertType,
content,
active,
allowDismiss,
registeredOnly,
); err != nil {
return fmt.Errorf("error creating new alert: %v", err)
}
Expand All @@ -119,20 +119,20 @@ func (d *Service) AlertsCreate(ctx context.Context, Name string, Type string, Co
}

// AlertsUpdate updates a global alert
func (d *Service) AlertsUpdate(ctx context.Context, ID string, Name string, Type string, Content string, Active bool, AllowDismiss bool, RegisteredOnly bool) error {
func (d *Service) AlertsUpdate(ctx context.Context, alertID string, name string, alertType string, content string, active bool, allowDismiss bool, registeredOnly bool) error {
if _, err := d.DB.ExecContext(ctx,
`
UPDATE thunderdome.alert
SET name = $2, type = $3, content = $4, active = $5, allow_dismiss = $6, registered_only = $7
WHERE id = $1;
`,
ID,
Name,
Type,
Content,
Active,
AllowDismiss,
RegisteredOnly,
alertID,
name,
alertType,
content,
active,
allowDismiss,
registeredOnly,
); err != nil {
return fmt.Errorf("error updating alert: %v", err)
}
Expand All @@ -141,10 +141,10 @@ func (d *Service) AlertsUpdate(ctx context.Context, ID string, Name string, Type
}

// AlertDelete deletes a global alert
func (d *Service) AlertDelete(ctx context.Context, AlertID string) error {
func (d *Service) AlertDelete(ctx context.Context, alertID string) error {
_, err := d.DB.ExecContext(ctx,
`DELETE FROM thunderdome.alert WHERE id = $1;`,
AlertID,
alertID,
)

if err != nil {
Expand Down
Loading

0 comments on commit 608baec

Please sign in to comment.