diff --git a/.gitignore b/.gitignore index 7540fb1..739e1e8 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,5 @@ /public/assets/ /assets/vendor/ ###< symfony/asset-mapper ### -.idea \ No newline at end of file +.idea +/migrations/ \ No newline at end of file diff --git a/migrations/Version20241114132304.php b/migrations/Version20241114132304.php deleted file mode 100644 index e87512c..0000000 --- a/migrations/Version20241114132304.php +++ /dev/null @@ -1,110 +0,0 @@ -addSql('CREATE SEQUENCE degree_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE faq_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE intern_application_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE intern_degree_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE intern_favorite_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE intern_skill_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE message_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE skill_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE TABLE degree (id INT NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE faq (id INT NOT NULL, question TEXT NOT NULL, answer TEXT DEFAULT NULL, update_date DATE NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE intern_application (id INT NOT NULL, application_id INT DEFAULT NULL, intern_id INT DEFAULT NULL, application_date DATE NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_4EDBBCC83E030ACD ON intern_application (application_id)'); - $this->addSql('CREATE INDEX IDX_4EDBBCC8525DD4B4 ON intern_application (intern_id)'); - $this->addSql('CREATE TABLE intern_degree (id INT NOT NULL, degree_id INT DEFAULT NULL, intern_id INT DEFAULT NULL, graduation_date DATE NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_E68CCB23B35C5756 ON intern_degree (degree_id)'); - $this->addSql('CREATE INDEX IDX_E68CCB23525DD4B4 ON intern_degree (intern_id)'); - $this->addSql('CREATE TABLE intern_favorite (id INT NOT NULL, announcement_id INT DEFAULT NULL, intern_id INT DEFAULT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_A709862E913AEA17 ON intern_favorite (announcement_id)'); - $this->addSql('CREATE INDEX IDX_A709862E525DD4B4 ON intern_favorite (intern_id)'); - $this->addSql('CREATE TABLE intern_skill (id INT NOT NULL, skill_id INT DEFAULT NULL, intern_id INT DEFAULT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_75E1C4DC5585C142 ON intern_skill (skill_id)'); - $this->addSql('CREATE INDEX IDX_75E1C4DC525DD4B4 ON intern_skill (intern_id)'); - $this->addSql('CREATE TABLE message (id INT NOT NULL, sender_id INT DEFAULT NULL, receiver_id INT DEFAULT NULL, content TEXT NOT NULL, sending_date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_B6BD307FF624B39D ON message (sender_id)'); - $this->addSql('CREATE INDEX IDX_B6BD307FCD53EDB6 ON message (receiver_id)'); - $this->addSql('CREATE TABLE skill (id INT NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('ALTER TABLE intern_application ADD CONSTRAINT FK_4EDBBCC83E030ACD FOREIGN KEY (application_id) REFERENCES announcement (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE intern_application ADD CONSTRAINT FK_4EDBBCC8525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE intern_degree ADD CONSTRAINT FK_E68CCB23B35C5756 FOREIGN KEY (degree_id) REFERENCES degree (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE intern_degree ADD CONSTRAINT FK_E68CCB23525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE intern_favorite ADD CONSTRAINT FK_A709862E913AEA17 FOREIGN KEY (announcement_id) REFERENCES announcement (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE intern_favorite ADD CONSTRAINT FK_A709862E525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE intern_skill ADD CONSTRAINT FK_75E1C4DC5585C142 FOREIGN KEY (skill_id) REFERENCES skill (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE intern_skill ADD CONSTRAINT FK_75E1C4DC525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FF624B39D FOREIGN KEY (sender_id) REFERENCES userApp (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FCD53EDB6 FOREIGN KEY (receiver_id) REFERENCES userApp (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE favorites DROP CONSTRAINT fk_e46960f5525dd4b4'); - $this->addSql('ALTER TABLE favorites DROP CONSTRAINT fk_e46960f5913aea17'); - $this->addSql('ALTER TABLE applications DROP CONSTRAINT fk_f7c966f0525dd4b4'); - $this->addSql('ALTER TABLE applications DROP CONSTRAINT fk_f7c966f0913aea17'); - $this->addSql('DROP TABLE favorites'); - $this->addSql('DROP TABLE applications'); - $this->addSql('ALTER TABLE announcement ADD creation_date DATE NOT NULL'); - } - - 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('DROP SEQUENCE degree_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE faq_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE intern_application_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE intern_degree_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE intern_favorite_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE intern_skill_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE message_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE skill_id_seq CASCADE'); - $this->addSql('CREATE TABLE favorites (intern_id INT NOT NULL, announcement_id INT NOT NULL, PRIMARY KEY(intern_id, announcement_id))'); - $this->addSql('CREATE INDEX idx_e46960f5913aea17 ON favorites (announcement_id)'); - $this->addSql('CREATE INDEX idx_e46960f5525dd4b4 ON favorites (intern_id)'); - $this->addSql('CREATE TABLE applications (intern_id INT NOT NULL, announcement_id INT NOT NULL, PRIMARY KEY(intern_id, announcement_id))'); - $this->addSql('CREATE INDEX idx_f7c966f0913aea17 ON applications (announcement_id)'); - $this->addSql('CREATE INDEX idx_f7c966f0525dd4b4 ON applications (intern_id)'); - $this->addSql('ALTER TABLE favorites ADD CONSTRAINT fk_e46960f5525dd4b4 FOREIGN KEY (intern_id) REFERENCES intern (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE favorites ADD CONSTRAINT fk_e46960f5913aea17 FOREIGN KEY (announcement_id) REFERENCES announcement (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE applications ADD CONSTRAINT fk_f7c966f0525dd4b4 FOREIGN KEY (intern_id) REFERENCES intern (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE applications ADD CONSTRAINT fk_f7c966f0913aea17 FOREIGN KEY (announcement_id) REFERENCES announcement (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE intern_application DROP CONSTRAINT FK_4EDBBCC83E030ACD'); - $this->addSql('ALTER TABLE intern_application DROP CONSTRAINT FK_4EDBBCC8525DD4B4'); - $this->addSql('ALTER TABLE intern_degree DROP CONSTRAINT FK_E68CCB23B35C5756'); - $this->addSql('ALTER TABLE intern_degree DROP CONSTRAINT FK_E68CCB23525DD4B4'); - $this->addSql('ALTER TABLE intern_favorite DROP CONSTRAINT FK_A709862E913AEA17'); - $this->addSql('ALTER TABLE intern_favorite DROP CONSTRAINT FK_A709862E525DD4B4'); - $this->addSql('ALTER TABLE intern_skill DROP CONSTRAINT FK_75E1C4DC5585C142'); - $this->addSql('ALTER TABLE intern_skill DROP CONSTRAINT FK_75E1C4DC525DD4B4'); - $this->addSql('ALTER TABLE message DROP CONSTRAINT FK_B6BD307FF624B39D'); - $this->addSql('ALTER TABLE message DROP CONSTRAINT FK_B6BD307FCD53EDB6'); - $this->addSql('DROP TABLE degree'); - $this->addSql('DROP TABLE faq'); - $this->addSql('DROP TABLE intern_application'); - $this->addSql('DROP TABLE intern_degree'); - $this->addSql('DROP TABLE intern_favorite'); - $this->addSql('DROP TABLE intern_skill'); - $this->addSql('DROP TABLE message'); - $this->addSql('DROP TABLE skill'); - $this->addSql('ALTER TABLE announcement DROP creation_date'); - } -} diff --git a/migrations/Version20241121135116.php b/migrations/Version20241121135116.php deleted file mode 100644 index c932e51..0000000 --- a/migrations/Version20241121135116.php +++ /dev/null @@ -1,32 +0,0 @@ -addSql('ALTER TABLE userapp ALTER roles DROP NOT NULL'); - } - - 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 userApp ALTER roles SET NOT NULL'); - } -} diff --git a/migrations/Version20241121140219.php b/migrations/Version20241121140219.php deleted file mode 100644 index 28107a4..0000000 --- a/migrations/Version20241121140219.php +++ /dev/null @@ -1,38 +0,0 @@ -addSql('ALTER TABLE announcement DROP CONSTRAINT fk_4db9d91c6bf700bd'); - $this->addSql('DROP INDEX idx_4db9d91c6bf700bd'); - $this->addSql('ALTER TABLE announcement ADD status VARCHAR(255) NOT NULL'); - $this->addSql('ALTER TABLE announcement DROP status_id'); - } - - 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 announcement ADD status_id INT NOT NULL'); - $this->addSql('ALTER TABLE announcement DROP status'); - $this->addSql('ALTER TABLE announcement ADD CONSTRAINT fk_4db9d91c6bf700bd FOREIGN KEY (status_id) REFERENCES status (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('CREATE INDEX idx_4db9d91c6bf700bd ON announcement (status_id)'); - } -} diff --git a/migrations/Version20241121153037.php b/migrations/Version20241121153037.php deleted file mode 100644 index 9a792b8..0000000 --- a/migrations/Version20241121153037.php +++ /dev/null @@ -1,31 +0,0 @@ -addSql('CREATE SCHEMA public'); - } -} diff --git a/src/Controller/IndexController.php b/src/Controller/IndexController.php index 356aa94..a15ba6f 100644 --- a/src/Controller/IndexController.php +++ b/src/Controller/IndexController.php @@ -9,7 +9,7 @@ use Symfony\Component\Routing\Attribute\Route; class IndexController extends AbstractController { - #[Route('/index', name: 'app_index')] + #[Route('/', name: 'app_index')] public function index(): Response { return $this->render('index/index.html.twig', [ diff --git a/src/Controller/ProfileController.php b/src/Controller/ProfileController.php new file mode 100644 index 0000000..6f0de0f --- /dev/null +++ b/src/Controller/ProfileController.php @@ -0,0 +1,29 @@ +getUser(); + + // Vérifiez les rôles si nécessaire + if (!$user) { + throw $this->createAccessDeniedException('Vous devez être connecté pour accéder à cette page.'); + } + + return $this->render('profile/index.html.twig', [ + 'user' => $user, + ]); + } +} + + + diff --git a/templates/base.html.twig b/templates/base.html.twig index 2fd436e..1b5a07a 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -18,12 +18,12 @@ } - +
- HegreSphere + HegreSphere
- + Profil
-{# Block for the specific page content #} -
+
{% block body %} {% endblock %}
+ + diff --git a/templates/profile/employee.html.twig b/templates/profile/employee.html.twig new file mode 100644 index 0000000..641f9fe --- /dev/null +++ b/templates/profile/employee.html.twig @@ -0,0 +1,7 @@ +
+

Bonjour {{ app.user.firstName }} {{ app.user.lastName }}

+

Vous êtes employé(e) chez {{ app.user.company }}.

+

Adresse : {{ app.user.address }}

+

Téléphone : {{ app.user.tel }}

+

Email : {{ app.user.mail }}

+
diff --git a/templates/profile/index.html.twig b/templates/profile/index.html.twig new file mode 100644 index 0000000..251ddc1 --- /dev/null +++ b/templates/profile/index.html.twig @@ -0,0 +1,19 @@ +{% extends 'base.html.twig' %} + +{% block title %}Profil{% endblock %} + +{% block body %} +
+

Profil

+ + + {% if 'ROLE_INTERN' in app.user.roles %} + {% include 'profile/intern.html.twig' %} + {% endif %} + + + {% if 'ROLE_EMPLOYEE' in app.user.roles %} + {% include 'profile/employee.html.twig' %} + {% endif %} +
+{% endblock %} diff --git a/templates/profile/intern.html.twig b/templates/profile/intern.html.twig new file mode 100644 index 0000000..5e74532 --- /dev/null +++ b/templates/profile/intern.html.twig @@ -0,0 +1,14 @@ +
+

Bonjour {{ app.user.firstName }} {{ app.user.lastName }}

+

Vous êtes à la recherche d'un stage.

+

Adresse : {{ app.user.address }}

+

Téléphone : {{ app.user.tel }}

+

Email : {{ app.user.mail }}

+ +

Vos compétences :

+ +