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 22 additions and 2 deletions
Showing only changes of commit 6268a594cf - Show all commits

View File

@ -211,3 +211,24 @@ func GetAnthroveUser(ctx context.Context, db *gorm.DB, anthroveUserID models.Ant
return anthroveUser, nil
}
func GetAllAnthroveUserIDs(ctx context.Context, db *gorm.DB) ([]models.AnthroveUserID, error) {
var users []pgModels.User
var userIDs []models.AnthroveUserID
err := db.WithContext(ctx).Model(&pgModels.User{}).Find(&users).Error
if err != nil {
log.Error("database: failed to get all anthrove user IDs")
return nil, err
}
for _, user := range users {
userIDs = append(userIDs, models.AnthroveUserID(user.ID))
}
log.WithFields(log.Fields{
"anthrove_user_id_count": len(userIDs),
}).Trace("database: got all anthrove user IDs")
return userIDs, nil
}

View File

@ -118,8 +118,7 @@ func (p *postgresqlConnection) GetAnthroveUser(ctx context.Context, anthroveUser
}
func (p *postgresqlConnection) GetAllAnthroveUserIDs(ctx context.Context) ([]models.AnthroveUserID, error) {
//TODO implement me
panic("implement me")
return postgres.GetAllAnthroveUserIDs(ctx, p.db)
}
func (p *postgresqlConnection) GetUserFavoritePostsWithPagination(ctx context.Context, anthroveUserID models.AnthroveUserID, skip int, limit int) (*graphModels.FavoriteList, error) {