Skip to content

Commit

Permalink
fix list story by id and by user (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joao Pedro da Silva authored Apr 17, 2023
1 parent e0968c4 commit 82a3654
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions packages/core/src/services/story/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ export default class StoryServiceV2 {
attributes: [
'id',
'message',
'storyMediaPath',
'storyMedia',
'byAddress',
'postedAt',
[
fn('count', fn('distinct', col('storyComment.id'))),
Expand Down Expand Up @@ -238,7 +239,6 @@ export default class StoryServiceV2 {
return {
// we can use ! because it's included on the query
id: content.id,
storyMediaPath: content.storyMediaPath,
message: content.message,
isDeletable: userAddress
? content.byAddress.toLowerCase() === userAddress.toLowerCase()
Expand All @@ -253,6 +253,7 @@ export default class StoryServiceV2 {
: false,
comments: content.totalComments,
},
storyMedia: content.storyMedia,
};
}

Expand All @@ -265,7 +266,8 @@ export default class StoryServiceV2 {
attributes: [
'id',
'message',
'storyMediaPath',
'storyMedia',
'byAddress',
'postedAt',
[
fn('count', fn('distinct', col('storyComment.id'))),
Expand Down Expand Up @@ -344,7 +346,6 @@ export default class StoryServiceV2 {
};
return {
id: content.id,
storyMediaPath: content.storyMediaPath,
message: content.message,
isDeletable:
content.byAddress.toLowerCase() ===
Expand All @@ -357,6 +358,7 @@ export default class StoryServiceV2 {
userLoved: !!content.storyUserEngagement?.length,
comments: content.totalComments,
},
storyMedia: content.storyMedia,
};
});
return {
Expand Down Expand Up @@ -554,7 +556,6 @@ export default class StoryServiceV2 {
return {
// we can use ! because it's included on the query
id: content.id,
storyMediaPath: content.storyMediaPath,
message: content.message,
isDeletable: userAddress
? content.byAddress.toLowerCase() ===
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/services/story/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ export interface ICommunityStory {
id: number;
message: string | null;
byAddress: string;
storyMediaPath: string | null;
loves: number;
userLoved: boolean;
userReported: boolean;
storyMedia?: string[];
}
export interface ICommunityStoryGet {
id: number;
message: string | null;
storyMediaPath: string | null;
storyMedia?: string[];
isDeletable: boolean;
createdAt: Date;
community?: any;
Expand Down

0 comments on commit 82a3654

Please sign in to comment.