mirror of
https://github.com/KaySar12/NextZen-UserService.git
synced 2025-03-15 23:25:35 +07:00
bug: fix recored not found lead to not save settings
This commit is contained in:
parent
e265ce3f9c
commit
50ff1c7fc3
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -6,7 +6,7 @@
|
||||
"type": "go",
|
||||
"debugAdapter": "dlv-dap",
|
||||
"request": "launch",
|
||||
"port": 39117,
|
||||
"port": 34155,
|
||||
"host": "127.0.0.1",
|
||||
"mode": "exec",
|
||||
"program": "${workspaceFolder}/dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service"
|
||||
|
@ -40,6 +40,10 @@ func (a *authentikService) UpdateSettings(m model2.AuthentikCredentialsDBModel)
|
||||
var existing model2.AuthentikCredentialsDBModel
|
||||
result := a.db.First(&existing)
|
||||
if result.Error != nil {
|
||||
if result.Error.Error() == "record not found" {
|
||||
a.db.Create(&m)
|
||||
return existing, nil
|
||||
}
|
||||
return existing, result.Error
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user