Compare commits

..

No commits in common. "53e141277229c800965f10f04443609fbe0532a8" and "5665d56ce423e4bf91ed31b673fa0ce66868c28c" have entirely different histories.

2 changed files with 5 additions and 6 deletions

View File

@ -3,7 +3,6 @@ package postgres
import ( import (
"context" "context"
"errors" "errors"
otterError "git.dragse.it/anthrove/otter-space-sdk/v2/pkg/error" otterError "git.dragse.it/anthrove/otter-space-sdk/v2/pkg/error"
"git.dragse.it/anthrove/otter-space-sdk/v2/pkg/models" "git.dragse.it/anthrove/otter-space-sdk/v2/pkg/models"
@ -39,14 +38,14 @@ func CreatePost(ctx context.Context, db *gorm.DB, anthrovePost *models.Post) err
// TODO: Make Tests // TODO: Make Tests
func CreatePostInBatch(ctx context.Context, db *gorm.DB, anthrovePost []models.Post, batchSize int) error { func CreatePostInBatch(ctx context.Context, db *gorm.DB, anthrovePost []models.Post, batchSize int) error {
if anthrovePost == nil {
return &otterError.EntityValidationFailed{Reason: "anthrovePost cannot be nil"}
}
if len(anthrovePost) == 0 { if len(anthrovePost) == 0 {
return &otterError.EntityValidationFailed{Reason: "anthrovePost cannot be empty"} return &otterError.EntityValidationFailed{Reason: "anthrovePost cannot be empty"}
} }
if anthrovePost == nil {
return &otterError.EntityValidationFailed{Reason: "anthrovePost cannot be nil"}
}
if batchSize == 0 { if batchSize == 0 {
return &otterError.EntityValidationFailed{Reason: "batch size cannot be zero"} return &otterError.EntityValidationFailed{Reason: "batch size cannot be zero"}
} }

View File

@ -3,7 +3,7 @@ package models
type PostReference struct { type PostReference struct {
PostID string `gorm:"primaryKey"` PostID string `gorm:"primaryKey"`
SourceID string `gorm:"primaryKey"` SourceID string `gorm:"primaryKey"`
URL string `gorm:"primaryKey"` URL string `gorm:"not null;unique"`
PostReferenceConfig PostReferenceConfig
} }