Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BonFire does not contain User #135

Open
oksanasalohubova opened this issue Oct 12, 2021 · 3 comments
Open

BonFire does not contain User #135

oksanasalohubova opened this issue Oct 12, 2021 · 3 comments
Labels
bonfire-migration Issues linked to ZenPub to Bonfire migration

Comments

@oksanasalohubova
Copy link
Collaborator

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
Copy link
Collaborator

user, me, like, Activity, Collection, Community

@pral2a
Copy link

pral2a commented Oct 15, 2021

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

@VolodymyrPavlichenko
Copy link
Collaborator

Screenshot 2021-10-18 at 19 35 12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bonfire-migration Issues linked to ZenPub to Bonfire migration
Projects
None yet
Development

No branches or pull requests

3 participants