changeFullName static method

Future<UserProfileModel> changeFullName(
  1. Session session,
  2. UuidValue authUserId,
  3. String? newFullName, {
  4. Transaction? transaction,
})

Updates a profile's full name.

Implementation

static Future<UserProfileModel> changeFullName(
  final Session session,
  final UuidValue authUserId,
  final String? newFullName, {
  final Transaction? transaction,
}) async {
  return DatabaseUtil.runInTransactionOrSavepoint(
    session.db,
    transaction,
    (final transaction) async {
      final userProfile = await _findUserProfile(
        session,
        authUserId,
        transaction: transaction,
      );

      userProfile.fullName = newFullName;

      final updatedProfile = await _updateProfile(
        session,
        userProfile,
        transaction: transaction,
      );

      return updatedProfile.toModel();
    },
  );
}