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

Is not working with @adminjs-prisma #27

Open
Kuro091 opened this issue Mar 13, 2024 · 3 comments
Open

Is not working with @adminjs-prisma #27

Kuro091 opened this issue Mar 13, 2024 · 3 comments

Comments

@Kuro091
Copy link

Kuro091 commented Mar 13, 2024

As per title. I'm trying to have the import export function working in a NestJS application

AdminModule.createAdminAsync({
      useFactory: async () => {
        const prisma = new PrismaService();

return {
          adminJsOptions: {
          resources: [{
              resource: {
                model: getModelByName('ContactSearch'),
                client: prisma,
              },
              options: {},
              features: [importExportFeature({
                new ComponentLoader()
              })]
            }]
        }
})

This did not work and I was referred to a broken link
image

@dziraf
Copy link
Contributor

dziraf commented Mar 13, 2024

              features: [importExportFeature({
                new ComponentLoader()
              })]

this is invalid configuration.

You have to setup one instance of ComponentLoader somewhere in your project, ideally in a separate file and import it. You're also missing componentLoader in AdminJS config.

import componentLoader from '../path/to/your/component-loader'

// ...

          adminJsOptions: {
          componentLoader,
          resources: [{
              resource: {
                model: getModelByName('ContactSearch'),
                client: prisma,
              },
              options: {},
              features: [importExportFeature({
                componentLoader,
              })]
            }]
        }

@Kuro091
Copy link
Author

Kuro091 commented Mar 13, 2024

Thanks for the quick response. As I mentioned I was using NestJs so that should only run once during its lifetime. The full code is as such
image

Let me try it in a separate file

@taksuparth
Copy link

taksuparth commented Oct 25, 2024

@dziraf tried with express server and @admin/prisma and facing the same issue. Can you please check? Also, I am using authenticate router.

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

3 participants