Add mutation to fetch the latest track data from the tracker (#920)

* Add mutation to fetch the latest track data from the tracker

* Update Track.kt

---------

Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>
This commit is contained in:
schroda
2024-03-31 19:25:58 +02:00
committed by GitHub
parent 16474d4328
commit 89dd570b30
2 changed files with 41 additions and 0 deletions

View File

@@ -187,6 +187,19 @@ object Track {
}
}
suspend fun refresh(recordId: Int) {
val recordDb =
transaction {
TrackRecordTable.select { TrackRecordTable.id eq recordId }.first()
}
val tracker = TrackerManager.getTracker(recordDb[TrackRecordTable.trackerId])!!
val track = recordDb.toTrack()
tracker.refresh(track)
upsertTrackRecord(track)
}
suspend fun unbind(
recordId: Int,
deleteRemoteTrack: Boolean? = false,