-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add delete token traits resolver and increase traits job delay (#…
…1313) * fix: add delete token traits resolver and increasse job delay * fix
- Loading branch information
Showing
4 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* eslint-disable max-classes-per-file */ | ||
import { Query, Resolver, Arg } from 'type-graphql' | ||
import 'reflect-metadata' | ||
import { EntityManager } from 'typeorm' | ||
|
||
@Resolver() | ||
export class DeleteTokenTraitsResolver { | ||
constructor(private tx: () => Promise<EntityManager>) {} | ||
|
||
@Query(() => Boolean) | ||
async deleteTokenTraits( | ||
@Arg('tokenId', { | ||
description: 'token id e.g. 2100-17', | ||
}) | ||
tokenId: string | ||
): Promise<boolean> { | ||
const manager = await this.tx() | ||
|
||
await manager.query( | ||
` | ||
DELETE FROM trait_token WHERE token_id = $1 | ||
`, | ||
[tokenId] | ||
) | ||
|
||
await manager.query( | ||
` | ||
DELETE FROM token_rarity WHERE token_id = $1 | ||
`, | ||
[tokenId] | ||
) | ||
|
||
return true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters