fix: make sonarqube happy
Signed-off-by: SoXX <soxx@fenpa.ws>
This commit is contained in:
parent
5f9ace9bd3
commit
3dfb345edc
@ -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)
|
||||||
|
@ -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 {
|
||||||
|
Reference in New Issue
Block a user