MCPcopy
hub / github.com/dexie/Dexie.js / leaveList

Method leaveList

samples/dexie-cloud-todo-app/src/db/TodoList.ts:194–204  ·  view source on GitHub ↗

Remove access to the list for the current user. * * This is a sync-consistent operation. The server * will reject the operation if the user is the owner of the list. * If this happens, the server will roll-back the operation and * restore the local data to mirror the server state (i.

()

Source from the content-addressed store, hash-verified

192 * user will still have access and be owner).
193 */
194 async leaveList() {
195 // Delete own member entry --> you will then no longer have access
196 // to the shared list.
197 const { db } = this;
198 await db.members
199 .where({
200 realmId: getTiedRealmId(this.id),
201 userId: db.cloud.currentUserId,
202 })
203 .delete();
204 }
205
206 /** Delete the todo list including all its related entities (todo-items,
207 * realm and memberships)

Callers 1

MemberRowFunction · 0.80

Calls 3

getTiedRealmIdFunction · 0.85
deleteMethod · 0.65
whereMethod · 0.65

Tested by

no test coverage detected