Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #64 from preschian/add-collection-name-in-last-event
Browse files Browse the repository at this point in the history
add collection in lastEvent
  • Loading branch information
vikiival committed Sep 20, 2022
2 parents bc8bbb8 + 0a70334 commit 94d1ad5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/server-extension/model/event.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ export class LastEventEntity {
@Field(() => String, { nullable: true })
image!: string;

@Field(() => String, {nullable: true, name: 'animationUrl'})
animation_url!: string | undefined | null
@Field(() => String, { nullable: true, name: 'animationUrl' })
animation_url!: string | undefined | null;

@Field(() => String, { nullable: false, name: 'collectionId' })
collection_id!: string;

@Field(() => String, { nullable: false, name: 'collectionName' })
collection_name!: string;

constructor(props: Partial<LastEventEntity>) {
Object.assign(this, props);
Expand Down
9 changes: 6 additions & 3 deletions src/server-extension/query/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ export const lastEventQuery = `SELECT
me.image as image,
me.animation_url,
MAX(e.timestamp) as timestamp,
MAX(e.meta) as value
MAX(e.meta) as value,
ne.collection_id as collection_id,
ce.name as collection_name
FROM event e
JOIN nft_entity ne on e.nft_id = ne.id
LEFT join metadata_entity me on me.id = ne.metadata
LEFT JOIN collection_entity ce on ne.collection_id = ce.id
WHERE
e.interaction = $1
AND ne.burned = false
GROUP BY ne.id, me.id, e.current_owner, me.image
GROUP BY ne.id, me.id, e.current_owner, me.image, ce.name
ORDER BY MAX(e.timestamp) DESC
LIMIT $2 OFFSET $3`
LIMIT $2 OFFSET $3`;

0 comments on commit 94d1ad5

Please sign in to comment.