Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/organization management: 중개자>봉사관리 & 봉사자>봉사관리 & 홈 UI 수정 #52

Merged
merged 35 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
60cfc32
feat/dialog: Dialog 팝업 구현 완료
mjkim1019 Nov 22, 2023
9e70093
feat/dialog: 확정, 반려 Dialog 구현
mjkim1019 Nov 22, 2023
9d22f9e
feat/management: 이동봉사자 확인 UI 살짝 수정
mjkim1019 Nov 22, 2023
fcc3397
feat/management: 이동봉사자 반려, 승인 api 연동
mjkim1019 Nov 22, 2023
af0af24
feat/management: 이동봉사자 봉사관리 > 봉사 취소 dialog 구현 및 api 연결
mjkim1019 Nov 22, 2023
4466cc8
fix/home: filter 검색 "전체" 들어갈 경우 앞글자만 따도록 변경
mjkim1019 Nov 22, 2023
d1e739c
fix/home: 이동봉사 공고 ui 살짝 변경
mjkim1019 Nov 22, 2023
adb38ab
fix/api: patch, delete 등 데이터 변화 일으킨 후에 성공 여부 resposne로 받도록 변경
mjkim1019 Nov 22, 2023
348dce5
fix/management: 승인대기중 승인/반려시 List api 재호출
mjkim1019 Nov 22, 2023
4e92315
feat/management: 봉사 완료하기 api 연결 & refresh 진행중 구현
mjkim1019 Nov 22, 2023
cd792bd
feat/management: 봉사 완료 dialog 구현
mjkim1019 Nov 22, 2023
0894cf2
feat/management: 봉사 완료 버튼 클릭 시 봉사 완료 List api도 재호출
mjkim1019 Nov 22, 2023
c140f62
feat/style: empty, loading UI view 공통 component로 구현
mjkim1019 Nov 22, 2023
8ceb7b7
update/style: empty ui 예쁘게 수정
mjkim1019 Nov 22, 2023
eb417b4
feat/management: 중개 > 봉사관리 empty view 보여주게 구현
mjkim1019 Nov 22, 2023
5f49828
update/management: 중개 > 봉사관리 tab UI 변경
mjkim1019 Nov 22, 2023
46f0369
feat/util: profileImage core>util에서 관리하고 가져오도록 구현 및 변경
mjkim1019 Nov 22, 2023
8b52056
update/home: naviagation icon & ui 살짝 변경
mjkim1019 Nov 22, 2023
c7cce83
update/home: 홈 icon 대신 홈 텍스트 보여주도록 변경
mjkim1019 Nov 22, 2023
5207aca
update/util: profileImage 받아오도록 변경
mjkim1019 Nov 22, 2023
a4566bc
update/api: review api response 및 ui profileImage Int로 받아오도록 변경
mjkim1019 Nov 22, 2023
4338d88
update/api: review api response nullable한 변수 변경
mjkim1019 Nov 22, 2023
1c2e75d
update/home: review & home ui 수정
mjkim1019 Nov 22, 2023
c9bd172
update/home: home & review 워딩 수정
mjkim1019 Nov 22, 2023
d6efd7d
update/search: empty 화면 추가
mjkim1019 Nov 22, 2023
2fd1967
update/home: filterSearch이동 구현
mjkim1019 Nov 22, 2023
e4b44f6
update/region: 지역 선택 모달 안눌리는 부분 fix
mjkim1019 Nov 22, 2023
5dcb488
update/management: 이동봉사 봉사관리 empty 구현
mjkim1019 Nov 22, 2023
543f525
update/api: DataUiState & UiState 공통 모듈로 이동
mjkim1019 Nov 22, 2023
17b07ff
update/api: DataUiState & UiState 공통 모듈로 이동
mjkim1019 Nov 22, 2023
25ae67d
update/api: delete 후 response 받아오고, 성공하면 waiting list 재호출하도록 구현
mjkim1019 Nov 22, 2023
442f7ee
merge develop
mjkim1019 Nov 22, 2023
f9b7e08
chore: ktlint formatting
mjkim1019 Nov 22, 2023
b01383a
merge develop
mjkim1019 Nov 22, 2023
c0b8c65
chore: ktlint formatting
mjkim1019 Nov 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.kusitms.connectdog.core.data.api
import com.kusitms.connectdog.core.data.api.model.LoginResponseItem
import com.kusitms.connectdog.core.data.api.model.MyInfoResponseItem
import com.kusitms.connectdog.core.data.api.model.NormalLoginBody
import com.kusitms.connectdog.core.data.api.model.Response
import com.kusitms.connectdog.core.data.api.model.ReviewResponseItem
import com.kusitms.connectdog.core.data.api.model.SocialLoginBody
import com.kusitms.connectdog.core.data.api.model.VolunteerResponse
Expand All @@ -15,6 +16,7 @@ import com.kusitms.connectdog.core.data.api.model.volunteer.BadgeResponse
import com.kusitms.connectdog.core.data.api.model.volunteer.BookmarkResponseItem
import com.kusitms.connectdog.core.data.api.model.volunteer.UserInfoResponse
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.POST
Expand All @@ -24,7 +26,7 @@ import retrofit2.http.Query
internal interface ApiService {

/**
* 이동봉사자 >
* 홈
*/
@GET("/volunteers/posts/home")
suspend fun getAnnouncementPostsHome(): List<AnnouncementHomeResponseItem>
Expand All @@ -51,7 +53,7 @@ internal interface ApiService {
): List<ReviewResponseItem>

/**
* 이동봉사자 > 봉사관리
* 봉사관리
*/
@GET("/volunteers/applications/waiting")
suspend fun getApplicationWaiting(
Expand All @@ -76,6 +78,11 @@ internal interface ApiService {
@Path("applicationId") applicationId: Long
): VolunteerResponse

@DELETE("/volunteers/applications/{applicationId}")
suspend fun deleteMyApplication(
@Path("applicationId") applicationId: Long
): Response

/**
* 로그인
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.kusitms.connectdog.core.data.api

import com.kusitms.connectdog.core.data.api.model.Response
import com.kusitms.connectdog.core.data.api.model.VolunteerResponse
import com.kusitms.connectdog.core.data.api.model.intermediator.InterApplicationCompletedResponseItem
import com.kusitms.connectdog.core.data.api.model.intermediator.InterApplicationInProgressResponseItem
import com.kusitms.connectdog.core.data.api.model.intermediator.InterApplicationRecruitingResponseItem
import com.kusitms.connectdog.core.data.api.model.intermediator.InterApplicationWaitingResponseItem
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.PATCH
import retrofit2.http.Path
import retrofit2.http.Query

Expand Down Expand Up @@ -41,4 +44,19 @@ internal interface InterApiService {
suspend fun getApplicationVolunteer(
@Path("applicationId") applicationId: Long
): VolunteerResponse

@PATCH("/intermediaries/applications/{applicationId}")
suspend fun patchApplicationVolunteer(
@Path("applicationId") applicationId: Long
): Response

@DELETE("/intermediaries/applications/{applicationId}")
suspend fun deleteApplicationVolunteer(
@Path("applicationId") applicationId: Long
): Response

@PATCH("/intermediaries/applications/{applicationId}/completed")
suspend fun patchApplicationCompleted(
@Path("applicationId") applicationId: Long
): Response
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.kusitms.connectdog.core.data.api.model

import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = true)
data class Response(
val isSuccess: Boolean
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ data class ReviewResponseItem(
val departureLoc: String,
val dogName: String,
val endDate: String,
val images: List<String>,
val images: List<String>?,
val intermediaryName: String,
val mainImage: String,
val startDate: String,
val volunteerNickname: String
val volunteerNickname: String,
val profileImageNum: Int
)
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,6 @@ internal object ApiModule {
}
}

@Provides
@Singleton
fun provideIntermediatorApiService(
okHttpClient: OkHttpClient,
moshi: Moshi
): InterApiService {
return Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(MoshiConverterFactory.create(moshi))
.client(okHttpClient).build()
.create(InterApiService::class.java)
}

@Provides
@Singleton
fun provideDataStoreRepository(@ApplicationContext context: Context): DataStoreRepository {
Expand Down Expand Up @@ -112,6 +99,19 @@ internal object ApiModule {
.create(ApiService::class.java)
}

@Provides
@Singleton
fun provideIntermediatorApiService(
okHttpClient: OkHttpClient,
moshi: Moshi
): InterApiService {
return Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(MoshiConverterFactory.create(moshi))
.client(okHttpClient).build()
.create(InterApiService::class.java)
}

@Provides
@Singleton
fun provideJson(): Json =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.kusitms.connectdog.core.data.mapper

import com.kusitms.connectdog.core.data.api.model.Response
import com.kusitms.connectdog.core.model.ConnectDogResult

internal fun Response.toData(): ConnectDogResult = ConnectDogResult(isSuccess)
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@ 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
import com.kusitms.connectdog.core.util.dateRangeFormat

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로 바뀔 예정
profileNum = profileImageNum,
dogName = dogName,
userName = volunteerNickname,
contentUrl = mainImage,
date = "$start-$end",
location = "$departureLoc->$arrivalLoc",
date = dateRangeFormat(startDate, endDate),
location = "$departureLoc$arrivalLoc",
organization = intermediaryName,
content = content
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,23 @@ package com.kusitms.connectdog.core.data.mapper.volunteer
import com.kusitms.connectdog.core.data.api.model.volunteer.AnnouncementHomeResponseItem
import com.kusitms.connectdog.core.data.api.model.volunteer.AnnouncementSearchResponseItem
import com.kusitms.connectdog.core.model.Announcement
import com.kusitms.connectdog.core.util.dateFormat
import com.kusitms.connectdog.core.util.toLocalDate
import com.kusitms.connectdog.core.util.dateRangeFormat

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",
date = dateRangeFormat(startDate, endDate),
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",
date = dateRangeFormat(startDate, endDate),
organization = this.intermediaryName,
hasKennel = this.isKennel
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,17 @@ internal class HomeRepositoryImpl @Inject constructor(
page: Int?,
size: Int?
): List<Announcement> {
var depart = departureLoc
if (depart != null) {
if ("전체" in depart) depart = depart.take(2)
}
var dest = arrivalLoc
if (dest != null) {
if ("전체" in dest) dest = dest.take(2)
}
return api.getAnnouncementFilterPosts(
postStatus,
departureLoc, arrivalLoc,
depart, dest,
startDate, endDate,
dogSize, isKennel, intermediaryName,
orderCondition,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kusitms.connectdog.core.data.repository

import com.kusitms.connectdog.core.model.ConnectDogResult
import com.kusitms.connectdog.core.model.InterApplication
import com.kusitms.connectdog.core.model.Volunteer

Expand All @@ -9,4 +10,9 @@ interface InterManagementRepository {
suspend fun getApplicationInProgress(page: Int? = 0, size: Int? = 5): List<InterApplication>
suspend fun getApplicationCompleted(page: Int? = 0, size: Int? = 5): List<InterApplication>
suspend fun getApplicationVolunteer(applicationId: Long): Volunteer

suspend fun confirmApplicationVolunteer(applicationId: Long): ConnectDogResult
suspend fun rejectApplicationVolunteer(applicationId: Long): ConnectDogResult

suspend fun completeApllication(applicationId: Long): ConnectDogResult
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.kusitms.connectdog.core.data.repository
import com.kusitms.connectdog.core.data.api.InterApiService
import com.kusitms.connectdog.core.data.mapper.intermediator.toData
import com.kusitms.connectdog.core.data.mapper.toData
import com.kusitms.connectdog.core.data.mapper.volunteer.toData
import com.kusitms.connectdog.core.model.ConnectDogResult
import com.kusitms.connectdog.core.model.InterApplication
import com.kusitms.connectdog.core.model.Volunteer
import javax.inject.Inject
Expand All @@ -30,4 +30,16 @@ internal class InterManagementRepositoryImpl @Inject constructor(
override suspend fun getApplicationVolunteer(applicationId: Long): Volunteer {
return api.getApplicationVolunteer(applicationId).toData()
}

override suspend fun confirmApplicationVolunteer(applicationId: Long): ConnectDogResult {
return api.patchApplicationVolunteer(applicationId).toData()
}

override suspend fun rejectApplicationVolunteer(applicationId: Long): ConnectDogResult {
return api.deleteApplicationVolunteer(applicationId).toData()
}

override suspend fun completeApllication(applicationId: Long): ConnectDogResult {
return api.patchApplicationCompleted(applicationId).toData()
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.kusitms.connectdog.core.data.repository

import com.kusitms.connectdog.core.model.Application
import com.kusitms.connectdog.core.model.ConnectDogResult
import com.kusitms.connectdog.core.model.Volunteer

interface ManagementRepository {
suspend fun getApplicationWaiting(page: Int? = 0, size: Int? = 5): List<Application>
suspend fun getApplicationInProgress(page: Int? = 0, size: Int? = 5): List<Application>
suspend fun getApplicationCompleted(page: Int? = 0, size: Int? = 5): List<Application>
suspend fun getMyApplication(applicationId: Long): Volunteer

suspend fun deleteMyApplication(applicationId: Long): ConnectDogResult
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.kusitms.connectdog.core.data.api.ApiService
import com.kusitms.connectdog.core.data.mapper.toData
import com.kusitms.connectdog.core.data.mapper.volunteer.toData
import com.kusitms.connectdog.core.model.Application
import com.kusitms.connectdog.core.model.ConnectDogResult
import com.kusitms.connectdog.core.model.Volunteer
import javax.inject.Inject

Expand All @@ -25,4 +26,8 @@ internal class ManagementRepositoryImpl @Inject constructor(
override suspend fun getMyApplication(applicationId: Long): Volunteer {
return api.getMyApplication(applicationId).toData()
}

override suspend fun deleteMyApplication(applicationId: Long): ConnectDogResult {
return api.deleteMyApplication(applicationId).toData()
}
}
1 change: 1 addition & 0 deletions core/designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ android {

dependencies {
implementation(project(":core:model"))
implementation(project(":core:util"))

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,14 @@ private fun CommentContent(comment: String) {
.fillMaxWidth()
.background(color = Orange20, shape = RoundedCornerShape(4.dp))
.padding(10.dp),
horizontalAlignment = Alignment.Start
horizontalAlignment = Alignment.Start,
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
Text(
text = stringResource(id = R.string.volunteer_comment),
style = MaterialTheme.typography.titleSmall,
fontSize = 14.sp
)
Spacer(modifier = Modifier.size(6.dp))
Text(text = comment, style = MaterialTheme.typography.bodyMedium)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ package com.kusitms.connectdog.core.designsystem.component
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.width
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -60,14 +57,12 @@ fun TitleValue(
style: TextStyle,
isValid: Boolean = true
) {
Row {
Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {
Text(
text = title,
style = style,
color = if (isValid) Gray3 else Gray6,
modifier = Modifier.defaultMinSize(minWidth = 35.dp)
color = if (isValid) Gray3 else Gray6
)
Spacer(modifier = Modifier.width(12.dp))
Text(
text = value,
style = style,
Expand Down
Loading