addUserToParticipants method

Future<void> addUserToParticipants(
  1. String activityID,
  2. String userId,
  3. ParticipantType type
)

Adds a user to the participants of an activity.

Implementation

Future<void> addUserToParticipants(
  String activityID,
  String userId,
  ParticipantType type,
) async {
  final value = switch (type) {
    ParticipantType.going => "gaat",
    ParticipantType.maybe => "misschien",
    ParticipantType.notGoing => "gaat niet",
    ParticipantType.undefined => null,
  };
  instance.collection('participants').doc(activityID).set(
    {userId: value},
    SetOptions(merge: true),
  );
}