You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to hard delete items from a backend amplify @model generated DynamoDB table which is linked to Datastore client on the my frontend mobile app. I don't think this is possible without accessing Dynamo DB directly from a lambda - and this could cause sync issues with Datastore.
If this is correct, then my next option is filter on the _deleted flag so that the deleted items are never received in my local datastore in my observeQuery.
// Put your code below this line.Schema&observeQuerycodebelowforreference:
schema.graphqltypeGeofenceEvent
@model
@auth(rules: [{allow: publicprovider: identityPooloperations: [create,update,delete,read]}{allow: privateprovider: userPoolsoperations: [create,update,delete,read]}{allow: publicprovider: apiKeyoperations: [create,update,delete,read]}]){GeofenceName: String! @primaryKey(sortKeyFields: ["DeviceId"])DeviceId: ID!EventType: String!updatedAt: AWSDateTime!}// Subscribe to changes for a specific geofenceconstsubscribeToSpecificGeofenceEventUpdates=(geofenceName: string)=>{letpreviousEventTypes: {[key: string]: string}={};DataStore.observeQuery(GeofenceEvent,(ge)=>ge.GeofenceName.eq(geofenceName)).subscribe((snapshot)=>{const{ items, isSynced }=snapshot;console.log("observeQuery: received for geofence:",geofenceName,items,isSynced);if(isSynced){// Handle the updated geofence eventsitems.forEach((event)=>{// console.log(`Device ${event.DeviceId} has event type: ${event.EventType}`);constpreviousEventType=previousEventTypes[event.DeviceId];// TO DO - should I be using previousEventType store??if(previousEventType!==event.EventType){console.log(`>>>>>>>>>>>>>>>>>>>>> Device ${event.DeviceId} has NEW event type: ${event.EventType}`);// Update the previous event type for the devicepreviousEventTypes[event.DeviceId]=event.EventType;}});}});};}
Log output
// Put your logs below this line
Property '_deleted' does not exist on type 'V5ModelPredicate<LazyGeofenceEvent>'.
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered:
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
GraphQL API, DataStore
Amplify Version
v6
Amplify Categories
storage, api
Backend
Amplify CLI
Environment information
Describe the bug
I want to hard delete items from a backend amplify @model generated DynamoDB table which is linked to Datastore client on the my frontend mobile app. I don't think this is possible without accessing Dynamo DB directly from a lambda - and this could cause sync issues with Datastore.
If this is correct, then my next option is filter on the _deleted flag so that the deleted items are never received in my local datastore in my observeQuery.
However, when I try to do this:
I get the error: Property '_deleted' does not exist on type 'V5ModelPredicate'.
If I try to add _deleted to the schema, I get: type ModelGeofenceEventFilterInput has already a field with name _deleted.
How do I access the _deleted flag in syncExpression? Is it possible and if not - what other options do I have?
Expected behavior
Items should be filtered from observeQuery if the _deleted flag is set, and syncExpression is configured to filter these items out.
Reproduction steps
Add this code to a datastore with the above schema
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: