createPublicMedium static method
Implementation
static Future<void> createPublicMedium(
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 publicMedium = repository.fromMap(theNewItem);
if (publicMedium != null) {
var helper = PublicMediumHelper(
app,
memberId,
);
var base = publicMedium.base;
if (base == oldDocumentId) {
base = newDocumentId;
}
await upload(
repository,
helper,
base,
publicMedium.ext,
publicMedium.mediumType ?? 0,
theNewItem,
publicMedium.relatedMediumId);
}
} catch (e) {
print("Error whilst creating public medium $e");
}
}