From fb8ac92abfacb510b8d5fa4fff03b37362d5b499 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 12 Apr 2020 22:48:46 +0200 Subject: [PATCH] Change all json fields to snake_case --- pkg/models/list_team.go | 2 +- pkg/models/list_users.go | 2 +- pkg/models/namespace_team.go | 2 +- pkg/models/tasks.go | 20 ++++++++++---------- pkg/models/teams.go | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pkg/models/list_team.go b/pkg/models/list_team.go index e78f8c6f0f..b3bb0e21d2 100644 --- a/pkg/models/list_team.go +++ b/pkg/models/list_team.go @@ -26,7 +26,7 @@ type TeamList struct { // The unique, numeric id of this list <-> team relation. ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"` // The team id. - TeamID int64 `xorm:"int(11) not null INDEX" json:"teamID" param:"team"` + TeamID int64 `xorm:"int(11) not null INDEX" json:"team_id" param:"team"` // The list id. ListID int64 `xorm:"int(11) not null INDEX" json:"-" param:"list"` // The right this team has. 0 = Read only, 1 = Read & Write, 2 = Admin. See the docs for more details. diff --git a/pkg/models/list_users.go b/pkg/models/list_users.go index d322d36663..9fdc01eb9a 100644 --- a/pkg/models/list_users.go +++ b/pkg/models/list_users.go @@ -27,7 +27,7 @@ type ListUser struct { // The unique, numeric id of this list <-> user relation. ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"namespace"` // The username. - Username string `xorm:"-" json:"userID" param:"user"` + Username string `xorm:"-" json:"user_id" param:"user"` // Used internally to reference the user UserID int64 `xorm:"int(11) not null INDEX" json:"-"` // The list id. diff --git a/pkg/models/namespace_team.go b/pkg/models/namespace_team.go index f7f3852a0d..8029e6e541 100644 --- a/pkg/models/namespace_team.go +++ b/pkg/models/namespace_team.go @@ -26,7 +26,7 @@ type TeamNamespace struct { // The unique, numeric id of this namespace <-> team relation. ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"` // The team id. - TeamID int64 `xorm:"int(11) not null INDEX" json:"teamID" param:"team"` + TeamID int64 `xorm:"int(11) not null INDEX" json:"team_id" param:"team"` // The namespace id. NamespaceID int64 `xorm:"int(11) not null INDEX" json:"-" param:"namespace"` // The right this team has. 0 = Read only, 1 = Read & Write, 2 = Admin. See the docs for more details. diff --git a/pkg/models/tasks.go b/pkg/models/tasks.go index ba0717973f..99a4989bf9 100644 --- a/pkg/models/tasks.go +++ b/pkg/models/tasks.go @@ -41,30 +41,30 @@ type Task struct { // Whether a task is done or not. Done bool `xorm:"INDEX null" json:"done"` // The time when a task was marked as done. - DoneAt timeutil.TimeStamp `xorm:"INDEX null 'done_at_unix'" json:"doneAt"` + DoneAt timeutil.TimeStamp `xorm:"INDEX null 'done_at_unix'" json:"done_at"` // The time when the task is due. - DueDate timeutil.TimeStamp `xorm:"int(11) INDEX null 'due_date_unix'" json:"dueDate"` + DueDate timeutil.TimeStamp `xorm:"int(11) INDEX null 'due_date_unix'" json:"due_date"` // An array of datetimes when the user wants to be reminded of the task. - Reminders []timeutil.TimeStamp `xorm:"-" json:"reminderDates"` + Reminders []timeutil.TimeStamp `xorm:"-" json:"reminder_dates"` CreatedByID int64 `xorm:"int(11) not null" json:"-"` // ID of the user who put that task on the list // The list this task belongs to. - ListID int64 `xorm:"int(11) INDEX not null" json:"listID" param:"list"` + ListID int64 `xorm:"int(11) INDEX not null" json:"list_id" param:"list"` // An amount in seconds this task repeats itself. If this is set, when marking the task as done, it will mark itself as "undone" and then increase all remindes and the due date by its amount. - RepeatAfter int64 `xorm:"int(11) INDEX null" json:"repeatAfter"` + RepeatAfter int64 `xorm:"int(11) INDEX null" json:"repeat_after"` // The task priority. Can be anything you want, it is possible to sort by this later. Priority int64 `xorm:"int(11) null" json:"priority"` // When this task starts. - StartDate timeutil.TimeStamp `xorm:"int(11) INDEX null 'start_date_unix'" json:"startDate" query:"-"` + StartDate timeutil.TimeStamp `xorm:"int(11) INDEX null 'start_date_unix'" json:"start_date" query:"-"` // When this task ends. - EndDate timeutil.TimeStamp `xorm:"int(11) INDEX null 'end_date_unix'" json:"endDate" query:"-"` + EndDate timeutil.TimeStamp `xorm:"int(11) INDEX null 'end_date_unix'" json:"end_date" query:"-"` // An array of users who are assigned to this task Assignees []*user.User `xorm:"-" json:"assignees"` // An array of labels which are associated with this task. Labels []*Label `xorm:"-" json:"labels"` // The task color in hex - HexColor string `xorm:"varchar(6) null" json:"hexColor" valid:"runelength(0|6)" maxLength:"6"` + HexColor string `xorm:"varchar(6) null" json:"hex_color" valid:"runelength(0|6)" maxLength:"6"` // Determines how far a task is left from being done - PercentDone float64 `xorm:"DOUBLE null" json:"percentDone"` + PercentDone float64 `xorm:"DOUBLE null" json:"percent_done"` // The task identifier, based on the list identifier and the task's index Identifier string `xorm:"-" json:"identifier"` @@ -86,7 +86,7 @@ type Task struct { Updated timeutil.TimeStamp `xorm:"updated not null" json:"updated"` // The user who initially created the task. - CreatedBy *user.User `xorm:"-" json:"createdBy" valid:"-"` + CreatedBy *user.User `xorm:"-" json:"created_by" valid:"-"` web.CRUDable `xorm:"-" json:"-"` web.Rights `xorm:"-" json:"-"` diff --git a/pkg/models/teams.go b/pkg/models/teams.go index 9f79877f1d..f1dbabf142 100644 --- a/pkg/models/teams.go +++ b/pkg/models/teams.go @@ -35,7 +35,7 @@ type Team struct { CreatedByID int64 `xorm:"int(11) not null INDEX" json:"-"` // The user who created this team. - CreatedBy *user.User `xorm:"-" json:"createdBy"` + CreatedBy *user.User `xorm:"-" json:"created_by"` // An array of all members in this team. Members []*TeamUser `xorm:"-" json:"members"`