Documentation ¶
Index ¶
- func CreateFile(db *gorm.DB, ownerID uuid.UUID, ownerType string, fileInfo models.FileInfo) (*models.File, error)
- func DeleteFile(db *gorm.DB, fileID uuid.UUID) error
- func File(fileParams types.RouteParams)
- func GetFile(db *gorm.DB, fileID uuid.UUID) (*models.File, error)
- func GetFiles(db *gorm.DB, pageInfo fiberpaginate.PageInfo) ([]models.File, error)
- func UpdateFile(db *gorm.DB, fileID uuid.UUID, fileInfo models.FileInfo) (*models.File, error)
- type CreateFileRequestBody
- type FileController
- type FileService
- func (f *FileService) CreateFile(fileBody *CreateFileRequestBody, fileHeader *multipart.FileHeader) (*models.File, error)
- func (f *FileService) DeleteFile(fileID string) error
- func (f *FileService) GetFile(fileID string) (*models.File, error)
- func (f *FileService) GetFiles(pageInfo fiberpaginate.PageInfo) ([]models.File, error)
- type FileServiceInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFile ¶
func File ¶
func File(fileParams types.RouteParams)
Types ¶
type CreateFileRequestBody ¶
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 CreateFileRequestBody true "File" @Success 201 {object} models.File @Failure 400 {object} error @Failure 401 {object} error @Failure 404 {object} error @Failure 500 {object} 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} error @Failure 401 {object} error @Failure 404 {object} error @Failure 500 {object} 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} error @Failure 401 {object} error @Failure 404 {object} error @Failure 500 {object} 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} error @Failure 401 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /files/ [get]
type FileService ¶
type FileService struct {
types.ServiceParams
}
func (*FileService) CreateFile ¶
func (f *FileService) CreateFile(fileBody *CreateFileRequestBody, fileHeader *multipart.FileHeader) (*models.File, error)
func (*FileService) DeleteFile ¶
func (f *FileService) DeleteFile(fileID string) error
func (*FileService) GetFiles ¶
func (f *FileService) GetFiles(pageInfo fiberpaginate.PageInfo) ([]models.File, error)
type FileServiceInterface ¶
type FileServiceInterface interface { GetFiles(pageInfo fiberpaginate.PageInfo) ([]models.File, error) GetFile(fileID string) (*models.File, error) CreateFile(fileBody *CreateFileRequestBody, formFile *multipart.FileHeader) (*models.File, error) DeleteFile(fileID string) error }
func NewFileService ¶
func NewFileService(serviceParams types.ServiceParams) FileServiceInterface