diff --git a/internal/postgres/tag.go b/internal/postgres/tag.go index 4e851e2..405b5a8 100644 --- a/internal/postgres/tag.go +++ b/internal/postgres/tag.go @@ -97,7 +97,7 @@ func CreateTagAlias(ctx context.Context, db *gorm.DB, tagAliasName models.Anthro return &otterError.EntityValidationFailed{Reason: "tagAliasName cannot be empty"} } if tagID == "" { - return &otterError.EntityValidationFailed{Reason: "tagID cannot be empty"} + return &otterError.EntityValidationFailed{Reason: otterError.AnthroveTagIDEmpty} } 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 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) @@ -191,7 +191,7 @@ func CreateTagGroup(ctx context.Context, db *gorm.DB, tagGroupName models.Anthro return &otterError.EntityValidationFailed{Reason: "tagGroupName cannot be empty"} } if tagID == "" { - return &otterError.EntityValidationFailed{Reason: "tagID cannot be empty"} + return &otterError.EntityValidationFailed{Reason: otterError.AnthroveTagIDEmpty} } 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 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) diff --git a/pkg/error/validation.go b/pkg/error/validation.go index 48b8632..27ec3c4 100644 --- a/pkg/error/validation.go +++ b/pkg/error/validation.go @@ -7,6 +7,7 @@ const ( AnthroveUserIDToShort = "anthrovePostID needs to be 25 characters long" AnthroveSourceIDEmpty = "anthroveSourceID cannot be empty" AnthroveSourceIDToShort = "anthroveSourceID needs to be 25 characters long" + AnthroveTagIDEmpty = "tagID cannot be empty" ) type EntityValidationFailed struct {