Skip to content

Commit

Permalink
#6 feat/홈 : 홈 화면에서 필요한 usecase 추가
Browse files Browse the repository at this point in the history
- User 정보를 얻어오는 GetCachedUserUseCase 추가 (내용은 임시)
- User 기반으로 Review 정보를 얻어오는 GetLocationReviewsUseCase 추가 (내용은 임시)
  • Loading branch information
HayleyKim0716 committed Aug 2, 2022
1 parent 5be475c commit b8b1421
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.ftw.hometerview.di.usecase

import com.ftw.domain.usecase.review.GetLocaionReviewsUseCase
import com.ftw.domain.usecase.review.GetLocationReviewsUseCaseImpl
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
class ReviewUseCaseModule {
@Provides
@Singleton
fun provideGetLocationReviewsUseCase(): GetLocaionReviewsUseCase{
return GetLocationReviewsUseCaseImpl()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ftw.hometerview.di.usecase

import com.ftw.domain.usecase.user.GetCachedUserUseCase
import com.ftw.domain.usecase.user.GetCachedUserUseCaseImpl
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
class UserUseCaseModule {

@Provides
@Singleton
fun provideGetCachedUseCase(): GetCachedUserUseCase {
return GetCachedUserUseCaseImpl()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.ftw.domain.usecase.review

import com.ftw.domain.entity.LocationReview

interface GetLocaionReviewsUseCase {
operator fun invoke(location: String): List<LocationReview>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package com.ftw.domain.usecase.review

import com.ftw.domain.entity.BuildingType
import com.ftw.domain.entity.LocationReview
import com.ftw.domain.entity.Review
import java.util.Calendar
import java.util.Date

class GetLocationReviewsUseCaseImpl : GetLocaionReviewsUseCase {
override fun invoke(location: String): List<LocationReview> {
return listOf(
LocationReview(
location = "강남구",
reviews = listOf(getTempReview1(), getTempReview2(), getTempReview3())
),
LocationReview(
location = "서초구",
reviews = listOf(getTempReview3(), getTempReview1(), getTempReview2())
),
LocationReview(
location = "중구",
reviews = listOf(getTempReview2(), getTempReview3(), getTempReview1())
)
)
}

private fun getTempReview1(): Review {
return Review(
buildingName = "아크로텔 오피스텔",
buildingType = BuildingType.OFFICETEL,
address = "인천 남동구 구월남로 125",
rating = 4,
officeLocation = "역삼역",
advantage = "역근처라 그런지 일단 인프라가 너무 좋아요!",
disadvantage = "창문이 많아서 냉난방비 많이나오고 커튼달기도 쉽지 않음... 그리고 새거라 석면가루같은게 막 나오고 그럼.\n그래도 살만합니다.",
favorite = false,
leftAt = Date().apply {
Calendar.getInstance().apply {
set(2020, 12, 30)
}
}
)
}

private fun getTempReview2(): Review {
return Review(
buildingName = "한국 아파트",
buildingType = BuildingType.APARTMENT,
address = "성남대로 1226번길 2",
rating = 3,
officeLocation = "삼전역",
advantage = "지하철 가깝고, 내부 도배, 가구들 깔끔하고, 구조 괜팒습니다. 화장실도 괜찮은 편이고 이중창이라 단열 잘되구요.",
disadvantage = "정말 작습니다. 1층 문앞에 외부인들 매일 담배피고 침 뱉습니다ㅣ. 비번입력 잘 안돼서 배달 시키면 1층 내려가서 받아야 함. 남향이라고 했는데 앞에 건물 때문에 직광 전혀 없습니다. 그냥 북향이라고 보면 됨",
favorite = false,
leftAt = Date().apply {
Calendar.getInstance().apply {
set(2021, 11, 3)
}
}
)
}

private fun getTempReview3(): Review {
return Review(
buildingName = "한빛 삼성 아파트",
buildingType = BuildingType.APARTMENT,
address = "서재2길 41-9",
rating = 1,
officeLocation = "몽촌토성역",
advantage = "관리비 8만원 월세에 포함되어있음\n- 주변에 버스 정류장이 많아 평택역이나 시내에 나가기 편함\n- 건물 내부 엘리베이터 있음\n- 주차공간14개\n- 주변에 신축공원 공사 중",
disadvantage = "건물 관리인이 노답임. 통화도 어렵고 어렵게 통화가 되더라도 말이 안 통함. 집주인과 직통으로 연락하는 것이 아닌 건물 관리인이 중간에 있기 때문에 건물 관리인의 역할이 중요하다 진짜 욕나오게 하는 관리인임. 아래는 건무루 관리인과 있었던 트러블(입주 두 달 동안) \n1. 입주한지 두 달 밖에 안 된 월세 세입자를 입주 2년 넘은 전세 세입자로 착각. \n2. 전화통화 어려움. 문자 답장 또한 없음\n3. 월세 확인도 제대로 안 됨. \n 4. 방 내부 관리가 전혀 안 되어있어(화장실 문 안 닫힘, 화장실 내부 창 흔들림 등) 요청하였으나 알겠다고 하고는 그 이후 연락이없음. 화를 내야 그제서야 고쳐줌 \n5. 집이 낡았다는 이유로 방 내부에 있는 옵션 수리 안 해줌",
favorite = false,
leftAt = Date().apply {
Calendar.getInstance().apply {
set(2022, 3, 2)
}
}
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.ftw.domain.usecase.user

import com.ftw.domain.entity.User

interface GetCachedUserUseCase {
operator fun invoke(): User
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.ftw.domain.usecase.user

import com.ftw.domain.entity.Company
import com.ftw.domain.entity.User

class GetCachedUserUseCaseImpl : GetCachedUserUseCase {
override fun invoke(): User {
// TODO: UserRepository 추가 및 return value 수정
return User(
company = Company("삼성전자", "동탄역")
)
}
}

0 comments on commit b8b1421

Please sign in to comment.