diff --git a/lib/models/oxygenpost.dart b/lib/models/oxygenpostmodel.dart similarity index 100% rename from lib/models/oxygenpost.dart rename to lib/models/oxygenpostmodel.dart diff --git a/lib/services/database.dart b/lib/services/database.dart index bceb548..7a6b3b7 100644 --- a/lib/services/database.dart +++ b/lib/services/database.dart @@ -1,5 +1,6 @@ import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:plaso_connect/models/donormodel.dart'; +import 'package:plaso_connect/models/oxygenpostmodel.dart'; class DatabaseMethod { final FirebaseFirestore db = FirebaseFirestore.instance; @@ -20,4 +21,17 @@ class DatabaseMethod { .where("pin", isEqualTo: pin) .snapshots(); } + + Future uploadOxygen(OxygenPostModel oxygenPostModel) async { + var userMap = oxygenPostModel.toMap(); + try { + await db + .collection("oxygenPosts") + .doc(oxygenPostModel.title) + .set(userMap); + print("Done"); + } catch (e) { + print(e.toString()); + } + } }