updates
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-08 15:35:13 +11:00
parent d1857f2db1
commit ac60d1daef
4 changed files with 97 additions and 74 deletions

View File

@@ -70,13 +70,14 @@ func StoreSecret(c *gin.Context) {
return
}
// TODO - replace this with a call to SecretsGetMultipleSafes
// If this secret already exists in the database then generate an error
checkExists, err := models.GetSecrets(&s, false)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
if len(checkExists) > 0 {
log.Printf("StoreSecret not storing secret with '%d' already matching secrets.\n", len(checkExists))
c.JSON(http.StatusBadRequest, gin.H{"error": "StoreSecret attempting to store secret already defined. Use update API call instead"})
@@ -156,6 +157,8 @@ func UpdateSecret(c *gin.Context) {
s.SafeId = safeId
// TODO - replace this with a call to SecretsGetMultipleSafes
// Confirm that the secret already exists
checkExists, err := models.GetSecrets(&s, false)
if err != nil {