Documentation ¶
Index ¶
- func CreateFile(db *gorm.DB, ownerID uuid.UUID, ownerType string, fileInfo models.FileInfo) (*models.File, *errors.Error)
- func DeleteFile(db *gorm.DB, fileID uuid.UUID) *errors.Error
- func File(fileParams types.RouteParams)
- func GetFile(db *gorm.DB, fileID uuid.UUID) (*models.File, *errors.Error)
- func GetFiles(db *gorm.DB, limit, page int) ([]models.File, *errors.Error)
- func UpdateFile(db *gorm.DB, fileID uuid.UUID, fileInfo models.FileInfo) (*models.File, *errors.Error)
- type FileController
- type FileService
- func (f *FileService) CreateFile(fileBody *models.CreateFileRequestBody, fileHeader *multipart.FileHeader) (*models.File, *errors.Error)
- func (f *FileService) DeleteFile(fileID string) *errors.Error
- func (f *FileService) GetFile(fileID string) (*models.File, *errors.Error)
- func (f *FileService) GetFiles(limit string, page string) ([]models.File, *errors.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 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
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