Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
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
7d76b6be
Commit
7d76b6be
authored
Dec 25, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
actualize api calls
parent
6c81fb51
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
5 deletions
+114
-5
EstateRepository.kt
...to/visual/roompark/data/data_provider/EstateRepository.kt
+43
-0
response.kt
...ual/roompark/data/repository/api/retrofit/raw/response.kt
+4
-5
Estate.kt
...isual/roompark/data/repository/db/requrey/model/Estate.kt
+10
-0
deals.kt
...in/java/com/biganto/visual/roompark/domain/model/deals.kt
+41
-0
estateUseCase.kt
.../biganto/visual/roompark/domain/use_case/estateUseCase.kt
+16
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/EstateRepository.kt
0 → 100644
View file @
7d76b6be
package
com.biganto.visual.roompark.data.data_provider
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.domain.contract.DealContract
import
com.biganto.visual.roompark.domain.custom_exception.CustomApiException
import
com.biganto.visual.roompark.domain.model.EstateModel
import
timber.log.Timber
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 29.10.2019.
*/
//
class
EstateRepository
@Inject
constructor
(
private
val
local
:
ILocalStore
,
private
val
api
:
IRoomParkApi
,
private
val
db
:
IDb
):
DealContract
{
init
{
Timber
.
d
(
"Estate Repository Created"
)
}
val
getFavoritesApi
=
local
.
recentUser
()
.
flatMap
{
when
(
it
){
is
UserState
.
Authenticated
->
db
.
fetchUser
(
it
.
uuid
.
toInt
())
else
->
throw
CustomApiException
.
NotAuthorizedException
()
}
}
.
flatMap
{
api
.
getFavorites
(
it
.
authToken
)
// .map(::fromRaw)
}
override
fun
getFavorites
():
io
.
reactivex
.
rxjava3
.
core
.
Observable
<
List
<
EstateModel
>>
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
}
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/raw/response.kt
View file @
7d76b6be
...
@@ -35,8 +35,7 @@ data class EstateRaw(
...
@@ -35,8 +35,7 @@ data class EstateRaw(
val
plan_jpg
:
PlanRaw
?,
val
plan_jpg
:
PlanRaw
?,
val
url
:
String
,
val
url
:
String
,
val
album_id
:
Int
,
val
album_id
:
Int
,
val
multitour_id
:
Int
?,
val
multitour_id
:
Int
?
val
explications
:
List
<
ExplicationRaw
>?
)
)
data class
PlanRaw
(
data class
PlanRaw
(
...
@@ -48,6 +47,7 @@ data class PlanRaw(
...
@@ -48,6 +47,7 @@ data class PlanRaw(
data class
CommonInfoRaw
(
data class
CommonInfoRaw
(
val
building
:
Int
,
val
building
:
Int
,
val
section_begin
:
Int
,
val
section_begin
:
Int
,
val
section_end
:
Int
?,
val
floor
:
Int
,
val
floor
:
Int
,
val
floor_max
:
Int
,
val
floor_max
:
Int
,
val
area
:
Float
?,
val
area
:
Float
?,
...
@@ -65,8 +65,6 @@ data class CommonInfoRaw(
...
@@ -65,8 +65,6 @@ data class CommonInfoRaw(
val
rooms
:
Int
?
val
rooms
:
Int
?
)
)
data class
ExplicationRaw
(
val
plan_id
:
Int
,
val
items
:
List
<
EstateRoomRaw
>)
data class
EstateRoomRaw
(
data class
EstateRoomRaw
(
val
title
:
String
,
val
title
:
String
,
val
living
:
Boolean
,
val
living
:
Boolean
,
...
@@ -138,7 +136,8 @@ data class ResolutionRaw(
...
@@ -138,7 +136,8 @@ data class ResolutionRaw(
data class
PlanTypeRaw
(
data class
PlanTypeRaw
(
val
plan_id
:
Int
,
val
plan_id
:
Int
,
val
title
:
String
,
val
title
:
String
,
val
features
:
List
<
String
>
val
features
:
List
<
String
>,
val
explication
:
List
<
EstateRoomRaw
>?
)
)
data class
MultiTourRaw
(
data class
MultiTourRaw
(
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/Estate.kt
View file @
7d76b6be
...
@@ -56,4 +56,14 @@ interface Estate : Persistable {
...
@@ -56,4 +56,14 @@ interface Estate : Persistable {
val
info_dependent
:
Boolean
?
val
info_dependent
:
Boolean
?
@get
:
Nullable
@get
:
Nullable
val
info_decoration
:
String
?
val
info_decoration
:
String
?
@get
:
Nullable
val
info_window_face
:
String
?
@get
:
Nullable
val
info_price
:
Int
?
@get
:
Nullable
val
info_price_meter
:
Int
?
@get
:
Nullable
val
info_ceiling
:
Float
?
@get
:
Nullable
val
info_direction
:
String
?
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/model/deals.kt
View file @
7d76b6be
package
com.biganto.visual.roompark.domain.model
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.
* Created by Vladislav Bogdashkin on 23.09.2019.
*/
*/
...
@@ -41,6 +45,43 @@ data class EstateModel(
...
@@ -41,6 +45,43 @@ data class EstateModel(
val
url
:
String
?
val
url
:
String
?
)
)
fun
fromRaw
(
raw
:
EstateRaw
):
EstateEntity
{
val
entity
=
EstateEntity
()
entity
.
setId
(
raw
.
id
)
entity
.
setType
(
raw
.
type
)
entity
.
setNumber
(
raw
.
number
)
entity
.
setSectionBegin
(
raw
.
common_info
.
section_begin
)
entity
.
setSectionEnd
(
raw
.
common_info
.
section_end
)
entity
.
setPlanJpgUrl
(
raw
.
plan_jpg
?.
url
)
entity
.
setPlanJpgWidth
(
raw
.
plan_jpg
?.
width
)
entity
.
setPlanJpgHeight
(
raw
.
plan_jpg
?.
height
)
entity
.
setPlanPngUrl
(
raw
.
plan_png
?.
url
)
entity
.
setPlanPngWidth
(
raw
.
plan_png
?.
width
)
entity
.
setPlanPngHeight
(
raw
.
plan_png
?.
height
)
entity
.
setRooms
(
raw
.
common_info
.
rooms
)
entity
.
setAlbumId
(
raw
.
album_id
)
entity
.
setMultitourId
(
raw
.
multitour_id
)
entity
.
setUrl
(
raw
.
url
)
entity
.
setInfo_floor_max
(
raw
.
common_info
.
floor_max
)
entity
.
setInfo_area
(
raw
.
common_info
.
area
)
entity
.
setInfo_area_living
(
raw
.
common_info
.
area_living
)
entity
.
setInfo_kind
(
raw
.
common_info
.
kind
)
entity
.
setInfo_dependent
(
raw
.
common_info
.
dependent
)
entity
.
setInfo_decoration
(
raw
.
common_info
.
decoration
)
entity
.
setInfo_building
(
raw
.
common_info
.
building
)
entity
.
setInfo_section_begin
(
raw
.
common_info
.
section_begin
)
entity
.
setInfo_floor
(
raw
.
common_info
.
floor
)
entity
.
setInfo_window_face
(
raw
.
common_info
.
windows_face
)
entity
.
setInfo_price
(
raw
.
common_info
.
price
)
entity
.
setInfo_price_meter
(
raw
.
common_info
.
price_meter
)
entity
.
setInfo_ceiling
(
raw
.
common_info
.
ceiling
)
entity
.
setInfo_direction
(
raw
.
common_info
.
direction
)
return
entity
}
data class
PlanModel
(
data class
PlanModel
(
val
url
:
String
,
val
url
:
String
,
val
width
:
Int
,
val
width
:
Int
,
...
...
app/src/main/java/com/biganto/visual/roompark/domain/use_case/estateUseCase.kt
0 → 100644
View file @
7d76b6be
package
com.biganto.visual.roompark.domain.use_case
import
com.biganto.visual.roompark.domain.contract.DealContract
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 24.09.2019.
*/
class
EstateUseCase
@Inject
constructor
(
private
val
contract
:
DealContract
){
fun
fetchFavorites
()
=
contract
.
getFavorites
()
}
\ No newline at end of file
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