elersong / fireorm24

ORM for Firebase Firestore 🔥 updated for 2024
MIT License
1 stars 0 forks source link

Support for Constructor Parameters in Collection Classes #13

Open elersong opened 3 months ago

elersong commented 3 months ago

Description

FireORM currently requires collection classes to have parameterless constructors to initialize instances. This limitation forces developers to add undefined and null types to all class attributes to satisfy TypeScript's strict mode, leading to potential issues with data storage and unnecessary null values being written to the datastore.

Steps to Reproduce

  1. Create a collection class with attributes.
  2. Add a parameterless constructor to comply with FireORM requirements.
  3. Attempt to initialize the class with data, encountering TypeScript errors if attributes are not undefined or null.

Expected Behavior

Allow collection classes to have constructors with parameters to initialize data while still supporting FireORM's initialization process. Ensure undefined values are not written to the datastore to avoid storage issues and maintain data integrity.

Actual Behavior

Developers must add undefined and null types to attributes, leading to unnecessary null values in the datastore.

Acceptance Criteria

Additional Context

Original Issue