mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 12:56:05 +00:00
Refactor entity handling to preserve config while overriding type
Reworked `ensureEntity` to replace entities while maintaining their configuration and allowing type adjustments. Updated tests to verify type persistence and synchronization of entity properties.
This commit is contained in:
@@ -48,10 +48,9 @@ export class AppMedia extends Module<typeof mediaConfigSchema> {
|
||||
this.setupListeners();
|
||||
this.ctx.server.route(this.basepath, new MediaController(this).getController());
|
||||
|
||||
const mediaEntity = this.getMediaEntity(true);
|
||||
const name = mediaEntity.name as "media";
|
||||
const media = this.getMediaEntity(true);
|
||||
this.ensureSchema(
|
||||
em({ [name]: mediaEntity }, ({ index }, { media }) => {
|
||||
em({ [media.name as "media"]: media }, ({ index }, { media }) => {
|
||||
index(media).on(["path"], true).on(["reference"]);
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user