createMemberMedium static method
Implementation
static Future<void> createMemberMedium(
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 memberMedium = repository.fromMap(theNewItem);
if (memberMedium != null) {
var memberMediumAccessibleByGroup = toMemberMediumAccessibleByGroup(
memberMedium.accessibleByGroup ??
MemberMediumAccessibleByGroup.me.index);
var helper = MemberMediumHelper(
app, memberId, memberMediumAccessibleByGroup,
accessibleByMembers: memberMedium.accessibleByMembers);
var base = memberMedium.base;
if (base == oldDocumentId) {
base = newDocumentId;
}
await upload(
repository,
helper,
base,
memberMedium.ext,
memberMedium.mediumType ?? 0,
theNewItem,
memberMedium.relatedMediumId);
}
} catch (e) {
print("Error whilst creating public medium $e");
}
}