Skip to content

Commit

Permalink
refactor: 장소 등록 api 수정 (#369)
Browse files Browse the repository at this point in the history
* refactor: 장소 등록을 검수할 수 있도록 검수중으로 등록한다

* refactor: 변경된 API 명세 반영

* refactor: string 변경

* feat: 장소등록 성공시 토스트 메시지를 띄워줌
  • Loading branch information
krrong authored Oct 5, 2023
1 parent af684a6 commit 5a08f44
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 3 deletions.
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 @@ -92,6 +92,7 @@ class UploadActivity : AppCompatActivity(), AnalyticsDelegate by DefaultAnalytic
when (uploadStatus) {
UploadStatus.SUCCESS -> {
changeVisibility(binding.lottieUploadLoading, View.GONE)
shortToast(getString(R.string.upload_success_submit))
finish()
}

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

0 comments on commit 5a08f44

Please sign in to comment.