fix(postgres): added url to SourceLink

Signed-off-by: soxx <soxx@fenpa.ws>
This commit is contained in:
SoXX 2024-06-21 15:15:20 +02:00
parent 2515fc5081
commit 4690ce135d
2 changed files with 4 additions and 2 deletions

View File

@ -3,12 +3,13 @@ package postgres
import (
"context"
"git.dragse.it/anthrove/otter-space-sdk/pkg/models"
"git.dragse.it/anthrove/otter-space-sdk/pkg/models/graphModels"
"git.dragse.it/anthrove/otter-space-sdk/pkg/models/pgModels"
log "github.com/sirupsen/logrus"
"gorm.io/gorm"
)
func EstablishAnthrovePostToSourceLink(ctx context.Context, db *gorm.DB, anthrovePostID models.AnthrovePostID, anthroveSourceDomain string) error {
func EstablishAnthrovePostToSourceLink(ctx context.Context, db *gorm.DB, anthrovePostID models.AnthrovePostID, anthroveSourceDomain string, anthrovePostRelationship *graphModels.AnthrovePostRelationship) error {
var source pgModels.Source
var err error
@ -22,6 +23,7 @@ func EstablishAnthrovePostToSourceLink(ctx context.Context, db *gorm.DB, anthrov
err = db.WithContext(ctx).Create(pgModels.PostReference{
PostID: string(anthrovePostID),
SourceID: source.ID,
URL: anthrovePostRelationship.Url,
}).Error
if err != nil {

View File

@ -71,7 +71,7 @@ func (p *postgresqlConnection) AddTagWithRelationToPost(ctx context.Context, ant
}
func (p *postgresqlConnection) LinkPostWithSource(ctx context.Context, anthrovePostID models.AnthrovePostID, anthroveSourceDomain string, anthrovePostRelationship *graphModels.AnthrovePostRelationship) error {
return postgres.EstablishAnthrovePostToSourceLink(ctx, p.db, anthrovePostID, anthroveSourceDomain)
return postgres.EstablishAnthrovePostToSourceLink(ctx, p.db, anthrovePostID, anthroveSourceDomain, anthrovePostRelationship)
}
func (p *postgresqlConnection) LinkUserWithPost(ctx context.Context, anthroveUser *graphModels.AnthroveUser, anthrovePost *graphModels.AnthrovePost) error {