Handling `ref`
hendrysadrak opened this issue · comments
Hendry Sadrak commented
adminjs-mongoose/src/property.ts
Lines 72 to 80 in b35f89f
This part requires another update because the ref
in mongoose can be defined as string | Model<any> | ((this: any, doc: any) => string | Model<any>);
Right now this logic correctly handles ref: string | Model
but not the ref: () => string | Model
part
Line 77 should be updated to
if (typeof ref === 'function') return ref.modelName || ref().modelName
Lmk what you think