mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 12:39:17 +00:00
updating profile without version check
This commit is contained in:
parent
fae657d356
commit
f97a527eb8
@ -29,6 +29,7 @@ func SetAccountAuthentication(w http.ResponseWriter, r *http.Request) {
|
||||
token.Account.Username = username;
|
||||
token.Account.Handle = strings.ToLower(username);
|
||||
token.Account.Password = password;
|
||||
|
||||
err := store.DB.Transaction(func(tx *gorm.DB) error {
|
||||
if res := tx.Save(token.Account).Error; res != nil {
|
||||
return res
|
||||
|
@ -1,6 +1,7 @@
|
||||
package databag
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"net/http"
|
||||
"gorm.io/gorm"
|
||||
"databag/internal/store"
|
||||
@ -30,6 +31,9 @@ func SetAccountLogin(w http.ResponseWriter, r *http.Request) {
|
||||
if res := tx.Model(&account).Update("Username", username).Error; res != nil {
|
||||
return res
|
||||
}
|
||||
if res := tx.Model(&account).Update("Handle", strings.ToLower(username)).Error; res != nil {
|
||||
return res
|
||||
}
|
||||
if res := tx.Model(&account).Update("Password", password).Error; res != nil {
|
||||
return res
|
||||
}
|
||||
|
@ -52,16 +52,14 @@ func SetCardProfile(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if identity.Revision > card.ProfileRevision {
|
||||
card.Username = identity.Handle
|
||||
card.Name = identity.Name
|
||||
card.Description = identity.Description
|
||||
card.Location = identity.Location
|
||||
card.Image = identity.Image
|
||||
card.Version = identity.Version
|
||||
card.Node = identity.Node
|
||||
card.ProfileRevision = identity.Revision
|
||||
}
|
||||
card.Username = identity.Handle
|
||||
card.Name = identity.Name
|
||||
card.Description = identity.Description
|
||||
card.Location = identity.Location
|
||||
card.Image = identity.Image
|
||||
card.Version = identity.Version
|
||||
card.Node = identity.Node
|
||||
card.ProfileRevision = identity.Revision
|
||||
|
||||
err = store.DB.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user