services

package
v0.0.0-...-a66885a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusContinue                      = 100 // RFC 7231, 6.2.1
	StatusSwitchingProtocols            = 101 // RFC 7231, 6.2.2
	StatusProcessing                    = 102 // RFC 2518, 10.1
	StatusEarlyHints                    = 103 // RFC 8297
	StatusOK                            = 200 // RFC 7231, 6.3.1
	StatusCreated                       = 201 // RFC 7231, 6.3.2
	StatusAccepted                      = 202 // RFC 7231, 6.3.3
	StatusNonAuthoritativeInformation   = 203 // RFC 7231, 6.3.4
	StatusNoContent                     = 204 // RFC 7231, 6.3.5
	StatusResetContent                  = 205 // RFC 7231, 6.3.6
	StatusPartialContent                = 206 // RFC 7233, 4.1
	StatusMultiStatus                   = 207 // RFC 4918, 11.1
	StatusAlreadyReported               = 208 // RFC 5842, 7.1
	StatusIMUsed                        = 226 // RFC 3229, 10.4.1
	StatusMultipleChoices               = 300 // RFC 7231, 6.4.1
	StatusMovedPermanently              = 301 // RFC 7231, 6.4.2
	StatusFound                         = 302 // RFC 7231, 6.4.3
	StatusSeeOther                      = 303 // RFC 7231, 6.4.4
	StatusNotModified                   = 304 // RFC 7232, 4.1
	StatusUseProxy                      = 305 // RFC 7231, 6.4.5
	StatusTemporaryRedirect             = 307 // RFC 7231, 6.4.7
	StatusPermanentRedirect             = 308 // RFC 7538, 3
	StatusBadRequest                    = 400 // RFC 7231, 6.5.1
	StatusUnauthorized                  = 401 // RFC 7235, 3.1
	StatusPaymentRequired               = 402 // RFC 7231, 6.5.2
	StatusForbidden                     = 403 // RFC 7231, 6.5.3
	StatusNotFound                      = 404 // RFC 7231, 6.5.4
	StatusMethodNotAllowed              = 405 // RFC 7231, 6.5.5
	StatusNotAcceptable                 = 406 // RFC 7231, 6.5.6
	StatusProxyAuthRequired             = 407 // RFC 7235, 3.2
	StatusRequestTimeout                = 408 // RFC 7231, 6.5.7
	StatusConflict                      = 409 // RFC 7231, 6.5.8
	StatusGone                          = 410 // RFC 7231, 6.5.9
	StatusLengthRequired                = 411 // RFC 7231, 6.5.10
	StatusPreconditionFailed            = 412 // RFC 7232, 4.2
	StatusRequestEntityTooLarge         = 413 // RFC 7231, 6.5.11
	StatusRequestURITooLong             = 414 // RFC 7231, 6.5.12
	StatusUnsupportedMediaType          = 415 // RFC 7231, 6.5.13
	StatusRequestedRangeNotSatisfiable  = 416 // RFC 7233, 4.4
	StatusExpectationFailed             = 417 // RFC 7231, 6.5.14
	StatusTeapot                        = 418 // RFC 7168, 2.3.3
	StatusMisdirectedRequest            = 421 // RFC 7540, 9.1.2
	StatusUnprocessableEntity           = 422 // RFC 4918, 11.2
	StatusLocked                        = 423 // RFC 4918, 11.3
	StatusFailedDependency              = 424 // RFC 4918, 11.4
	StatusTooEarly                      = 425 // RFC 8470, 5.2.
	StatusUpgradeRequired               = 426 // RFC 7231, 6.5.15
	StatusPreconditionRequired          = 428 // RFC 6585, 3
	StatusTooManyRequests               = 429 // RFC 6585, 4
	StatusRequestHeaderFieldsTooLarge   = 431 // RFC 6585, 5
	StatusUnavailableForLegalReasons    = 451 // RFC 7725, 3
	StatusInternalServerError           = 500 // RFC 7231, 6.6.1
	StatusNotImplemented                = 501 // RFC 7231, 6.6.2
	StatusBadGateway                    = 502 // RFC 7231, 6.6.3
	StatusServiceUnavailable            = 503 // RFC 7231, 6.6.4
	StatusGatewayTimeout                = 504 // RFC 7231, 6.6.5
	StatusHTTPVersionNotSupported       = 505 // RFC 7231, 6.6.6
	StatusVariantAlsoNegotiates         = 506 // RFC 2295, 8.1
	StatusInsufficientStorage           = 507 // RFC 4918, 11.5
	StatusLoopDetected                  = 508 // RFC 5842, 7.2
	StatusNotExtended                   = 510 // RFC 2774, 7
	StatusNetworkAuthenticationRequired = 511 // RFC 6585, 6

	DbResultNotFound = "sql: no rows in result set"
)

HTTP status codes were copied from net/http.

View Source
const (
	UsernameTestDB = "postgres"
	PasswordTestDB = "1234"
	HostTestDB     = "localhost"
	PortTestDB     = "5432"
	DBnameTestDB   = "yak_test_db"
	SslmodeTestDB  = "disable"
)

tests

View Source
const (
	IsProject            = 1
	IsBoard              = 2
	ErrPermsIsNotDefined = "Permissions is not defined"
	ErrPermsIncor        = "Permissions are set incorrectly"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Board

type Board interface {
	Create(userId, projectId int, board *models.Board) *models.ApiResponse
	GetAll(userId, projectId int) *models.ApiResponse
	GetById(userId, projectId, boardId int) *models.ApiResponse
	Delete(userId, projectId, boardId int) *models.ApiResponse
	Update(userId, projectId, boardId int, board *models.UpdateBoard) *models.ApiResponse
	GetMembers(userId, projectId, boardId int) *models.ApiResponse
}

type BoardPerms

type BoardPerms interface {
	Create(userId, projectId, boardId int, memberNickname string, permissions *models.Permission) *models.ApiResponse
	Get(userId, projectId, boardId, memberId int) *models.ApiResponse
	Delete(userId, projectId, boardId, memberId int) *models.ApiResponse
	Update(userId, projectId, boardId, memberId int, list *models.UpdatePermission) *models.ApiResponse
}

type BoardPermsService

type BoardPermsService struct {
	// contains filtered or unexported fields
}

func NewBoardPermsService

func NewBoardPermsService(repo repositories.ObjectPerms, boardRepo repositories.Board,
	projectRepo repositories.Project) *BoardPermsService

func (*BoardPermsService) Create

func (s *BoardPermsService) Create(userId, projectId, boardId int, memberNickname string, boardPerms *models.Permission) *models.ApiResponse

func (*BoardPermsService) Delete

func (s *BoardPermsService) Delete(userId, projectId, boardId, memberId int) *models.ApiResponse

func (*BoardPermsService) Get

func (s *BoardPermsService) Get(userId, projectId, boardId, memberId int) *models.ApiResponse

func (*BoardPermsService) Update

func (s *BoardPermsService) Update(userId, projectId, boardId, memberId int, boardPerms *models.UpdatePermission) *models.ApiResponse

type BoardService

type BoardService struct {
	// contains filtered or unexported fields
}

func NewBoardService

func NewBoardService(repo repositories.Board, projectRepo repositories.Project) *BoardService

func (*BoardService) Create

func (s *BoardService) Create(userId, projectId int, board *models.Board) *models.ApiResponse

func (*BoardService) Delete

func (s *BoardService) Delete(userId, projectId, boardId int) *models.ApiResponse

func (*BoardService) GetAll

func (s *BoardService) GetAll(userId, projectId int) *models.ApiResponse

func (*BoardService) GetById

func (s *BoardService) GetById(userId, projectId, boardId int) *models.ApiResponse

func (*BoardService) GetMembers

func (s *BoardService) GetMembers(userId, projectId, boardId int) *models.ApiResponse

func (*BoardService) Update

func (s *BoardService) Update(userId, projectId, boardId int, board *models.UpdateBoard) *models.ApiResponse

type Label

type Label interface {
	Create(userId, projectId, boardId int, label *models.Label) *models.ApiResponse
	CreateInTask(userId, projectId, boardId, taskId, labelId int) *models.ApiResponse
	GetAllInTask(userId, projectId, boardId, taskId int) *models.ApiResponse
	GetAll(userId, projectId, boardId int) *models.ApiResponse
	GetById(userId, projectId, boardId, labelId int) *models.ApiResponse
	DeleteInTask(userId, projectId, boardId, taskId, labelId int) *models.ApiResponse
	Delete(userId, projectId, boardId, labelId int) *models.ApiResponse
	Update(userId, projectId, boardId, labelId int, label *models.UpdateLabel) *models.ApiResponse
}

type LabelService

type LabelService struct {
	// contains filtered or unexported fields
}

func NewLabelService

func NewLabelService(repo repositories.Label, boardRepo repositories.Board, projectRepo repositories.Project) *LabelService

func (*LabelService) Create

func (s *LabelService) Create(userId, projectId, boardId int, label *models.Label) *models.ApiResponse

func (*LabelService) CreateInTask

func (s *LabelService) CreateInTask(userId, projectId, boardId, taskId, labelId int) *models.ApiResponse

func (*LabelService) Delete

func (s *LabelService) Delete(userId, projectId, boardId, labelId int) *models.ApiResponse

func (*LabelService) DeleteInTask

func (s *LabelService) DeleteInTask(userId, projectId, boardId, taskId, labelId int) *models.ApiResponse

func (*LabelService) GetAll

func (s *LabelService) GetAll(userId, projectId, boardId int) *models.ApiResponse

func (*LabelService) GetAllInTask

func (s *LabelService) GetAllInTask(userId, projectId, boardId, taskId int) *models.ApiResponse

func (*LabelService) GetById

func (s *LabelService) GetById(userId, projectId, boardId, labelId int) *models.ApiResponse

func (*LabelService) Update

func (s *LabelService) Update(userId, projectId, boardId, labelId int, label *models.UpdateLabel) *models.ApiResponse

type Map

type Map map[string]interface{}

type Project

type Project interface {
	Create(userId int, project *models.Project) *models.ApiResponse
	GetAll(userId int) *models.ApiResponse
	GetById(userId, projectId int) *models.ApiResponse
	Delete(userId, projectId int) *models.ApiResponse
	Update(userId, projectId int, project *models.UpdateProject) *models.ApiResponse
	GetMembers(userId, projectId int) *models.ApiResponse
}

type ProjectPerms

type ProjectPerms interface {
	Create(userId, projectId int, memberNickname string, permissions *models.Permission) *models.ApiResponse
	Get(userId, projectId, memberId int) *models.ApiResponse
	Delete(userId, projectId, memberId int) *models.ApiResponse
	Update(userId, projectId, memberId int, list *models.UpdatePermission) *models.ApiResponse
}

type ProjectPermsService

type ProjectPermsService struct {
	// contains filtered or unexported fields
}

func NewProjectPermsService

func NewProjectPermsService(repo repositories.ObjectPerms, projectRepo repositories.Project, boardRepo repositories.Board) *ProjectPermsService

func (*ProjectPermsService) Create

func (s *ProjectPermsService) Create(userId, projectId int, memberNickname string, projectPerms *models.Permission) *models.ApiResponse

func (*ProjectPermsService) Delete

func (s *ProjectPermsService) Delete(userId, projectId, memberId int) *models.ApiResponse

func (*ProjectPermsService) Get

func (s *ProjectPermsService) Get(userId, projectId, memberId int) *models.ApiResponse

func (*ProjectPermsService) Update

func (s *ProjectPermsService) Update(userId, projectId, memberId int, projectPerms *models.UpdatePermission) *models.ApiResponse

type ProjectService

type ProjectService struct {
	// contains filtered or unexported fields
}

func NewProjectService

func NewProjectService(repo repositories.Project) *ProjectService

func (*ProjectService) Create

func (s *ProjectService) Create(userId int, project *models.Project) *models.ApiResponse

func (*ProjectService) Delete

func (s *ProjectService) Delete(userId, projectId int) *models.ApiResponse

func (*ProjectService) GetAll

func (s *ProjectService) GetAll(userId int) *models.ApiResponse

func (*ProjectService) GetById

func (s *ProjectService) GetById(userId, projectId int) *models.ApiResponse

func (*ProjectService) GetMembers

func (s *ProjectService) GetMembers(userId, projectId int) *models.ApiResponse

func (*ProjectService) Update

func (s *ProjectService) Update(userId, projectId int, project *models.UpdateProject) *models.ApiResponse

type Task

type Task interface {
	Create(userId, projectId, boardId, listId int, list *models.Task) *models.ApiResponse
	GetAll(userId, projectId, boardId, listId int) *models.ApiResponse
	GetById(userId, projectId, boardId, listId, taskId int) *models.ApiResponse
	Delete(userId, projectId, boardId, listId, taskId int) *models.ApiResponse
	Update(userId, projectId, boardId, listId, taskId int, list *models.UpdateTask) *models.ApiResponse
}

type TaskList

type TaskList interface {
	Create(userId, projectId, boardId int, list *models.TaskList) *models.ApiResponse
	GetAll(userId, projectId, boardId int) *models.ApiResponse
	GetById(userId, projectId, boardId, listId int) *models.ApiResponse
	Delete(userId, projectId, boardId, listId int) *models.ApiResponse
	Update(userId, projectId, boardId, listId int, list *models.UpdateTaskList) *models.ApiResponse
}

type TaskListService

type TaskListService struct {
	// contains filtered or unexported fields
}

func NewTaskListService

func NewTaskListService(repo repositories.TaskList, boardRepo repositories.Board, projectRepo repositories.Project) *TaskListService

func (*TaskListService) Create

func (s *TaskListService) Create(userId, projectId, boardId int, list *models.TaskList) *models.ApiResponse

func (*TaskListService) Delete

func (s *TaskListService) Delete(userId, projectId, boardId, listId int) *models.ApiResponse

func (*TaskListService) GetAll

func (s *TaskListService) GetAll(userId, projectId, boardId int) *models.ApiResponse

func (*TaskListService) GetById

func (s *TaskListService) GetById(userId, projectId, boardId, listId int) *models.ApiResponse

func (*TaskListService) Update

func (s *TaskListService) Update(userId, projectId, boardId, listId int, list *models.UpdateTaskList) *models.ApiResponse

type TaskService

type TaskService struct {
	// contains filtered or unexported fields
}

func NewTaskService

func NewTaskService(repo repositories.Task, boardRepo repositories.Board, projectRepo repositories.Project) *TaskService

func (*TaskService) Create

func (s *TaskService) Create(userId, projectId, boardId, listId int, task *models.Task) *models.ApiResponse

func (*TaskService) Delete

func (s *TaskService) Delete(userId, projectId, boardId, listId, taskId int) *models.ApiResponse

func (*TaskService) GetAll

func (s *TaskService) GetAll(userId, projectId, boardId, listId int) *models.ApiResponse

func (*TaskService) GetById

func (s *TaskService) GetById(userId, projectId, boardId, listId, taksId int) *models.ApiResponse

func (*TaskService) Update

func (s *TaskService) Update(userId, projectId, boardId, listId, taskId int, task *models.UpdateTask) *models.ApiResponse

type UrlValidator

type UrlValidator interface {
	Validation(urlIds *models.UrlIds) *models.ApiResponse
}

type UrlValidatorService

type UrlValidatorService struct {
	// contains filtered or unexported fields
}

func NewUrlValidatorService

func NewUrlValidatorService(boardRepo repositories.Board, listRepo repositories.TaskList,
	taskRepo repositories.Task) *UrlValidatorService

func (*UrlValidatorService) Validation

func (s *UrlValidatorService) Validation(urlIds *models.UrlIds) *models.ApiResponse

type User

type User interface {
	GetAll() ([]*models.User, error)
	Get(id int) *models.ApiResponse
	Create(user *models.User) *models.ApiResponse
	GenerateToken(username, password string) *models.ApiResponse
	ParseToken(token string) (int, error)
	SignOut(token string) *models.ApiResponse
	Update(id int, profile *models.UpdateUser) *models.ApiResponse
}

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

func NewUserService

func NewUserService(repo repositories.User) *UserService

func (*UserService) Create

func (s *UserService) Create(user *models.User) *models.ApiResponse

func (*UserService) GenerateToken

func (s *UserService) GenerateToken(nickname, password string) *models.ApiResponse

func (*UserService) Get

func (s *UserService) Get(id int) *models.ApiResponse

func (*UserService) GetAll

func (s *UserService) GetAll() ([]*models.User, error)

func (*UserService) ParseToken

func (s *UserService) ParseToken(accessToken string) (int, error)

func (*UserService) SignOut

func (s *UserService) SignOut(token string) *models.ApiResponse

func (*UserService) Update

func (s *UserService) Update(id int, profile *models.UpdateUser) *models.ApiResponse

Directories

Path Synopsis
Package mock_services is a generated GoMock package.
Package mock_services is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL