@jiway/firestorm-core - v1.1.1
    Preparing search index...

    Class FirestormMetadata<T_model>

    Metadatas linked to a type that holds information:

    • on how to convert it to and from firestore.
    • the fields remapped
    • the conversions of complex fields
    • the subcollections
    • the fields ignored

    Type Parameters

    • T_model

      Type this metadatas are for

    Index

    Constructors

    Properties

    collection?: string

    Collection's path

    type: Type<T_model>

    Type this metadatas are for

    Accessors

    • get documentBlueprint(): Record<string, PropertyBluePrint>

      Creates a blueprint of the document created by the model

      Returns Record<string, PropertyBluePrint>

      ⚠️ Not ready

    • get modelProperties(): MapIterator<FirestormPropertyMetadata<any>>

      List of the properties that are mapped to a document, including ignored keys.

      Returns MapIterator<FirestormPropertyMetadata<any>>

    Methods

    • Adds a converter for a field from the document to the model

      Type Parameters

      • T

      Parameters

      Returns void

    • Marks a key as ignored when deserializing a document

      Parameters

      • propertyName: string

        The name of the property to ignore

      Returns void

    • Adds a converter for a property from the model to the document

      Type Parameters

      • T

      Parameters

      Returns void

    • Marks a key in the model to be read when deserializing a document

      Parameters

      • propertyName: string

        They name of the property in the model

      Returns string

      The default key that will be used in the document

    • Overrides the key in a document mapping to a the key in the model

      Parameters

      • propertyName: string

        Key in the model

      • mapTo: string

        Matching key in the document

      Returns void

    • Adds a ToCollection relationship

      Type Parameters

      • T_target_model extends IFirestormModel

        Type of the target of the relationship

      Parameters

      • propertyName: string

        The name of the property that has a relationship

      • targetType: Type<T_target_model>

        Type of the target of the relationship

      • location: PathLike

        Location of the relationship

      Returns void

    • Adds a ToDocument relationship

      Type Parameters

      • T_target_model extends IFirestormModel

        Type of the target of the relationship

      Parameters

      • propertyName: string

        The name of the property that has a relationship

      • targetType: Type<T_target_model>

        Type of the target of the relationship

      • location: PathLike

        Location of the relationship

      • documentId: string

        Id of the document

      Returns void

    • Adds a ToMany relationship

      Type Parameters

      • T_target_model extends IFirestormModel

        Type of the target of the relationship

      Parameters

      • propertyName: string

        The name of the property that has a relationship

      • targetType: Type<T_target_model>

        Type of the target of the relationship

      • location: PathLike

        Location of the relationship

      Returns void

    • Adds a ToOne relationship

      Type Parameters

      • T_target_model extends IFirestormModel

        Type of the target of the relationship

      Parameters

      • propertyName: string

        The name of the property that has a relationship

      • targetType: Type<T_target_model>

        Type of the target of the relationship

      • location: PathLike

        Location of the relationship

      Returns void

    • Converts a document to a model

      Parameters

      Returns T_model

      The model created from the document

    • Converts a model or part of a model to a document.

      Parameters

      • model: Partial<T_model>

        Model to convert

      Returns FirestoreDocument

      The document created from the model