GraphQL API and utilities for the rpdata project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
610 B

  1. package resolvers
  2. import (
  3. "context"
  4. "git.aiterp.net/rpdata/api/graph2/graphcore"
  5. "git.aiterp.net/rpdata/api/models"
  6. "git.aiterp.net/rpdata/api/models/unknownnicks"
  7. )
  8. /// Queries
  9. func (r *queryResolver) UnknownNicks(ctx context.Context, filter *graphcore.UnknownNicksFilter) ([]*models.UnknownNick, error) {
  10. limit := 100
  11. if filter != nil {
  12. if filter.Limit > 0 {
  13. limit = filter.Limit
  14. }
  15. }
  16. nicks, err := unknownnicks.List(limit)
  17. if err != nil {
  18. return nil, err
  19. }
  20. nicks2 := make([]*models.UnknownNick, len(nicks))
  21. for i := range nicks {
  22. nicks2[i] = &nicks[i]
  23. }
  24. return nicks2, nil
  25. }