BREAKING CHANGE: V2 of thr SDK #12

Merged
fenpaws merged 124 commits from develop/postgresql into main 2024-07-01 20:46:28 +00:00
2 changed files with 20 additions and 2 deletions
Showing only changes of commit a430c3b582 - Show all commits

View File

@ -37,3 +37,22 @@ func EstablishAnthrovePostToSourceLink(ctx context.Context, db *gorm.DB, anthrov
return nil
}
func EstablishUserToPostLink(ctx context.Context, db *gorm.DB, anthroveUserID models.AnthroveUserID, anthrovePostID models.AnthrovePostID) error {
userFavorite := pgModels.UserFavorite{
UserID: string(anthroveUserID),
PostID: string(anthrovePostID),
}
err := db.WithContext(ctx).Create(&userFavorite).Error
if err != nil {
return err
}
log.WithFields(log.Fields{
"anthrove_user_id": anthroveUserID,
"anthrove_post_id": anthrovePostID,
}).Trace("database: created user to post link")
return nil
}

View File

@ -77,8 +77,7 @@ func (p *postgresqlConnection) LinkPostWithSource(ctx context.Context, anthroveP
}
func (p *postgresqlConnection) LinkUserWithPost(ctx context.Context, anthroveUser *graphModels.AnthroveUser, anthrovePost *graphModels.AnthrovePost) error {
//TODO implement me
panic("implement me")
return postgres.EstablishUserToPostLink(ctx, p.db, anthroveUser.UserID, anthrovePost.PostID)
}
func (p *postgresqlConnection) CheckUserPostLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourcePostID string, sourceUrl string) (bool, error) {