Documentation
¶
Index ¶
- func AuthMiddleware(tokenMaker token.Maker) gin.HandlerFunc
- func AuthorizeMiddleware(authorize authorization.AuthorizationService) gin.HandlerFunc
- type Server
- func (s *Server) CreateCompany(c *gin.Context)
- func (s *Server) CreateProject(c *gin.Context)
- func (s *Server) CreateTask(c *gin.Context)
- func (s *Server) CreateUser(ctx *gin.Context)
- func (s *Server) DeleteTask(c *gin.Context)
- func (s *Server) GetTask(c *gin.Context)
- func (s *Server) GetTaskListByProject(c *gin.Context)
- func (s *Server) LoginUser(ctx *gin.Context)
- func (s *Server) PayForATask(c *gin.Context)
- func (server *Server) Start(address string) error
- func (s *Server) UpdateTask(c *gin.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthMiddleware ¶
func AuthMiddleware(tokenMaker token.Maker) gin.HandlerFunc
func AuthorizeMiddleware ¶
func AuthorizeMiddleware(authorize authorization.AuthorizationService) gin.HandlerFunc
Authorize determines if current subject has been authorized to take an action on an object.
Types ¶
type Server ¶
func NewServer ¶
func NewServer(config util.Config, service service.TaskService, authorize authorization.AuthorizationService, policies authorization.PolicyManagementService) (*Server, error)
NewServer creates a new HTTP server and set up routing.
func (*Server) CreateCompany ¶
CreateCompany godoc @Summary Create a company @Description Creates a company @Tags company @Accept json @Produce json @Param request body db.CreateCompanyParams true "company creation parameter" @Success 200 {object} domain.Company @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /companies [post] @Security BearerAuth
func (*Server) CreateProject ¶
CreateProject godoc @Summary Create a project @Description create a project @Tags projects @Produce json @Param companyId path int true "Company ID" @Param request body db.CreateProjectParam true "project creation parameters" @Success 200 {object} domain.Project @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /company/{companyId}/projects/ [post] @Security BearerAuth
func (*Server) CreateTask ¶
CreateTask godoc @Summary Create a Task @Description Create a tasks @Tags tasks @Accept json @Produce json @Param projectId path int true "Project ID" @Param companyId path int true "Company ID" @Param request body db.CreateTaskParams true "task creation parameter" @Success 200 {object} domain.Task @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /company/{companyId}/projects/{projectId}/tasks/ [post] @Security BearerAuth
func (*Server) CreateUser ¶
CreateUser godoc @Summary Create a User @Description Create a user @Tags users @Accept json @Produce json @Param request body createUserRequest true "user creation parameters" @Success 200 {object} domain.User @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /users/ [post]
func (*Server) DeleteTask ¶
DeleteTask godoc @Summary Delete a Task by its ID @Description delete a task by its ID @Tags tasks @Produce json @Param taskId path int true "Task ID" @Param projectId path int true "Project ID" @Param companyId path int true "Company ID" @Success 202 @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /company/{companyId}/projects/{projectId}/tasks/{taskId} [delete] @Security BearerAuth
func (*Server) GetTask ¶
GetTask godoc @Summary Get a Task by its ID @Description get a task by its ID @Tags tasks @Produce json @Param taskId path int true "Task ID" @Param projectId path int true "Project ID" @Param companyId path int true "Company ID" @Success 200 {object} domain.Task @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /company/{companyId}/projects/{projectId}/tasks/{taskId} [get] @Security BearerAuth
func (*Server) GetTaskListByProject ¶
GetTaskList godoc @Summary Get all Tasks by its Project ID @Description get aall tasks by its Project ID @Tags tasks @Produce json @Param projectId path int true "Project ID" @Param companyId path int true "Company ID" @Success 200 {object} []domain.Task @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /company/{companyId}/projects/{projectId}/tasks/ [get] @Security BearerAuth
func (*Server) LoginUser ¶
LoginUser godoc @Summary Logs an user in @Description Logs an user in @Tags users @Accept json @Produce json @Param request body loginUserRequest true "user creation parameters" @Success 200 {object} loginUserResponse @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /users/login [post]
func (*Server) PayForATask ¶
Createpayment godoc @Summary Pay for a task @Description Adds a payment source and a payment amout for a task @Tags tasks @Accept json @Produce json @Param taskId path int true "Task ID" @Param projectId path int true "Project ID" @Param companyId path int true "Company ID" @Param request body db.CreateTaskPaymentParams true "payment source" @Success 200 {object} domain.TaskPayment @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /payment/{paymentId}/projects/{projectId}/payment/{taskId} [post] @Security BearerAuth
func (*Server) UpdateTask ¶
UpdateTask godoc @Summary Update a Task @Description Updates a tasks @Tags tasks @Accept json @Produce json @Param taskId path int true "Task ID" @Param projectId path int true "Project ID" @Param companyId path int true "Company ID" @Param request body db.UpdateTaskParams true "task update parameter" @Success 200 {object} domain.Task @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /company/{companyId}/projects/{projectId}/tasks/{taskId} [post] @Security BearerAuth