-
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.
feat: integrate webhooks in the indexer
- Loading branch information
Showing
24 changed files
with
451 additions
and
106 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 |
---|---|---|
@@ -1,16 +1,28 @@ | ||
import { Entity, PrimaryColumn, Column } from "typeorm"; | ||
import { | ||
Entity, | ||
PrimaryColumn, | ||
Column, | ||
Unique, | ||
CreateDateColumn, | ||
Index, | ||
} from "typeorm"; | ||
|
||
@Entity() | ||
@Unique("UK_webhook_request_clientId_filter", ["clientId", "filter"]) | ||
@Index("IX_webhook_request_filter", ["filter"]) | ||
export class WebhookRequest { | ||
@PrimaryColumn() | ||
id: string; | ||
|
||
@Column({ type: "integer" }) | ||
clientId: number; | ||
|
||
@Column() | ||
url: string; | ||
|
||
@Column() | ||
filter: string; | ||
|
||
@Column({ type: "text", nullable: true, default: undefined }) | ||
clientId?: string | undefined; | ||
@CreateDateColumn() | ||
createdAt: Date; | ||
} |
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
21 changes: 21 additions & 0 deletions
21
packages/indexer-database/src/migrations/1732297474910-WebhookClient.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,21 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class WebhookClient1732297474910 implements MigrationInterface { | ||
name = "WebhookClient1732297474910"; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
CREATE TABLE "webhook_client" ( | ||
"id" SERIAL NOT NULL, | ||
"name" character varying NOT NULL, | ||
"apiKey" character varying NOT NULL, | ||
"domains" jsonb NOT NULL, | ||
CONSTRAINT "UK_webhook_client_api_key" UNIQUE ("apiKey"), | ||
CONSTRAINT "PK_f7330fb3bdb2e19534eae691d44" PRIMARY KEY ("id") | ||
)`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP TABLE "webhook_client"`); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/indexer-database/src/migrations/1732297948190-WebhookRequest.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,22 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class WebhookRequest1732297948190 implements MigrationInterface { | ||
name = "WebhookRequest1732297948190"; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
CREATE TABLE "webhook_request" ( | ||
"id" character varying NOT NULL, | ||
"clientId" integer NOT NULL, | ||
"url" character varying NOT NULL, | ||
"filter" character varying NOT NULL, | ||
"createdAt" TIMESTAMP NOT NULL DEFAULT now(), | ||
CONSTRAINT "UK_webhook_request_clientId_filter" UNIQUE ("clientId", "filter"), | ||
CONSTRAINT "PK_67a7784045de2d1b7139b611b93" PRIMARY KEY ("id") | ||
)`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP TABLE "webhook_request"`); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/indexer-database/src/migrations/1732310112989-WebhookRequest.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,15 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class WebhookRequest1732310112989 implements MigrationInterface { | ||
name = "WebhookRequest1732310112989"; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`CREATE INDEX "IX_webhook_request_filter" ON "webhook_request" ("filter") `, | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP INDEX "public"."IX_webhook_request_filter"`); | ||
} | ||
} |
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
Oops, something went wrong.