-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
also don't scrap the same url multiple times
- Loading branch information
1 parent
6f9d9c4
commit 01d4da3
Showing
8 changed files
with
109 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/ratanparai/moviedog/db/dao/ScrappedDao.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.ratanparai.moviedog.db.dao | ||
|
||
import androidx.room.Dao | ||
import androidx.room.Insert | ||
import androidx.room.Query | ||
import com.ratanparai.moviedog.db.entity.Scrapped | ||
|
||
@Dao | ||
interface ScrappedDao { | ||
@Query("SELECT * FROM scrapped WHERE url = :url") | ||
fun getByUrl(url: String) : Scrapped? | ||
|
||
@Insert | ||
fun insert(scrapped: Scrapped) | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/ratanparai/moviedog/db/entity/MovieUrl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.ratanparai.moviedog.db.entity | ||
|
||
import androidx.room.ColumnInfo | ||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
|
||
@Entity(tableName = "movieUrl") | ||
data class MovieUrl( | ||
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Int = 0, | ||
val movieId: Int, | ||
val movieUrl: String, | ||
val serviceName: String | ||
) |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/com/ratanparai/moviedog/db/entity/MovieWithMovieUrls.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.ratanparai.moviedog.db.entity | ||
|
||
import androidx.room.Embedded | ||
import androidx.room.Relation | ||
|
||
data class MovieWithMovieUrls ( | ||
@Embedded val movie: Movie, | ||
@Relation(parentColumn = "id", entityColumn = "movieId", entity = MovieUrl::class) val movieUrls : List<MovieUrl> | ||
) |
11 changes: 11 additions & 0 deletions
11
app/src/main/java/com/ratanparai/moviedog/db/entity/Scrapped.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.ratanparai.moviedog.db.entity | ||
|
||
import androidx.room.ColumnInfo | ||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
|
||
@Entity(tableName = "scrapped") | ||
data class Scrapped ( | ||
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Int = 0, | ||
val url: String | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters