|
|
|
@@ -10,6 +10,7 @@ import ( |
|
|
|
"io" |
|
|
|
"path" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
"code.gitea.io/gitea/modules/obs" |
|
|
|
@@ -104,6 +105,14 @@ func (a *Attachment) IncreaseDownloadCount() error { |
|
|
|
return nil |
|
|
|
} |
|
|
|
|
|
|
|
func (a *Attachment) UpdateDatasetUpdateUnix() error { |
|
|
|
// Update download count. |
|
|
|
if _, err := x.Exec("UPDATE `dataset` SET updated_unix="+fmt.Sprint(time.Now().Unix())+" WHERE id=?", a.DatasetID); err != nil { |
|
|
|
return fmt.Errorf("UpdateDatasetUpdateUnix: %v", err) |
|
|
|
} |
|
|
|
return nil |
|
|
|
} |
|
|
|
|
|
|
|
// APIFormat converts models.Attachment to api.Attachment |
|
|
|
func (a *Attachment) APIFormat() *api.Attachment { |
|
|
|
return &api.Attachment{ |
|
|
|
|