api

package
v0.0.0-...-723301f Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

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

type Server struct {
	Router *gin.Engine
	// contains filtered or unexported fields
}

func NewServer

NewServer creates a new HTTP server and set up routing.

func (*Server) CreateCompany

func (s *Server) CreateCompany(c *gin.Context)

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

func (s *Server) CreateProject(c *gin.Context)

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

func (s *Server) CreateTask(c *gin.Context)

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

func (s *Server) CreateUser(ctx *gin.Context)

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

func (s *Server) DeleteTask(c *gin.Context)

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

func (s *Server) GetTask(c *gin.Context)

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

func (s *Server) GetTaskListByProject(c *gin.Context)

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

func (s *Server) LoginUser(ctx *gin.Context)

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

func (s *Server) PayForATask(c *gin.Context)

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) Start

func (server *Server) Start(address string) error

Start runs the HTTP server on a specific address.

func (*Server) UpdateTask

func (s *Server) UpdateTask(c *gin.Context)

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

Jump to

Keyboard shortcuts

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