BREAKING CHANGE: V2 of thr SDK #12
@ -59,3 +59,21 @@ func CreateUserNodeWithSourceRelation(ctx context.Context, db *gorm.DB, anthrove
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetUserFavoritesCount(ctx context.Context, db *gorm.DB, anthroveUserID models.AnthroveUserID) (int64, error) {
|
||||
var count int64
|
||||
err := db.WithContext(ctx).Model(&pgModels.UserFavorite{}).Where("user_id = ?", string(anthroveUserID)).Count(&count).Error
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"anthrove_user_id": anthroveUserID,
|
||||
}).Error("database: failed to get user favorites count")
|
||||
return 0, err
|
||||
}
|
||||
|
||||
log.WithFields(log.Fields{
|
||||
"anthrove_user_id": anthroveUserID,
|
||||
"anthrove_user_fav_count": count,
|
||||
}).Trace("database: got user favorite count")
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
@ -102,8 +102,7 @@ func (p *postgresqlConnection) CheckPostNodeExistsBySourceID(ctx context.Context
|
||||
}
|
||||
|
||||
func (p *postgresqlConnection) GetUserFavoriteCount(ctx context.Context, anthroveUserID models.AnthroveUserID) (int64, error) {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
return postgres.GetUserFavoritesCount(ctx, p.db, anthroveUserID)
|
||||
}
|
||||
|
||||
func (p *postgresqlConnection) GetUserSourceLinks(ctx context.Context, anthroveUserID models.AnthroveUserID) (map[string]graphModels.AnthroveUserRelationship, error) {
|
||||
|
Reference in New Issue
Block a user