Refactor {List|Namespace}{User|Team} to not expose unneded values via json (#52)

This commit is contained in:
konrad 2019-01-14 22:32:56 +00:00 committed by Gitea
parent cf0b0a2853
commit 19218b28a2
12 changed files with 87 additions and 164 deletions

View file

@ -154,7 +154,7 @@ Sorry for some of them being in German, I'll tranlate them at some point.
### Refactor
* [x] ListTaskRights, sollte überall gleich funktionieren, gibt ja mittlerweile auch eine Methode um liste von nem Task aus zu kriegen oder so
* [ ] Re-check all `{List|Namespace}{User|Team}` if really all parameters need to be exposed via json or are overwritten via param anyway.
* [x] Re-check all `{List|Namespace}{User|Team}` if really all parameters need to be exposed via json or are overwritten via param anyway.
### Vikunja web

View file

@ -1,6 +1,6 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2019-01-10 00:01:27.123040428 +0100 CET m=+0.110268080
// 2019-01-14 23:02:47.994258682 +0100 CET m=+0.170768570
package docs
@ -14,7 +14,7 @@ import (
var doc = `{
"swagger": "2.0",
"info": {
"description": "This is the documentation for the [Vikunja](http://vikunja.io) API. Vikunja is a cross-plattform Todo-application with a lot of features, such as sharing lists with users or teams. \u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e\n# Authorization\n**JWT-Auth:** Main authorization method, used for most of the requests. Needs ` + "`" + `Authorization: Bearer \u003cjwt-token\u003e` + "`" + `-header to authenticate successfully.\n\n**BasicAuth:** Only used when requesting tasks via caldav.\n\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e",
"description": "\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e",
"title": "Vikunja API",
"contact": {
"name": "General Vikunja contact",
@ -37,7 +37,7 @@ var doc = `{
"JWTKeyAuth": []
}
],
"description": "Returns all labels which are either created by the user or associated with a task the user has at least read-access to.",
"description": "Returns an array with all assignees for this task.",
"consumes": [
"application/json"
],
@ -45,9 +45,9 @@ var doc = `{
"application/json"
],
"tags": [
"labels"
"assignees"
],
"summary": "Get all labels a user has access to",
"summary": "Get all assignees for a task",
"parameters": [
{
"type": "integer",
@ -57,18 +57,18 @@ var doc = `{
},
{
"type": "string",
"description": "Search labels by label text.",
"description": "Search assignees by their username.",
"name": "s",
"in": "query"
}
],
"responses": {
"200": {
"description": "The labels",
"description": "The assignees",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Label"
"$ref": "#/definitions/models.User"
}
}
},
@ -3799,6 +3799,7 @@ var doc = `{
"maxLength": 250
},
"done": {
"description": "Whether a task is done or not.",
"type": "boolean"
},
"dueDate": {
@ -3820,10 +3821,6 @@ var doc = `{
"$ref": "#/definitions/models.Label"
}
},
"listID": {
"description": "The list this task belongs to.",
"type": "integer"
},
"parentTaskID": {
"description": "If the task is a subtask, this is the id of its parent.",
"type": "integer"
@ -3997,6 +3994,7 @@ var doc = `{
"maxLength": 250
},
"done": {
"description": "Whether a task is done or not.",
"type": "boolean"
},
"dueDate": {
@ -4018,10 +4016,6 @@ var doc = `{
"$ref": "#/definitions/models.Label"
}
},
"listID": {
"description": "The list this task belongs to.",
"type": "integer"
},
"parentTaskID": {
"description": "If the task is a subtask, this is the id of its parent.",
"type": "integer"
@ -4086,10 +4080,6 @@ var doc = `{
"description": "The unique, numeric id of this list \u003c-\u003e user relation.",
"type": "integer"
},
"list_id": {
"description": "The list id.",
"type": "integer"
},
"right": {
"description": "The right this user has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.",
"type": "integer",
@ -4100,7 +4090,7 @@ var doc = `{
"description": "A unix timestamp when this relation was last updated. You cannot change this value.",
"type": "integer"
},
"user_id": {
"userID": {
"description": "The user id.",
"type": "integer"
}
@ -4159,10 +4149,6 @@ var doc = `{
"description": "The unique, numeric id of this namespace \u003c-\u003e user relation.",
"type": "integer"
},
"namespace_id": {
"description": "The namespace id",
"type": "integer"
},
"right": {
"description": "The right this user has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.",
"type": "integer",
@ -4173,7 +4159,7 @@ var doc = `{
"description": "A unix timestamp when this relation was last updated. You cannot change this value.",
"type": "integer"
},
"user_id": {
"userID": {
"description": "The user id.",
"type": "integer"
}
@ -4247,7 +4233,7 @@ var doc = `{
"description": "A unix timestamp when this relation was created. You cannot change this value.",
"type": "integer"
},
"created_by": {
"createdBy": {
"description": "The user who created this team.",
"type": "object",
"$ref": "#/definitions/models.User"
@ -4292,17 +4278,13 @@ var doc = `{
"description": "The unique, numeric id of this list \u003c-\u003e team relation.",
"type": "integer"
},
"list_id": {
"description": "The list id.",
"type": "integer"
},
"right": {
"description": "The right this team has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.",
"type": "integer",
"default": 0,
"maximum": 2
},
"team_id": {
"teamID": {
"description": "The team id.",
"type": "integer"
},
@ -4327,11 +4309,7 @@ var doc = `{
"description": "The unique, numeric id of this team member relation.",
"type": "integer"
},
"team_id": {
"description": "The team id.",
"type": "integer"
},
"user_id": {
"userID": {
"description": "The id of the member.",
"type": "integer"
}
@ -4348,17 +4326,13 @@ var doc = `{
"description": "The unique, numeric id of this namespace \u003c-\u003e team relation.",
"type": "integer"
},
"namespace_id": {
"description": "The namespace id.",
"type": "integer"
},
"right": {
"description": "The right this team has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.",
"type": "integer",
"default": 0,
"maximum": 2
},
"team_id": {
"teamID": {
"description": "The team id.",
"type": "integer"
},
@ -4380,7 +4354,7 @@ var doc = `{
"type": "integer"
},
"email": {
"description": "The user's email address",
"description": "The user's email address.",
"type": "string",
"maxLength": 250
},
@ -4393,7 +4367,7 @@ var doc = `{
"type": "integer"
},
"username": {
"description": "The username of the username. Is always unique.",
"description": "The username of the user. Is always unique.",
"type": "string",
"maxLength": 250,
"minLength": 3
@ -4407,7 +4381,7 @@ var doc = `{
"description": "A unix timestamp when this relation was created. You cannot change this value.",
"type": "integer"
},
"created_by": {
"createdBy": {
"description": "The user who created this team.",
"type": "object",
"$ref": "#/definitions/models.User"
@ -4452,7 +4426,7 @@ var doc = `{
"type": "integer"
},
"email": {
"description": "The user's email address",
"description": "The user's email address.",
"type": "string",
"maxLength": 250
},
@ -4465,7 +4439,7 @@ var doc = `{
"type": "integer"
},
"username": {
"description": "The username of the username. Is always unique.",
"description": "The username of the user. Is always unique.",
"type": "string",
"maxLength": 250,
"minLength": 3
@ -4493,7 +4467,7 @@ var doc = `{
"type": "integer"
},
"email": {
"description": "The user's email address",
"description": "The user's email address.",
"type": "string",
"maxLength": 250
},
@ -4509,7 +4483,7 @@ var doc = `{
"type": "integer"
},
"username": {
"description": "The username of the username. Is always unique.",
"description": "The username of the user. Is always unique.",
"type": "string",
"maxLength": 250,
"minLength": 3

View file

@ -1,7 +1,7 @@
{
"swagger": "2.0",
"info": {
"description": "This is the documentation for the [Vikunja](http://vikunja.io) API. Vikunja is a cross-plattform Todo-application with a lot of features, such as sharing lists with users or teams. \u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e\n# Authorization\n**JWT-Auth:** Main authorization method, used for most of the requests. Needs ` + \"`\" + `Authorization: Bearer \u003cjwt-token\u003e` + \"`\" + `-header to authenticate successfully.\n\n**BasicAuth:** Only used when requesting tasks via caldav.\n\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e",
"description": "\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e",
"title": "Vikunja API",
"contact": {
"name": "General Vikunja contact",
@ -24,7 +24,7 @@
"JWTKeyAuth": []
}
],
"description": "Returns all labels which are either created by the user or associated with a task the user has at least read-access to.",
"description": "Returns an array with all assignees for this task.",
"consumes": [
"application/json"
],
@ -32,9 +32,9 @@
"application/json"
],
"tags": [
"labels"
"assignees"
],
"summary": "Get all labels a user has access to",
"summary": "Get all assignees for a task",
"parameters": [
{
"type": "integer",
@ -44,18 +44,18 @@
},
{
"type": "string",
"description": "Search labels by label text.",
"description": "Search assignees by their username.",
"name": "s",
"in": "query"
}
],
"responses": {
"200": {
"description": "The labels",
"description": "The assignees",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Label"
"$ref": "#/definitions/models.User"
}
}
},
@ -3785,6 +3785,7 @@
"maxLength": 250
},
"done": {
"description": "Whether a task is done or not.",
"type": "boolean"
},
"dueDate": {
@ -3806,10 +3807,6 @@
"$ref": "#/definitions/models.Label"
}
},
"listID": {
"description": "The list this task belongs to.",
"type": "integer"
},
"parentTaskID": {
"description": "If the task is a subtask, this is the id of its parent.",
"type": "integer"
@ -3983,6 +3980,7 @@
"maxLength": 250
},
"done": {
"description": "Whether a task is done or not.",
"type": "boolean"
},
"dueDate": {
@ -4004,10 +4002,6 @@
"$ref": "#/definitions/models.Label"
}
},
"listID": {
"description": "The list this task belongs to.",
"type": "integer"
},
"parentTaskID": {
"description": "If the task is a subtask, this is the id of its parent.",
"type": "integer"
@ -4072,10 +4066,6 @@
"description": "The unique, numeric id of this list \u003c-\u003e user relation.",
"type": "integer"
},
"list_id": {
"description": "The list id.",
"type": "integer"
},
"right": {
"description": "The right this user has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.",
"type": "integer",
@ -4086,7 +4076,7 @@
"description": "A unix timestamp when this relation was last updated. You cannot change this value.",
"type": "integer"
},
"user_id": {
"userID": {
"description": "The user id.",
"type": "integer"
}
@ -4145,10 +4135,6 @@
"description": "The unique, numeric id of this namespace \u003c-\u003e user relation.",
"type": "integer"
},
"namespace_id": {
"description": "The namespace id",
"type": "integer"
},
"right": {
"description": "The right this user has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.",
"type": "integer",
@ -4159,7 +4145,7 @@
"description": "A unix timestamp when this relation was last updated. You cannot change this value.",
"type": "integer"
},
"user_id": {
"userID": {
"description": "The user id.",
"type": "integer"
}
@ -4233,7 +4219,7 @@
"description": "A unix timestamp when this relation was created. You cannot change this value.",
"type": "integer"
},
"created_by": {
"createdBy": {
"description": "The user who created this team.",
"type": "object",
"$ref": "#/definitions/models.User"
@ -4278,17 +4264,13 @@
"description": "The unique, numeric id of this list \u003c-\u003e team relation.",
"type": "integer"
},
"list_id": {
"description": "The list id.",
"type": "integer"
},
"right": {
"description": "The right this team has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.",
"type": "integer",
"default": 0,
"maximum": 2
},
"team_id": {
"teamID": {
"description": "The team id.",
"type": "integer"
},
@ -4313,11 +4295,7 @@
"description": "The unique, numeric id of this team member relation.",
"type": "integer"
},
"team_id": {
"description": "The team id.",
"type": "integer"
},
"user_id": {
"userID": {
"description": "The id of the member.",
"type": "integer"
}
@ -4334,17 +4312,13 @@
"description": "The unique, numeric id of this namespace \u003c-\u003e team relation.",
"type": "integer"
},
"namespace_id": {
"description": "The namespace id.",
"type": "integer"
},
"right": {
"description": "The right this team has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.",
"type": "integer",
"default": 0,
"maximum": 2
},
"team_id": {
"teamID": {
"description": "The team id.",
"type": "integer"
},
@ -4366,7 +4340,7 @@
"type": "integer"
},
"email": {
"description": "The user's email address",
"description": "The user's email address.",
"type": "string",
"maxLength": 250
},
@ -4379,7 +4353,7 @@
"type": "integer"
},
"username": {
"description": "The username of the username. Is always unique.",
"description": "The username of the user. Is always unique.",
"type": "string",
"maxLength": 250,
"minLength": 3
@ -4393,7 +4367,7 @@
"description": "A unix timestamp when this relation was created. You cannot change this value.",
"type": "integer"
},
"created_by": {
"createdBy": {
"description": "The user who created this team.",
"type": "object",
"$ref": "#/definitions/models.User"
@ -4438,7 +4412,7 @@
"type": "integer"
},
"email": {
"description": "The user's email address",
"description": "The user's email address.",
"type": "string",
"maxLength": 250
},
@ -4451,7 +4425,7 @@
"type": "integer"
},
"username": {
"description": "The username of the username. Is always unique.",
"description": "The username of the user. Is always unique.",
"type": "string",
"maxLength": 250,
"minLength": 3
@ -4479,7 +4453,7 @@
"type": "integer"
},
"email": {
"description": "The user's email address",
"description": "The user's email address.",
"type": "string",
"maxLength": 250
},
@ -4495,7 +4469,7 @@
"type": "integer"
},
"username": {
"description": "The username of the username. Is always unique.",
"description": "The username of the user. Is always unique.",
"type": "string",
"maxLength": 250,
"minLength": 3

View file

@ -49,6 +49,7 @@ definitions:
maxLength: 250
type: string
done:
description: Whether a task is done or not.
type: boolean
dueDate:
description: A unix timestamp when the task is due.
@ -64,9 +65,6 @@ definitions:
items:
$ref: '#/definitions/models.Label'
type: array
listID:
description: The list this task belongs to.
type: integer
parentTaskID:
description: If the task is a subtask, this is the id of its parent.
type: integer
@ -207,6 +205,7 @@ definitions:
maxLength: 250
type: string
done:
description: Whether a task is done or not.
type: boolean
dueDate:
description: A unix timestamp when the task is due.
@ -222,9 +221,6 @@ definitions:
items:
$ref: '#/definitions/models.Label'
type: array
listID:
description: The list this task belongs to.
type: integer
parentTaskID:
description: If the task is a subtask, this is the id of its parent.
type: integer
@ -277,9 +273,6 @@ definitions:
id:
description: The unique, numeric id of this list <-> user relation.
type: integer
list_id:
description: The list id.
type: integer
right:
default: 0
description: The right this user has. 0 = Read only, 1 = Read & Write, 2 =
@ -290,7 +283,7 @@ definitions:
description: A unix timestamp when this relation was last updated. You cannot
change this value.
type: integer
user_id:
userID:
description: The user id.
type: integer
type: object
@ -336,9 +329,6 @@ definitions:
id:
description: The unique, numeric id of this namespace <-> user relation.
type: integer
namespace_id:
description: The namespace id
type: integer
right:
default: 0
description: The right this user has. 0 = Read only, 1 = Read & Write, 2 =
@ -349,7 +339,7 @@ definitions:
description: A unix timestamp when this relation was last updated. You cannot
change this value.
type: integer
user_id:
userID:
description: The user id.
type: integer
type: object
@ -405,7 +395,7 @@ definitions:
description: A unix timestamp when this relation was created. You cannot change
this value.
type: integer
created_by:
createdBy:
$ref: '#/definitions/models.User'
description: The user who created this team.
type: object
@ -441,16 +431,13 @@ definitions:
id:
description: The unique, numeric id of this list <-> team relation.
type: integer
list_id:
description: The list id.
type: integer
right:
default: 0
description: The right this team has. 0 = Read only, 1 = Read & Write, 2 =
Admin. See the docs for more details.
maximum: 2
type: integer
team_id:
teamID:
description: The team id.
type: integer
updated:
@ -471,10 +458,7 @@ definitions:
id:
description: The unique, numeric id of this team member relation.
type: integer
team_id:
description: The team id.
type: integer
user_id:
userID:
description: The id of the member.
type: integer
type: object
@ -487,16 +471,13 @@ definitions:
id:
description: The unique, numeric id of this namespace <-> team relation.
type: integer
namespace_id:
description: The namespace id.
type: integer
right:
default: 0
description: The right this team has. 0 = Read only, 1 = Read & Write, 2 =
Admin. See the docs for more details.
maximum: 2
type: integer
team_id:
teamID:
description: The team id.
type: integer
updated:
@ -515,7 +496,7 @@ definitions:
this value.
type: integer
email:
description: The user's email address
description: The user's email address.
maxLength: 250
type: string
id:
@ -526,7 +507,7 @@ definitions:
change this value.
type: integer
username:
description: The username of the username. Is always unique.
description: The username of the user. Is always unique.
maxLength: 250
minLength: 3
type: string
@ -537,7 +518,7 @@ definitions:
description: A unix timestamp when this relation was created. You cannot change
this value.
type: integer
created_by:
createdBy:
$ref: '#/definitions/models.User'
description: The user who created this team.
type: object
@ -573,7 +554,7 @@ definitions:
this value.
type: integer
email:
description: The user's email address
description: The user's email address.
maxLength: 250
type: string
id:
@ -584,7 +565,7 @@ definitions:
change this value.
type: integer
username:
description: The username of the username. Is always unique.
description: The username of the user. Is always unique.
maxLength: 250
minLength: 3
type: string
@ -605,7 +586,7 @@ definitions:
this value.
type: integer
email:
description: The user's email address
description: The user's email address.
maxLength: 250
type: string
id:
@ -618,7 +599,7 @@ definitions:
change this value.
type: integer
username:
description: The username of the username. Is always unique.
description: The username of the user. Is always unique.
maxLength: 250
minLength: 3
type: string
@ -641,13 +622,7 @@ info:
email: hello@vikunja.io
name: General Vikunja contact
url: http://vikunja.io/en/contact/
description: |-
This is the documentation for the [Vikunja](http://vikunja.io) API. Vikunja is a cross-plattform Todo-application with a lot of features, such as sharing lists with users or teams. <!-- ReDoc-Inject: <security-definitions> -->
# Authorization
**JWT-Auth:** Main authorization method, used for most of the requests. Needs ` + "`" + `Authorization: Bearer <jwt-token>` + "`" + `-header to authenticate successfully.
**BasicAuth:** Only used when requesting tasks via caldav.
<!-- ReDoc-Inject: <security-definitions> -->
description: '<!-- ReDoc-Inject: <security-definitions> -->'
license:
name: GPLv3
url: http://code.vikunja.io/api/src/branch/master/LICENSE
@ -658,15 +633,14 @@ paths:
get:
consumes:
- application/json
description: Returns all labels which are either created by the user or associated
with a task the user has at least read-access to.
description: Returns an array with all assignees for this task.
parameters:
- description: The page number. Used for pagination. If not provided, the first
page of results is returned.
in: query
name: p
type: integer
- description: Search labels by label text.
- description: Search assignees by their username.
in: query
name: s
type: string
@ -674,10 +648,10 @@ paths:
- application/json
responses:
"200":
description: The labels
description: The assignees
schema:
items:
$ref: '#/definitions/models.Label'
$ref: '#/definitions/models.User'
type: array
"500":
description: Internal error
@ -686,9 +660,9 @@ paths:
type: object
security:
- JWTKeyAuth: []
summary: Get all labels a user has access to
summary: Get all assignees for a task
tags:
- labels
- assignees
put:
consumes:
- application/json

View file

@ -24,7 +24,7 @@ import (
// LabelTask represents a relation between a label and a task
type LabelTask struct {
// The unique, numeric id of this label.
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"`
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"-"`
TaskID int64 `xorm:"int(11) INDEX not null" json:"-" param:"listtask"`
// The label id you want to associate with a task.
LabelID int64 `xorm:"int(11) INDEX not null" json:"label_id" param:"label"`

View file

@ -29,6 +29,7 @@ type ListTask struct {
Text string `xorm:"varchar(250)" json:"text" valid:"runelength(3|250)" minLength:"3" maxLength:"250"`
// The task description.
Description string `xorm:"varchar(250)" json:"description" valid:"runelength(0|250)" maxLength:"250"`
// Whether a task is done or not.
Done bool `xorm:"INDEX" json:"done"`
// A unix timestamp when the task is due.
DueDateUnix int64 `xorm:"int(11) INDEX" json:"dueDate"`
@ -36,7 +37,7 @@ type ListTask struct {
RemindersUnix []int64 `xorm:"JSON TEXT" json:"reminderDates"`
CreatedByID int64 `xorm:"int(11)" json:"-"` // ID of the user who put that task on the list
// The list this task belongs to.
ListID int64 `xorm:"int(11) INDEX" json:"listID" param:"list"`
ListID int64 `xorm:"int(11) INDEX" json:"-" 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" json:"repeatAfter"`
// If the task is a subtask, this is the id of its parent.

View file

@ -23,9 +23,9 @@ 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 user id.
UserID int64 `xorm:"int(11) not null INDEX" json:"user_id" param:"user"`
UserID int64 `xorm:"int(11) not null INDEX" json:"userID" param:"user"`
// The list id.
ListID int64 `xorm:"int(11) not null INDEX" json:"list_id" param:"list"`
ListID int64 `xorm:"int(11) not null INDEX" json:"-" param:"list"`
// The right this user has. 0 = Read only, 1 = Read & Write, 2 = Admin. See the docs for more details.
Right UserRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)" maximum:"2" default:"0"`

View file

@ -23,9 +23,9 @@ type NamespaceUser struct {
// The unique, numeric id of this namespace <-> user relation.
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"namespace"`
// The user id.
UserID int64 `xorm:"int(11) not null INDEX" json:"user_id" param:"user"`
UserID int64 `xorm:"int(11) not null INDEX" json:"userID" param:"user"`
// The namespace id
NamespaceID int64 `xorm:"int(11) not null INDEX" json:"namespace_id" param:"namespace"`
NamespaceID int64 `xorm:"int(11) not null INDEX" json:"-" param:"namespace"`
// The right this user has. 0 = Read only, 1 = Read & Write, 2 = Admin. See the docs for more details.
Right UserRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)" maximum:"2" default:"0"`

View file

@ -23,9 +23,9 @@ 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:"team_id" param:"team"`
TeamID int64 `xorm:"int(11) not null INDEX" json:"teamID" param:"team"`
// The list id.
ListID int64 `xorm:"int(11) not null INDEX" json:"list_id" param:"list"`
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.
Right TeamRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)" maximum:"2" default:"0"`

View file

@ -23,9 +23,9 @@ 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:"team_id" param:"team"`
TeamID int64 `xorm:"int(11) not null INDEX" json:"teamID" param:"team"`
// The namespace id.
NamespaceID int64 `xorm:"int(11) not null INDEX" json:"namespace_id" param:"namespace"`
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.
Right TeamRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)" maximum:"2" default:"0"`

View file

@ -29,7 +29,7 @@ type Team struct {
CreatedByID int64 `xorm:"int(11) not null INDEX" json:"-"`
// The user who created this team.
CreatedBy User `xorm:"-" json:"created_by"`
CreatedBy User `xorm:"-" json:"createdBy"`
// An array of all members in this team.
Members []*TeamUser `xorm:"-" json:"members"`
@ -65,9 +65,9 @@ type TeamMember struct {
// The unique, numeric id of this team member 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:"team_id" param:"team"`
TeamID int64 `xorm:"int(11) not null INDEX" json:"-" param:"team"`
// The id of the member.
UserID int64 `xorm:"int(11) not null INDEX" json:"user_id" param:"user"`
UserID int64 `xorm:"int(11) not null INDEX" json:"userID" param:"user"`
// Whether or not the member is an admin of the team. See the docs for more about what a team admin can do
Admin bool `xorm:"tinyint(1) INDEX" json:"admin"`

View file

@ -31,19 +31,19 @@ import (
// UserLogin Object to recive user credentials in JSON format
type UserLogin struct {
// The username used to log in.
Username string `json:"username" form:"username"`
Username string `json:"username"`
// The password for the user.
Password string `json:"password" form:"password"`
Password string `json:"password"`
}
// User holds information about an user
type User struct {
// The unique, numeric id of this user.
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"`
// The username of the username. Is always unique.
// The username of the user. Is always unique.
Username string `xorm:"varchar(250) not null unique" json:"username" valid:"length(3|250)" minLength:"3" maxLength:"250"`
Password string `xorm:"varchar(250) not null" json:"-"`
// The user's email address
// The user's email address.
Email string `xorm:"varchar(250)" json:"email" valid:"email,length(0|250)" maxLength:"250"`
IsActive bool `json:"-"`