Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): add listByIndex to ModelQueries #4945

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MarlonJD
Copy link
Contributor

@MarlonJD MarlonJD commented May 31, 2024

Issue #4942

Description of changes:

  • Add listByIndex to ModelQueries, it's build on list, required parameters are: classType and queryField, optional fields are sortDirection, indexName, overrideQueryFieldType.

Usage:

ModelQueries.listByIndex(
  TaskComment.classType,
  queryField: taskId,
  /// sortDirection: "ASC",  /// ASC or DESC, default is DESC
  /// indexName: "taskCommentsByDate",  ///  It's getting first secondary index in schema, if you have more, specify secondary index name
  /// overrideQueryFieldType: "String!",  /// It's for queryField's type, it should be match for GraphQL validation, autogenerated gen1 belongsTo fields are `ID!`
  /// customQueryName: "listTasksCommentsByDate" /// It's optional. On Gen1 user provide query name, on gen 2 it's generating automatically.
  /// where: TaskComment.TASK.eq(taskId), /// It cannot be used, if secondary index's queryField is taskId, you cannot use where taskId at the same time,
);

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant