remoteStorage

Nested objects

hi there,

Well, something that i probably missed in docs but i’m stuck by how to link objects.
Say i want to use “contacts” module and i would like to store groups with contacts in.
Any idea or closed samples where i can deal with it ?

Thanks
lionel

Hi,

There is currently no way to define groups in the contacts module afaics. I’m not sure if that’s somehow standardized with vcards or not, so no idea what the best way to implement it would be.

In any case, it would make sense to add support for it to the module in my opinion. Maybe @untitaker could share his opinion, as I think he worked with calendars and contacts (outside of RS) quite a bit in the past.

The easiest way would be to just create subdirectories for address books/groups. You could check out the albums in the pictures module, which is doing basically just that. Then just add a (optional?) group param to the add and get functions for example.

1 Like

raucao thanks :grinning:
see an example?

We deprecated the legacy modules, but if you go back in Git history of that repo, you can still access the code. Here’s the latest pictures module:

Using this would work by opening an album like this:

const album = new Album('2019_spring_festival');
await album.store(mimeType, filename, data);

I could imagine doing it similarly with contacts, and using e.g. AddressBook like the Album in the pictures module.