@jcbuisson/express-x 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/server.mjs +7 -1
package/package.json
CHANGED
package/src/server.mjs
CHANGED
|
@@ -448,13 +448,18 @@ export function offlinePlugin(app, modelNames) {
|
|
|
448
448
|
const prisma = app.get('prisma');
|
|
449
449
|
|
|
450
450
|
if (!prisma.metadata) {
|
|
451
|
-
app.log('error', "A model named 'metadata' is expected in the prisma
|
|
451
|
+
app.log('error', "A model named 'metadata' is expected in the prisma schema - see https://expressx.jcbuisson.dev/server-api.html#offline")
|
|
452
452
|
return
|
|
453
453
|
}
|
|
454
454
|
|
|
455
455
|
// add a database service for each model
|
|
456
456
|
for (const modelName of modelNames) {
|
|
457
457
|
const model = prisma[modelName];
|
|
458
|
+
|
|
459
|
+
if (!model) {
|
|
460
|
+
app.log('error', `There is no model named '${modelName}}' in the prisma schema`)
|
|
461
|
+
return
|
|
462
|
+
}
|
|
458
463
|
|
|
459
464
|
app.createService(modelName, {
|
|
460
465
|
|
|
@@ -617,3 +622,4 @@ export function offlinePlugin(app, modelNames) {
|
|
|
617
622
|
})
|
|
618
623
|
|
|
619
624
|
}
|
|
625
|
+
|