Skip to content

Commit ecb9548

Browse files
authored
Merge pull request #309 from kodadot/main
🔖 Speck v14
2 parents a14903c + 5c7c313 commit ecb9548

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/server-extension/model/tokenEntity.model.ts

+7
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ class Collection {
4141

4242
@Field(() => String, { nullable: true })
4343
name!: string;
44+
45+
@Field(() => String, { nullable: true })
46+
kind?: string;
4447
}
4548

4649

@@ -100,6 +103,8 @@ export class TokenEntityModel {
100103
@Field(() => Collection)
101104
collection!: Collection;
102105

106+
@Field(() => String, { nullable: true })
107+
kind?: string;
103108

104109
constructor(props: Partial<TokenEntityModel>) {
105110
Object.assign(this, props);
@@ -150,6 +155,8 @@ export class TokenEntityQueryResult {
150155
@Field(() => String, { nullable: false })
151156
collection_name!: string;
152157

158+
@Field(() => String, { nullable: true })
159+
kind?: string;
153160

154161
@Field(() => String, { nullable: false })
155162
meta_id!: string;

src/server-extension/query/tokenEntities.ts

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ SELECT
5454
nc.supply as supply,
5555
col.id AS collection_id,
5656
col.name AS collection_name
57+
col.kind AS kind
5758
FROM
5859
token_entity as t
5960
JOIN collection_entity as col ON t.collection_id = col.id
@@ -64,4 +65,5 @@ WHERE
6465
nc.supply > 0 AND
6566
t.deleted = false AND
6667
($10::text IS NULL OR LOWER(t.name) LIKE LOWER('%' || $10 || '%'))
68+
AND ($11::text IS NULL OR col.kind = $11)
6769
`

src/server-extension/resolvers/tokenEntities.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ export class TokenResolver {
2222
@Arg('price_lte', { nullable: true }) price_lte?: number,
2323
@Arg('denyList', () => [String], { nullable: true }) denyList?: string[],
2424
@Arg('collections', () => [String], { nullable: true }) collections?: string[],
25-
@Arg('name', { nullable: true }) name?: string
25+
@Arg('name', { nullable: true }) name?: string,
26+
@Arg('kind', { nullable: true }) kind?: string
2627
): Promise<TokenEntityModel[]> {
2728
const orderQuery = this.getOrderByQuery(orderBy)
2829

@@ -40,7 +41,8 @@ ORDER BY ${orderQuery} LIMIT $2 OFFSET $3;
4041
denyList,
4142
issuer,
4243
collections,
43-
name
44+
name,
45+
kind
4446
])
4547
return result.map(this.mapRowToTokenEntityByOwner)
4648
}
@@ -51,6 +53,7 @@ ORDER BY ${orderQuery} LIMIT $2 OFFSET $3;
5153
blockNumber: row.block_number,
5254
createdAt: row.created_at,
5355
updatedAt: row.updated_at,
56+
kind: row.kind,
5457
cheapest: {
5558
id: row.cheapest_id,
5659
price: row.cheapest_price,
@@ -59,6 +62,7 @@ ORDER BY ${orderQuery} LIMIT $2 OFFSET $3;
5962
collection: {
6063
id: row.collection_id,
6164
name: row.collection_name,
65+
kind: row.kind,
6266
},
6367
meta: {
6468
id: row.meta_id,

0 commit comments

Comments
 (0)