constructTutorialModel static method
Future<TutorialModel>
constructTutorialModel(
- MemberModel? member,
- AppModel app,
- String tutorialID,
- String name,
- String title,
- String description,
- String assetRoot,
- List<String?> assetLocations,
- List<String?> codes,
- List<String> descriptions,
)
Implementation
static Future<TutorialModel> constructTutorialModel(
MemberModel? member,
AppModel app,
String tutorialID,
String name,
String title,
String description,
String assetRoot,
List<String?> assetLocations,
List<String?> codes,
List<String> descriptions) async {
assert(assetLocations.length == descriptions.length);
List<TutorialEntryModel> items = [];
for (int i = 0; i < assetLocations.length; i++) {
String assetLocation;
PlatformMediumModel? image;
if (assetLocations[i] != null) {
assetLocation = assetRoot + assetLocations[i]!;
image = await ImageTools.uploadPlatformPhoto(
app,
member!.documentID,
assetLocation,
PrivilegeLevelRequiredSimple.noPrivilegeRequiredSimple);
}
String documentID = i.toString();
items.add(TutorialEntryModel(
documentID: documentID,
description: descriptions[i],
image: image,
code: codes[i]));
}
return TutorialModel(
documentID: tutorialID,
appId: app.documentID,
name: name,
title: title,
description: description,
tutorialEntries: items,
conditions: StorageConditionsModel(
privilegeLevelRequired:
PrivilegeLevelRequiredSimple.noPrivilegeRequiredSimple),
);
}