-
Notifications
You must be signed in to change notification settings - Fork 2
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 #42 from SwEnt-Group13/chore/firestore
Chore/firestore #2
- Loading branch information
Showing
18 changed files
with
256 additions
and
168 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
package com.android.unio.model.event | ||
|
||
import com.android.unio.model.association.Association | ||
import com.android.unio.model.firestore.ReferenceList | ||
import com.android.unio.model.map.Location | ||
import com.google.firebase.Timestamp | ||
import java.util.Date | ||
|
||
data class Event( | ||
val uid: String = "", | ||
val title: String = "", | ||
val organisers: List<String> = mutableListOf<String>(), | ||
val taggedAssociations: List<String> = mutableListOf<String>(), | ||
val organisers: ReferenceList<Association>, | ||
val taggedAssociations: ReferenceList<Association>, | ||
val image: String = "", | ||
val description: String = "", | ||
val catchyDescription: String = "", | ||
val price: Double = 0.0, | ||
val date: Timestamp = Timestamp(Date()), | ||
val location: Location = Location(), | ||
val types: List<String> = mutableListOf<String>() | ||
val types: List<String> = mutableListOf() | ||
) |
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
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
25 changes: 24 additions & 1 deletion
25
app/src/main/java/com/android/unio/model/firestore/ReferenceList.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 |
---|---|---|
@@ -1,9 +1,32 @@ | ||
package com.android.unio.model.firestore | ||
|
||
interface ReferenceList { | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
import kotlinx.coroutines.flow.StateFlow | ||
|
||
interface ReferenceList<T> { | ||
val list: StateFlow<List<T>> | ||
|
||
fun add(uid: String) | ||
|
||
fun addAll(uids: List<String>) | ||
|
||
fun requestAll() | ||
} | ||
|
||
class MockReferenceList<T> : ReferenceList<T> { | ||
private val _uids = mutableListOf<String>() | ||
private val _list = MutableStateFlow<List<T>>(emptyList()) | ||
override val list: StateFlow<List<T>> = _list | ||
|
||
override fun add(uid: String) { | ||
_uids.add(uid) | ||
} | ||
|
||
override fun addAll(uids: List<String>) { | ||
_uids.addAll(uids) | ||
} | ||
|
||
override fun requestAll() { | ||
_list.value = emptyList() | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
package com.android.unio.model.user | ||
|
||
import com.android.unio.model.association.Association | ||
import com.android.unio.model.firestore.FirestoreReferenceList | ||
import com.android.unio.model.firestore.ReferenceList | ||
|
||
data class User( | ||
val uid: String, | ||
val name: String, | ||
val email: String, | ||
val followingAssociations: FirestoreReferenceList<Association> | ||
val followingAssociations: ReferenceList<Association> | ||
) |
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.