mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 10:45:47 +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")
|
tag := c.Input().Get("tag")
|
||||||
parent := c.Input().Get("parent")
|
parent := c.Input().Get("parent")
|
||||||
fullFilePath := c.Input().Get("fullFilePath")
|
fullFilePath := c.Input().Get("fullFilePath")
|
||||||
|
createdTime := c.Input().Get("createdTime")
|
||||||
|
description := c.Input().Get("description")
|
||||||
|
|
||||||
file, header, err := c.GetFile("file")
|
file, header, err := c.GetFile("file")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -144,12 +146,15 @@ func (c *ApiController) UploadResource() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if createdTime == "" {
|
||||||
|
createdTime = util.GetCurrentTime()
|
||||||
|
}
|
||||||
fileFormat := filepath.Ext(fullFilePath)
|
fileFormat := filepath.Ext(fullFilePath)
|
||||||
fileSize := int(header.Size)
|
fileSize := int(header.Size)
|
||||||
resource := &object.Resource{
|
resource := &object.Resource{
|
||||||
Owner: owner,
|
Owner: owner,
|
||||||
Name: objectKey,
|
Name: objectKey,
|
||||||
CreatedTime: util.GetCurrentTime(),
|
CreatedTime: createdTime,
|
||||||
User: username,
|
User: username,
|
||||||
Provider: provider.Name,
|
Provider: provider.Name,
|
||||||
Application: application,
|
Application: application,
|
||||||
@ -160,6 +165,7 @@ func (c *ApiController) UploadResource() {
|
|||||||
FileFormat: fileFormat,
|
FileFormat: fileFormat,
|
||||||
FileSize: fileSize,
|
FileSize: fileSize,
|
||||||
Url: fileUrl,
|
Url: fileUrl,
|
||||||
|
Description: description,
|
||||||
}
|
}
|
||||||
object.AddOrUpdateResource(resource)
|
object.AddOrUpdateResource(resource)
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ type Resource struct {
|
|||||||
FileFormat string `xorm:"varchar(100)" json:"fileFormat"`
|
FileFormat string `xorm:"varchar(100)" json:"fileFormat"`
|
||||||
FileSize int `json:"fileSize"`
|
FileSize int `json:"fileSize"`
|
||||||
Url string `xorm:"varchar(1000)" json:"url"`
|
Url string `xorm:"varchar(1000)" json:"url"`
|
||||||
|
Description string `xorm:"varchar(1000)" json:"description"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetResourceCount(owner string, user string) int {
|
func GetResourceCount(owner string, user string) int {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user