-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from PawWithU/feature/network_home
Feature/network_home : 홈 api 연동 완료
- Loading branch information
Showing
20 changed files
with
298 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 28 additions & 3 deletions
31
core/data/src/main/java/com/kusitms/connectdog/core/data/api/ApiService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,34 @@ | ||
package com.kusitms.connectdog.core.data.api | ||
|
||
import com.kusitms.connectdog.core.data.api.model.ExampleResponse | ||
import com.kusitms.connectdog.core.data.api.model.AnnouncementHomeResponseItem | ||
import com.kusitms.connectdog.core.data.api.model.AnnouncementSearchResponseItem | ||
import com.kusitms.connectdog.core.data.api.model.ReviewResponseItem | ||
import retrofit2.http.GET | ||
import retrofit2.http.Query | ||
|
||
internal interface ApiService { | ||
@GET("/droidknights/DroidKnights2023_App/main/core/data/src/main/assets/sponsors.json") | ||
suspend fun getExample(): List<ExampleResponse> | ||
|
||
@GET("/volunteers/posts/home") | ||
suspend fun getAnnouncementPostsHome(): List<AnnouncementHomeResponseItem> | ||
|
||
@GET("/volunteers/posts") | ||
suspend fun getAnnouncementFilterPosts( | ||
@Query("postStatus") postStatus: String?, | ||
@Query("departureLoc") departureLoc: String?, | ||
@Query("arrivalLoc") arrivalLoc: String?, | ||
@Query("startDate") startDate: String?, | ||
@Query("endDate") endDate: String?, | ||
@Query("dogSize") dogSize: String?, | ||
@Query("isKennel") isKennel: Boolean?, | ||
@Query("intermediaryName") intermediaryName: String?, | ||
@Query("orderCondition") orderCondition: String?, | ||
@Query("page") page: Int, | ||
@Query("size") size: Int | ||
): List<AnnouncementSearchResponseItem> | ||
|
||
@GET("/volunteers/reviews") | ||
suspend fun getReviewsHome( | ||
@Query("page") page: Int, | ||
@Query("size") size: Int | ||
): List<ReviewResponseItem> | ||
} |
15 changes: 15 additions & 0 deletions
15
.../src/main/java/com/kusitms/connectdog/core/data/api/model/AnnouncementHomeResponseItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.kusitms.connectdog.core.data.api.model | ||
|
||
import com.squareup.moshi.JsonClass | ||
|
||
@JsonClass(generateAdapter = true) | ||
data class AnnouncementHomeResponseItem( | ||
val arrivalLoc: String, | ||
val departureLoc: String, | ||
val endDate: String, | ||
val intermediaryName: String, | ||
val isKennel: Boolean, | ||
val mainImage: String, | ||
val postId: Int, | ||
val startDate: String | ||
) |
15 changes: 15 additions & 0 deletions
15
...rc/main/java/com/kusitms/connectdog/core/data/api/model/AnnouncementSearchResponseItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.kusitms.connectdog.core.data.api.model | ||
|
||
import com.squareup.moshi.JsonClass | ||
|
||
@JsonClass(generateAdapter = true) | ||
data class AnnouncementSearchResponseItem( | ||
val postId: Int, | ||
val departureLoc: String, | ||
val arrivalLoc: String, | ||
val startDate: String, | ||
val endDate: String, | ||
val intermediaryName: String, | ||
val isKennel: Boolean, | ||
val mainImage: String | ||
) |
20 changes: 0 additions & 20 deletions
20
core/data/src/main/java/com/kusitms/connectdog/core/data/api/model/ExampleResponse.kt
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
core/data/src/main/java/com/kusitms/connectdog/core/data/api/model/ReviewResponseItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.kusitms.connectdog.core.data.api.model | ||
|
||
import com.squareup.moshi.JsonClass | ||
|
||
@JsonClass(generateAdapter = true) | ||
data class ReviewResponseItem( | ||
val arrivalLoc: String, | ||
val content: String, | ||
val departureLoc: String, | ||
val dogName: String, | ||
val endDate: String, | ||
val images: List<String>, | ||
val intermediaryName: String, | ||
val mainImage: String, | ||
val startDate: String, | ||
val volunteerNickname: String | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletions
16
core/data/src/main/java/com/kusitms/connectdog/core/data/di/DataModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
core/data/src/main/java/com/kusitms/connectdog/core/data/mapper/AnnouncementMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.kusitms.connectdog.core.data.mapper | ||
|
||
import com.kusitms.connectdog.core.data.api.model.AnnouncementHomeResponseItem | ||
import com.kusitms.connectdog.core.data.api.model.AnnouncementSearchResponseItem | ||
import com.kusitms.connectdog.core.model.Announcement | ||
import com.kusitms.connectdog.core.util.dateFormat | ||
import com.kusitms.connectdog.core.util.toLocalDate | ||
|
||
internal fun AnnouncementHomeResponseItem.toData(): Announcement { | ||
val datePattern = "yyyy-MM-dd" | ||
val uiPattern = "YY.MM.dd(E)" | ||
val start = this.startDate.toLocalDate(datePattern).dateFormat(uiPattern) | ||
val end = this.endDate.toLocalDate(datePattern).dateFormat(uiPattern) | ||
return Announcement( | ||
imageUrl = this.mainImage, | ||
location = "${this.departureLoc} → ${this.arrivalLoc}", | ||
date = "$start-$end", | ||
organization = this.intermediaryName, | ||
hasKennel = this.isKennel | ||
) | ||
} | ||
|
||
internal fun AnnouncementSearchResponseItem.toData(): Announcement { | ||
val datePattern = "yyyy-MM-dd" | ||
val uiPattern = "YY.MM.dd(E)" | ||
val start = this.startDate.toLocalDate(datePattern).dateFormat(uiPattern) | ||
val end = this.endDate.toLocalDate(datePattern).dateFormat(uiPattern) | ||
return Announcement( | ||
imageUrl = this.mainImage, | ||
location = "${this.departureLoc} → ${this.arrivalLoc}", | ||
date = "$start-$end", | ||
organization = this.intermediaryName, | ||
hasKennel = this.isKennel | ||
) | ||
} |
16 changes: 0 additions & 16 deletions
16
core/data/src/main/java/com/kusitms/connectdog/core/data/mapper/ExampleMapper.kt
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
core/data/src/main/java/com/kusitms/connectdog/core/data/mapper/ReviewMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.kusitms.connectdog.core.data.mapper | ||
|
||
import com.kusitms.connectdog.core.data.api.model.ReviewResponseItem | ||
import com.kusitms.connectdog.core.model.Review | ||
import com.kusitms.connectdog.core.util.toLocalDate | ||
|
||
internal fun ReviewResponseItem.toData(): Review { | ||
val datePattern = "yyyy-MM-dd" | ||
val start = startDate.toLocalDate(datePattern) | ||
val end = endDate.toLocalDate(datePattern) | ||
return Review( | ||
profileUrl = mainImage, // todo profileUrl로 바뀔 예정 | ||
dogName = dogName, | ||
userName = volunteerNickname, | ||
contentUrl = mainImage, | ||
date = "$start-$end", | ||
location = "$departureLoc->$arrivalLoc", | ||
organization = intermediaryName, | ||
content = content | ||
) | ||
} |
16 changes: 0 additions & 16 deletions
16
...ata/src/main/java/com/kusitms/connectdog/core/data/repository/DefaultExampleRepository.kt
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
core/data/src/main/java/com/kusitms/connectdog/core/data/repository/ExampleRepository.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.