SDK v3 #8

Merged
SoXX merged 77 commits from dev/issue-5 into main 2024-08-14 13:27:35 +00:00
Showing only changes of commit 5562d75e3a - Show all commits

View File

@ -32,6 +32,14 @@ func CreateTagAlias(ctx context.Context, tagAliasName models.TagAliasName, tagNa
return models.TagAlias{}, utils.HandleError(ctx, span, localLogger, &otterError.Database{Reason: otterError.DatabaseIsNotConnected})
}
if tagAliasName == "" {
return models.TagAlias{}, utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.TagAliasNameIsEmpty})
}
if tagName == "" {
return models.TagAlias{}, utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.TagNameIsEmpty})
}
tagAlias := models.TagAlias{
Name: tagAliasName,
TagID: tagName,
@ -109,6 +117,10 @@ func DeleteTagAlias(ctx context.Context, tagAliasName models.TagAliasName) error
return utils.HandleError(ctx, span, localLogger, &otterError.Database{Reason: otterError.DatabaseIsNotConnected})
}
if len(tagAliasName) == 0 {
return utils.HandleError(ctx, span, localLogger, &otterError.Database{Reason: otterError.TagAliasNameIsEmpty})
}
result := client.WithContext(ctx).Delete(&tagAlias, tagAliasName)
if result.Error != nil {
if errors.Is(result.Error, gorm.ErrRecordNotFound) {