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

BonFire does not contain User #135

Open oksanasalohubova opened 2 years ago

oksanasalohubova commented 2 years ago

Linked with Asses ZenPub replacement with BonFire #121

User

We have no way to get User in these requests and mutations

fragment HeroUserUserData on User {
  id
  image{ id, url }
  icon{ id, url }
  displayUsername
  location
  summary
  name
  myFollow{ id }
  myFlag { id }
  followerCount
}
fragment SettingsPageMeUser on User{
  id
  name
  icon{ id, url },
  image{ id, url },
  location,
  summary,
  displayUsername,
  website,
  extraInfo
}
fragment UserPreview on User {
  icon{ id, url }
  image{ id, url }
  userId: id 
  userName: name
  displayUsername
  summary
  canonicalUrl
  # isLocal
  myFollow { id }
  # likerCount
  # myLike { id }
  myFlag { id }
}
fragment UserPageUserData on User {
  id
  userId:id
  collectionFollows{
    totalCount
  }
  communityFollows{
    totalCount
  }
  userFollows{
    totalCount
  }
  outbox{
    totalCount
  }
  website
  userName:name

  ...HeroUserUserData
}
fragment UserFollowedUser on User {
  ...UserPreview
}
fragment CollectionFollower on User {
  ...UserPreview
}
fragment CommunityFollower on User {
  ...UserPreview
}
mutation follow($contextId: String!) {
    createFollow(contextId: $contextId){
      context{
        ...on Collection{
          id
          myFollow{ id }
          followerCount
        }
        ...on Community{
          id
          myFollow{ id }
          followerCount
        }
        ...on User{
          userId: id
          myFollow{ id }
          followerCount
        }
      }
    }
}
mutation unfollow($contextId: String!) {
  delete(contextId: $contextId){
    ... on Follow {
      context{
        ...on Collection{
          id
          myFollow{ id }
          followerCount
        }
        ...on Community{
          id
          myFollow{ id }
          followerCount
        }
        ...on User{
          userId: id
          myFollow{ id }
          followerCount
        }
      }
    }
  }
}
fragment SidebarMeUser on User {
  id
  name
  icon {
    id
    url
  }
  image {
    id
    url
  }
  preferredUsername
  displayUsername
}
fragment ActivityPreview on Activity {
  id
  verb
  createdAt
  user {
    icon {
      id
      url
    }
    image {
      id
      url
    }
    userId: id
    userName: name
    canonicalUrl
  }
  context {
    ... on Community {
      ...CommunityPreview
    }
    ... on Collection {
      ...CollectionPreview
    }
    ... on Resource {
      ...ResourcePreview
    }
    ... on User {
      ...UserPreview
    }
    ... on Comment {
      ...CommentPreview
    }
    ... on Flag {
      ...FlagPreview
    }
    ... on Like {
      ...LikePreview
    }
    ... on Follow {
      ...FollowPreview
    }
  }
}
fragment FlagPreview on Flag{
  id
  message
  isResolved
  creator{
    ...UserPreview
  }
  createdAt
  context{
    ...on Community {
      ...CommunityPreview
    }
    ...on Collection {
      ...CollectionPreview
    }
    ...on Resource {
      ...ResourcePreview
    }
    ...on User {
      ...UserPreview
    }
    ...on Comment {
      ...CommentPreview
    }
  }
}
fragment FollowPreview on Follow{
  id
  context{
    ...on Community {
      ...CommunityPreview
    }
    ...on Collection {
      ...CollectionPreview
    }
    ...on User {
      ...UserPreview
    }
  }
}
fragment LikePreview on Like{
  id
  createdAt

  context{
    ...on Community {
      ...CommunityPreview
    }
    ...on Collection {
      ...CollectionPreview
    }
    ...on Resource {
      ...ResourcePreview
    }
    ...on User {
      ...UserPreview
    }
    ...on Comment {
      ...CommentPreview
    }
  }
}
query user($userId: String!) {
    user(userId: $userId) {
        outbox(limit:15) {
            edges {
                user {
                    icon {
                        id
                    }
                    name
                    image {
                        id
                    }
                }
                verb
                context  {
                    ... on Community {
                        ...CommunityPreview
                    }
                    ... on Collection {
                        ...CollectionPreview
                    }
                    ... on Resource {
                        ...ResourcePreview
                    }
                    ... on User {
                        ...UserPreview
                    }
                    ... on Comment {
                        ...CommentPreview
                    }
                    ... on Flag {
                        ...FlagPreview
                    }
                    ... on Like {
                        ...LikePreview
                    }
                    ... on Follow {
                        ...FollowPreview
                    }
                }

            }
            totalCount
            pageInfo {
                hasNextPage
                hasPreviousPage
            }
        }
    }
}
mutation deactivateFlaggedUser($userId:String!){
  delete(contextId:$userId){
    ...on User { id }
  }
}
mutation flag($contextId: String!,$message: String!) {
    createFlag(contextId: $contextId, message: $message){
      context{
        ...on Collection{
          id
          myFlag{ id }
        }
        ...on Comment{
          id
          myFlag{ id }
        }
        ...on Community{
          id
          myFlag{ id }
        }
        ...on Resource{
          id
          myFlag{ id }
        }
        ...on User{
          userId: id
          myFlag{ id }
        }
      }
    }
}
mutation unflag($contextId: String!) {
  delete(contextId: $contextId){
    ... on Flag {
      context{
        ...on Collection{
          id
          myFlag{ id }
        }
        ...on Comment{
          id
          myFlag{ id }
        }
        ...on Community{
          id
          myFlag{ id }
        }
        ...on Resource{
          id
          myFlag{ id }
        }
        ...on User{
          userId: id
          myFlag{ id }
        }
      }
    }
  }
}
mutation like($contextId: String!) {
    createLike(contextId: $contextId){
      context{
        ...on Collection{
          id
          myLike{ id }
          likerCount
        }
        ...on Comment{
          id
          myLike{ id }
          likerCount
        }
        ...on Community{
          id
          myLike{ id }
          likerCount
        }
        ...on Resource{
          id
          myLike{ id }
          likers{ totalCount }
        }
        ...on User{
          userId: id
          myLike{ id }
          likerCount
        }
      }
    }
}
mutation unlike($contextId: String!) {
  delete(contextId: $contextId){
    ... on Like {
      context{
        ...on Collection{
          id
          myLike{ id }
          likerCount
        }
        ...on Comment{
          id
          myLike{ id }
          likerCount
        }
        ...on Community{
          id
          myLike{ id }
          likerCount
        }
        ...on Resource{
          id
          myLike{ id }
          likers{ totalCount }
        }
        ...on User{
          userId: id
          myLike{ id }
          likerCount
        }
      }
    }
  }
}
query userFollowedUsers($userId: String!, $limit:Int, $before:[Cursor!], $after:[Cursor!]) {
  user(userId:$userId) @connection(key: "userFollowedUsers", filter: ["userId"]){
    id
    userFollows(limit:$limit, before:$before, after:$after){
      totalCount,
      pageInfo{ ...FullPageInfo }
      edges{
        id 
        context{
          ... on User{
            ...UserFollowedUser
          }
        }        
      }
    }
  }
}
VolodymyrPavlichenko commented 2 years ago
user, me, like, Activity, Collection, Community
pral2a commented 2 years ago

Migrate all the queries and mutations using Users to the newer Agent model

VolodymyrPavlichenko commented 2 years ago
Screenshot 2021-10-18 at 19 35 12