-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from brandy-kay/feature/alarm_manager
- Loading branch information
Showing
26 changed files
with
664 additions
and
90 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
6 changes: 6 additions & 0 deletions
6
core/common/src/main/java/com/brandyodhiambo/common/domain/model/DailyStatistics.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,6 @@ | ||
package com.brandyodhiambo.common.domain.model | ||
|
||
data class DailyStatistics( | ||
val amountTaken: Float, | ||
val day: String, | ||
) |
6 changes: 6 additions & 0 deletions
6
core/common/src/main/java/com/brandyodhiambo/common/domain/model/MonthlyStatistics.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,6 @@ | ||
package com.brandyodhiambo.common.domain.model | ||
|
||
data class MonthlyStatistics( | ||
val amountTaken: Float, | ||
val month: String, | ||
) |
6 changes: 6 additions & 0 deletions
6
core/common/src/main/java/com/brandyodhiambo/common/domain/model/WeeklyStatistics.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,6 @@ | ||
package com.brandyodhiambo.common.domain.model | ||
|
||
data class WeeklyStatistics( | ||
val amountTaken: Float, | ||
val week: String, | ||
) |
12 changes: 12 additions & 0 deletions
12
...on/src/main/java/com/brandyodhiambo/common/domain/repository/DailyStatisticsRepository.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,12 @@ | ||
package com.brandyodhiambo.common.domain.repository | ||
|
||
import androidx.lifecycle.LiveData | ||
import com.brandyodhiambo.common.domain.model.DailyStatistics | ||
|
||
interface DailyStatisticsRepository { | ||
suspend fun insertDailyStatistics(dailyStatistics: DailyStatistics) | ||
suspend fun updateDailyStatistics(dailyStatistics: DailyStatistics) | ||
suspend fun deleteDailyStatistics(dailyStatistics: DailyStatistics) | ||
suspend fun deleteAllDailyStatistics() | ||
fun getDailyStatistics(): LiveData<List<DailyStatistics>?> | ||
} |
13 changes: 13 additions & 0 deletions
13
.../src/main/java/com/brandyodhiambo/common/domain/repository/MonthlyStatisticsRepository.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.brandyodhiambo.common.domain.repository | ||
|
||
import androidx.lifecycle.LiveData | ||
import com.brandyodhiambo.common.domain.model.MonthlyStatistics | ||
|
||
interface MonthlyStatisticsRepository { | ||
|
||
suspend fun insertMonthlyStatistics(monthlyStatistics: MonthlyStatistics) | ||
suspend fun updateMonthlyStatistics(monthlyStatistics: MonthlyStatistics) | ||
fun getMonthlyStatistics(): LiveData<List<MonthlyStatistics>?> | ||
suspend fun deleteMonthlyStatistics(monthlyStatistics: MonthlyStatistics) | ||
suspend fun deleteAllMonthlyStatistics() | ||
} |
12 changes: 12 additions & 0 deletions
12
...on/src/main/java/com/brandyodhiambo/common/domain/repository/WeeklyStatisticRepository.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,12 @@ | ||
package com.brandyodhiambo.common.domain.repository | ||
|
||
import androidx.lifecycle.LiveData | ||
import com.brandyodhiambo.common.domain.model.WeeklyStatistics | ||
|
||
interface WeeklyStatisticRepository { | ||
suspend fun insertWeeklyStatistic(weeklyStatistic: WeeklyStatistics) | ||
suspend fun updateWeeklyStatistic(weeklyStatistic: WeeklyStatistics) | ||
fun getWeeklyStatistic(): LiveData<List<WeeklyStatistics>?> | ||
suspend fun deleteWeeklyStatistic(weeklyStatistic: WeeklyStatistics) | ||
suspend fun deleteAllWeeklyStatistic() | ||
} |
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
27 changes: 27 additions & 0 deletions
27
core/database/src/main/java/com/brandyodhiambo/dao/DailyStatisticsDao.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 com.brandyodhiambo.dao | ||
|
||
import androidx.lifecycle.LiveData | ||
import androidx.room.Dao | ||
import androidx.room.Delete | ||
import androidx.room.Insert | ||
import androidx.room.Query | ||
import com.brandyodhiambo.entity.DailyStatisticsEntity | ||
|
||
@Dao | ||
interface DailyStatisticsDao { | ||
|
||
@Insert | ||
suspend fun insertDailyStatistic(dailyStatisticsEntity: DailyStatisticsEntity) | ||
|
||
@Query("SELECT *FROM daily_statistics_table") | ||
fun getDailyStatistics(): LiveData<List<DailyStatisticsEntity>?> | ||
|
||
@Delete | ||
suspend fun deleteDailyStatistic(dailyStatisticsEntity: DailyStatisticsEntity) | ||
|
||
@Query("UPDATE daily_statistics_table SET amountTaken = :amountTaken, day = :day WHERE id = :id") | ||
suspend fun updateDailyStatistic(id: Int, amountTaken: Float, day: String) | ||
|
||
@Query("DELETE FROM daily_statistics_table") | ||
suspend fun deleteAllDailyStatistics() | ||
} |
26 changes: 26 additions & 0 deletions
26
core/database/src/main/java/com/brandyodhiambo/dao/MonthlyStatisticsDao.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 com.brandyodhiambo.dao | ||
|
||
import androidx.lifecycle.LiveData | ||
import androidx.room.Dao | ||
import androidx.room.Delete | ||
import androidx.room.Insert | ||
import androidx.room.Query | ||
import com.brandyodhiambo.entity.MonthlyStatisticsEntity | ||
|
||
@Dao | ||
interface MonthlyStatisticsDao { | ||
@Insert | ||
suspend fun insertMonthlyStatistic(monthlyStatisticsEntity: MonthlyStatisticsEntity) | ||
|
||
@Query("SELECT *FROM monthly_statistics_table") | ||
fun getMonthlyStatistics(): LiveData<List<MonthlyStatisticsEntity>?> | ||
|
||
@Delete | ||
suspend fun deleteMonthlyStatistic(monthlyStatisticsEntity: MonthlyStatisticsEntity) | ||
|
||
@Query("UPDATE monthly_statistics_table SET amountTaken = :amountTaken, month = :month WHERE id = :id") | ||
suspend fun updateMonthlyStatistic(id: Int, amountTaken: Float, month: String) | ||
|
||
@Query("DELETE FROM monthly_statistics_table") | ||
suspend fun deleteAllMonthlyStatistics() | ||
} |
26 changes: 26 additions & 0 deletions
26
core/database/src/main/java/com/brandyodhiambo/dao/WeeklyStatisticDao.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 com.brandyodhiambo.dao | ||
|
||
import androidx.lifecycle.LiveData | ||
import androidx.room.Dao | ||
import androidx.room.Delete | ||
import androidx.room.Insert | ||
import androidx.room.Query | ||
import com.brandyodhiambo.entity.WeeklyStatisticsEntity | ||
|
||
@Dao | ||
interface WeeklyStatisticDao { | ||
@Insert | ||
suspend fun insertWeeklyStatistic(weeklyStatisticsEntity: WeeklyStatisticsEntity) | ||
|
||
@Query("SELECT *FROM weekly_statistics_table") | ||
fun getWeeklyStatistics(): LiveData<List<WeeklyStatisticsEntity>?> | ||
|
||
@Delete | ||
suspend fun deleteWeeklyStatistic(weeklyStatisticsEntity: WeeklyStatisticsEntity) | ||
|
||
@Query("UPDATE weekly_statistics_table SET amountTaken = :amountTaken, week = :week WHERE id = :id") | ||
suspend fun updateWeeklyStatistic(id: Int, amountTaken: Float, week: String) | ||
|
||
@Query("DELETE FROM weekly_statistics_table") | ||
suspend fun deleteAllWeeklyStatistics() | ||
} |
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
13 changes: 13 additions & 0 deletions
13
core/database/src/main/java/com/brandyodhiambo/entity/DailyStatisticsEntity.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.brandyodhiambo.entity | ||
|
||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
import com.brandyodhiambo.Constants.DAILY_STATISTICS_TABLE | ||
|
||
@Entity(tableName = DAILY_STATISTICS_TABLE) | ||
data class DailyStatisticsEntity( | ||
@PrimaryKey(autoGenerate = true) | ||
val id: Int = 0, | ||
val amountTaken: Float, | ||
val day: String, | ||
) |
13 changes: 13 additions & 0 deletions
13
core/database/src/main/java/com/brandyodhiambo/entity/MonthlyStatisticsEntity.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.brandyodhiambo.entity | ||
|
||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
import com.brandyodhiambo.Constants.MONTHLY_STATISTICS_TABLE | ||
|
||
@Entity(tableName = MONTHLY_STATISTICS_TABLE) | ||
data class MonthlyStatisticsEntity( | ||
@PrimaryKey(autoGenerate = true) | ||
val id: Int = 0, | ||
val amountTaken: Float, | ||
val month: String, | ||
) |
13 changes: 13 additions & 0 deletions
13
core/database/src/main/java/com/brandyodhiambo/entity/WeeklyStatisticsEntity.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.brandyodhiambo.entity | ||
|
||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
import com.brandyodhiambo.Constants.WEEKLY_STATISTICS_TABLE | ||
|
||
@Entity(tableName = WEEKLY_STATISTICS_TABLE) | ||
data class WeeklyStatisticsEntity( | ||
@PrimaryKey(autoGenerate = true) | ||
val id: Int = 0, | ||
val amountTaken: Float, | ||
val week: 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
Oops, something went wrong.