package controllers

import (
	"github.com/kataras/iris/v12"
	"sparrow/services/knowoapi/services"
)

// FileController role
type FileController struct {
	Ctx     iris.Context
	Service services.FileService
	Token   Token
}

// Post 上传文件
// Post /file
func (a *FileController) Post() {
	fileInfo, err := a.Service.Upload(a.Ctx, "file", "sparrow")
	if err != nil {
		responseError(a.Ctx, ErrNormal, err.Error())
		return
	}
	done(a.Ctx, fileInfo)
}
