fix(database): update function

This commit is contained in:
SoXX 2024-11-06 12:20:24 +01:00
parent d69d1b68f6
commit 1ae76234b2

View File

@ -120,7 +120,7 @@ func UpdatePostReport(ctx context.Context, postReport models.PostReport) error {
ReportState: postReport.ReportState, ReportState: postReport.ReportState,
} }
result := client.WithContext(ctx).Model(&updatePost).Update("deleted_at", gorm.DeletedAt{}) result := client.WithContext(ctx).Model(&updatePost).Updates(updatePost)
if result.Error != nil { if result.Error != nil {
if errors.Is(result.Error, gorm.ErrRecordNotFound) { if errors.Is(result.Error, gorm.ErrRecordNotFound) {
return utils.HandleError(ctx, span, localLogger, &otterError.Database{Reason: otterError.NoDataFound}) return utils.HandleError(ctx, span, localLogger, &otterError.Database{Reason: otterError.NoDataFound})