reflow-project / weloop

WeLoop is a React/TypeScript client for ZenPub and a key component of ReflowOS
https://weloop.reflowproject.eu
GNU Affero General Public License v3.0
5 stars 5 forks source link

A lot of differences between user entity in ZenPub and Bonfire API #168

Open oksanasalohubova opened 2 years ago

oksanasalohubova commented 2 years ago

In order to create the functionality of the organization in the application, it is necessary for the objects to have the same structure or differ slightly. Now I see a completely different structure about the User entity, of the Me entity and the Person entity

This is the structure of me entity in ZenPub:

query me {
  me{
    isInstanceAdmin
    email
    isConfirmed
    wantsEmailDigest
    wantsNotifications
    user {
      id
      name
      icon {
        id
        url
      }
      image {
        id
        url
      }
      location
      summary
      displayUsername
      website
      extraInfo
      preferredUsername
     .... // may be some other fields but in login function only this
    }
  }
}

This is a structure of me entity in BonFire:

query me {
  me {
    accountId
    flagsForModeration {
      id
      object {
       ...
      }
      objectId
      subject
      subjectId
      verb
    }
    userFeed {
      id
      object
      objectId
      subject
      subjectId
      directReplies
    }
    followed {
      ...
    }
    followers {
      ...
    }
    likeActivities {
      ...
    }
    userNotifications{
      ...
    }
    user {
      id
      character {
        username
      }
      profile {
        summary
        name
      }
      userActivities {
        ....
      }
      boostActivities {

      }
      posts {
        id
        postContent {
          title
          htmlBody
        }
      }
    }
  }
}

These differences prevent existing application code from being adapted to this API in a quick and easy way. There is not enough information both in the user object and in the Me object

It should also be taken into account that the primary file with query object Me calls contains the profile update and session exit functions that have the following form, and each time were imported usMe function it provide logout and updateProfile functions.

mutation meLogout {
  deleteSession
}
 mutation updateProfile(profile:$profile, icon: $icon, image: $image){
    user {
      ...SettingsPageMeUser
    }
  }

I can change mutation updateProfile to updateUser, but the properties is also different