-
Notifications
You must be signed in to change notification settings - Fork 0
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 #170 from PDG-NUTRI/162-add-client-to-dietitian
162 add client to dietitian
- Loading branch information
Showing
9 changed files
with
62 additions
and
6 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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'dart:developer'; | ||
|
||
import 'package:cloud_firestore/cloud_firestore.dart'; | ||
import 'package:firebase_core/firebase_core.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:pdg_app/api/firebase_user.dart'; | ||
import 'package:pdg_app/api/iuser.dart'; | ||
import 'package:pdg_app/firebase_options.dart'; | ||
|
||
void main() async { | ||
WidgetsFlutterBinding.ensureInitialized(); | ||
|
||
await Firebase.initializeApp( | ||
options: DefaultFirebaseOptions.currentPlatform, | ||
); | ||
runApp(const MaterialApp()); | ||
|
||
IUser userApi = FirebaseUser(FirebaseFirestore.instance); | ||
|
||
await userApi.addClient("coco", "PSCOEhz98TORfOb9BizGfjUA8hc2"); | ||
final coco = await userApi.readUser("PSCOEhz98TORfOb9BizGfjUA8hc2"); | ||
log(coco.clientList.toString()); | ||
log("programme terminé"); | ||
} |
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 |
---|---|---|
|
@@ -38,7 +38,7 @@ User d1 = User( | |
lastName: 'Emery', | ||
birthDate: DateTime.now(), | ||
avs: '', | ||
clientList: [c2.uid, c3.uid, c4.uid], | ||
clientList: [c2.uid, c3.uid], | ||
phoneNumber: '', | ||
email: '[email protected]'); | ||
User d2 = User( | ||
|
@@ -125,7 +125,7 @@ void main() { | |
}); | ||
|
||
test("getDietitianClients", () async { | ||
List<User> coco = [c2, c3, c4]; | ||
List<User> coco = [c2, c3]; | ||
final clients = await userApi.getDietitianClient(d1.uid); | ||
expect(clients.elementAt(0).toString(), coco.elementAt(0).toString()); | ||
}); | ||
|
@@ -134,4 +134,10 @@ void main() { | |
final User? dietCopy = await userApi.readDietitianOfClient(c3.uid); | ||
expect(d1.toString(), dietCopy.toString()); | ||
}); | ||
|
||
test("Add Client to dietitian", () async { | ||
await userApi.addClient("banane", d1.uid); | ||
final User diet = await userApi.readUser(d1.uid); | ||
expect(diet.clientList, [c2.uid, c3.uid, "banane"]); | ||
}); | ||
} |