dexie / Dexie.js

A Minimalistic Wrapper for IndexedDB
https://dexie.org
Apache License 2.0
11.5k stars 642 forks source link

Dexie Cloud REST API track changes #1927

Open dfahlander opened 6 months ago

dfahlander commented 6 months ago

The REST API endpoints /all, /my and /public does not track changes or notify clients of updates the same way as when changes come over the sync endpoint.

Also, REST api must be able to add members and set the userId field. Currently a service account using the REST endpoint hasn't more permissions than a standard user for updating userId and owner in members.

dusty-phillips commented 4 months ago

~The second issue is becoming a blocker for my current feature. I'm able to add a member from the REST API and set the userId field with invite=false without any errors, but then I don't see the member, realm, or objects in that realm synced to the client, and if I export the database it doesn't have the invited/accepted dates set.~

Ok, I'm mistaken. I can add a member using a POST to /all/members if I manually set "accepted":

const member = {
    realmId,
    userId,
    invite: false,
    accepted: { $t: "Date", v: new Date().toISOString() },
    permissions,
}

The data in the realm doesn't sync down to the client unless I refresh the page (which is what this issue is really about), but I can force a refresh as a workaround for now.