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

refactor: 장소 등록 api 수정 #369

Merged
merged 5 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions android/app/src/main/java/com/now/naaga/data/mapper/PlaceMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.now.naaga.data.mapper

import com.now.domain.model.Place
import com.now.naaga.data.remote.dto.PlaceDto
import com.now.naaga.data.remote.dto.PostPlaceDto

fun Place.toDto(): PlaceDto {
return PlaceDto(
Expand All @@ -22,3 +23,13 @@ fun PlaceDto.toDomain(): Place {
description = description,
)
}

fun PostPlaceDto.toDomain(): Place {
return Place(
id = id,
name = name,
coordinate = coordinate.toDomain(),
image = imageUrl,
description = description,
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.now.naaga.data.remote.dto

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class PostPlaceDto(
@SerialName("id")
val id: Long,
@SerialName("name")
val name: String,
@SerialName("coordinate")
val coordinate: CoordinateDto,
@SerialName("imageUrl")
val imageUrl: String,
@SerialName("description")
val description: String,
@SerialName("registeredPlayerId")
val registeredPlayerId: Long,
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.now.naaga.data.remote.retrofit.service

import com.now.naaga.data.remote.dto.PlaceDto
import com.now.naaga.data.remote.dto.PostPlaceDto
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.Response
Expand All @@ -25,9 +26,9 @@ interface PlaceService {
): Response<PlaceDto>

@Multipart
@POST("/places")
@POST("/temporary-places")
suspend fun registerPlace(
@PartMap postData: HashMap<String, RequestBody>,
@Part imageFile: MultipartBody.Part,
): Response<PlaceDto>
): Response<PostPlaceDto>
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class UploadActivity : AppCompatActivity(), AnalyticsDelegate by DefaultAnalytic
when (uploadStatus) {
UploadStatus.SUCCESS -> {
changeVisibility(binding.lottieUploadLoading, View.GONE)
shortToast(getString(R.string.upload_success_submit))
finish()
}
UploadStatus.PENDING -> { changeVisibility(binding.lottieUploadLoading, View.VISIBLE) }
Expand Down
3 changes: 2 additions & 1 deletion android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@
<!-- UploadActivity -->
<string name="upload_title">장소 등록</string>
<string name="upload_photo_title">장소이름</string>
<string name="upload_photo_title_hint">이곳에 장소이름을 적어주세요!</string>
<string name="upload_photo_title_hint">장소이름을 적어주세요!</string>
<string name="upload_submit">장소 등록</string>
<string name="upload_success_submit">장소등록에 성공했어요!\n반영되기까지 약간의 시간이 필요해요!</string>
<string name="upload_fail_submit">장소등록에 실패했어요!</string>
<string name="upload_error_store_photo_message">사진을 저장하는데 문제가 생겼어요! 다시 시도해주세요!</string>
<string name="upload_error_already_exists_nearby_message">근방에 다른 미션장소가 존재해서 추가할 수 없어요!</string>
Expand Down
Loading