@ -141,6 +141,7 @@ class DataStore: ObservableObject {
for club in clubsCollection {
if let userId = Store.main.userId, club.creator == nil {
club.creator = userId
self.userStorage.item()?.addClub(club)
clubsCollection.writeChangeAndInsertOnServer(instance: club)
}
@ -102,6 +102,12 @@ class User: ModelObject, UserBase, Storable {
func addClub(_ club: Club) {
if !self.clubs.contains(where: { $0.id == club.id }) {
self.clubs.append(club.id)
enum CodingKeys: String, CodingKey {
case _id = "id"
case _username = "username"