Perhaps, dont IP ban moderators

This commit is contained in:
Rory&
2025-12-07 22:32:37 +01:00
parent 710b9280de
commit de1ebc99a7
5 changed files with 18 additions and 3 deletions
Binary file not shown.
Binary file not shown.
-1
View File
@@ -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
});
+2 -2
View File
@@ -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;
@@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class DontIpBanBanner1765143034407 implements MigrationInterface {
name = 'DontIpBanBanner1765143034407'
public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
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`);
}
}