🚧 refactor mongoDB

This commit is contained in:
Ben Hesseldieck 2021-01-14 17:27:17 +01:00
parent 3419d4b69f
commit 8d4feda7dd
5 changed files with 17 additions and 6 deletions

View file

@ -11,6 +11,8 @@ import {
} from '../../Interfaces'; } from '../../Interfaces';
@Entity() @Entity()
@Index(["webhookPath", "method"], { unique: true })
@Index(["webhookId", "method"], { unique: true })
export class WebhookEntity implements IWebhookDb { export class WebhookEntity implements IWebhookDb {
@ObjectIdColumn() @ObjectIdColumn()
@ -27,4 +29,7 @@ export class WebhookEntity implements IWebhookDb {
@Column() @Column()
node: string; node: string;
@Column()
webhookId: string;
} }

View file

@ -5,7 +5,7 @@ import {
import * as config from '../../../../config'; import * as config from '../../../../config';
export class CreateIndexStoppedAt1594910478695 implements MigrationInterface { export default class CreateIndexStoppedAt1594910478695 implements MigrationInterface {
name = 'CreateIndexStoppedAt1594910478695'; name = 'CreateIndexStoppedAt1594910478695';
async up(queryRunner: MongoQueryRunner): Promise<void> { async up(queryRunner: MongoQueryRunner): Promise<void> {

View file

@ -1,6 +1,6 @@
import { MigrationInterface, QueryRunner } from 'typeorm'; import { MigrationInterface, QueryRunner } from 'typeorm';
export class InitialMigration1587563438936 implements MigrationInterface { export default class InitialMigration1587563438936 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> { async up(queryRunner: QueryRunner): Promise<void> {
} }

View file

@ -8,7 +8,7 @@ import {
MongoQueryRunner, MongoQueryRunner,
} from 'typeorm/driver/mongodb/MongoQueryRunner'; } from 'typeorm/driver/mongodb/MongoQueryRunner';
export class WebhookModel1592679094242 implements MigrationInterface { export default class WebhookModel1592679094242 implements MigrationInterface {
name = 'WebhookModel1592679094242'; name = 'WebhookModel1592679094242';
async up(queryRunner: MongoQueryRunner): Promise<void> { async up(queryRunner: MongoQueryRunner): Promise<void> {

View file

@ -1,3 +1,9 @@
export * from './1587563438936-InitialMigration'; import InitialMigration1587563438936 from './1587563438936-InitialMigration';
export * from './1592679094242-WebhookModel'; import WebhookModel1592679094242 from './1592679094242-WebhookModel';
export * from './151594910478695-CreateIndexStoppedAt'; import CreateIndexStoppedAt1594910478695 from './151594910478695-CreateIndexStoppedAt';
export default [
InitialMigration1587563438936,
WebhookModel1592679094242,
CreateIndexStoppedAt1594910478695,
]