Skip to content

Commit 819288c

Browse files
authored
Merge pull request #248 from boostcampwm-2022/hotfix/photographer-list-mine
fix: 자신의 작가 정보는 받아오지 않도록 수정
2 parents 52b5f01 + 55f7f28 commit 819288c

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

Trinap/Sources/Data/Repositories/Photograhper/DefaultPhotograhperRepository.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,41 @@ final class DefaultPhotographerRepository: PhotographerRepository {
2727

2828
// MARK: Methods
2929
func fetchPhotographers(type: TagType) -> Observable<[Photographer]> {
30+
guard let userId = tokenManager.getToken(with: .userId) else {
31+
return .error(TokenManagerError.notFound)
32+
}
33+
3034
return fireStoreService.getDocument(collection: .photographers)
3135
.map { $0.compactMap { $0.toObject(PhotographerDTO.self)?.toModel() } }
36+
.map { $0.filter { $0.photographerUserId != userId } }
3237
.asObservable()
3338
}
3439

3540
func fetchPhotographers(ids: [String]) -> Observable<[Photographer]> {
41+
guard let userId = tokenManager.getToken(with: .userId) else {
42+
return .error(TokenManagerError.notFound)
43+
}
44+
3645
return fireStoreService.getDocument(collection: .photographers, field: "photographerId", in: ids)
3746
.map { $0.compactMap { $0.toObject(PhotographerDTO.self)?.toModel() } }
47+
.map { $0.filter { $0.photographerUserId != userId } }
3848
.asObservable()
3949
}
4050

4151
func fetchPhotographers(coordinate: Coordinate) -> Observable<[Photographer]> {
52+
guard let userId = tokenManager.getToken(with: .userId) else {
53+
return .error(TokenManagerError.notFound)
54+
}
4255
guard let data = coordinate.asDictionary else { return Observable.just([]) }
56+
4357
return fireStoreService.useFunctions(
4458
functionName: "nearPhotographer",
4559
data: data
4660
)
4761
.map {
4862
$0.compactMap { $0.toObject(PhotographerDTO.self)?.toModel() }
4963
}
64+
.map { $0.filter { $0.photographerUserId != userId } }
5065
.asObservable()
5166
}
5267

Trinap/Sources/Domain/UseCases/Photographer/DefaultFetchPhotographerPreviewsUseCase.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,7 @@ final class DefaultFetchPhotographerPreviewsUseCase: FetchPhotographerPreviewsUs
6868
if photographers.isEmpty {
6969
return Observable.just([])
7070
}
71-
// let asd = Observable.from(photographers.map { owner.convertPreview(photographer: $0) }).merge()
72-
// return asd.toArray().asObservable().map { previews in
73-
// previews.filter { !$0.name.isEmpty }
74-
// }
75-
//
71+
7672
let photographerList = photographers.map {
7773
return owner.convertPreview(photographer: $0)
7874
}

0 commit comments

Comments
 (0)