feat: Refactor Item Edit Screen with all API fields and user-friendly UI
This commit is contained in:
@@ -17,17 +17,28 @@ import com.homebox.lens.domain.model.ItemCreate
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class ItemCreateDto(
|
||||
@Json(name = "name") val name: String,
|
||||
@Json(name = "assetId") val assetId: String?,
|
||||
@Json(name = "description") val description: String?,
|
||||
@Json(name = "notes") val notes: String?,
|
||||
@Json(name = "serialNumber") val serialNumber: String?,
|
||||
@Json(name = "quantity") val quantity: Int?,
|
||||
@Json(name = "value") val value: Double?,
|
||||
@Json(name = "purchasePrice") val purchasePrice: Double?,
|
||||
@Json(name = "purchaseDate") val purchaseDate: String?,
|
||||
@Json(name = "warrantyUntil") val warrantyUntil: String?,
|
||||
@Json(name = "locationId") val locationId: String?,
|
||||
@Json(name = "archived") val archived: Boolean?,
|
||||
@Json(name = "assetId") val assetId: String?,
|
||||
@Json(name = "insured") val insured: Boolean?,
|
||||
@Json(name = "lifetimeWarranty") val lifetimeWarranty: Boolean?,
|
||||
@Json(name = "manufacturer") val manufacturer: String?,
|
||||
@Json(name = "modelNumber") val modelNumber: String?,
|
||||
@Json(name = "notes") val notes: String?,
|
||||
@Json(name = "parentId") val parentId: String?,
|
||||
@Json(name = "purchaseFrom") val purchaseFrom: String?,
|
||||
@Json(name = "purchasePrice") val purchasePrice: Double?,
|
||||
@Json(name = "purchaseTime") val purchaseTime: String?,
|
||||
@Json(name = "serialNumber") val serialNumber: String?,
|
||||
@Json(name = "soldNotes") val soldNotes: String?,
|
||||
@Json(name = "soldPrice") val soldPrice: Double?,
|
||||
@Json(name = "soldTime") val soldTime: String?,
|
||||
@Json(name = "soldTo") val soldTo: String?,
|
||||
@Json(name = "syncChildItemsLocations") val syncChildItemsLocations: Boolean?,
|
||||
@Json(name = "warrantyDetails") val warrantyDetails: String?,
|
||||
@Json(name = "warrantyExpires") val warrantyExpires: String?,
|
||||
@Json(name = "locationId") val locationId: String?,
|
||||
@Json(name = "labelIds") val labelIds: List<String>?
|
||||
)
|
||||
// [END_ENTITY: DataClass('ItemCreateDto')]
|
||||
@@ -40,17 +51,28 @@ data class ItemCreateDto(
|
||||
fun ItemCreate.toDto(): ItemCreateDto {
|
||||
return ItemCreateDto(
|
||||
name = this.name,
|
||||
assetId = this.assetId,
|
||||
description = this.description,
|
||||
notes = this.notes,
|
||||
serialNumber = this.serialNumber,
|
||||
quantity = this.quantity,
|
||||
value = this.value,
|
||||
purchasePrice = this.purchasePrice,
|
||||
purchaseDate = this.purchaseDate,
|
||||
warrantyUntil = this.warrantyUntil,
|
||||
locationId = this.locationId,
|
||||
archived = this.archived,
|
||||
assetId = this.assetId,
|
||||
insured = this.insured,
|
||||
lifetimeWarranty = this.lifetimeWarranty,
|
||||
manufacturer = this.manufacturer,
|
||||
modelNumber = this.modelNumber,
|
||||
notes = this.notes,
|
||||
parentId = this.parentId,
|
||||
purchaseFrom = this.purchaseFrom,
|
||||
purchasePrice = this.purchasePrice,
|
||||
purchaseTime = this.purchaseTime,
|
||||
serialNumber = this.serialNumber,
|
||||
soldNotes = this.soldNotes,
|
||||
soldPrice = this.soldPrice,
|
||||
soldTime = this.soldTime,
|
||||
soldTo = this.soldTo,
|
||||
syncChildItemsLocations = this.syncChildItemsLocations,
|
||||
warrantyDetails = this.warrantyDetails,
|
||||
warrantyExpires = this.warrantyExpires,
|
||||
locationId = this.locationId,
|
||||
labelIds = this.labelIds
|
||||
)
|
||||
}
|
||||
|
||||
@@ -24,10 +24,20 @@ data class ItemOutDto(
|
||||
@Json(name = "serialNumber") val serialNumber: String?,
|
||||
@Json(name = "quantity") val quantity: Int,
|
||||
@Json(name = "isArchived") val isArchived: Boolean,
|
||||
@Json(name = "value") val value: Double,
|
||||
@Json(name = "purchasePrice") val purchasePrice: Double?,
|
||||
@Json(name = "purchaseDate") val purchaseDate: String?,
|
||||
@Json(name = "warrantyUntil") val warrantyUntil: String?,
|
||||
@Json(name = "purchaseTime") val purchaseTime: String?,
|
||||
@Json(name = "purchaseFrom") val purchaseFrom: String?,
|
||||
@Json(name = "warrantyExpires") val warrantyExpires: String?,
|
||||
@Json(name = "warrantyDetails") val warrantyDetails: String?,
|
||||
@Json(name = "lifetimeWarranty") val lifetimeWarranty: Boolean?,
|
||||
@Json(name = "insured") val insured: Boolean?,
|
||||
@Json(name = "manufacturer") val manufacturer: String?,
|
||||
@Json(name = "modelNumber") val modelNumber: String?,
|
||||
@Json(name = "soldPrice") val soldPrice: Double?,
|
||||
@Json(name = "soldTime") val soldTime: String?,
|
||||
@Json(name = "soldTo") val soldTo: String?,
|
||||
@Json(name = "soldNotes") val soldNotes: String?,
|
||||
@Json(name = "syncChildItemsLocations") val syncChildItemsLocations: Boolean?,
|
||||
@Json(name = "location") val location: LocationOutDto?,
|
||||
@Json(name = "parent") val parent: ItemSummaryDto?,
|
||||
@Json(name = "children") val children: List<ItemSummaryDto>,
|
||||
@@ -56,10 +66,20 @@ fun ItemOutDto.toDomain(): ItemOut {
|
||||
serialNumber = this.serialNumber,
|
||||
quantity = this.quantity,
|
||||
isArchived = this.isArchived,
|
||||
value = this.value,
|
||||
purchasePrice = this.purchasePrice,
|
||||
purchaseDate = this.purchaseDate,
|
||||
warrantyUntil = this.warrantyUntil,
|
||||
purchaseTime = this.purchaseTime,
|
||||
purchaseFrom = this.purchaseFrom,
|
||||
warrantyExpires = this.warrantyExpires,
|
||||
warrantyDetails = this.warrantyDetails,
|
||||
lifetimeWarranty = this.lifetimeWarranty,
|
||||
insured = this.insured,
|
||||
manufacturer = this.manufacturer,
|
||||
modelNumber = this.modelNumber,
|
||||
soldPrice = this.soldPrice,
|
||||
soldTime = this.soldTime,
|
||||
soldTo = this.soldTo,
|
||||
soldNotes = this.soldNotes,
|
||||
syncChildItemsLocations = this.syncChildItemsLocations,
|
||||
location = this.location?.toDomain(),
|
||||
parent = this.parent?.toDomain(),
|
||||
children = this.children.map { it.toDomain() },
|
||||
|
||||
@@ -17,18 +17,28 @@ import com.homebox.lens.domain.model.ItemUpdate
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class ItemUpdateDto(
|
||||
@Json(name = "name") val name: String?,
|
||||
@Json(name = "assetId") val assetId: String?,
|
||||
@Json(name = "description") val description: String?,
|
||||
@Json(name = "notes") val notes: String?,
|
||||
@Json(name = "serialNumber") val serialNumber: String?,
|
||||
@Json(name = "quantity") val quantity: Int?,
|
||||
@Json(name = "isArchived") val isArchived: Boolean?,
|
||||
@Json(name = "value") val value: Double?,
|
||||
@Json(name = "purchasePrice") val purchasePrice: Double?,
|
||||
@Json(name = "purchaseDate") val purchaseDate: String?,
|
||||
@Json(name = "warrantyUntil") val warrantyUntil: String?,
|
||||
@Json(name = "locationId") val locationId: String?,
|
||||
@Json(name = "archived") val archived: Boolean?,
|
||||
@Json(name = "assetId") val assetId: String?,
|
||||
@Json(name = "insured") val insured: Boolean?,
|
||||
@Json(name = "lifetimeWarranty") val lifetimeWarranty: Boolean?,
|
||||
@Json(name = "manufacturer") val manufacturer: String?,
|
||||
@Json(name = "modelNumber") val modelNumber: String?,
|
||||
@Json(name = "notes") val notes: String?,
|
||||
@Json(name = "parentId") val parentId: String?,
|
||||
@Json(name = "purchaseFrom") val purchaseFrom: String?,
|
||||
@Json(name = "purchasePrice") val purchasePrice: Double?,
|
||||
@Json(name = "purchaseTime") val purchaseTime: String?,
|
||||
@Json(name = "serialNumber") val serialNumber: String?,
|
||||
@Json(name = "soldNotes") val soldNotes: String?,
|
||||
@Json(name = "soldPrice") val soldPrice: Double?,
|
||||
@Json(name = "soldTime") val soldTime: String?,
|
||||
@Json(name = "soldTo") val soldTo: String?,
|
||||
@Json(name = "syncChildItemsLocations") val syncChildItemsLocations: Boolean?,
|
||||
@Json(name = "warrantyDetails") val warrantyDetails: String?,
|
||||
@Json(name = "warrantyExpires") val warrantyExpires: String?,
|
||||
@Json(name = "locationId") val locationId: String?,
|
||||
@Json(name = "labelIds") val labelIds: List<String>?
|
||||
)
|
||||
// [END_ENTITY: DataClass('ItemUpdateDto')]
|
||||
@@ -41,18 +51,28 @@ data class ItemUpdateDto(
|
||||
fun ItemUpdate.toDto(): ItemUpdateDto {
|
||||
return ItemUpdateDto(
|
||||
name = this.name,
|
||||
assetId = this.assetId,
|
||||
description = this.description,
|
||||
notes = this.notes,
|
||||
serialNumber = this.serialNumber,
|
||||
quantity = this.quantity,
|
||||
isArchived = this.isArchived,
|
||||
value = this.value,
|
||||
purchasePrice = this.purchasePrice,
|
||||
purchaseDate = this.purchaseDate,
|
||||
warrantyUntil = this.warrantyUntil,
|
||||
locationId = this.locationId,
|
||||
archived = this.archived,
|
||||
assetId = this.assetId,
|
||||
insured = this.insured,
|
||||
lifetimeWarranty = this.lifetimeWarranty,
|
||||
manufacturer = this.manufacturer,
|
||||
modelNumber = this.modelNumber,
|
||||
notes = this.notes,
|
||||
parentId = this.parentId,
|
||||
purchaseFrom = this.purchaseFrom,
|
||||
purchasePrice = this.purchasePrice,
|
||||
purchaseTime = this.purchaseTime,
|
||||
serialNumber = this.serialNumber,
|
||||
soldNotes = this.soldNotes,
|
||||
soldPrice = this.soldPrice,
|
||||
soldTime = this.soldTime,
|
||||
soldTo = this.soldTo,
|
||||
syncChildItemsLocations = this.syncChildItemsLocations,
|
||||
warrantyDetails = this.warrantyDetails,
|
||||
warrantyExpires = this.warrantyExpires,
|
||||
locationId = this.locationId,
|
||||
labelIds = this.labelIds
|
||||
)
|
||||
}
|
||||
|
||||
@@ -18,10 +18,29 @@ data class ItemEntity(
|
||||
@PrimaryKey val id: String,
|
||||
val name: String,
|
||||
val description: String?,
|
||||
val quantity: Int,
|
||||
val image: String?,
|
||||
val locationId: String?,
|
||||
val value: BigDecimal?,
|
||||
val createdAt: String?
|
||||
val purchasePrice: BigDecimal?,
|
||||
val createdAt: String?,
|
||||
val archived: Boolean,
|
||||
val assetId: String?,
|
||||
val insured: Boolean,
|
||||
val lifetimeWarranty: Boolean,
|
||||
val manufacturer: String?,
|
||||
val modelNumber: String?,
|
||||
val notes: String?,
|
||||
val parentId: String?,
|
||||
val purchaseFrom: String?,
|
||||
val purchaseTime: String?,
|
||||
val serialNumber: String?,
|
||||
val soldNotes: String?,
|
||||
val soldPrice: BigDecimal?,
|
||||
val soldTime: String?,
|
||||
val soldTo: String?,
|
||||
val syncChildItemsLocations: Boolean,
|
||||
val warrantyDetails: String?,
|
||||
val warrantyExpires: String?
|
||||
)
|
||||
// [END_ENTITY: DatabaseTable('ItemEntity')]
|
||||
|
||||
|
||||
@@ -4,39 +4,236 @@
|
||||
package com.homebox.lens.data.db.entity
|
||||
|
||||
// [IMPORTS]
|
||||
import com.homebox.lens.data.api.dto.CustomFieldDto
|
||||
import com.homebox.lens.data.api.dto.ItemCreateDto
|
||||
import com.homebox.lens.data.api.dto.ItemOutDto
|
||||
import com.homebox.lens.data.api.dto.ItemUpdateDto
|
||||
import com.homebox.lens.domain.model.CustomField
|
||||
import com.homebox.lens.domain.model.Image
|
||||
import com.homebox.lens.domain.model.Item
|
||||
import com.homebox.lens.domain.model.ItemCreate
|
||||
import com.homebox.lens.domain.model.ItemOut
|
||||
import com.homebox.lens.domain.model.ItemSummary
|
||||
import com.homebox.lens.domain.model.ItemUpdate
|
||||
import com.homebox.lens.domain.model.Label
|
||||
import com.homebox.lens.domain.model.LabelOut
|
||||
import com.homebox.lens.domain.model.Location
|
||||
import com.homebox.lens.domain.model.LocationOut
|
||||
import java.math.BigDecimal
|
||||
// [END_IMPORTS]
|
||||
|
||||
// [ENTITY: Function('toDomain')]
|
||||
// [RELATION: Function('toDomain')] -> [RETURNS] -> [DataClass('ItemSummary')]
|
||||
// [ENTITY: Function('ItemWithLabels.toDomainItemSummary')]
|
||||
// [RELATION: Function('ItemWithLabels.toDomainItemSummary')] -> [RETURNS] -> [DataClass('ItemSummary')]
|
||||
/**
|
||||
* @summary Преобразует [ItemWithLabels] (сущность БД) в [ItemSummary] (доменную модель).
|
||||
*/
|
||||
fun ItemWithLabels.toDomain(): ItemSummary {
|
||||
fun ItemWithLabels.toDomainItemSummary(): ItemSummary {
|
||||
return ItemSummary(
|
||||
id = this.item.id,
|
||||
name = this.item.name,
|
||||
image = this.item.image?.let { Image(id = "", path = it, isPrimary = true) },
|
||||
location = this.item.locationId?.let { LocationOut(id = it, name = "", color = "", isArchived = false, createdAt = "", updatedAt = "") },
|
||||
labels = this.labels.map { it.toDomain() },
|
||||
assetId = null,
|
||||
isArchived = false,
|
||||
value = this.item.value?.toDouble() ?: 0.0,
|
||||
labels = this.labels.map { it.toDomainLabelOut() },
|
||||
assetId = this.item.assetId,
|
||||
isArchived = this.item.archived,
|
||||
value = this.item.purchasePrice?.toDouble() ?: 0.0, // Assuming value maps to purchasePrice
|
||||
createdAt = this.item.createdAt ?: "",
|
||||
updatedAt = ""
|
||||
updatedAt = "" // ItemEntity does not have updatedAt
|
||||
)
|
||||
}
|
||||
// [END_ENTITY: Function('toDomain')]
|
||||
// [END_ENTITY: Function('ItemWithLabels.toDomainItemSummary')]
|
||||
|
||||
// [ENTITY: Function('toDomain')]
|
||||
// [RELATION: Function('toDomain')] -> [RETURNS] -> [DataClass('LabelOut')]
|
||||
// [ENTITY: Function('ItemEntity.toDomainItem')]
|
||||
// [RELATION: Function('ItemEntity.toDomainItem')] -> [RETURNS] -> [DataClass('Item')]
|
||||
/**
|
||||
* @summary Преобразует [ItemEntity] (сущность БД) в [Item] (доменную модель).
|
||||
*/
|
||||
fun ItemEntity.toDomainItem(): Item {
|
||||
return Item(
|
||||
id = this.id,
|
||||
name = this.name,
|
||||
description = this.description,
|
||||
quantity = this.quantity,
|
||||
image = this.image,
|
||||
location = this.locationId?.let { Location(it, "") }, // Simplified, name is not in ItemEntity
|
||||
labels = emptyList(), // Labels are handled via ItemWithLabels
|
||||
purchasePrice = this.purchasePrice,
|
||||
createdAt = this.createdAt,
|
||||
archived = this.archived,
|
||||
assetId = this.assetId,
|
||||
fields = emptyList(), // Custom fields are not stored in ItemEntity
|
||||
insured = this.insured,
|
||||
lifetimeWarranty = this.lifetimeWarranty,
|
||||
manufacturer = this.manufacturer,
|
||||
modelNumber = this.modelNumber,
|
||||
notes = this.notes,
|
||||
parentId = this.parentId,
|
||||
purchaseFrom = this.purchaseFrom,
|
||||
purchaseTime = this.purchaseTime,
|
||||
serialNumber = this.serialNumber,
|
||||
soldNotes = this.soldNotes,
|
||||
soldPrice = this.soldPrice,
|
||||
soldTime = this.soldTime,
|
||||
soldTo = this.soldTo,
|
||||
syncChildItemsLocations = this.syncChildItemsLocations,
|
||||
warrantyDetails = this.warrantyDetails,
|
||||
warrantyExpires = this.warrantyExpires
|
||||
)
|
||||
}
|
||||
// [END_ENTITY: Function('ItemEntity.toDomainItem')]
|
||||
|
||||
// [ENTITY: Function('Item.toItemEntity')]
|
||||
// [RELATION: Function('Item.toItemEntity')] -> [RETURNS] -> [DataClass('ItemEntity')]
|
||||
/**
|
||||
* @summary Преобразует [Item] (доменную модель) в [ItemEntity] (сущность БД).
|
||||
*/
|
||||
fun Item.toItemEntity(): ItemEntity {
|
||||
return ItemEntity(
|
||||
id = this.id,
|
||||
name = this.name,
|
||||
description = this.description,
|
||||
quantity = this.quantity,
|
||||
image = this.image,
|
||||
locationId = this.location?.id,
|
||||
purchasePrice = this.purchasePrice,
|
||||
createdAt = this.createdAt,
|
||||
archived = this.archived,
|
||||
assetId = this.assetId,
|
||||
insured = this.insured,
|
||||
lifetimeWarranty = this.lifetimeWarranty,
|
||||
manufacturer = this.manufacturer,
|
||||
modelNumber = this.modelNumber,
|
||||
notes = this.notes,
|
||||
parentId = this.parentId,
|
||||
purchaseFrom = this.purchaseFrom,
|
||||
purchaseTime = this.purchaseTime,
|
||||
serialNumber = this.serialNumber,
|
||||
soldNotes = this.soldNotes,
|
||||
soldPrice = this.soldPrice,
|
||||
soldTime = this.soldTime,
|
||||
soldTo = this.soldTo,
|
||||
syncChildItemsLocations = this.syncChildItemsLocations,
|
||||
warrantyDetails = this.warrantyDetails,
|
||||
warrantyExpires = this.warrantyExpires
|
||||
)
|
||||
}
|
||||
// [END_ENTITY: Function('Item.toItemEntity')]
|
||||
|
||||
// [ENTITY: Function('ItemOutDto.toDomainItem')]
|
||||
// [RELATION: Function('ItemOutDto.toDomainItem')] -> [RETURNS] -> [DataClass('Item')]
|
||||
/**
|
||||
* @summary Маппер из ItemOutDto в доменную модель Item.
|
||||
*/
|
||||
fun ItemOutDto.toDomainItem(): Item {
|
||||
return Item(
|
||||
id = this.id,
|
||||
name = this.name,
|
||||
description = this.description,
|
||||
quantity = this.quantity,
|
||||
image = this.images.firstOrNull()?.path,
|
||||
location = this.location?.toDomain(),
|
||||
labels = this.labels.map { Label(it.id, it.name) },
|
||||
purchasePrice = this.purchasePrice?.toBigDecimal(),
|
||||
createdAt = this.createdAt,
|
||||
archived = this.isArchived,
|
||||
assetId = this.assetId,
|
||||
fields = this.fields.map { it.toDomainCustomField() },
|
||||
insured = this.insured ?: false,
|
||||
lifetimeWarranty = this.lifetimeWarranty ?: false,
|
||||
manufacturer = this.manufacturer,
|
||||
modelNumber = this.modelNumber,
|
||||
notes = this.notes,
|
||||
parentId = this.parent?.id,
|
||||
purchaseFrom = this.purchaseFrom,
|
||||
purchaseTime = this.purchaseTime,
|
||||
serialNumber = this.serialNumber,
|
||||
soldNotes = this.soldNotes,
|
||||
soldPrice = this.soldPrice?.toBigDecimal(),
|
||||
soldTime = this.soldTime,
|
||||
soldTo = this.soldTo,
|
||||
syncChildItemsLocations = this.syncChildItemsLocations ?: false,
|
||||
warrantyDetails = this.warrantyDetails,
|
||||
warrantyExpires = this.warrantyExpires
|
||||
)
|
||||
}
|
||||
// [END_ENTITY: Function('ItemOutDto.toDomainItem')]
|
||||
|
||||
// [ENTITY: Function('ItemCreate.toItemCreateDto')]
|
||||
// [RELATION: Function('ItemCreate.toItemCreateDto')] -> [RETURNS] -> [DataClass('ItemCreateDto')]
|
||||
/**
|
||||
* @summary Маппер из доменной модели ItemCreate в ItemCreateDto.
|
||||
*/
|
||||
fun ItemCreate.toItemCreateDto(): ItemCreateDto {
|
||||
return ItemCreateDto(
|
||||
name = this.name,
|
||||
description = this.description,
|
||||
quantity = this.quantity,
|
||||
archived = null, // Not applicable for creation
|
||||
assetId = this.assetId,
|
||||
insured = null, // Not applicable for creation
|
||||
lifetimeWarranty = null, // Not applicable for creation
|
||||
manufacturer = this.manufacturer,
|
||||
modelNumber = this.modelNumber,
|
||||
notes = this.notes,
|
||||
parentId = this.parentId,
|
||||
purchaseFrom = this.purchaseFrom,
|
||||
purchasePrice = this.purchasePrice?.toDouble(),
|
||||
purchaseTime = this.purchaseTime,
|
||||
serialNumber = this.serialNumber,
|
||||
soldNotes = null, // Not applicable for creation
|
||||
soldPrice = null, // Not applicable for creation
|
||||
soldTime = null, // Not applicable for creation
|
||||
soldTo = null, // Not applicable for creation
|
||||
syncChildItemsLocations = null, // Not applicable for creation
|
||||
warrantyDetails = this.warrantyDetails,
|
||||
warrantyExpires = this.warrantyExpires,
|
||||
locationId = this.locationId,
|
||||
labelIds = this.labelIds
|
||||
)
|
||||
}
|
||||
// [END_ENTITY: Function('ItemCreate.toItemCreateDto')]
|
||||
|
||||
// [ENTITY: Function('ItemUpdate.toItemUpdateDto')]
|
||||
// [RELATION: Function('ItemUpdate.toItemUpdateDto')] -> [RETURNS] -> [DataClass('ItemUpdateDto')]
|
||||
/**
|
||||
* @summary Маппер из доменной модели ItemUpdate в ItemUpdateDto.
|
||||
*/
|
||||
fun ItemUpdate.toItemUpdateDto(): ItemUpdateDto {
|
||||
return ItemUpdateDto(
|
||||
name = this.name,
|
||||
description = this.description,
|
||||
quantity = this.quantity,
|
||||
archived = this.archived,
|
||||
assetId = this.assetId,
|
||||
insured = this.insured,
|
||||
lifetimeWarranty = this.lifetimeWarranty,
|
||||
manufacturer = this.manufacturer,
|
||||
modelNumber = this.modelNumber,
|
||||
notes = this.notes,
|
||||
parentId = this.parentId,
|
||||
purchaseFrom = this.purchaseFrom,
|
||||
purchasePrice = this.purchasePrice?.toDouble(),
|
||||
purchaseTime = this.purchaseTime,
|
||||
serialNumber = this.serialNumber,
|
||||
soldNotes = this.soldNotes,
|
||||
soldPrice = this.soldPrice?.toDouble(),
|
||||
soldTime = this.soldTime,
|
||||
soldTo = this.soldTo,
|
||||
syncChildItemsLocations = this.syncChildItemsLocations,
|
||||
warrantyDetails = this.warrantyDetails,
|
||||
warrantyExpires = this.warrantyExpires,
|
||||
locationId = this.locationId,
|
||||
labelIds = this.labelIds
|
||||
)
|
||||
}
|
||||
// [END_ENTITY: Function('ItemUpdate.toItemUpdateDto')]
|
||||
|
||||
// [ENTITY: Function('LabelEntity.toDomainLabelOut')]
|
||||
// [RELATION: Function('LabelEntity.toDomainLabelOut')] -> [RETURNS] -> [DataClass('LabelOut')]
|
||||
/**
|
||||
* @summary Преобразует [LabelEntity] (сущность БД) в [LabelOut] (доменную модель).
|
||||
*/
|
||||
fun LabelEntity.toDomain(): LabelOut {
|
||||
fun LabelEntity.toDomainLabelOut(): LabelOut {
|
||||
return LabelOut(
|
||||
id = this.id,
|
||||
name = this.name,
|
||||
@@ -46,4 +243,17 @@ fun LabelEntity.toDomain(): LabelOut {
|
||||
updatedAt = ""
|
||||
)
|
||||
}
|
||||
// [END_ENTITY: Function('toDomain')]
|
||||
// [END_ENTITY: Function('LabelEntity.toDomainLabelOut')]
|
||||
|
||||
// [ENTITY: Function('CustomFieldDto.toDomainCustomField')]
|
||||
// [RELATION: Function('CustomFieldDto.toDomainCustomField')] -> [RETURNS] -> [DataClass('CustomField')]
|
||||
/**
|
||||
* @summary Преобразует [CustomFieldDto] (DTO API) в [CustomField] (доменную модель).
|
||||
*/
|
||||
fun CustomFieldDto.toDomainCustomField(): CustomField {
|
||||
return CustomField(
|
||||
name = this.name,
|
||||
value = this.value
|
||||
)
|
||||
}
|
||||
// [END_ENTITY: Function('CustomFieldDto.toDomainCustomField')]
|
||||
Reference in New Issue
Block a user