def get_all_posts_query(self): allPostsDict = CommonUsed.dfToArrayOfJsonWithoutIdx(self.posts_df) Posts = [] for post in allPostsDict: Posts.append( Post(postDict['id'], postDict['userId'], postDict['title'], postDict['body'])) return Posts # returns array of entities
def get_single_post_query(self, _id): signle_post = self.posts_df.loc[self.posts_df['id'] == _id] postDict = CommonUsed.rowToJson(signle_post) postEntity = Post(postDict['id'], postDict['userId'], postDict['title'], postDict['body']) return postEntity # returns entity