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
4ccf07dd
Commit
4ccf07dd
authored
Dec 18, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix query right join select
parent
296ca215
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
31 deletions
+32
-31
AlbumsRepository.kt
...to/visual/roompark/data/data_provider/AlbumsRepository.kt
+0
-3
IDb.kt
...ava/com/biganto/visual/roompark/data/repository/db/IDb.kt
+2
-2
RequeryRepository.kt
.../roompark/data/repository/db/requrey/RequeryRepository.kt
+30
-26
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/AlbumsRepository.kt
View file @
4ccf07dd
...
...
@@ -64,7 +64,6 @@ class AlbumsContractModule @Inject constructor(
private
val
fetchTopLevelAlbumsDb
=
db
.
getTopLevelAlbums
()
.
toObservable
()
.
subscribeOn
(
Schedulers
.
io
())
private
fun
fetchTopLevelAlbums
():
Observable
<
List
<
AlbumPreviewModel
>>
=
...
...
@@ -99,8 +98,6 @@ class AlbumsContractModule @Inject constructor(
private
fun
fetchAlbumsDb
(
parentAlbumId
:
Int
)
=
db
.
getChildAlbums
(
parentAlbumId
)
.
toList
()
.
toObservable
()
.
subscribeOn
(
Schedulers
.
io
())
private
fun
fetchAlbums
(
parentId
:
Int
):
Observable
<
List
<
AlbumPreviewModel
>>
=
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/IDb.kt
View file @
4ccf07dd
...
...
@@ -18,8 +18,8 @@ interface IDb {
fun
<
T
:
List
<
Persistable
>
>
blockingUpsert
(
entity
:
T
)
fun
userObservableResult
(
uuid
:
Int
):
Observable
<
ReactiveResult
<
UserEntity
>>
fun
fetchArticles
(
feedAlias
:
String
,
pageSize
:
Int
,
startIndex
:
Int
):
Observable
<
ArticleEntity
>
fun
getTopLevelAlbums
():
Single
<
Mutable
List
<
ImageAlbumEntity
>>
fun
getChildAlbums
(
parentId
:
Int
):
Observable
<
ImageAlbumEntity
>
fun
getTopLevelAlbums
():
Observable
<
List
<
ImageAlbumEntity
>>
fun
getChildAlbums
(
parentId
:
Int
):
Observable
<
List
<
ImageAlbumEntity
>
>
fun
checkIfExistsAlbumJunction
(
albumId
:
Int
,
parentAlbumId
:
Int
):
ImageAlbumJunctionEntity
?
fun
getFeed
(
feedAlias
:
String
):
ReactiveResult
<
FeedEntity
>
fun
getArticle
(
id
:
Int
):
ReactiveResult
<
ArticleEntity
>
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/RequeryRepository.kt
View file @
4ccf07dd
...
...
@@ -45,52 +45,58 @@ class RequeryRepository @Inject constructor(
)
:
IDb
{
private
inline
fun
<
reified
T
:
Persistable
>
fetchAll
()
=
private
inline
fun
<
reified
T
:
Persistable
>
fetchAll
()
=
store
.
select
(
T
::
class
)
override
fun
upsertUser
(
entity
:
UserEntity
):
Observable
<
UserEntity
>
=
override
fun
upsertUser
(
entity
:
UserEntity
):
Observable
<
UserEntity
>
=
store
.
upsert
(
entity
).
toObservable
()
override
fun
<
T
:
Persistable
>
upsert
(
entity
:
T
)
=
store
.
upsert
(
entity
)
override
fun
<
T
:
Persistable
>
upsert
(
entity
:
T
)
=
store
.
upsert
(
entity
)
override
fun
<
T
:
List
<
Persistable
>
>
upsert
(
entity
:
T
):
Single
<
Iterable
<
Persistable
>>
=
store
.
upsert
(
entity
)
override
fun
<
T
:
List
<
Persistable
>
>
blockingUpsert
(
entity
:
T
)
=
override
fun
<
T
:
List
<
Persistable
>
>
blockingUpsert
(
entity
:
T
)
=
store
.
upsert
(
entity
).
toObservable
().
blockingSubscribe
()
override
fun
fetchFeeds
():
Observable
<
FeedEntity
>
=
fetchAll
<
FeedEntity
>().
get
().
observable
()
override
fun
getFeed
(
feedAlias
:
String
):
ReactiveResult
<
FeedEntity
>
=
override
fun
getFeed
(
feedAlias
:
String
):
ReactiveResult
<
FeedEntity
>
=
fetchAll
<
FeedEntity
>().
where
(
FeedEntity
.
ALIAS
.
eq
(
feedAlias
))
.
get
()
override
fun
getArticle
(
id
:
Int
):
ReactiveResult
<
ArticleEntity
>
=
override
fun
getArticle
(
id
:
Int
):
ReactiveResult
<
ArticleEntity
>
=
fetchAll
<
ArticleEntity
>().
where
(
ArticleEntity
.
ID
.
eq
(
id
))
.
get
()
override
fun
getTopLevelAlbums
():
Single
<
MutableList
<
ImageAlbumEntity
>>
=
fetchAll
<
ImageAlbumEntity
>()
.
join
(
ImageAlbumJunctionEntity
::
class
)
.
on
(
ImageAlbumJunctionEntity
.
ALBUM_ID
.
eq
(
ImageAlbumEntity
.
ID
))
.
where
(
ImageAlbumJunctionEntity
.
ALBUM_ID
.
isNull
())
.
get
().
observable
().
toList
()
override
fun
getChildAlbums
(
parentId
:
Int
):
Observable
<
ImageAlbumEntity
>
=
store
.
select
(
ImageAlbumEntity
::
class
)
.
join
(
ImageAlbumJunctionEntity
::
class
)
.
on
(
ImageAlbumJunctionEntity
.
ALBUM_ID
.
eq
(
ImageAlbumEntity
.
ID
))
.
where
(
ImageAlbumJunctionEntity
.
PARENT_ID
.
eq
(
parentId
))
.
get
().
observable
()
override
fun
getTopLevelAlbums
():
Observable
<
List
<
ImageAlbumEntity
>>
=
Observable
.
fromArray
(
store
.
raw
(
ImageAlbumEntity
::
class
,
"SELECT alb.* from ImageAlbumJunction albJun "
+
"left join ImageAlbum alb on albJun.albumId = alb.id "
+
"WHERE albJun.albumId is null "
).
toList
()
)
override
fun
getChildAlbums
(
parentId
:
Int
):
Observable
<
List
<
ImageAlbumEntity
>>
=
Observable
.
fromArray
(
store
.
raw
(
ImageAlbumEntity
::
class
,
"SELECT alb.* from ImageAlbumJunction albJun "
+
"left join ImageAlbum alb on albJun.albumId = alb.id "
+
"WHERE albJun.albumId is $parentId "
).
toList
()
)
override
fun
getPhotos
(
albumId
:
Int
):
Observable
<
GalleryPhotoEntity
>
=
store
.
select
(
GalleryPhotoEntity
::
class
)
.
where
(
GalleryPhotoEntity
.
ALBUM_ID
.
eq
(
albumId
))
.
get
().
observable
()
override
fun
fetchArticles
(
feedAlias
:
String
,
pageSize
:
Int
,
startIndex
:
Int
)
override
fun
fetchArticles
(
feedAlias
:
String
,
pageSize
:
Int
,
startIndex
:
Int
)
:
Observable
<
ArticleEntity
>
=
fetchAll
<
ArticleEntity
>()
.
where
(
ArticleEntity
.
FEED_ID
.
eq
(
feedAlias
))
...
...
@@ -99,25 +105,23 @@ class RequeryRepository @Inject constructor(
.
offset
(
startIndex
)
.
get
().
observable
()
override
fun
checkIfExistsAlbumJunction
(
albumId
:
Int
,
parentAlbumId
:
Int
)
=
override
fun
checkIfExistsAlbumJunction
(
albumId
:
Int
,
parentAlbumId
:
Int
)
=
fetchAll
<
ImageAlbumJunctionEntity
>()
.
where
(
ImageAlbumJunctionEntity
.
ALBUM_ID
.
eq
(
albumId
))
.
and
(
ImageAlbumJunctionEntity
.
PARENT_ID
.
eq
(
parentAlbumId
))
.
get
()
.
firstOrNull
()
override
fun
fetchUser
(
uuid
:
Int
):
Observable
<
UserEntity
>
=
override
fun
fetchUser
(
uuid
:
Int
):
Observable
<
UserEntity
>
=
fetchAll
<
UserEntity
>().
where
(
UserEntity
.
UUID
.
eq
(
uuid
)).
get
().
observable
()
fun
upsertFeeds
(
entity
:
List
<
FeedEntity
>)
=
fun
upsertFeeds
(
entity
:
List
<
FeedEntity
>)
=
store
.
upsert
(
entity
)
override
fun
userObservableResult
(
uuid
:
Int
)
=
override
fun
userObservableResult
(
uuid
:
Int
)
=
store
.
select
(
UserEntity
::
class
)
.
where
(
UserEntity
.
UUID
.
eq
(
uuid
))
.
get
()
.
observableResult
()
}
\ 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