diff --git "a/src/api/routes/applications/\043id/index.ts" "b/src/api/routes/applications/\043id/index.ts" index 11cd5a5..6ed602f 100644 --- "a/src/api/routes/applications/\043id/index.ts" +++ "b/src/api/routes/applications/\043id/index.ts" @@ -71,8 +71,6 @@ ) throw new HTTPError(req.t("auth:login.INVALID_TOTP_CODE"), 60008); - if (app.bot) await User.delete({ id: app.bot.id }); - await Application.delete({ id: app.id }); res.send().status(200); diff --git a/src/util/entities/Application.ts b/src/util/entities/Application.ts index e37f5ee..081b5cf 100644 --- a/src/util/entities/Application.ts +++ b/src/util/entities/Application.ts @@ -41,7 +41,7 @@ verify_key: string; @JoinColumn({ name: "owner_id" }) - @ManyToOne(() => User) + @ManyToOne(() => User, { onDelete: "CASCADE" }) owner: User; // TODO: enum this? https://discord.com/developers/docs/resources/application#application-object-application-flags @@ -76,7 +76,7 @@ discovery_eligibility_flags: number = 2240; @JoinColumn({ name: "bot_user_id" }) - @OneToOne(() => User) + @OneToOne(() => User, { onDelete: "CASCADE" }) bot?: User; @Column({ type: "simple-array", nullable: true })