digidem / comapeo-core

A local-first library for collaborating on mapping projects
MIT License
7 stars 1 forks source link

Derive `createdBy` and `updatedBy` fields for data returned to client #136

Open gmaclennan opened 1 year ago

gmaclennan commented 1 year ago

Description

See https://github.com/digidem/mapeo-schema/issues/83 for background.

The createdBy field is required for the frontend in order to limit editing of records to the device that created them.

The "core ID of the updator" is stored in the versionId (hex string before the @ character). The "core ID of the creator" depends on https://github.com/digidem/mapeo-sqlite-indexer/issues/7

Tasks

This task is to use core ownership records to derive the device ID of the creator and updator, and append them to each returned document as createdBy and updatedBy fields.

gmaclennan commented 1 year ago

Suggesting to solve through encoding to docId see https://github.com/digidem/mapeo-core-next/issues/153 Will still require implementation here to expose to the API