createOrUpdateJetpack

abstract suspend fun createOrUpdateJetpack(jetpack: Jetpack): Result<Unit>

Creates or updates a jetpack in the repository.

Return

A Result indicating the success or failure of the operation.

Parameters

jetpack

The Jetpack object to create or update.

Samples

return suspendRunCatching {
    val userId = preferencesDataSource.getUserIdOrThrow()
    localDataSource.upsertJetpack(
        jetpack
            .toJetpackEntity()
            .copy(
                userId = userId,
                lastUpdated = System.currentTimeMillis(),
                needsSync = true,
                syncAction = SyncAction.UPSERT,
            ),
    )
    syncManager.requestSync()
}