Documentation ¶
Index ¶
- Constants
- type CreateGroupRequest
- type CreateGroupResponse
- type CreateInviteRequest
- type CreateInviteResponse
- type CreateInviteViaGroupRequest
- type CreateTokenRequest
- type CreateTokenResponse
- type CreateUserResponse
- type Error
- type GetMeResponse
- type GetTasksResponse
- type Group
- type GroupInUser
- type RegisterUserRequest
- type Role
- type Task
- type TaskCreateRequest
- type Token
- type User
- type UserInGroup
Constants ¶
const ( PermReadRelated = iota PermReadAll PermCreate PermChangeRelated PermChangeAll )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateGroupRequest ¶
type CreateGroupRequest struct { // Name must be unique string. Name will be used Name string `json:"name"` // Description is additional info about group. // For example a Company name or any other meta info. Description string `json:"description"` }
CreateGroupRequest ...
type CreateGroupResponse ¶
type CreateGroupResponse struct { // ID is primary key of group. ID uuid.UUID `json:"id"` // Name is unique name of group. Name string `json:"name"` // Description is short info about group. Description string `json:"description"` // CreatedAt is creation time in UNIX format CreatedAt int64 `json:"created-at"` }
CreateGroupResponse represents group object that was stored in service.
type CreateInviteRequest ¶
type CreateInviteRequest struct { Group uuid.UUID `json:"group" example:"00000000-0000-0000-0000-000000000000"` Limit int `json:"limit" example:"2"` Member int `json:"members-permission" example:"4"` Task int `json:"tasks-permission" example:"4"` Review int `json:"reviews-permission" example:"4"` Comment int `json:"comments-permission" example:"4"` }
CreateInviteRequest represents data that must be passed by user to create invite.
type CreateInviteResponse ¶
type CreateInviteResponse struct { // Link is invite link to group. Link string `` /* 151-byte string literal not displayed */ // Limit is count of available usages of invite link. Limit int `json:"limit" example:"2"` }
CreateInviteResponse is response returned to user.
type CreateInviteViaGroupRequest ¶
type CreateInviteViaGroupRequest struct { // Limit is count of available usages of invite link Limit int `json:"limit" example:"2"` // Member is role of user. // // There are permissions: // 0 - user can affect(read/update) only related objects; // 1 - user can read all object. // 2 - user can create new objects (invite users); // 3 - user can change/delete users who was invited by whose; // 4 - user can affect all users. Member int `json:"members-permission" example:"4"` // Task is role of user. // // Permissions: // 0 - read related; // 1 - read all; // 2 create; // 3 - update/delete related; // 4 - delete all; Task int `json:"tasks-permission" example:"4"` // Review is role of user. // // Permissions: // 0 - read related; // 1 - read all; // 2 - create; // 3 - update/delete related; // 4 - update/delete any; Review int `json:"reviews-permission" example:"4"` // Comment is role of user. // // Permissions: // 0 - read related; // 1 - read all; // 2 - create; // 3 - update/delete related; // 4 - update/delete any; Comment int `json:"comments-permission" example:"4"` }
CreateInviteViaGroupRequest is response object to create invite.
type CreateTokenRequest ¶
type CreateTokenRequest struct { // Email is user email Email string `json:"email" example:"user@example.com"` // Password is password of user. Password string `json:"password" example:"strong_password"` TokenType string `json:"token-type" example:"bearer"` }
CreateTokenRequest ...
type CreateTokenResponse ¶
type CreateTokenResponse struct { TokenType string `json:"token_type"` AccessToken string `json:"access_token"` }
CreateTokenResponse is request object which will return to user on token create.
type CreateUserResponse ¶
type CreateUserResponse struct { ID uuid.UUID `json:"id" example:"00000000-0000-0000-0000-000000000000"` Email string `json:"email" example:"user@example.com"` }
CreateUserResponse ...
type Error ¶
type Error struct { Err string `json:"error" example:"short summary info about error"` Field string `json:"field" example:"additional info about error"` }
Error is abstract error response type.
type GetMeResponse ¶
type GetMeResponse struct { ID uuid.UUID `json:"id"` Email string `json:"email"` Groups []GroupInUser `json:"groups,omitempty"` }
GetMeResponse ...
type GetTasksResponse ¶
GetTasksResponse ...
type Group ¶
type Group struct { ID uuid.UUID Name string Description string CreatedAt time.Time Owner uuid.UUID }
Group is abstract view of group.
type GroupInUser ¶
type GroupInUser struct { ID uuid.UUID `json:"id"` Name string `json:"name"` Description string `json:"description"` Tasks []*Task `json:"tasks,omitempty"` }
GroupInUser is short info about group.
type RegisterUserRequest ¶
type RegisterUserRequest struct { // Email is user email Email string `json:"email" example:"user@example.com"` // Password is password string Password string `json:"password" example:"strong_password"` }
RegisterUserRequest ...
type Task ¶
type Task struct { ID uuid.UUID `json:"id"` Name string `json:"name"` Description string `json:"description"` CreatedAt time.Time `json:"-"` CreatedBy uuid.UUID `json:"created-by"` Status string `json:"status"` }
Task ...
func (*Task) MarshalJSON ¶
MarshalJSON implements json.Marshaler. Used to pass correct time layout to user.
func (*Task) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler. That gives developer flexibility to not thing about correct time layout passed into.
type TaskCreateRequest ¶
type TaskCreateRequest struct { // Name is name of task. Name string `json:"name"` // Description - is verbose info about task. Could be any string. Description string `json:"description"` // Users - field which relating users to task. // If not defined, will create task only for user, who creates this task or for group. Users []uuid.UUID `json:"users"` // Group - optional filed that show group to which task will be related. Group *uuid.UUID `json:"group"` }
TaskCreateRequest ...