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

feat: support passion list filter on series #92

Merged
merged 1 commit into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions db/migrations/1654263619001-Data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = class Data1654263619001 {
name = 'Data1654263619001'

async up(db) {
await db.query(`ALTER TABLE "series" ADD "issuer" text`)
}

async down(db) {
await db.query(`ALTER TABLE "series" DROP COLUMN "issuer"`)
}
}
11 changes: 11 additions & 0 deletions db/migrations/1654265159164-Data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = class Data1654265159164 {
name = 'Data1654265159164'

async up(db) {
await db.query(`ALTER TABLE "series" ADD "issuer" text`)
}

async down(db) {
await db.query(`ALTER TABLE "series" DROP COLUMN "issuer"`)
}
}
1 change: 1 addition & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ enum Interaction {

type Series @entity {
id: ID!
issuer: String,
unique: Int!
uniqueCollectors: Int!
sold: Int! @index
Expand Down
2 changes: 1 addition & 1 deletion src/mappings/utils/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const STATUS_ID: string = "0"
enum Query {

series = `SELECT
ce.id, ce.name, ce.meta_id as metadata, me.image,
ce.id, ce.name, ce.meta_id as metadata, me.image, ce.issuer,
COUNT(distinct ne.meta_id) as unique,
COUNT(distinct ne.current_owner) as unique_collectors,
COUNT(distinct ne.current_owner) as sold,
Expand Down
3 changes: 3 additions & 0 deletions src/server-extension/model/series.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ export class SeriesEntity {
@Field(() => String, { nullable: false })
id!: string

@Field(() => String, { nullable: false })
issuer!: string

@Field(() => Number, { nullable: false })
unique!: number

Expand Down
2 changes: 1 addition & 1 deletion src/server-extension/resolvers/series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class SeriesResolver {
? ''
: `AND e.timestamp >= NOW() - INTERVAL '${dateRange}'`
const query = `SELECT
ce.id, ce.name, ce.meta_id as metadata, me.image,
ce.id, ce.name, ce.meta_id as metadata, me.image, ce.issuer,
COUNT(distinct ne.meta_id) as unique,
COUNT(distinct ne.current_owner) as unique_collectors,
COUNT(distinct ne.current_owner) as sold,
Expand Down