mirror of https://github.com/Xhofe/alist
feat: set account modified time
parent
7b6f11fa52
commit
c5e5666b64
|
@ -11,6 +11,7 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Although the driver type is stored,
|
// Although the driver type is stored,
|
||||||
|
@ -29,6 +30,7 @@ func GetAccountByVirtualPath(virtualPath string) (driver.Driver, error) {
|
||||||
// CreateAccount Save the account to database so account can get an id
|
// CreateAccount Save the account to database so account can get an id
|
||||||
// then instantiate corresponding driver and save it in memory
|
// then instantiate corresponding driver and save it in memory
|
||||||
func CreateAccount(ctx context.Context, account model.Account) error {
|
func CreateAccount(ctx context.Context, account model.Account) error {
|
||||||
|
account.Modified = time.Now()
|
||||||
err := store.CreateAccount(&account)
|
err := store.CreateAccount(&account)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.WithMessage(err, "failed create account in database")
|
return errors.WithMessage(err, "failed create account in database")
|
||||||
|
@ -56,6 +58,7 @@ func UpdateAccount(ctx context.Context, account model.Account) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.WithMessage(err, "failed get old account")
|
return errors.WithMessage(err, "failed get old account")
|
||||||
}
|
}
|
||||||
|
account.Modified = time.Now()
|
||||||
err = store.UpdateAccount(&account)
|
err = store.UpdateAccount(&account)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.WithMessage(err, "failed update account in database")
|
return errors.WithMessage(err, "failed update account in database")
|
||||||
|
|
Loading…
Reference in New Issue