@@ -19,7 +19,7 @@ import AdminJS from 'adminjs'
19
19
AdminJS .registerAdapter ({ Database , Resource })
20
20
```
21
21
22
- ## Example
22
+ ## Example (Basic)
23
23
24
24
Whole code can be found in ` example-app ` directory in the repository.
25
25
68
68
})
69
69
```
70
70
71
+ ## Example (Custom Client Output Path)
72
+
73
+ If you defined a custom client output path in your Prisma's schema, for example:
74
+
75
+ ``` prisma
76
+ generator client {
77
+ provider = "prisma-client-js"
78
+ output = "./client-prisma"
79
+ }
80
+ ```
81
+
82
+ You must:
83
+ * import your custom Prisma client
84
+ * provide it to each resource which uses that Prisma client
85
+
86
+ * Example* :
87
+
88
+ ``` typescript
89
+ // other imports
90
+ import PrismaModule from ' ../prisma/client-prisma/index.js' ;
91
+
92
+ // ...
93
+
94
+ const prisma = new PrismaModule .PrismaClient ();
95
+
96
+ // ...
97
+
98
+ // Notice `clientModule` per resource
99
+ const admin = new AdminJS ({
100
+ resources: [{
101
+ resource: { model: getModelByName (' Post' , PrismaModule ), client: prisma , clientModule: PrismaModule },
102
+ options: {
103
+ properties: {
104
+ someJson: { type: ' mixed' , isArray: true },
105
+ ' someJson.number' : { type: ' number' },
106
+ ' someJson.string' : { type: ' string' },
107
+ ' someJson.boolean' : { type: ' boolean' },
108
+ ' someJson.date' : { type: ' datetime' },
109
+ },
110
+ },
111
+ }, {
112
+ resource: { model: getModelByName (' Profile' , PrismaModule ), client: prisma , clientModule: PrismaModule },
113
+ options: {},
114
+ }, {
115
+ resource: { model: getModelByName (' Publisher' , PrismaModule ), client: prisma , clientModule: PrismaModule },
116
+ options: {},
117
+ }],
118
+ });
119
+
120
+ // ...
121
+ ```
122
+
71
123
## ManyToOne / ManyToMany
72
124
73
125
These relationships are currently not supported by default. You can manage them using custom actions and components.
0 commit comments