示例#1
0
 def mutate(cls, _, info, content):
     tweet = Tweet(content=content)
     tweet.addUser(get_jwt_identity())
     tweet.save()
     return TweetAddMutation(
         tweet=TweetField(content=tweet.content,
                          user=UserField(username=get_jwt_identity())),
         ok=True)
示例#2
0
    def resolve_me(self, info: ResolveInfo) -> User:
        """Resolve the User object query that is given by info.

        :param info :type ResolveInfo: desired response data
        :return :type User
        """
        return UserModel.query.filter(
            UserModel.email == get_jwt_identity()).first()
示例#3
0
    def mutate(self):

        # Retrieves User claim(user id) from refresh_token and creates new
        # acces_token
        username = get_jwt_identity()
        acces_token = create_access_token(identity=username)

        return RefreshMutation(acces_token)