@@ -58,25 +58,6 @@ abstract class BaseEntity implements IBaseEntity {
5858
5959 const schemaProperties = schema ?. properties || { } ;
6060
61- // Dynamically add getters and setters based on schema
62- Object . keys ( schemaProperties ) . forEach ( property => {
63- Object . defineProperty ( this , property , {
64- get ( ) {
65- return this . privateData . get ( this ) [ property ] ; // Retrieve the field value
66- } ,
67- set ( value ) {
68- this . privateData . get ( this ) [ property ] = value ; // Assign value to internal variable
69- } ,
70- enumerable : true ,
71- configurable : true
72- } ) ;
73- } ) ;
74-
75- // Initialize properties from schema
76- Object . keys ( schemaProperties ) . forEach ( property => {
77- this . privateData . get ( this ) [ property ] = data [ property ] ;
78- } ) ;
79-
8061 }
8162
8263 toJSON ( ) {
@@ -86,34 +67,6 @@ abstract class BaseEntity implements IBaseEntity {
8667 return data ;
8768 }
8869
89- static extractFieldMapFromSchema ( schemaOrSchemaId : any , ajvOptions : any ) : Record < string , string > {
90-
91- const fieldMap : Record < string , string > = { } ;
92-
93- // Initialize the AJV instance with options
94- const ajv = new Ajv ( ajvOptions || { } ) ;
95- let schema : any = schemaOrSchemaId ;
96-
97-
98- // If schemaOrSchemaId is a string (schema ID), fetch the schema
99- if ( typeof schemaOrSchemaId === "string" ) {
100- schema = ajv . getSchema ( schemaOrSchemaId ) ; // Retrieve the schema
101- if ( ! schema ) {
102- throw new Error ( `Schema with ID ${ schemaOrSchemaId } not found.` ) ;
103- }
104- }
105-
106- if ( schema && schema . properties ) {
107- // Only consider top-level properties from the schema
108- for ( const key in schema . properties ) {
109- fieldMap [ key ] = key ; // Field name matches property name by default
110- }
111- }
112-
113- return fieldMap ;
114-
115- }
116-
11770
11871 // Getter for id
11972 get id ( ) : string | undefined {
0 commit comments