[APIv2] Implement getting timetable for one week. Support arguments in EdziennikTask. Create new DataRemoveModel.

This commit is contained in:
Kuba Szczodrzyński
2019-11-11 14:11:05 +01:00
parent 4eeaa54a47
commit d4e9e1730f
21 changed files with 626 additions and 67 deletions

View File

@ -17,6 +17,7 @@ import pl.szczodrzynski.edziennik.utils.models.Time
])
open class Lesson(val profileId: Int, @PrimaryKey val id: Long) {
companion object {
const val TYPE_NO_LESSONS = -1
const val TYPE_NORMAL = 0
const val TYPE_CANCELLED = 1
const val TYPE_CHANGE = 2

View File

@ -17,6 +17,13 @@ interface TimetableDao {
@Query("DELETE FROM timetable WHERE profileId = :profileId")
fun clear(profileId: Int)
@Query("DELETE FROM timetable WHERE profileId = :profileId AND (type != 3 AND date >= :dateFrom) OR ((type = 3 OR type = 1) AND oldDate >= :dateFrom)")
fun clearFromDate(profileId: Int, dateFrom: Date)
@Query("DELETE FROM timetable WHERE profileId = :profileId AND (type != 3 AND date <= :dateTo) OR ((type = 3 OR type = 1) AND oldDate <= :dateTo)")
fun clearToDate(profileId: Int, dateTo: Date)
@Query("DELETE FROM timetable WHERE profileId = :profileId AND (type != 3 AND date >= :dateFrom AND date <= :dateTo) OR ((type = 3 OR type = 1) AND oldDate >= :dateFrom AND oldDate <= :dateTo)")
fun clearBetweenDates(profileId: Int, dateFrom: Date, dateTo: Date)
@Query("""
SELECT
timetable.*,