Skip to content

Commit

Permalink
feat: standardization virtual path while create and update
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Jun 17, 2022
1 parent 04f43cb commit 355db3a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/operations/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func GetAccountByVirtualPath(virtualPath string) (driver.Driver, error) {
// then instantiate corresponding driver and save it in memory
func CreateAccount(ctx context.Context, account model.Account) error {
account.Modified = time.Now()
account.VirtualPath = utils.StandardizationPath(account.VirtualPath)
err := store.CreateAccount(&account)
if err != nil {
return errors.WithMessage(err, "failed create account in database")
Expand Down Expand Up @@ -59,6 +60,7 @@ func UpdateAccount(ctx context.Context, account model.Account) error {
return errors.WithMessage(err, "failed get old account")
}
account.Modified = time.Now()
account.VirtualPath = utils.StandardizationPath(account.VirtualPath)
err = store.UpdateAccount(&account)
if err != nil {
return errors.WithMessage(err, "failed update account in database")
Expand Down

0 comments on commit 355db3a

Please sign in to comment.