Skip to content

Commit 9bb66ec

Browse files
committed
[Feat] isDocumentExists makeQuery closure's input param type modify FirestoreReference -> CollectionReference
1 parent de8b873 commit 9bb66ec

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

Sources/SHFirestoreService/FirestoreDocumentSupportable.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Foundation
1111
#if os(iOS) && canImport(FirebaseFirestore)
1212
import FirebaseFirestore
1313
public protocol FirestoreDocumentSupportable {
14+
typealias QueryHandler = (CollectionReference) throws -> Query
1415

1516
/// When implementing the endpoint's document instance to be returned from the request Type, it is returned whether the document exists.
1617
func isDocumentExists(
@@ -33,7 +34,7 @@ public protocol FirestoreDocumentSupportable {
3334
/// - Throws: `FirestoreServiceError` if the query execution fails.
3435
func isDocumentExists(
3536
endpoint: any FirestoreEndopintable,
36-
makeQuery: @escaping FirestoreQueryable.FirestoreQueryHandler
37+
makeQuery: @escaping QueryHandler
3738
) -> AnyPublisher<Bool, FirestoreServiceError>
3839
}
3940
#endif

Sources/SHFirestoreService/FirestoreService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ extension FirestoreService: FirestoreDocumentSupportable {
440440
/// ```
441441
public func isDocumentExists(
442442
endpoint: any FirestoreEndopintable,
443-
makeQuery: @escaping FirestoreQueryHandler
443+
makeQuery: @escaping QueryHandler
444444
) -> AnyPublisher<Bool, FirestoreServiceError> {
445445
return Future<Bool, FirestoreServiceError> { promise in
446446
guard let collectionRef = endpoint.requestType.asCollectionRef else {

0 commit comments

Comments
 (0)