createPlatformMedium static method
Future<void>
createPlatformMedium(
- Map theNewItem,
- AppModel app,
- String memberId,
- RepositoryBase repository, {
- Map<String, String>? newDocumentIds,
})
Implementation
static Future<void> createPlatformMedium(
Map theNewItem, AppModel app, String memberId, RepositoryBase repository,
{Map<String, String>? newDocumentIds}) async {
var oldDocumentId = theNewItem["documentID"];
renameDoc(theNewItem, newDocumentIds);
var newDocumentId = theNewItem["documentID"];
try {
var platformMedium = repository.fromMap(theNewItem);
if (platformMedium != null) {
var helper = PlatformMediumHelper(
app,
memberId,
platformMedium.conditions == null
? PrivilegeLevelRequiredSimple.noPrivilegeRequiredSimple
: toPrivilegeLevelRequiredSimple(
platformMedium.conditions!.privilegeLevelRequired!));
var base = platformMedium.base;
if (base == oldDocumentId) {
base = newDocumentId;
}
await upload(
repository,
helper,
base,
platformMedium.ext,
platformMedium.mediumType ?? 0,
theNewItem,
platformMedium.relatedMediumId,
newDocumentIds: newDocumentIds);
}
} catch (e) {
print("Error whilst creating public medium $e");
}
}