-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
78 changed files
with
1,173 additions
and
230 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
2 changes: 1 addition & 1 deletion
2
common/systemDesign/src/main/java/city/zouitel/systemDesign/CommonConstants.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
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
26 changes: 26 additions & 0 deletions
26
core/database/src/main/java/city/zouitel/database/dao/MediaDao.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,26 @@ | ||
package city.zouitel.database.dao | ||
|
||
import androidx.room.Dao | ||
import androidx.room.Delete | ||
import androidx.room.Insert | ||
import androidx.room.OnConflictStrategy | ||
import androidx.room.Query | ||
import androidx.room.Update | ||
import city.zouitel.database.model.MediaEntity | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
@Dao | ||
interface MediaDao { | ||
|
||
@Query("SELECT * FROM MEDIA_TABLE") | ||
fun getAllMedias(): Flow<List<MediaEntity>> | ||
|
||
@Insert(onConflict = OnConflictStrategy.REPLACE) | ||
fun addMedia(media: MediaEntity) | ||
|
||
@Update(onConflict = OnConflictStrategy.REPLACE) | ||
fun updateMedia(media: MediaEntity) | ||
|
||
@Delete | ||
fun deleteMedia(media: MediaEntity) | ||
} |
27 changes: 27 additions & 0 deletions
27
core/database/src/main/java/city/zouitel/database/dao/NoteAndMediaDao.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,27 @@ | ||
package city.zouitel.database.dao | ||
|
||
import androidx.room.Dao | ||
import androidx.room.Delete | ||
import androidx.room.Insert | ||
import androidx.room.OnConflictStrategy | ||
import androidx.room.Query | ||
import androidx.room.Update | ||
import city.zouitel.database.model.MediaEntity | ||
import city.zouitel.database.model.NoteAndMediaEntity | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
@Dao | ||
interface NoteAndMediaDao { | ||
|
||
@Query("SELECT * FROM NOTE_AND_MEDIA") | ||
fun getAllMedias(): Flow<List<NoteAndMediaEntity>> | ||
|
||
@Insert(onConflict = OnConflictStrategy.REPLACE) | ||
fun addNoteAndMedia(noteAndMedia: NoteAndMediaEntity) | ||
|
||
@Update(onConflict = OnConflictStrategy.REPLACE) | ||
fun updateNoteAndMedia(noteAndMedia: NoteAndMediaEntity) | ||
|
||
@Delete | ||
fun deleteNoteAndMedia(noteAndMedia: NoteAndMediaEntity) | ||
} |
28 changes: 28 additions & 0 deletions
28
core/database/src/main/java/city/zouitel/database/datasourceImpl/MediaDataSourceImpl.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,28 @@ | ||
package city.zouitel.database.datasourceImpl | ||
|
||
import city.zouitel.database.dao.MediaDao | ||
import city.zouitel.database.mapper.MediaMapper | ||
import city.zouitel.repository.datasource.MediaDataSource | ||
import city.zouitel.repository.model.Media | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.map | ||
|
||
class MediaDataSourceImpl( | ||
private val dao: MediaDao, | ||
private val mapper: MediaMapper | ||
): MediaDataSource { | ||
override val getAllMedias: Flow<List<Media>> | ||
get() = dao.getAllMedias().map { medias -> mapper.toRepo(medias) } | ||
|
||
override fun addMedia(media: Media) { | ||
dao.addMedia(mapper.fromRepo(media)) | ||
} | ||
|
||
override fun updateMedia(media: Media) { | ||
dao.updateMedia(mapper.fromRepo(media)) | ||
} | ||
|
||
override fun deleteMedia(media: Media) { | ||
dao.deleteMedia(mapper.fromRepo(media)) | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...database/src/main/java/city/zouitel/database/datasourceImpl/NoteAndMediaDataSourceImpl.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,28 @@ | ||
package city.zouitel.database.datasourceImpl | ||
|
||
import city.zouitel.database.dao.NoteAndMediaDao | ||
import city.zouitel.database.mapper.NoteAndMediaMapper | ||
import city.zouitel.repository.datasource.NoteAndMediaDataSource | ||
import city.zouitel.repository.model.NoteAndMedia | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.map | ||
|
||
class NoteAndMediaDataSourceImpl( | ||
private val dao: NoteAndMediaDao, | ||
private val mapper: NoteAndMediaMapper | ||
): NoteAndMediaDataSource { | ||
override val getAllNotesAndMedia: Flow<List<NoteAndMedia>> | ||
get() = dao.getAllMedias().map { notesAndMedia -> mapper.toRepo(notesAndMedia) } | ||
|
||
override fun addNoteAndMedia(noteAndMedia: NoteAndMedia) { | ||
dao.addNoteAndMedia(mapper.fromRepo(noteAndMedia)) | ||
} | ||
|
||
override fun updateNoteAndMedia(noteAndMedia: NoteAndMedia) { | ||
dao.updateNoteAndMedia(mapper.fromRepo(noteAndMedia)) | ||
} | ||
|
||
override fun deleteNoteAndMedia(noteAndMedia: NoteAndMedia) { | ||
dao.deleteNoteAndMedia(mapper.fromRepo(noteAndMedia)) | ||
} | ||
} |
Oops, something went wrong.