-
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.
Merge pull request #41 from sotatek-dev/develop
Develop
- Loading branch information
Showing
21 changed files
with
1,178 additions
and
150 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
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
63 changes: 63 additions & 0 deletions
63
src/database/migrations/1725867149224-add-multi-signature-table.ts
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,63 @@ | ||
import { MigrationInterface, QueryRunner, Table } from 'typeorm'; | ||
|
||
import { ENetworkName } from '@constants/blockchain.constant'; | ||
|
||
export class AddMultiSignatureTable1725867149224 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
return queryRunner.createTable( | ||
new Table({ | ||
name: 'multi_signature', | ||
columns: [ | ||
{ | ||
name: 'id', | ||
type: 'int', | ||
isPrimary: true, | ||
isGenerated: true, | ||
}, | ||
{ | ||
name: 'validator', | ||
type: 'varchar', | ||
length: '255', | ||
isNullable: true, | ||
}, | ||
{ | ||
name: 'tx_id', | ||
type: 'bigint', | ||
isNullable: true, | ||
}, | ||
{ | ||
name: 'signature', | ||
type: 'text', | ||
isNullable: true, | ||
}, | ||
{ | ||
name: 'chain', | ||
type: 'varchar', | ||
length: '255', | ||
enum: Object.values(ENetworkName), | ||
isNullable: true, | ||
}, | ||
{ | ||
name: 'created_at', | ||
type: 'timestamp', | ||
default: 'CURRENT_TIMESTAMP', | ||
}, | ||
{ | ||
name: 'updated_at', | ||
type: 'timestamp', | ||
default: 'CURRENT_TIMESTAMP', | ||
}, | ||
{ | ||
name: 'deleted_at', | ||
type: 'timestamp', | ||
isNullable: true, | ||
}, | ||
], | ||
}), | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
return queryRunner.dropTable('multi_signature'); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/database/migrations/1726107274721-add-error-retry-multi-signature-table.ts
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,13 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class AddErrorRetryMultiSignatureTable1726107274721 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE multi_signature ADD COLUMN retry BIGINT NULL`); | ||
await queryRunner.query(`ALTER TABLE multi_signature ADD COLUMN error_code TEXT NULL`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.dropColumn('multi_signature', 'retry'); | ||
await queryRunner.dropColumn('multi_signature', 'error_code'); | ||
} | ||
} |
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,14 @@ | ||
import { EntityRepository } from 'nestjs-typeorm-custom-repository'; | ||
|
||
import { EDirection } from '@constants/api.constant'; | ||
import { EEventStatus, ENetworkName } from '@constants/blockchain.constant'; | ||
import { ETableName } from '@constants/entity.constant'; | ||
|
||
import { BaseRepository } from '@core/base-repository'; | ||
|
||
import { MultiSignature } from '@modules/crawler/entities/multi-signature.entity'; | ||
|
||
@EntityRepository(MultiSignature) | ||
export class MultiSignatureRepository extends BaseRepository<MultiSignature> { | ||
protected alias: ETableName = ETableName.MULTI_SIGNATURE; | ||
} |
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
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,40 @@ | ||
import { Column, Entity, JoinColumn, ManyToOne } from 'typeorm'; | ||
|
||
import { ENetworkName } from '@constants/blockchain.constant'; | ||
import { ETableName } from '@constants/entity.constant'; | ||
|
||
import { BaseEntityIncludeTime } from '@core/base.entity'; | ||
|
||
import { EventLog } from './event-logs.entity'; | ||
|
||
@Entity(ETableName.MULTI_SIGNATURE) | ||
export class MultiSignature extends BaseEntityIncludeTime { | ||
@Column({ name: 'validator', type: 'varchar', nullable: true }) | ||
validator: string; | ||
|
||
@Column({ name: 'tx_id', type: 'bigint', nullable: true }) | ||
txId: number; | ||
|
||
@Column({ name: 'retry', type: 'bigint', nullable: true }) | ||
retry: number; | ||
|
||
@Column({ name: 'signature', type: 'text', nullable: true }) | ||
signature: string; | ||
|
||
@Column({ name: 'error_code', type: 'text', nullable: true }) | ||
errorCode: string | unknown; | ||
|
||
@Column({ name: 'chain', type: 'varchar', enum: ENetworkName, nullable: true }) | ||
chain: ENetworkName; | ||
|
||
@ManyToOne<EventLog>(() => EventLog, eventLog => eventLog.validator, { | ||
onDelete: 'CASCADE', | ||
}) | ||
@JoinColumn({ name: 'tx_id' }) | ||
transaction: EventLog; | ||
|
||
constructor(value: Partial<MultiSignature>) { | ||
super(); | ||
Object.assign(this, value); | ||
} | ||
} |
Oops, something went wrong.