Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Room Park Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav Bogdashkin
Room Park Android
Commits
501b0ea3
Commit
501b0ea3
authored
Dec 26, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fetch favorites complete
parent
8c5e77c4
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
362 additions
and
265 deletions
+362
-265
EstateRepository.kt
...to/visual/roompark/data/data_provider/EstateRepository.kt
+46
-10
UserHolder.kt
...java/com/biganto/visual/roompark/data/local/UserHolder.kt
+1
-0
IDb.kt
...ava/com/biganto/visual/roompark/data/repository/db/IDb.kt
+2
-0
RequeryRepository.kt
.../roompark/data/repository/db/requrey/RequeryRepository.kt
+10
-2
Deal.kt
.../visual/roompark/data/repository/db/requrey/model/Deal.kt
+5
-0
Estate.kt
...isual/roompark/data/repository/db/requrey/model/Estate.kt
+8
-0
raw2entity.kt
...anto/visual/roompark/data/repository/mapper/raw2entity.kt
+1
-0
ContextModule.kt
...va/com/biganto/visual/roompark/di/dagger/ContextModule.kt
+1
-1
DealContract.kt
...m/biganto/visual/roompark/domain/contract/DealContract.kt
+1
-1
deals.kt
...va/com/biganto/visual/roompark/domain/interactor/deals.kt
+139
-139
favorites.kt
...om/biganto/visual/roompark/domain/interactor/favorites.kt
+109
-106
deals.kt
...in/java/com/biganto/visual/roompark/domain/model/deals.kt
+39
-6
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/EstateRepository.kt
View file @
501b0ea3
...
...
@@ -4,9 +4,14 @@ import com.biganto.visual.androidplayer.data.repository.local.ILocalStore
import
com.biganto.visual.roompark.data.local.UserState
import
com.biganto.visual.roompark.data.repository.api.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.model.EstateEntity
import
com.biganto.visual.roompark.data.repository.mapper.fromRaw
import
com.biganto.visual.roompark.data.repository.mapper.fromRawList
import
com.biganto.visual.roompark.domain.contract.DealContract
import
com.biganto.visual.roompark.domain.custom_exception.CustomApiException
import
com.biganto.visual.roompark.domain.model.EstateModel
import
com.biganto.visual.roompark.domain.model.fromEntity
import
io.reactivex.Observable
import
timber.log.Timber
import
javax.inject.Inject
...
...
@@ -20,23 +25,54 @@ class EstateRepository @Inject constructor(
private
val
local
:
ILocalStore
,
private
val
api
:
IRoomParkApi
,
private
val
db
:
IDb
):
DealContract
{
):
DealContract
{
init
{
Timber
.
d
(
"Estate Repository Created"
)
}
val
getFavoritesApi
=
private
val
getFavoritesApi
:
Observable
<
List
<
EstateEntity
>>
=
local
.
recentUser
()
.
flatMap
{
when
(
it
){
is
UserState
.
Authenticated
->
db
.
fetchUser
(
it
.
uuid
.
toInt
())
else
->
throw
CustomApiException
.
NotAuthorizedException
()
}
}
.
flatMap
{
api
.
getFavorites
(
it
.
authToken
)
// .map(::fromRaw)
.
flatMap
{
when
(
it
)
{
is
UserState
.
Authenticated
->
db
.
fetchUser
(
it
.
uuid
.
toInt
())
else
->
throw
CustomApiException
.
NotAuthorizedException
()
}
}
.
flatMap
{
user
->
api
.
getFavorites
(
user
.
authToken
)
.
doOnError
(
Timber
::
e
)
.
map
{
fromRawList
(
it
,
::
fromRaw
)
}
.
doOnNext
{
it
.
forEach
{
estate
->
estate
.
setFavorite
(
true
)
estate
.
user
=
user
}
}
.
doOnNext
(
db
::
blockingUpsert
)
}
private
val
getFavoritesDb
:
Observable
<
List
<
EstateEntity
>>
=
local
.
recentUser
()
.
flatMap
{
when
(
it
)
{
is
UserState
.
Authenticated
->
db
.
fetchUser
(
it
.
uuid
.
toInt
()).
take
(
1
)
else
->
throw
CustomApiException
.
NotAuthorizedException
()
}
}
.
flatMap
{
db
.
getUserFavorites
(
it
.
uuid
)
.
doOnError
(
Timber
::
e
)
.
toList
().
toObservable
()
}
override
fun
getFavorites
():
io
.
reactivex
.
rxjava3
.
core
.
Observable
<
List
<
EstateModel
>>
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
override
fun
getFavorites
():
Observable
<
List
<
EstateModel
>>
{
return
Observable
.
mergeDelayError
(
arrayListOf
(
getFavoritesApi
,
getFavoritesDb
)
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
.
doOnError
(
Timber
::
e
)
}
...
...
app/src/main/java/com/biganto/visual/roompark/data/local/UserHolder.kt
View file @
501b0ea3
...
...
@@ -62,6 +62,7 @@ class UserHolder @Inject constructor(val context : Application) : ILocalStore
.
observe
()
.
map
{
Timber
.
d
(
" AUTH VALUE: $it"
)
Timber
.
d
(
" EMPTY_PREF_VALUE_KEY: $EMPTY_PREF_VALUE_KEY"
)
if
(
it
==
EMPTY_PREF_VALUE_KEY
)
return
@map
UserState
.
NotAuthenticated
()
else
return
@map
UserState
.
Authenticated
(
it
)
}
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/IDb.kt
View file @
501b0ea3
...
...
@@ -26,4 +26,6 @@ interface IDb {
fun
getPhotos
(
albumId
:
Int
):
Observable
<
GalleryPhotoEntity
>
fun
getPhoto
(
photoId
:
Int
):
Observable
<
GalleryPhotoEntity
>
fun
getAlbum
(
albumId
:
Int
):
Observable
<
ImageAlbumEntity
>
fun
getUserFavorites
(
uuid
:
Int
):
Observable
<
EstateEntity
>
fun
fetchAllUsers
():
Observable
<
List
<
UserEntity
>>
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/RequeryRepository.kt
View file @
501b0ea3
...
...
@@ -33,7 +33,6 @@ class DbModule{
// source.setLoggingEnabled(true)
// source.setWriteAheadLoggingEnabled(true)
source
.
setTableCreationMode
(
TableCreationMode
.
DROP_CREATE
)
val
store
=
KotlinEntityDataStore
<
Persistable
>(
source
.
configuration
)
Timber
.
d
(
"Kotlin store %s"
,
source
)
return
KotlinReactiveEntityStore
(
store
)
...
...
@@ -123,8 +122,12 @@ class RequeryRepository @Inject constructor(
.
firstOrNull
()
override
fun
fetchUser
(
uuid
:
Int
):
Observable
<
UserEntity
>
=
fetchAll
<
UserEntity
>().
where
(
UserEntity
.
UUID
.
eq
(
uuid
)).
get
().
observable
()
store
.
select
(
UserEntity
::
class
).
where
(
UserEntity
.
UUID
.
eq
(
uuid
)).
get
().
observable
()
// fetchAll<UserEntity>().where(UserEntity.UUID.eq(uuid)).get().observable()
override
fun
fetchAllUsers
():
Observable
<
List
<
UserEntity
>>
=
store
.
select
(
UserEntity
::
class
).
get
().
observable
().
toList
().
toObservable
()
fun
upsertFeeds
(
entity
:
List
<
FeedEntity
>)
=
store
.
upsert
(
entity
)
...
...
@@ -134,4 +137,9 @@ class RequeryRepository @Inject constructor(
.
where
(
UserEntity
.
UUID
.
eq
(
uuid
))
.
get
()
.
observableResult
()
override
fun
getUserFavorites
(
uuid
:
Int
):
Observable
<
EstateEntity
>
=
store
.
select
(
EstateEntity
::
class
)
.
where
(
EstateEntity
.
USER_ID
.
eq
(
uuid
))
.
get
().
observable
()
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/Deal.kt
View file @
501b0ea3
...
...
@@ -20,4 +20,9 @@ interface Deal : Persistable {
@get
:
ForeignKey
(
references
=
Estate
::
class
)
@get
:
OneToOne
(
cascade
=
[
CascadeAction
.
NONE
])
var
estate
:
Estate
@get
:
Nullable
@get
:
Column
(
name
=
"UserContainer"
)
@get
:
ForeignKey
(
references
=
User
::
class
)
@get
:
OneToOne
(
mappedBy
=
"uuid"
,
cascade
=
[
CascadeAction
.
NONE
])
var
user
:
User
?
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/Estate.kt
View file @
501b0ea3
...
...
@@ -67,4 +67,12 @@ interface Estate : Persistable {
@get
:
OneToMany
(
mappedBy
=
"id"
,
cascade
=
[
CascadeAction
.
SAVE
,
CascadeAction
.
DELETE
])
val
planPreset
:
MutableList
<
PlanPreset
>
val
favorite
:
Boolean
@get
:
Nullable
@get
:
Column
(
name
=
"UserContainer"
)
@get
:
ForeignKey
(
references
=
User
::
class
)
@get
:
OneToOne
(
mappedBy
=
"uuid"
,
cascade
=
[
CascadeAction
.
NONE
])
var
user
:
User
?
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/mapper/raw2entity.kt
View file @
501b0ea3
...
...
@@ -127,6 +127,7 @@ fun fromRaw(raw:EstateRaw):EstateEntity{
entity
.
setInfo_price_meter
(
raw
.
common_info
.
price_meter
)
entity
.
setInfo_ceiling
(
raw
.
common_info
.
ceiling
)
entity
.
setInfo_direction
(
raw
.
common_info
.
direction
)
entity
.
setFavorite
(
false
)
return
entity
}
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/ContextModule.kt
View file @
501b0ea3
...
...
@@ -21,7 +21,7 @@ const val ESTATES_CACHE_LIMIT_SECONDS_INACTIVE = 200L
const
val
FILES_CACHE_LIMIT_SIZE
=
10000
const
val
FILES_CACHE_LIMIT_SECONDS_INACTIVE
=
60L
const
val
DATABASE_VERSION
=
8
const
val
DATABASE_VERSION
=
9
@Module
abstract
class
AppModule
{
...
...
app/src/main/java/com/biganto/visual/roompark/domain/contract/DealContract.kt
View file @
501b0ea3
...
...
@@ -10,5 +10,5 @@ import io.reactivex.rxjava3.core.Observable
interface
DealContract
{
fun
getFavorites
()
:
Observable
<
List
<
EstateModel
>>
fun
getFavorites
()
:
io
.
reactivex
.
Observable
<
List
<
EstateModel
>>
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/interactor/deals.kt
View file @
501b0ea3
...
...
@@ -94,83 +94,83 @@ class DealsInteractor @Inject constructor(
section_begin
=
14
,
windows_face
=
"\u0414\u0432\u043e\u0440 \u0438 \u0423\u043b\u0438\u0446\u0430"
),
explications
=
arrayListOf
(
ExplicationListModel
(
items
=
arrayListOf
(
ExplicationModel
(
area
=
16.9f
,
living
=
true
,
title
=
"\u0413\u043e\u0441\u0442\u0438\u043d\u0430\u044f"
),
ExplicationModel
(
area
=
14.6f
,
living
=
true
,
title
=
"\u0421\u043f\u0430\u043b\u044c\u043d\u044f"
),
ExplicationModel
(
area
=
10.8f
,
living
=
false
,
title
=
"\u041a\u0443\u0445\u043d\u044f"
),
ExplicationModel
(
area
=
3.6f
,
living
=
false
,
title
=
"\u041a\u043e\u0440\u0438\u0434\u043e\u0440"
),
ExplicationModel
(
area
=
3.4f
,
living
=
false
,
title
=
"\u0421\u0430\u043d\u0443\u0437\u0435\u043b"
),
ExplicationModel
(
area
=
2.8f
,
living
=
false
,
title
=
"\u041f\u0440\u0438\u0445\u043e\u0436\u0430\u044f"
),
ExplicationModel
(
area
=
1.9f
,
living
=
false
,
title
=
"\u0421\u0430\u043d\u0443\u0437\u0435\u043b"
),
ExplicationModel
(
area
=
1.4f
,
living
=
false
,
title
=
"\u041b\u043e\u0434\u0436\u0438\u044f"
)
),
planId
=
0
),
ExplicationListModel
(
items
=
arrayListOf
(
ExplicationModel
(
area
=
16.2f
,
living
=
true
,
title
=
"\u0413\u043e\u0441\u0442\u0438\u043d\u0430\u044f"
),
ExplicationModel
(
area
=
13.7f
,
living
=
true
,
title
=
"\u0421\u043f\u0430\u043b\u044c\u043d\u044f"
),
ExplicationModel
(
area
=
10.2f
,
living
=
false
,
title
=
"\u041a\u0443\u0445\u043d\u044f"
),
ExplicationModel
(
area
=
4.3f
,
living
=
false
,
title
=
"\u041a\u043e\u0440\u0438\u0434\u043e\u0440"
),
ExplicationModel
(
area
=
4.2f
,
living
=
false
,
title
=
"\u041f\u0440\u0438\u0445\u043e\u0436\u0430\u044f"
),
ExplicationModel
(
area
=
4.1f
,
living
=
false
,
title
=
"\u0421\u0430\u043d\u0443\u0437\u0435\u043b"
),
ExplicationModel
(
area
=
1.4f
,
living
=
false
,
title
=
"\u041b\u043e\u0434\u0436\u0438\u044f"
),
ExplicationModel
(
area
=
1.3f
,
living
=
false
,
title
=
"\u0421\u0430\u043d\u0443\u0437\u0435\u043b"
)
),
planId
=
1
)
),
//
explications = arrayListOf(ExplicationListModel(
//
items = arrayListOf(
//
ExplicationModel(
//
area = 16.9f,
//
living = true,
//
title = "\u0413\u043e\u0441\u0442\u0438\u043d\u0430\u044f"
//
),ExplicationModel(
//
area = 14.6f,
//
living = true,
//
title = "\u0421\u043f\u0430\u043b\u044c\u043d\u044f"
//
),ExplicationModel(
//
area = 10.8f,
//
living = false,
//
title = "\u041a\u0443\u0445\u043d\u044f"
//
),ExplicationModel(
//
area = 3.6f,
//
living = false,
//
title = "\u041a\u043e\u0440\u0438\u0434\u043e\u0440"
//
),ExplicationModel(
//
area = 3.4f,
//
living = false,
//
title = "\u0421\u0430\u043d\u0443\u0437\u0435\u043b"
//
),ExplicationModel(
//
area = 2.8f,
//
living = false,
//
title = "\u041f\u0440\u0438\u0445\u043e\u0436\u0430\u044f"
//
),ExplicationModel(
//
area = 1.9f,
//
living = false,
//
title = "\u0421\u0430\u043d\u0443\u0437\u0435\u043b"
//
),ExplicationModel(
//
area = 1.4f,
//
living = false,
//
title = "\u041b\u043e\u0434\u0436\u0438\u044f"
//
)
//
),
//
planId = 0
//
),
//
ExplicationListModel(
//
items = arrayListOf(
//
ExplicationModel(
//
area = 16.2f,
//
living = true,
//
title = "\u0413\u043e\u0441\u0442\u0438\u043d\u0430\u044f"
//
),ExplicationModel(
//
area = 13.7f,
//
living = true,
//
title = "\u0421\u043f\u0430\u043b\u044c\u043d\u044f"
//
),ExplicationModel(
//
area = 10.2f,
//
living = false,
//
title = "\u041a\u0443\u0445\u043d\u044f"
//
),ExplicationModel(
//
area = 4.3f,
//
living = false,
//
title = "\u041a\u043e\u0440\u0438\u0434\u043e\u0440"
//
),ExplicationModel(
//
area = 4.2f,
//
living = false,
//
title = "\u041f\u0440\u0438\u0445\u043e\u0436\u0430\u044f"
//
),ExplicationModel(
//
area = 4.1f,
//
living = false,
//
title = "\u0421\u0430\u043d\u0443\u0437\u0435\u043b"
//
),ExplicationModel(
//
area = 1.4f,
//
living = false,
//
title = "\u041b\u043e\u0434\u0436\u0438\u044f"
//
),ExplicationModel(
//
area = 1.3f,
//
living = false,
//
title = "\u0421\u0430\u043d\u0443\u0437\u0435\u043b"
//
)
//
),
//
planId = 1
//
)
//
),
id
=
75
,
multitourId
=
4911
,
number
=
"1086"
,
...
...
@@ -218,68 +218,68 @@ class DealsInteractor @Inject constructor(
section_begin
=
2
,
windows_face
=
"Двор"
),
explications
=
arrayListOf
(
ExplicationListModel
(
items
=
arrayListOf
(
ExplicationModel
(
area
=
15.8f
,
living
=
true
,
title
=
"Гостиная"
),
ExplicationModel
(
area
=
14.5f
,
living
=
true
,
title
=
"Спальня"
),
ExplicationModel
(
area
=
20.2f
,
living
=
false
,
title
=
"Кухня"
),
ExplicationModel
(
area
=
5.0f
,
living
=
false
,
title
=
"Прихожая"
),
ExplicationModel
(
area
=
4.1f
,
living
=
false
,
title
=
"Санузел"
),
ExplicationModel
(
area
=
1.6f
,
living
=
false
,
title
=
"Лоджия"
)
),
planId
=
0
),
ExplicationListModel
(
items
=
arrayListOf
(
ExplicationModel
(
area
=
15.5f
,
living
=
true
,
title
=
"Спальня"
),
ExplicationModel
(
area
=
14.5f
,
living
=
true
,
title
=
"Спальня"
),
ExplicationModel
(
area
=
20.2f
,
living
=
false
,
title
=
"Кухня-гостиная"
),
ExplicationModel
(
area
=
5.3f
,
living
=
false
,
title
=
"Прихожая"
),
ExplicationModel
(
area
=
4.1f
,
living
=
false
,
title
=
"Санузел"
),
ExplicationModel
(
area
=
1.6f
,
living
=
false
,
title
=
"Лоджия"
)
),
planId
=
1
)
),
//
explications = arrayListOf(
//
ExplicationListModel(
//
items = arrayListOf(
//
ExplicationModel(
//
area = 15.8f,
//
living = true,
//
title = "Гостиная"
//
),ExplicationModel(
//
area = 14.5f,
//
living = true,
//
title = "Спальня"
//
),ExplicationModel(
//
area = 20.2f,
//
living = false,
//
title = "Кухня"
//
),ExplicationModel(
//
area = 5.0f,
//
living = false,
//
title = "Прихожая"
//
),ExplicationModel(
//
area = 4.1f,
//
living = false,
//
title = "Санузел"
//
),ExplicationModel(
//
area = 1.6f,
//
living = false,
//
title = "Лоджия"
//
)
//
),
//
planId = 0
//
),
//
ExplicationListModel(
//
items = arrayListOf(
//
ExplicationModel(
//
area = 15.5f,
//
living = true,
//
title = "Спальня"
//
),ExplicationModel(
//
area = 14.5f,
//
living = true,
//
title = "Спальня"
//
),ExplicationModel(
//
area = 20.2f,
//
living = false,
//
title = "Кухня-гостиная"
//
),ExplicationModel(
//
area = 5.3f,
//
living = false,
//
title = "Прихожая"
//
),ExplicationModel(
//
area = 4.1f,
//
living = false,
//
title = "Санузел"
//
),ExplicationModel(
//
area = 1.6f,
//
living = false,
//
title = "Лоджия"
//
)
//
),
//
planId = 1
//
)
//
),
id
=
1201
,
multitourId
=
6500
,
number
=
"88"
,
...
...
app/src/main/java/com/biganto/visual/roompark/domain/interactor/favorites.kt
View file @
501b0ea3
package
com.biganto.visual.roompark.domain.interactor
import
com.biganto.visual.roompark.domain.model.*
import
io.reactivex.Single
import
com.biganto.visual.roompark.domain.model.CommonInfoModel
import
com.biganto.visual.roompark.domain.model.EstateModel
import
com.biganto.visual.roompark.domain.model.PlanModel
import
com.biganto.visual.roompark.domain.use_case.EstateUseCase
import
javax.inject.Inject
/**
...
...
@@ -9,9 +11,12 @@ import javax.inject.Inject
*/
class
FavoritesInteractor
@Inject
constructor
(
private
val
estateUseCase
:
EstateUseCase
)
{
fun
getFavoritesForCurrentUser
()
=
Single
.
just
(
parkingEstateSample
)
fun
getFavoritesForCurrentUser
()
=
estateUseCase
.
fetchFavorites
()
// Single.just(parkingEstateSample )
companion
object
{
...
...
@@ -45,7 +50,6 @@ class FavoritesInteractor @Inject constructor(
planJPG
=
null
,
albumId
=
10
,
multitourId
=
null
,
explications
=
null
,
url
=
null
),
EstateModel
(
...
...
@@ -75,7 +79,6 @@ class FavoritesInteractor @Inject constructor(
planJPG
=
null
,
albumId
=
10
,
multitourId
=
null
,
explications
=
null
,
url
=
null
),
EstateModel
(
...
...
@@ -113,107 +116,107 @@ class FavoritesInteractor @Inject constructor(
),
albumId
=
10
,
url
=
null
,
multitourId
=
5790
,
explications
=
arrayListOf
<
ExplicationListModel
>(
ExplicationListModel
(
planId
=
0
,
items
=
arrayListOf
(
ExplicationModel
(
living
=
true
,
area
=
16.30f
,
title
=
"Спальня"
),
ExplicationModel
(
living
=
false
,
area
=
11.40f
,
title
=
"Кухня"
),
ExplicationModel
(
living
=
false
,
area
=
1.90f
,
title
=
"Прихожая"
),
ExplicationModel
(
living
=
false
,
area
=
5.20f
,
title
=
"Коридор"
),
ExplicationModel
(
living
=
false
,
area
=
1.70f
,
title
=
"Лоджия"
),
ExplicationModel
(
living
=
false
,
area
=
3.50f
,
title
=
"Санузел"
)
)
),
ExplicationListModel
(
planId
=
1
,
items
=
arrayListOf
(
ExplicationModel
(
living
=
true
,
area
=
16.30f
,
title
=
"Спальня"
),
ExplicationModel
(
living
=
false
,
area
=
11.40f
,
title
=
"Кухня"
),
ExplicationModel
(
living
=
false
,
area
=
5.20f
,
title
=
"Коридор"
),
ExplicationModel
(
living
=
false
,
area
=
1.90f
,
title
=
"Прихожая"
),
ExplicationModel
(
living
=
false
,
area
=
3.50f
,
title
=
"Санузел"
),
ExplicationModel
(
living
=
false
,
area
=
1.70f
,
title
=
"Лоджия"
)
)
),
ExplicationListModel
(
planId
=
2
,
items
=
arrayListOf
(
ExplicationModel
(
living
=
false
,
area
=
1.00f
,
title
=
"Кухня-гостиная"
),
ExplicationModel
(
living
=
false
,
area
=
2.00f
,
title
=
"Коридор"
),
ExplicationModel
(
living
=
false
,
area
=
3.00f
,
title
=
"Прихожая"
),
ExplicationModel
(
living
=
false
,
area
=
4.00f
,
title
=
"Санузел"
),
ExplicationModel
(
living
=
false
,
area
=
5.00f
,
title
=
"Лоджия"
)
)
)
)
multitourId
=
5790
// ,
explications = arrayListOf<ExplicationListModel>(
//
ExplicationListModel(
//
planId = 0,
//
items = arrayListOf(
//
ExplicationModel(
//
living = true,
//
area = 16.30f,
//
title = "Спальня"
//
),
//
ExplicationModel(
//
living = false,
//
area = 11.40f,
//
title = "Кухня"
//
),
//
ExplicationModel(
//
living = false,
//
area = 1.90f,
//
title = "Прихожая"
//
),
//
ExplicationModel(
//
living = false,
//
area = 5.20f,
//
title = "Коридор"
//
),
//
ExplicationModel(
//
living = false,
//
area = 1.70f,
//
title = "Лоджия"
//
),
//
ExplicationModel(
//
living = false,
//
area = 3.50f,
//
title = "Санузел"
//
)
//
)
//
), ExplicationListModel(
//
planId = 1,
//
items = arrayListOf(
//
ExplicationModel(
//
living = true,
//
area = 16.30f,
//
title = "Спальня"
//
),
//
ExplicationModel(
//
living = false,
//
area = 11.40f,
//
title = "Кухня"
//
),
//
ExplicationModel(
//
living = false,
//
area = 5.20f,
//
title = "Коридор"
//
),
//
ExplicationModel(
//
living = false,
//
area = 1.90f,
//
title = "Прихожая"
//
),
//
ExplicationModel(
//
living = false,
//
area = 3.50f,
//
title = "Санузел"
//
),
//
ExplicationModel(
//
living = false,
//
area = 1.70f,
//
title = "Лоджия"
//
)
//
)
//
), ExplicationListModel(
//
planId = 2,
//
items = arrayListOf(
//
ExplicationModel(
//
living = false,
//
area = 1.00f,
//
title = "Кухня-гостиная"
//
),
//
ExplicationModel(
//
living = false,
//
area = 2.00f,
//
title = "Коридор"
//
),
//
ExplicationModel(
//
living = false,
//
area = 3.00f,
//
title = "Прихожая"
//
),
//
ExplicationModel(
//
living = false,
//
area = 4.00f,
//
title = "Санузел"
//
),
//
ExplicationModel(
//
living = false,
//
area = 5.00f,
//
title = "Лоджия"
//
)
//
)
//
)
//
)
)
)
...
...
app/src/main/java/com/biganto/visual/roompark/domain/model/deals.kt
View file @
501b0ea3
package
com.biganto.visual.roompark.domain.model
import
com.biganto.visual.roompark.data.repository.api.retrofit.raw.EstateRaw
import
com.biganto.visual.roompark.data.repository.db.requrey.model.EstateEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.ExplicationEntity
/**
* Created by Vladislav Bogdashkin on 23.09.2019.
...
...
@@ -41,10 +39,45 @@ data class EstateModel(
val
albumId
:
Int
?=
null
,
val
multitourId
:
Int
?=
null
,
val
commonInfo
:
CommonInfoModel
?
=
null
,
val
explications
:
List
<
ExplicationListModel
>?
=
null
,
val
url
:
String
?
)
fun
fromEntity
(
entity
:
EstateEntity
):
EstateModel
{
val
model
=
EstateModel
(
id
=
entity
.
id
,
type
=
entity
.
type
,
number
=
entity
.
number
,
sectionBegin
=
entity
.
sectionBegin
,
sectionEnd
=
entity
.
sectionEnd
,
planPNG
=
null
,
planJPG
=
null
,
rooms
=
entity
.
rooms
,
albumId
=
entity
.
albumId
,
multitourId
=
entity
.
multitourId
,
commonInfo
=
CommonInfoModel
(
building
=
entity
.
info_building
,
section_begin
=
entity
.
sectionBegin
,
floor
=
entity
.
info_floor
,
floor_max
=
entity
.
info_floor_max
,
area
=
entity
.
info_area
,
area_living
=
entity
.
info_area_living
,
kind
=
entity
.
info_kind
,
dependent
=
entity
.
info_dependent
,
decoration
=
entity
.
info_decoration
,
ceiling
=
entity
.
info_ceiling
,
windows_face
=
entity
.
info_window_face
,
direction
=
entity
.
info_direction
,
price_meter
=
entity
.
info_price_meter
,
price
=
entity
.
info_price
,
// discount = entity.di
// discount_amount = entity
rooms
=
entity
.
rooms
),
url
=
entity
.
url
)
return
model
}
data class
PlanModel
(
val
url
:
String
,
val
width
:
Int
,
...
...
@@ -54,7 +87,7 @@ data class PlanModel(
data class
CommonInfoModel
(
val
building
:
Int
,
val
section_begin
:
Int
,
val
section_begin
:
Int
?
,
val
floor
:
Int
,
val
floor_max
:
Int
,
val
area
:
Float
?,
...
...
@@ -67,8 +100,8 @@ data class CommonInfoModel(
val
direction
:
String
?,
val
price_meter
:
Int
?,
val
price
:
Int
?,
val
discount
:
Float
?,
val
discount_amount
:
Int
?,
val
discount
:
Float
?
=
null
,
val
discount_amount
:
Int
?
=
null
,
val
rooms
:
Int
?
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment