diff --git a/assets/openapi.json b/assets/openapi.json index ee7a4e8a5..e502af61c 100644 Binary files a/assets/openapi.json and b/assets/openapi.json differ diff --git a/assets/schemas.json b/assets/schemas.json index 576a9c608..d5b4835ef 100644 Binary files a/assets/schemas.json and b/assets/schemas.json differ diff --git a/src/api/routes/guilds/#guild_id/bans.ts b/src/api/routes/guilds/#guild_id/bans.ts index e253bef9f..1274c195d 100644 --- a/src/api/routes/guilds/#guild_id/bans.ts +++ b/src/api/routes/guilds/#guild_id/bans.ts @@ -215,7 +215,6 @@ router.put( const ban = Ban.create({ user_id: banned_user_id, guild_id: guild_id, - ip: getIpAdress(req), executor_id: req.user_id, reason: req.body.reason, // || otherwise empty }); diff --git a/src/util/entities/Ban.ts b/src/util/entities/Ban.ts index d4a7bc1c3..c3c473f47 100644 --- a/src/util/entities/Ban.ts +++ b/src/util/entities/Ban.ts @@ -53,8 +53,8 @@ export class Ban extends BaseClass { @ManyToOne(() => User) executor: User; - @Column() - ip: string; + @Column({ nullable: true }) + ip?: string; @Column({ nullable: true }) reason?: string; diff --git a/src/util/migration/postgres/1765143034407-DontIpBanBanner.ts b/src/util/migration/postgres/1765143034407-DontIpBanBanner.ts new file mode 100644 index 000000000..6e8089efe --- /dev/null +++ b/src/util/migration/postgres/1765143034407-DontIpBanBanner.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class DontIpBanBanner1765143034407 implements MigrationInterface { + name = 'DontIpBanBanner1765143034407' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "bans" ALTER COLUMN "ip" DROP NOT NULL`); + await queryRunner.query(`UPDATE "bans" SET "ip" = NULL`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`UPDATE "bans" SET "ip" = '0.0.0.0' WHERE "ip" IS NULL`); + await queryRunner.query(`ALTER TABLE "bans" ALTER COLUMN "ip" SET NOT NULL`); + } + +}