mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
Add more args to UploadResource().
This commit is contained in:
parent
95600414d9
commit
44b59d866a
@ -103,6 +103,8 @@ func (c *ApiController) UploadResource() {
|
||||
tag := c.Input().Get("tag")
|
||||
parent := c.Input().Get("parent")
|
||||
fullFilePath := c.Input().Get("fullFilePath")
|
||||
createdTime := c.Input().Get("createdTime")
|
||||
description := c.Input().Get("description")
|
||||
|
||||
file, header, err := c.GetFile("file")
|
||||
if err != nil {
|
||||
@ -144,12 +146,15 @@ func (c *ApiController) UploadResource() {
|
||||
return
|
||||
}
|
||||
|
||||
if createdTime == "" {
|
||||
createdTime = util.GetCurrentTime()
|
||||
}
|
||||
fileFormat := filepath.Ext(fullFilePath)
|
||||
fileSize := int(header.Size)
|
||||
resource := &object.Resource{
|
||||
Owner: owner,
|
||||
Name: objectKey,
|
||||
CreatedTime: util.GetCurrentTime(),
|
||||
CreatedTime: createdTime,
|
||||
User: username,
|
||||
Provider: provider.Name,
|
||||
Application: application,
|
||||
@ -160,6 +165,7 @@ func (c *ApiController) UploadResource() {
|
||||
FileFormat: fileFormat,
|
||||
FileSize: fileSize,
|
||||
Url: fileUrl,
|
||||
Description: description,
|
||||
}
|
||||
object.AddOrUpdateResource(resource)
|
||||
|
||||
|
@ -36,6 +36,7 @@ type Resource struct {
|
||||
FileFormat string `xorm:"varchar(100)" json:"fileFormat"`
|
||||
FileSize int `json:"fileSize"`
|
||||
Url string `xorm:"varchar(1000)" json:"url"`
|
||||
Description string `xorm:"varchar(1000)" json:"description"`
|
||||
}
|
||||
|
||||
func GetResourceCount(owner string, user string) int {
|
||||
|
Loading…
x
Reference in New Issue
Block a user