Skip to content

Commit

Permalink
add: 정보 수정 제안 v1 (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
kymjaehong committed Nov 2, 2023
1 parent 4b7f50c commit ddce006
Show file tree
Hide file tree
Showing 22 changed files with 696 additions and 114 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ public fun FileEntity.toModel(): File =

public fun Image.toEntity(): ImageEntity =
ImageEntity(
files = files.map { it.toEntity() },
files = files?.map { it.toEntity() },
)

public fun ImageEntity.toModel(): Image =
Image(
files = files.map { it.toModel() },
files = files?.map { it.toModel() },
)

internal fun ProfileImage.toEntity() =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ internal fun UpsertPlaceEntity.toModel() =
UpsertPlaceRequest(
address1 = address1,
address2 = address2,
image = image.toModel(),
image = image?.toModel(),
info = info.toModel(),
latitude = latitude,
longitude = longitude,
menu = menu.toModel(),
menu = menu?.toModel(),
name = name,
placeId = placeId,
remarks = remarks,
Expand Down Expand Up @@ -94,12 +94,12 @@ public fun InfoEntity.toModel(): Info =

public fun Menu.toEntity(): MenuEntity =
MenuEntity(
products = products.map { it.toEntity() },
products = products?.map { it.toEntity() },
)

public fun MenuEntity.toModel(): Menu =
Menu(
products = products.map { it.toModel() },
products = products?.map { it.toModel() },
)

public fun Product.toEntity(): ProductEntity =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ public data class File(
val uploadFileId: Int,

@SerialName("url")
val url: String,
val url: String?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ import us.wedemy.eggeum.android.data.model.File
@Serializable
public data class Image(
@SerialName("files")
val files: List<File>,
val files: List<File>?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -58,44 +58,44 @@ import kotlinx.serialization.Serializable
@Serializable
public data class Info(
@SerialName("areaSize")
val areaSize: String,
val areaSize: String?,

@SerialName("blogUri")
val blogUri: String,
val blogUri: String?,

@SerialName("businessHours")
val businessHours: List<String>,
val businessHours: List<String>?,

@SerialName("existsSmokingArea")
val existsSmokingArea: Boolean,
val existsSmokingArea: Boolean?,

@SerialName("existsWifi")
val existsWifi: Boolean,
val existsWifi: Boolean?,

@SerialName("instagramUri")
val instagramUri: String,
val instagramUri: String?,

@SerialName("meetingRoomCount")
val meetingRoomCount: Int,
val meetingRoomCount: Int?,

@SerialName("mobileCharging")
val mobileCharging: String,
val mobileCharging: String?,

@SerialName("multiSeatCount")
val multiSeatCount: Int,
val multiSeatCount: Int?,

@SerialName("parking")
val parking: String,
val parking: String?,

@SerialName("phone")
val phone: String,
val phone: String?,

@SerialName("restRoom")
val restRoom: String,
val restRoom: String?,

@SerialName("singleSeatCount")
val singleSeatCount: Int,
val singleSeatCount: Int?,

@SerialName("websiteUri")
val websiteUri: String,
val websiteUri: String?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ import kotlinx.serialization.Serializable
@Serializable
public data class Menu(
@SerialName("products")
val products: List<Product>,
val products: List<Product>?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,13 @@ package us.wedemy.eggeum.android.data.model.place
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

// @JsonClass(generateAdapter = true)
// public data class PlaceResponse(
// @Json(name = "address1")
// val address1: String,
//
// @Json(name = "address2")
// val address2: String,
//
// @Json(name = "id")
// val id: Int,
//
// @Json(name = "image")
// val image: Image,
//
// @Json(name = "info")
// val info: Info,
//
// @Json(name = "latitude")
// val latitude: Double,
//
// @Json(name = "longitude")
// val longitude: Double,
//
// @Json(name = "menu")
// val menu: Menu,
//
// @Json(name = "name")
// val name: String,
//
// @Json(name = "type")
// val type: String,
// )

@Serializable
public data class PlaceResponse(
@SerialName("address1")
val address1: String,
val address1: String?,

@SerialName("address2")
val address2: String,
val address2: String?,

@SerialName("id")
val id: Int,
Expand All @@ -61,10 +28,10 @@ public data class PlaceResponse(
val info: Info,

@SerialName("latitude")
val latitude: Double,
val latitude: Double?,

@SerialName("longitude")
val longitude: Double,
val longitude: Double?,

@SerialName("menu")
val menu: Menu,
Expand All @@ -73,5 +40,5 @@ public data class PlaceResponse(
val name: String,

@SerialName("type")
val type: String,
val type: String?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -49,35 +49,35 @@ import kotlinx.serialization.Serializable
@Serializable
public data class UpsertPlaceRequest(
@SerialName("address1")
val address1: String,
val address1: String?,

@SerialName("address2")
val address2: String,
val address2: String?,

@SerialName("image")
val image: Image,
val image: Image?,

@SerialName("info")
val info: Info,

@SerialName("latitude")
val latitude: Double,
val latitude: Double?,

@SerialName("longitude")
val longitude: Double,
val longitude: Double?,

@SerialName("menu")
val menu: Menu,
val menu: Menu?,

@SerialName("name")
val name: String,
val name: String?,

@SerialName("placeId")
val placeId: Int,

@SerialName("remarks")
val remarks: String,
val remarks: String?,

@SerialName("type")
val type: String,
val type: String?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package us.wedemy.eggeum.android.data.service
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query
import us.wedemy.eggeum.android.data.model.place.PlaceResponse
Expand Down Expand Up @@ -37,7 +38,7 @@ public interface PlaceService {
@Query("type") type: String? = null,
): PlaceListResponse

@GET("app/place/edits")
@POST("app/place/edits")
public suspend fun upsertPlace(
@Body upsertPlaceRequest: UpsertPlaceRequest,
): Response<Unit>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ package us.wedemy.eggeum.android.domain.model

public data class FileEntity(
public val uploadFileId: Int,
val url: String,
val url: String?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ package us.wedemy.eggeum.android.domain.model.place
import us.wedemy.eggeum.android.domain.model.FileEntity

public data class ImageEntity(
val files: List<FileEntity>,
val files: List<FileEntity>?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,54 @@
package us.wedemy.eggeum.android.domain.model.place

public data class InfoEntity(
val areaSize: String,
val blogUri: String,
val businessHours: List<String>,
val existsSmokingArea: Boolean,
val existsWifi: Boolean,
val instagramUri: String,
val meetingRoomCount: Int,
val mobileCharging: String,
val multiSeatCount: Int,
val parking: String,
val phone: String,
val restRoom: String,
val singleSeatCount: Int,
val websiteUri: String,
)
val areaSize: String?,
val blogUri: String?,
val businessHours: List<String>?,
val existsSmokingArea: Boolean?,
val existsWifi: Boolean?,
val instagramUri: String?,
val meetingRoomCount: Int?,
val mobileCharging: String?,
val multiSeatCount: Int?,
val parking: String?,
val phone: String?,
val restRoom: String?,
val singleSeatCount: Int?,
val websiteUri: String?,
) {
public companion object {
public fun of(
areaSize: String? = null,
blogUri: String? = null,
businessHours: List<String>? = null,
existsSmokingArea: Boolean? = null,
existsWifi: Boolean? = null,
instagramUri: String? = null,
meetingRoomCount: Int? = null,
mobileCharging: String? = null,
multiSeatCount: Int? = null,
parking: String? = null,
phone: String? = null,
restRoom: String? = null,
singleSeatCount: Int? = null,
websiteUri: String? = null,
): InfoEntity {
return InfoEntity(
areaSize = areaSize,
blogUri = blogUri,
businessHours = businessHours,
existsSmokingArea = existsSmokingArea,
existsWifi = existsWifi,
instagramUri = instagramUri,
meetingRoomCount = meetingRoomCount,
mobileCharging = mobileCharging,
multiSeatCount = multiSeatCount,
parking = parking,
phone = phone,
restRoom = restRoom,
singleSeatCount = singleSeatCount,
websiteUri = websiteUri,
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
package us.wedemy.eggeum.android.domain.model.place

public data class MenuEntity(
val products: List<ProductEntity>,
val products: List<ProductEntity>?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
package us.wedemy.eggeum.android.domain.model.place

public data class PlaceEntity(
val address1: String,
val address2: String,
val address1: String?,
val address2: String?,
val id: Int,
val image: ImageEntity,
val info: InfoEntity,
val latitude: Double,
val longitude: Double,
val latitude: Double?,
val longitude: Double?,
val menu: MenuEntity,
val name: String,
val type: String,
val type: String?,
)
Loading

0 comments on commit ddce006

Please sign in to comment.