Finishing Prototype
This commit is contained in:
parent
da9196f389
commit
473dc4a495
25 changed files with 1150 additions and 825 deletions
|
@ -31,7 +31,7 @@ type RegisterRequest struct {
|
|||
type RegisterResponse struct {
|
||||
UserId string `json:"user_id,omitempty"`
|
||||
AccessToken string `json:"access_token,omitempty"`
|
||||
HomeServer string `json:"home_server,omitempty"`
|
||||
sqllite string `json:"home_server,omitempty"`
|
||||
DeviceId string `json:"device_id,omitempty"`
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ func CreateUser(user *User) (err error) {
|
|||
|
||||
_, err = stmt.Exec(user.Id, user.Name, user.Password)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return
|
||||
}
|
||||
tx.Commit()
|
||||
|
@ -100,6 +101,7 @@ func UpdateUser(user *User) (err error) {
|
|||
|
||||
_, err = stmt.Exec(user.Name, user.Password, user.Id)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -116,8 +118,9 @@ func DeleteUser(id string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
_, err = database.DB.Exec(queryStmt)
|
||||
_, err = tx.Exec(queryStmt)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue