#74 added single getTask so feed kan fetch only one Task
This commit is contained in:
		
							parent
							
								
									dab4506a34
								
							
						
					
					
						commit
						2c7c96d73a
					
				
					 1 changed files with 7 additions and 0 deletions
				
			
		|  | @ -8,8 +8,11 @@ import be.ugent.sel.studeez.domain.TaskDAO | |||
| import com.google.firebase.firestore.CollectionReference | ||||
| import com.google.firebase.firestore.FirebaseFirestore | ||||
| import com.google.firebase.firestore.ktx.snapshots | ||||
| import com.google.firebase.firestore.ktx.toObject | ||||
| import kotlinx.coroutines.flow.Flow | ||||
| import kotlinx.coroutines.flow.flow | ||||
| import kotlinx.coroutines.flow.map | ||||
| import kotlinx.coroutines.tasks.await | ||||
| import javax.inject.Inject | ||||
| 
 | ||||
| class FireBaseTaskDAO @Inject constructor( | ||||
|  | @ -22,6 +25,10 @@ class FireBaseTaskDAO @Inject constructor( | |||
|             .map { it.toObjects(Task::class.java) } | ||||
|     } | ||||
| 
 | ||||
|     override suspend fun getTask(subjectId: String, taskId: String): Task { | ||||
|         return selectedSubjectTasksCollection(subjectId).document(taskId).get().await().toObject()!! | ||||
|     } | ||||
| 
 | ||||
|     override fun saveTask(newTask: Task) { | ||||
|         selectedSubjectTasksCollection(newTask.subjectId).add(newTask) | ||||
|     } | ||||
|  |  | |||
		Reference in a new issue
	
	 lbarraga
						lbarraga