[Bug]: Error with @adminjs/relations: "No property of the name: 'relations'" for Event Resource
Contact Details
No response
What happened?
AdminJS is not showing relations for a resource Event when using @adminjs/relations. All other resources in the database work as expected and show their relations. The issue only occurs with the Event resource.
The @adminjs/relations package throws the error:
[AdminJS]: There is no property of the name: "relations". Check out the "showProperties" in the resource: "events".
The Event resource is configured like this:
export const createEventResource = () => ({
resource: new LucidResource(Event, 'postgres'),
options: {
navigation: { name: null, icon: 'Calendar' },
listProperties: ['id', 'name', 'description', 'startDate', 'endDate', 'createdAt', 'updatedAt'],
filterProperties: ['name', 'description'],
editProperties: ['name', 'description', 'startDate', 'endDate'],
showProperties: ['id', 'name', 'description', 'startDate', 'endDate', 'createdAt', 'updatedAt', 'relations'],
properties: {
name: { isTitle: true },
description: { type: 'richtext' },
startDate: { type: 'datetime' },
endDate: { type: 'datetime' },
sort: { sortBy: 'updatedAt', direction: 'desc' },
},
features: [
targetRelationSettingsFeature(),
owningRelationSettingsFeature({
componentLoader,
licenseKey: process.env.ADMINJS_RELATIONS_LICENSE_KEY!,
relations: {
places: {
type: RelationType.ManyToMany,
junction: { joinKey: 'eventId', inverseJoinKey: 'placeId', throughResourceId: 'place_events' },
target: { resourceId: 'places' },
},
},
}),
],
},
});
Additional context
I'm using AdminJS with AdonisJS and Lucid ORM.
Any insights on whether the name "Event" or another configuration issue might be causing the conflict would be greatly appreciated.
Bug prevalence
Always
AdminJS dependencies version
{ "@adminjs/adonis": "^1.1.0", "@adminjs/passwords": "^4.0.0", "@adminjs/relations": "^1.1.2", "adminjs": "^7.8.7", }
What browsers do you see the problem on?
Chrome, Microsoft Edge
Relevant log output
[AdminJS]: There is no property of the name: "relations". Check out the "showProperties" in the resource: "events".
Relevant code that's giving you issues
export const createEventResource = () => ({
resource: new LucidResource(Event, 'postgres'),
options: {
navigation: { name: null, icon: 'Calendar' },
listProperties: ['id', 'name', 'description', 'startDate', 'endDate', 'createdAt', 'updatedAt'],
filterProperties: ['name', 'description'],
editProperties: ['name', 'description', 'startDate', 'endDate'],
showProperties: ['id', 'name', 'description', 'startDate', 'endDate', 'createdAt', 'updatedAt', 'relations'],
properties: {
name: { isTitle: true },
description: { type: 'richtext' },
startDate: { type: 'datetime' },
endDate: { type: 'datetime' },
sort: { sortBy: 'updatedAt', direction: 'desc' },
},
features: [
targetRelationSettingsFeature(),
owningRelationSettingsFeature({
componentLoader,
licenseKey: process.env.ADMINJS_RELATIONS_LICENSE_KEY!,
relations: {
places: {
type: RelationType.ManyToMany,
junction: { joinKey: 'eventId', inverseJoinKey: 'placeId', throughResourceId: 'place_events' },
target: { resourceId: 'places' },
},
},
}),
],
},
});
Hey @melyamri, did you manage to make it work? I have a similar issue with @adminjs/relations.