feat(command): add coordinates in ProductReader

This commit is contained in:
2026-03-01 04:05:44 +03:00
parent 966e819a4a
commit c4a9fd57aa

View File

@@ -21,7 +21,7 @@ class ProductReader(
do { do {
io.println("введите цену:") io.println("введите цену:")
var input = io.readLine() val input = io.readLine()
price = input?.toLongOrNull() price = input?.toLongOrNull()
@@ -32,12 +32,30 @@ class ProductReader(
} }
while (price == null) while (price == null)
// coordinates
var coordx: Long? = null
while (coordx == null) {
io.println("введите x")
val inputx = io.readLine()
coordx = inputx?.toLongOrNull()
if (coordx == null) io.println("x должен быть не null")
}
var coordy: Float? = null
while (coordy == null) {
io.println("введите y")
val inputy = io.readLine()
coordy = inputy?.toFloatOrNull()
if (coordy == null) io.println("y должен быть не null")
}
val newProduct = val newProduct =
Product( Product(
id = 1, id = 1,
name = name, name = name,
// TODO: do this coordinates section coordinates = Coordinates(coordx, coordy),
coordinates = Coordinates(10L, 10F),
creationDate = ZonedDateTime.now(), creationDate = ZonedDateTime.now(),
price = price, price = price,
unitOfMeasure = null, unitOfMeasure = null,