From 6b2d9e2cb523f397924900121327995dbb2e09b7 Mon Sep 17 00:00:00 2001 From: SoXX Date: Tue, 15 Oct 2024 10:50:55 +0200 Subject: [PATCH] fix: consistent id check - use consistent methode to check if the id is 0 --- pkg/database/pool_post.go | 4 ++-- pkg/database/pool_reference.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/database/pool_post.go b/pkg/database/pool_post.go index 686f205..5c3948d 100644 --- a/pkg/database/pool_post.go +++ b/pkg/database/pool_post.go @@ -32,7 +32,7 @@ func CreatePoolPost(ctx context.Context, poolID models.PoolID, postID models.Pos return models.PoolPost{}, utils.HandleError(ctx, span, localLogger, &otterError.Database{Reason: otterError.DatabaseIsNotConnected}) } - if poolID == "" { + if len(poolID) == 0 { return models.PoolPost{}, utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PoolIDIsEmpty}) } @@ -88,7 +88,7 @@ func DeletePoolPost(ctx context.Context, poolID models.PoolID, postID models.Pos return utils.HandleError(ctx, span, localLogger, &otterError.Database{Reason: otterError.DatabaseIsNotConnected}) } - if poolID == "" { + if len(poolID) == 0 { return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PoolIDIsEmpty}) } diff --git a/pkg/database/pool_reference.go b/pkg/database/pool_reference.go index 69bde93..eefbb36 100644 --- a/pkg/database/pool_reference.go +++ b/pkg/database/pool_reference.go @@ -32,7 +32,7 @@ func CreatePoolReference(ctx context.Context, poolID models.PoolID, sourceID mod return models.PoolReference{}, utils.HandleError(ctx, span, localLogger, &otterError.Database{Reason: otterError.DatabaseIsNotConnected}) } - if poolID == "" { + if len(poolID) == 0 { return models.PoolReference{}, utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PoolIDIsEmpty}) } @@ -92,7 +92,7 @@ func DeletePoolReference(ctx context.Context, poolID models.PoolID, sourceID mod return utils.HandleError(ctx, span, localLogger, &otterError.Database{Reason: otterError.DatabaseIsNotConnected}) } - if poolID == "" { + if len(poolID) == 0 { return utils.HandleError(ctx, span, localLogger, &otterError.EntityValidationFailed{Reason: otterError.PoolIDIsEmpty}) }