Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relationships: hasManyFiles bug? #1449

Open
Crash-- opened this issue Feb 27, 2024 · 0 comments
Open

Relationships: hasManyFiles bug? #1449

Crash-- opened this issue Feb 27, 2024 · 0 comments

Comments

@Crash--
Copy link
Contributor

Crash-- commented Feb 27, 2024

@zatteo a essayé un truc du genre :

new CozyClient({ uri: uri, token: token, schema: {
      files: {
        doctype: 'io.cozy.files',
        relationships: {
          contacts: {
            type:'io.cozy.files:hasmany',
            doctype: 'io.cozy.contacts'
          }
        }
      }
    } });

Ensuite, on fait la requête puis on hydrateDocuments("io.cozy.files", data)

Seulement, avec le hasManyFiles, notre contact était toujours vide. J'ai pris l'association HasManyAlbums dispo dans cozy-photos https://github.com/cozy/cozy-photos/blob/master/src/photos/targets/browser/doctypes.js#L5-L29 et je l'ai utilisé dans le schema et là ça a marché direct.

La diff que je vois entre hasManyFiles et hasManyAlbums, c'est que sur le get sur hasManyAlbums, on va chercher data https://github.com/cozy/cozy-photos/blob/master/src/photos/targets/browser/doctypes.js#L7 alors que sur la hasManyFiles, on va pas chercher data on s'arrête au relationship https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/associations/HasManyFiles.js#L42

Un bug dans la hasManyFiles Association ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant