added pools #14

Merged
SoXX merged 16 commits from dev/pools into main 2024-10-15 09:03:46 +00:00
8 changed files with 29 additions and 29 deletions
Showing only changes of commit 91254adfe3 - Show all commits

View File

@ -183,7 +183,7 @@ func DeleteUserFavorite(ctx context.Context, id models.UserFavoriteID) error {
} }
if len(id) != 25 { if len(id) != 25 {
return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.UserFavoriteIDToShort}) return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.UserFavoriteIsWrongLength})
} }
result := client.WithContext(ctx).Delete(&userFavorite, id) result := client.WithContext(ctx).Delete(&userFavorite, id)

View File

@ -147,7 +147,7 @@ func DeletePool(ctx context.Context, id models.PoolID) error {
} }
if len(id) != 25 { if len(id) != 25 {
return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PoolIDToShort}) return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PoolIDIsWrongLength})
} }
result := client.WithContext(ctx).Delete(&pool, "id = ?", id) result := client.WithContext(ctx).Delete(&pool, "id = ?", id)

View File

@ -37,7 +37,7 @@ func CreatePoolPost(ctx context.Context, poolID models.PoolID, postID models.Pos
} }
if len(poolID) != 25 { if len(poolID) != 25 {
return models.PoolPost{}, utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PoolIDToShort}) return models.PoolPost{}, utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PoolIDIsWrongLength})
} }
if postID == "" { if postID == "" {
@ -45,7 +45,7 @@ func CreatePoolPost(ctx context.Context, poolID models.PoolID, postID models.Pos
} }
if len(postID) != 25 { if len(postID) != 25 {
return models.PoolPost{}, utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PostIDToShort}) return models.PoolPost{}, utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PostIDIsWrongLength})
} }
poolPost := models.PoolPost{ poolPost := models.PoolPost{
@ -93,7 +93,7 @@ func DeletePoolPost(ctx context.Context, poolID models.PoolID, postID models.Pos
} }
if len(poolID) != 25 { if len(poolID) != 25 {
return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PoolIDToShort}) return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PoolIDIsWrongLength})
} }
if postID == "" { if postID == "" {
@ -101,7 +101,7 @@ func DeletePoolPost(ctx context.Context, poolID models.PoolID, postID models.Pos
} }
if len(postID) != 25 { if len(postID) != 25 {
return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PostIDToShort}) return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PostIDIsWrongLength})
} }
result := client.WithContext(ctx).Delete(&poolPost, "pool_id = ? AND post_id = ?", poolID, postID) result := client.WithContext(ctx).Delete(&poolPost, "pool_id = ? AND post_id = ?", poolID, postID)

View File

@ -37,7 +37,7 @@ func CreatePoolReference(ctx context.Context, poolID models.PoolID, sourceID mod
} }
if len(poolID) != 25 { if len(poolID) != 25 {
return models.PoolReference{}, utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PoolIDToShort}) return models.PoolReference{}, utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PoolIDIsWrongLength})
} }
if sourceID == "" { if sourceID == "" {
@ -45,7 +45,7 @@ func CreatePoolReference(ctx context.Context, poolID models.PoolID, sourceID mod
} }
if len(sourceID) != 25 { if len(sourceID) != 25 {
return models.PoolReference{}, utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.SourceIDToShort}) return models.PoolReference{}, utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.SourceIDIsWrongLength})
} }
if url == "" { if url == "" {
@ -97,7 +97,7 @@ func DeletePoolReference(ctx context.Context, poolID models.PoolID, sourceID mod
} }
if len(poolID) != 25 { if len(poolID) != 25 {
return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PostIDToShort}) return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PostIDIsWrongLength})
} }
if sourceID == "" { if sourceID == "" {
@ -105,7 +105,7 @@ func DeletePoolReference(ctx context.Context, poolID models.PoolID, sourceID mod
} }
if len(sourceID) != 25 { if len(sourceID) != 25 {
return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.SourceIDToShort}) return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.SourceIDIsWrongLength})
} }
result := client.WithContext(ctx).Delete(&poolReference, "pool_id = ? AND source_id = ?", poolID, sourceID) result := client.WithContext(ctx).Delete(&poolReference, "pool_id = ? AND source_id = ?", poolID, sourceID)

View File

@ -191,7 +191,7 @@ func DeletePost(ctx context.Context, id models.PostID) error {
} }
if len(id) != 25 { if len(id) != 25 {
return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PostIDToShort}) return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PostIDIsWrongLength})
} }
result := client.WithContext(ctx).Delete(&userFavorite, "id = ?", id) result := client.WithContext(ctx).Delete(&userFavorite, "id = ?", id)

View File

@ -155,7 +155,7 @@ func GetSourceByID(ctx context.Context, id models.SourceID) (models.Source, erro
} }
if len(id) != 25 { if len(id) != 25 {
return models.Source{}, utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.SourceIDToShort}) return models.Source{}, utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.SourceIDIsWrongLength})
} }
result := client.WithContext(ctx).First(&source, "id = ?", id) result := client.WithContext(ctx).First(&source, "id = ?", id)
@ -231,7 +231,7 @@ func DeleteSource(ctx context.Context, id models.SourceID) error {
} }
if len(id) != 25 { if len(id) != 25 {
return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.SourceIDToShort}) return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.SourceIDIsWrongLength})
} }
result := client.WithContext(ctx).Delete(&source, id) result := client.WithContext(ctx).Delete(&source, id)

View File

@ -118,7 +118,7 @@ func GetUserSourceByID(ctx context.Context, id models.UserSourceID) (models.User
} }
if len(id) != 25 { if len(id) != 25 {
return models.UserSource{}, utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.UserSourceIDToShort}) return models.UserSource{}, utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.UserSourceIsWrongLength})
} }
result := client.WithContext(ctx).First(&user, "id = ?", id) result := client.WithContext(ctx).First(&user, "id = ?", id)
@ -157,7 +157,7 @@ func DeleteUserSource(ctx context.Context, id models.UserSourceID) error {
} }
if len(id) != 25 { if len(id) != 25 {
return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.UserSourceIDToShort}) return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.UserSourceIsWrongLength})
} }
result := client.WithContext(ctx).Delete(&user, id) result := client.WithContext(ctx).Delete(&user, id)

View File

@ -5,11 +5,11 @@ import "fmt"
const ( const (
SourceListIsEmpty = "sourceList cannot be empty" SourceListIsEmpty = "sourceList cannot be empty"
SourceIDIsEmpty = "SourceID cannot be empty" SourceIDIsEmpty = "SourceID cannot be empty"
SourceIDToShort = "sourceID needs to be 25 characters long" SourceIDIsWrongLength = "sourceID has the wrong length"
SourceDomainIsEmpty = "source Domain cannot be empty" SourceDomainIsEmpty = "source Domain cannot be empty"
UserSourceIDIsEmpty = "userSourceID cannot be empty" UserSourceIDIsEmpty = "userSourceID cannot be empty"
UserSourceIDToShort = "userSourceID needs to be 25 characters long" UserSourceIsWrongLength = "userSourceID has the wrong length"
TagNameIsEmpty = "tagName cannot be empty" TagNameIsEmpty = "tagName cannot be empty"
TagTypeIsEmpty = "tagType cannot be empty" TagTypeIsEmpty = "tagType cannot be empty"
@ -23,16 +23,16 @@ const (
UserFavoriteListIsEmpty = "userFavoriteList cannot be empty" UserFavoriteListIsEmpty = "userFavoriteList cannot be empty"
UserFavoriteIDIsEmpty = "userFavoriteID cannot be empty" UserFavoriteIDIsEmpty = "userFavoriteID cannot be empty"
UserFavoriteIDToShort = "userFavoriteID needs to be 25 characters long" UserFavoriteIsWrongLength = "userFavoriteID has the wrong length"
PostListIsEmpty = "userFavoriteList cannot be empty" PostListIsEmpty = "userFavoriteList cannot be empty"
PostIDIsEmpty = "userFavoriteID cannot be empty" PostIDIsEmpty = "userFavoriteID cannot be empty"
PostIDToShort = "PostID needs to be 25 characters long" PostIDIsWrongLength = "PostID has the wrong length"
BatchSizeIsEmpty = "batchSize cannot be empty" BatchSizeIsEmpty = "batchSize cannot be empty"
PoolIDIsEmpty = "PoolID cannot be empty" PoolIDIsEmpty = "PoolID cannot be empty"
PoolIDToShort = "PoolID needs to be 25 characters long" PoolIDIsWrongLength = "PoolID has the wrong length"
PoolURLIsEmpty = "PoolURL cannot be empty" PoolURLIsEmpty = "PoolURL cannot be empty"
) )