exampleMemberProfileModel method

Future<MemberProfileModel> exampleMemberProfileModel(
  1. MemberModel member,
  2. String feedId
)

Implementation

Future<MemberProfileModel> exampleMemberProfileModel(
    MemberModel member, String feedId) async {
  var memberPublicInfo =
      await memberPublicInfoRepository()!.get(member.documentID);
  if (memberPublicInfo == null) {
    throw Exception("ERROR: can't retrieve member data");
  }
  var profilePhoto = await ImageTools.createMemberMediumModelPhoto(
      MinkeyApp.app,
      member.documentID,
      'packages/eliud_pkg_apps/assets/minkey_app/profile/exampleprofile.png');
  var profileBackground = await ImageTools.createMemberMediumModelPhoto(
      MinkeyApp.app,
      member.documentID,
      'packages/eliud_pkg_apps/assets/minkey_app/profile/pexels-pixabay-258109.jpg');
  var value = MemberProfileModel(
    documentID: "${memberPublicInfo.documentID}-$feedId",
    appId: MinkeyApp.app.documentID,
    authorId: member.documentID,
    feedId: feedId,
    profileBackground: profileBackground,
    profileOverride: profilePhoto.url,
    accessibleByGroup: accessibleByGroup,
    profile: kHtml,
    readAccess: [
      member.documentID
    ], // default readAccess to the owner. The function will expand this based on accessibleByGroup/Members
  );

  await pr
      .memberProfileRepository(appId: MinkeyApp.app.documentID)!
      .add(value);
  return value;
}