taskcontroller

package
v0.0.0-...-8735fdd Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateTaskDTO

type CreateTaskDTO struct {
	Repo string
}

type CreateTaskResponse

type CreateTaskResponse struct {
	TaskID uint              `json:"taskID"`
	Status models.TaskStatus `json:"status"`
}

func (*CreateTaskResponse) Render

type TaskController

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

func New

func New(taskService TaskService) *TaskController

func (*TaskController) Create

func (c *TaskController) Create(w http.ResponseWriter, r *http.Request)

Create a new task

@Summary		Create a new task
@Description	Create a new task for a specific repository
@Tags			tasks
@Security		ApiKeyAuth
@Accept			json
@Produce		json
@Param			body	body		CreateTaskDTO	true	"Request body to create a task"
@Success		201		{object}	CreateTaskResponse
@Failure		400		{object}	errors.ErrResponse	"Invalid JSON or missing required fields"
@Failure		500		{object}	errors.ErrResponse	"Internal server error"
@Router			/tasks [post]

func (*TaskController) Upload

func (c *TaskController) Upload(w http.ResponseWriter, r *http.Request)

Upload handles file uploads for a specific task.

@Summary		Upload files to a task
@Description	Upload multiple files associated with a specific task ID. Each file must be less than 10MB.
@Tags			tasks
@Security		ApiKeyAuth
@Accept			multipart/form-data
@Produce		json
@Param			taskID	path		string				true	"Task ID"
@Param			files	formData	file				true	"Files to upload"
@Success		200		{object}	TaskUploadResponse	"Successful file upload"
@Failure		400		{object}	errors.ErrResponse	"Bad Request or File too large"
@Failure		500		{object}	errors.ErrResponse	"Internal Server Error"
@Router			/tasks/{taskID}/upload [post]

type TaskService

type TaskService interface {
	Create(repo string) (*models.Task, error)
	Upload(input *taskservice.TaskUploadInput) error
}

type TaskUploadResponse

type TaskUploadResponse struct {
	TaskID     string `json:"taskID"`
	StatusText string `json:"status"`
}

func (*TaskUploadResponse) Render

Jump to

Keyboard shortcuts

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