fix: make sonarqube happy
All checks were successful
Gitea Build Check / Build (push) Successful in 11m26s
Gitea Build Check / Build (pull_request) Successful in 11m31s

Signed-off-by: SoXX <soxx@fenpa.ws>
This commit is contained in:
SoXX 2024-07-01 14:14:17 +02:00
parent 5f9ace9bd3
commit 3dfb345edc
2 changed files with 5 additions and 4 deletions

View File

@ -97,7 +97,7 @@ func CreateTagAlias(ctx context.Context, db *gorm.DB, tagAliasName models.Anthro
return &otterError.EntityValidationFailed{Reason: "tagAliasName cannot be empty"} return &otterError.EntityValidationFailed{Reason: "tagAliasName cannot be empty"}
} }
if tagID == "" { if tagID == "" {
return &otterError.EntityValidationFailed{Reason: "tagID cannot be empty"} return &otterError.EntityValidationFailed{Reason: otterError.AnthroveTagIDEmpty}
} }
result := db.WithContext(ctx).Create(&models.TagAlias{ result := db.WithContext(ctx).Create(&models.TagAlias{
@ -143,7 +143,7 @@ func GetAllTagAliasByTag(ctx context.Context, db *gorm.DB, tagID models.Anthrove
var tagAliases []models.TagAlias var tagAliases []models.TagAlias
if tagID == "" { if tagID == "" {
return nil, &otterError.EntityValidationFailed{Reason: "tagID cannot be empty"} return nil, &otterError.EntityValidationFailed{Reason: otterError.AnthroveTagIDEmpty}
} }
result := db.WithContext(ctx).Where("tag_id = ?", tagID).Find(&tagAliases) result := db.WithContext(ctx).Where("tag_id = ?", tagID).Find(&tagAliases)
@ -191,7 +191,7 @@ func CreateTagGroup(ctx context.Context, db *gorm.DB, tagGroupName models.Anthro
return &otterError.EntityValidationFailed{Reason: "tagGroupName cannot be empty"} return &otterError.EntityValidationFailed{Reason: "tagGroupName cannot be empty"}
} }
if tagID == "" { if tagID == "" {
return &otterError.EntityValidationFailed{Reason: "tagID cannot be empty"} return &otterError.EntityValidationFailed{Reason: otterError.AnthroveTagIDEmpty}
} }
result := db.WithContext(ctx).Create(&models.TagGroup{ result := db.WithContext(ctx).Create(&models.TagGroup{
@ -237,7 +237,7 @@ func GetAllTagGroupByTag(ctx context.Context, db *gorm.DB, tagID models.Anthrove
var tagGroups []models.TagGroup var tagGroups []models.TagGroup
if tagID == "" { if tagID == "" {
return nil, &otterError.EntityValidationFailed{Reason: "tagID cannot be empty"} return nil, &otterError.EntityValidationFailed{Reason: otterError.AnthroveTagIDEmpty}
} }
result := db.WithContext(ctx).Where("tag_id = ?", tagID).Find(&tagGroups) result := db.WithContext(ctx).Where("tag_id = ?", tagID).Find(&tagGroups)

View File

@ -7,6 +7,7 @@ const (
AnthroveUserIDToShort = "anthrovePostID needs to be 25 characters long" AnthroveUserIDToShort = "anthrovePostID needs to be 25 characters long"
AnthroveSourceIDEmpty = "anthroveSourceID cannot be empty" AnthroveSourceIDEmpty = "anthroveSourceID cannot be empty"
AnthroveSourceIDToShort = "anthroveSourceID needs to be 25 characters long" AnthroveSourceIDToShort = "anthroveSourceID needs to be 25 characters long"
AnthroveTagIDEmpty = "tagID cannot be empty"
) )
type EntityValidationFailed struct { type EntityValidationFailed struct {