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

Allow syncing directus_files #132

Open
shadiramadan opened this issue Dec 24, 2024 · 2 comments
Open

Allow syncing directus_files #132

shadiramadan opened this issue Dec 24, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@shadiramadan
Copy link

shadiramadan commented Dec 24, 2024

I'd like to be able to sync directus_files. I don't need directus-sync to handle syncing the assets themselves, only the table entries. I manage some icon files with predefined names that map to a custom icon library, these are uploaded as images in Directus until Directus has a better system for managing custom icons.

I essentially do a GCS/S3 copy with a glob on SVGs, and I was planning on filtering the synced files based off this hook:

    files: {
      /**
       * @param {Query} query
       * @param {DirectusClient} client
       */
      onQuery: (query, _client) => {
        query.filter = {
          ...query.filter,
          type: { _eq: "image/svg+xml" },
        };
        return query;
      },
    }

This is the error I get having defined files in onlyCollections.

      "message": "Config file: [onlyCollections,3] Invalid enum value. Expected 'dashboards' | 'flows' | 'folders' | 'operations' | 'panels' | 'permissions' | 'policies' | 'presets' | 'roles' | 'settings' | 'translations', received 'files'",

Please also enable syncing files, leaving the responsibility of the assets themselves to to the user. I believe directus says if it can't find a file in your storage and it let's you upload a file to update the file entry if so.

@shadiramadan
Copy link
Author

Really awesome library! I had written some scripts of my own for managing snapshot state and wrote idempotent seeds using the GraphQL API but I found the flow made more sense to just interact with the UI directly and use your utility! Much cleaner flow!

@EdouardDem
Copy link
Member

@shadiramadan The sync of file is not supported yet, but it could be achieved once the Seed feature is finished. I'm currently working on it.
Thanks for the words

@EdouardDem EdouardDem added the enhancement New feature or request label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants