elersong / fireorm24

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

Enhance Firestore Complex Types Handling #10

Open elersong opened 2 months ago

elersong commented 2 months ago

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

  1. Use the existing @Type decorator to cast Firestore GeoPoint fields.
  2. 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

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.