base

package
v0.0.0-...-702f6d9 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFile

func CreateFile(db *gorm.DB, ownerID uuid.UUID, ownerType string, fileInfo models.FileInfo) (*models.File, *errors.Error)

func DeleteFile

func DeleteFile(db *gorm.DB, fileID uuid.UUID) *errors.Error

func File

func File(fileParams types.RouteParams)

func GetFile

func GetFile(db *gorm.DB, fileID uuid.UUID) (*models.File, *errors.Error)

func GetFiles

func GetFiles(db *gorm.DB, limit, page int) ([]models.File, *errors.Error)

func UpdateFile

func UpdateFile(db *gorm.DB, fileID uuid.UUID, fileInfo models.FileInfo) (*models.File, *errors.Error)

Types

type FileController

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

func NewFileController

func NewFileController(fileService FileServiceInterface) *FileController

func (*FileController) CreateFile

func (f *FileController) CreateFile(c *fiber.Ctx) error

CreateFile godoc

@Summary Create a file @Description Creates a file @ID create-file @Tags file @Accept multipart/form-data @Produce json @Param file body models.CreateFileRequestBody true "File" @Success 201 {object} models.File @Failure 400 {object} errors.Error @Failure 401 {object} errors.Error @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Router /files/ [post]

func (*FileController) DeleteFile

func (f *FileController) DeleteFile(c *fiber.Ctx) error

DeleteFile godoc

@Summary Delete a file @Description Deletes a file @ID delete-file @Tags file @Produce json @Param fileID path string true "File ID" @Success 201 {object} models.File @Failure 400 {object} errors.Error @Failure 401 {object} errors.Error @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Router /files/:fileID [delete]

func (*FileController) GetFile

func (f *FileController) GetFile(c *fiber.Ctx) error

GetFile godoc

@Summary Retrieve a file @Description Retrieves a file @ID get-file @Tags file @Produce json @Param fileID path string true "File ID" @Success 200 {object} models.File @Failure 400 {object} errors.Error @Failure 401 {object} errors.Error @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Router /files/:fileID [get]

func (*FileController) GetFiles

func (f *FileController) GetFiles(c *fiber.Ctx) error

GetFiles godoc

@Summary Retrieve all files @Description Retrieves all files @ID get-files @Tags file @Produce json @Param limit query int false "Limit" @Param page query int false "Page" @Success 200 {object} []models.File @Failure 400 {object} errors.Error @Failure 401 {object} errors.Error @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Router /files/ [get]

type FileService

type FileService struct {
	types.ServiceParams
}

func (*FileService) CreateFile

func (f *FileService) CreateFile(fileBody *models.CreateFileRequestBody, fileHeader *multipart.FileHeader) (*models.File, *errors.Error)

func (*FileService) DeleteFile

func (f *FileService) DeleteFile(fileID string) *errors.Error

func (*FileService) GetFile

func (f *FileService) GetFile(fileID string) (*models.File, *errors.Error)

func (*FileService) GetFiles

func (f *FileService) GetFiles(limit string, page string) ([]models.File, *errors.Error)

type FileServiceInterface

type FileServiceInterface interface {
	GetFiles(limit string, page string) ([]models.File, *errors.Error)
	GetFile(fileID string) (*models.File, *errors.Error)
	CreateFile(fileBody *models.CreateFileRequestBody, formFile *multipart.FileHeader) (*models.File, *errors.Error)
	DeleteFile(fileID string) *errors.Error
}

func NewFileService

func NewFileService(serviceParams types.ServiceParams) FileServiceInterface

Jump to

Keyboard shortcuts

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