Skip to content

Commit

Permalink
Merge pull request #92 from KngZhi/issue-2223-1
Browse files Browse the repository at this point in the history
feat: support passion list filter on series
  • Loading branch information
vikiival committed Jun 3, 2022
2 parents bbfb66a + 1126ad7 commit 68f8d6e
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
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

0 comments on commit 68f8d6e

Please sign in to comment.