Skip to content

Releases: SHcommit/SHFirestoreService

[Fix] Remove meaningless casting operators

20 May 07:37
Compare
Choose a tag to compare

[Fix] Remove wrong working casting operators

/// This protocol defines objects that can access Firestore.
public protocol FirestoreAccessible {
  var collectionRef: CollectionReference { get }
  var documentRef: DocumentReference? { get }
}

// MARK: - Helpers
public extension FirestoreAccessible {
  var asCollectionRef: CollectionReference? {
    return self as? CollectionReference
  }
  
  var asDocumentRef: DocumentReference? {
    return self as? DocumentReference
  }
}
  • remove asCollectionRef, asDocumentRef.

It can be used without a where condition, whether the implementation of firestoreAccessible refers to a Collection or Document Ref. In this case, an error occurred, so I removed this code.😅

[Fix] isDocumentExists makeQuery closure's input param type modify FirestoreReference -> CollectionReference

19 May 14:28
Compare
Choose a tag to compare

[Fix]

  • isDocumentExists makeQuery closure's input param type modify FirestoreReference -> CollectionReference.
  • to handle references more clearly

[Feat] Now a document exists checking is available to query specific document's filtering for using where field.

19 May 14:18
Compare
Choose a tag to compare

[Feature] isDocumentExists func.

Previously, when the endpoint's firestoreAccessible type was a specific document path, a bool value could be received to determine whether the document exists.

Now you can find through query whether a specific document exists for a collection.

[Feat] Change specific extension helpers access control from internal to public

19 May 11:27
Compare
Choose a tag to compare

[Feat] Change specific extension helpers access control from internal to public

[Feature] FirestoreDocumentSupportable protocol

16 May 04:16
Compare
Choose a tag to compare

[Feature]

  • Declared the isDocumentExists function in the FirestoreDocumentSupportable protocol.
  • Implemented isDocumentExists function in FirestoreService

[Feature] the number of documents in a collection Retrieve logic implementation.

09 May 05:54
Compare
Choose a tag to compare

[Feature]

  • Retrieve the number of documents in a collection using aggressive query logic implement in request(endpoint:)
    • It execute to retrieve the number of all documents in a specified collectionRef from FirestoreAccessible.
    • This method using AggrateQuery's count() that match between 0 and 1000 index entries billed for one documen read: ]

image

  • Set Endpoint's responseDTO's type Int and FirestoreAccessible must return CollectionReference without DocumentReference and then use this method: ]

[References]

[Fix] Modified unexpected logic

08 May 16:51
Compare
Choose a tag to compare

[Fix] Modified unexpected logic

  • Modified unexpected logic in request(endpoint:).
  • "FirestoreMethod case .deleteACollection" was never called, becuse endpoint's request documentRef instance check logic was located at the top.

[Feat] Add batch function and a collection document delete logic, FirestoreMethod type

08 May 15:41
Compare
Choose a tag to compare

[Feautre]

  • Implemented logic to delete all documents in a collection using batch.
  • improved, including saving some redundant logic using Combine+extension.
  • Previously, when receiving collection documents, the endpoints response DTO type was specified as a single type even if it had to be received as an array, but now it must be specified as an array. 🤩

[Example]

  1. When deleting all documents in a collection, set the FirestoreMethod type to deleteADocument.
  2. And then, call a request(endpoint:) func using FirestoreService object ! delete it.
  3. Before deletion, FirestoreAccessible's documentRef must be nil and collectionRef must be specified as the deletion target path in the endpoint.

References:

  • Firebase Document link
  • Firebase | WriteBatch document link

[Feature] Append publisher's helper mehtods

08 May 07:20
Compare
Choose a tag to compare

[Feature]

  • Define sink(promise:) helpers when the publisher's Output value is Void and Future's promise is used

[Feature] Add throw error in FirestoreQueryHandler and handle in FirestoreService

05 May 06:29
Compare
Choose a tag to compare

[Feature]

  • In FirestoreQueryable, it is now possible to throw an error in the FirestoreQueryHandler closure!!
  • Casting computed properties is now possible in FirestoreAccessible😄