The current method for handling Firestore complex types, specifically using class-transformer's @Type decorator for GeoPoint fields, is a temporary workaround and needs a more robust solution. The main challenge is the lack of runtime type information in TypeScript, requiring a decorator to cast Firestore's complex types into custom classes effectively.
Steps to Reproduce
Use the existing @Type decorator to cast Firestore GeoPoint fields.
Attempt to apply similar methods to other complex Firestore data types.
Expected Behavior
Develop a new decorator that can handle type-casting for all Firestore complex types, allowing custom constructors and enforcing serialization and deserialization methods.
Actual Behavior
The current solution with @Type is limited, particularly for parsing GeoPoint, which requires public latitude and longitude fields.
Acceptance Criteria
Explore each Firestore Data Type and create unit tests for complex types.
Eliminate the use of class-transformer's @Type decorator.
Develop a new decorator (e.g., @Transform) to store field type-casting information and constraints.
Ensure the new decorator allows calling custom constructors, enabling class owners to construct objects flexibly.
Enforce serialization and deserialization methods for the new decorator to handle custom classes like GeoPoint and other complex types.
Additional Context
This issue has been an ongoing challenge, with various suggestions and discussions about the best approach to handle nested and complex data types in Firestore documents. The goal is to have a flexible, robust solution that can be easily validated and serialized.
Issue Title
Enhance Firestore Complex Types Handling
Description
The current method for handling Firestore complex types, specifically using class-transformer's
@Type
decorator for GeoPoint fields, is a temporary workaround and needs a more robust solution. The main challenge is the lack of runtime type information in TypeScript, requiring a decorator to cast Firestore's complex types into custom classes effectively.Steps to Reproduce
@Type
decorator to cast Firestore GeoPoint fields.Expected Behavior
Develop a new decorator that can handle type-casting for all Firestore complex types, allowing custom constructors and enforcing serialization and deserialization methods.
Actual Behavior
The current solution with
@Type
is limited, particularly for parsing GeoPoint, which requires public latitude and longitude fields.Acceptance Criteria
@Type
decorator.@Transform
) to store field type-casting information and constraints.Additional Context
This issue has been an ongoing challenge, with various suggestions and discussions about the best approach to handle nested and complex data types in Firestore documents. The goal is to have a flexible, robust solution that can be easily validated and serialized.