Skip to content

Commit

Permalink
feat: set account modified time
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Jun 10, 2022
1 parent 7b6f11f commit c5e5666
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/operations/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"sort"
"strings"
"sync"
"time"
)

// Although the driver type is stored,
Expand All @@ -29,6 +30,7 @@ func GetAccountByVirtualPath(virtualPath string) (driver.Driver, error) {
// CreateAccount Save the account to database so account can get an id
// then instantiate corresponding driver and save it in memory
func CreateAccount(ctx context.Context, account model.Account) error {
account.Modified = time.Now()
err := store.CreateAccount(&account)
if err != nil {
return errors.WithMessage(err, "failed create account in database")
Expand Down Expand Up @@ -56,6 +58,7 @@ func UpdateAccount(ctx context.Context, account model.Account) error {
if err != nil {
return errors.WithMessage(err, "failed get old account")
}
account.Modified = time.Now()
err = store.UpdateAccount(&account)
if err != nil {
return errors.WithMessage(err, "failed update account in database")
Expand Down

0 comments on commit c5e5666

Please sign in to comment.