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(core): add granular model read operations #2611

Merged
merged 1 commit into from
May 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion packages/amplify_core/lib/src/types/models/auth_rule.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@ import 'package:meta/meta.dart';

enum AuthStrategy { OWNER, GROUPS, PRIVATE, PUBLIC }

enum ModelOperation { CREATE, UPDATE, DELETE, READ }
enum ModelOperation {
CREATE,
UPDATE,
DELETE,
READ,
GET,
LIST,
SYNC,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per my understanding these finer read operation controls work out of box for API plugin, are these finer controls supported in DataStore? If not, do we have a documentation calling this out - not to use these finer read control with DataStore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not supported in Datastore especially for the local storage. The auth rules are only respected when it syncs with cloud. Adding these enums is to make the modelgen file compiled for those who uses these files only for API usage.

There is no document on this part but I will have a PR out later to call out that the finer read ops are not recommended for Datastore usage. If cx insists on using them, the sync and listen are required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update with the doc PR: aws-amplify/docs#5084

LISTEN,
SEARCH
}

enum AuthRuleProvider { APIKEY, OIDC, IAM, USERPOOLS, FUNCTION }

Expand Down