BREAKING CHANGE: V2 of thr SDK #12

Merged
fenpaws merged 124 commits from develop/postgresql into main 2024-07-01 20:46:28 +00:00
2 changed files with 5 additions and 4 deletions
Showing only changes of commit 3dfb345edc - Show all commits

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 {