diff --git a/assets/components/Sider.tsx b/assets/components/Sider.tsx index e5a2dbd..235716d 100644 --- a/assets/components/Sider.tsx +++ b/assets/components/Sider.tsx @@ -13,7 +13,8 @@ import { LogoutOutlined, SearchOutlined, TeamOutlined, - UserOutlined + UserOutlined, + FieldBinaryOutlined } from "@ant-design/icons"; import {Badge, Menu} from "antd"; import React from "react"; @@ -52,19 +53,11 @@ export function Sider({isAuthenticated}: { isAuthenticated: boolean }) { onClick: () => navigate('/info/tld') }, { - key: 'entity-finder', - icon: , - label: t`Entity`, - title: t`Entity Finder`, - disabled: true, - onClick: () => navigate('/search/entity') - }, - { - key: 'ns-finder', - icon: , - label: t`Nameserver`, - title: t`Nameserver Finder`, - disabled: true, + key: 'ip-finder', + icon: , + label: t`LIPI IP Finder`, + title: t`IP Finder`, + disabled: false, onClick: () => navigate('/search/nameserver') } ] diff --git a/migrations/Version20240806222018.php b/migrations/Version20240806222018.php new file mode 100644 index 0000000..8eaf027 --- /dev/null +++ b/migrations/Version20240806222018.php @@ -0,0 +1,50 @@ +addSql('ALTER TABLE connector DROP CONSTRAINT FK_148C456EA76ED395'); + $this->addSql('ALTER TABLE connector ADD CONSTRAINT FK_148C456EA76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE watch_list DROP CONSTRAINT FK_152B584BA76ED395'); + $this->addSql('ALTER TABLE watch_list ADD CONSTRAINT FK_152B584BA76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE watch_lists_domains DROP CONSTRAINT FK_F693E1D0D52D7AA6'); + $this->addSql('ALTER TABLE watch_lists_domains DROP CONSTRAINT FK_F693E1D0AF923913'); + $this->addSql('ALTER TABLE watch_lists_domains ADD CONSTRAINT FK_F693E1D0D52D7AA6 FOREIGN KEY (watch_list_token) REFERENCES watch_list (token) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE watch_lists_domains ADD CONSTRAINT FK_F693E1D0AF923913 FOREIGN KEY (domain_ldh_name) REFERENCES domain (ldh_name) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE watch_list_trigger DROP CONSTRAINT FK_CF857A4CC4508918'); + $this->addSql('ALTER TABLE watch_list_trigger ADD CONSTRAINT FK_CF857A4CC4508918 FOREIGN KEY (watch_list_id) REFERENCES watch_list (token) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SCHEMA public'); + $this->addSql('ALTER TABLE watch_list_trigger DROP CONSTRAINT fk_cf857a4cc4508918'); + $this->addSql('ALTER TABLE watch_list_trigger ADD CONSTRAINT fk_cf857a4cc4508918 FOREIGN KEY (watch_list_id) REFERENCES watch_list (token) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE watch_list DROP CONSTRAINT fk_152b584ba76ed395'); + $this->addSql('ALTER TABLE watch_list ADD CONSTRAINT fk_152b584ba76ed395 FOREIGN KEY (user_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE connector DROP CONSTRAINT fk_148c456ea76ed395'); + $this->addSql('ALTER TABLE connector ADD CONSTRAINT fk_148c456ea76ed395 FOREIGN KEY (user_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE watch_lists_domains DROP CONSTRAINT fk_f693e1d0d52d7aa6'); + $this->addSql('ALTER TABLE watch_lists_domains DROP CONSTRAINT fk_f693e1d0af923913'); + $this->addSql('ALTER TABLE watch_lists_domains ADD CONSTRAINT fk_f693e1d0d52d7aa6 FOREIGN KEY (watch_list_token) REFERENCES watch_list (token) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE watch_lists_domains ADD CONSTRAINT fk_f693e1d0af923913 FOREIGN KEY (domain_ldh_name) REFERENCES domain (ldh_name) NOT DEFERRABLE INITIALLY IMMEDIATE'); + } +} diff --git a/src/Entity/Connector.php b/src/Entity/Connector.php index 4fa8eaf..d622327 100644 --- a/src/Entity/Connector.php +++ b/src/Entity/Connector.php @@ -44,7 +44,7 @@ class Connector private ?string $id; #[ORM\ManyToOne(inversedBy: 'connectors')] - #[ORM\JoinColumn(nullable: false)] + #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')] public ?User $user = null; #[Groups(['connector:list', 'connector:create', 'watchlist:list'])] diff --git a/src/Entity/WatchList.php b/src/Entity/WatchList.php index 8cd8911..c5c926c 100644 --- a/src/Entity/WatchList.php +++ b/src/Entity/WatchList.php @@ -73,7 +73,7 @@ class WatchList private string $token; #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'watchLists')] - #[ORM\JoinColumn(nullable: false)] + #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')] public ?User $user = null; /** @@ -81,8 +81,8 @@ class WatchList */ #[ORM\ManyToMany(targetEntity: Domain::class, inversedBy: 'watchLists')] #[ORM\JoinTable(name: 'watch_lists_domains', - joinColumns: [new ORM\JoinColumn(name: 'watch_list_token', referencedColumnName: 'token')], - inverseJoinColumns: [new ORM\JoinColumn(name: 'domain_ldh_name', referencedColumnName: 'ldh_name')])] + joinColumns: [new ORM\JoinColumn(name: 'watch_list_token', referencedColumnName: 'token', onDelete: 'CASCADE')], + inverseJoinColumns: [new ORM\JoinColumn(name: 'domain_ldh_name', referencedColumnName: 'ldh_name', onDelete: 'CASCADE')])] #[Groups(['watchlist:list', 'watchlist:item', 'watchlist:create', 'watchlist:update'])] private Collection $domains; diff --git a/src/Entity/WatchListTrigger.php b/src/Entity/WatchListTrigger.php index 477669d..d40b265 100644 --- a/src/Entity/WatchListTrigger.php +++ b/src/Entity/WatchListTrigger.php @@ -17,7 +17,7 @@ class WatchListTrigger #[ORM\Id] #[ORM\ManyToOne(targetEntity: WatchList::class, inversedBy: 'watchListTriggers')] - #[ORM\JoinColumn(referencedColumnName: 'token', nullable: false)] + #[ORM\JoinColumn(referencedColumnName: 'token', nullable: false, onDelete: 'CASCADE')] private ?WatchList $watchList = null; #[ORM\Id]