From fbe560e66f8caf958ce24043aae9a09dbd2c206b Mon Sep 17 00:00:00 2001 From: Julian PEREZ-RAMIREZ <julian.perez-ramirez@imt-atlantique.net> Date: Wed, 26 Feb 2025 11:12:25 +0100 Subject: [PATCH] changing project struture according to moodle suggestions --- .docker/nginx/default.conf | 20 --- .gitignore | 60 ------- compose.yaml | 49 ------ symfony.dockerfile | 29 ---- web_app/.env.dev | 4 - web_app/.gitignore | 10 -- web_app/bin/console | 21 --- web_app/composer.json | 77 --------- web_app/config/bundles.php | 10 -- web_app/config/packages/cache.yaml | 19 --- web_app/config/packages/doctrine.yaml | 54 ------ .../config/packages/doctrine_migrations.yaml | 6 - web_app/config/packages/framework.yaml | 15 -- web_app/config/packages/routing.yaml | 10 -- web_app/config/packages/security.yaml | 39 ----- web_app/config/preload.php | 5 - web_app/config/routes.yaml | 5 - web_app/config/routes/framework.yaml | 4 - web_app/config/routes/security.yaml | 3 - web_app/config/services.yaml | 24 --- web_app/migrations/.gitignore | 0 web_app/migrations/Version20250225195907.php | 57 ------- web_app/public/index.php | 9 - web_app/src/Controller/.gitignore | 0 web_app/src/Controller/ItemController.php | 19 --- web_app/src/Controller/PurchaseController.php | 19 --- web_app/src/Controller/UserController.php | 19 --- web_app/src/Controller/WishListController.php | 19 --- .../Controller/WishListMemberController.php | 19 --- web_app/src/DataFixtures/ItemFixtures.php | 59 ------- web_app/src/DataFixtures/PurchaseFixtures.php | 17 -- web_app/src/DataFixtures/UserFixtures.php | 68 -------- web_app/src/DataFixtures/WishListFixtures.php | 74 -------- .../DataFixtures/WishListMemberFixtures.php | 66 -------- web_app/src/Entity/.gitignore | 0 web_app/src/Entity/Item.php | 95 ----------- web_app/src/Entity/Purchase.php | 113 ------------- web_app/src/Entity/User.php | 159 ------------------ web_app/src/Entity/WishList.php | 132 --------------- web_app/src/Entity/WishListMember.php | 97 ----------- web_app/src/Enum/UserRole.php | 19 --- web_app/src/Kernel.php | 11 -- web_app/src/Repository/.gitignore | 0 web_app/src/Repository/ItemRepository.php | 43 ----- web_app/src/Repository/PurchaseRepository.php | 43 ----- web_app/src/Repository/UserRepository.php | 43 ----- .../src/Repository/WishListItemRepository.php | 43 ----- .../Repository/WishListMemberRepository.php | 43 ----- web_app/src/Repository/WishListRepository.php | 43 ----- web_app/symfony.lock | 120 ------------- 50 files changed, 1913 deletions(-) delete mode 100644 .docker/nginx/default.conf delete mode 100644 .gitignore delete mode 100644 compose.yaml delete mode 100644 symfony.dockerfile delete mode 100644 web_app/.env.dev delete mode 100644 web_app/.gitignore delete mode 100755 web_app/bin/console delete mode 100644 web_app/composer.json delete mode 100644 web_app/config/bundles.php delete mode 100644 web_app/config/packages/cache.yaml delete mode 100644 web_app/config/packages/doctrine.yaml delete mode 100644 web_app/config/packages/doctrine_migrations.yaml delete mode 100644 web_app/config/packages/framework.yaml delete mode 100644 web_app/config/packages/routing.yaml delete mode 100644 web_app/config/packages/security.yaml delete mode 100644 web_app/config/preload.php delete mode 100644 web_app/config/routes.yaml delete mode 100644 web_app/config/routes/framework.yaml delete mode 100644 web_app/config/routes/security.yaml delete mode 100644 web_app/config/services.yaml delete mode 100644 web_app/migrations/.gitignore delete mode 100644 web_app/migrations/Version20250225195907.php delete mode 100755 web_app/public/index.php delete mode 100644 web_app/src/Controller/.gitignore delete mode 100644 web_app/src/Controller/ItemController.php delete mode 100644 web_app/src/Controller/PurchaseController.php delete mode 100644 web_app/src/Controller/UserController.php delete mode 100644 web_app/src/Controller/WishListController.php delete mode 100644 web_app/src/Controller/WishListMemberController.php delete mode 100644 web_app/src/DataFixtures/ItemFixtures.php delete mode 100644 web_app/src/DataFixtures/PurchaseFixtures.php delete mode 100644 web_app/src/DataFixtures/UserFixtures.php delete mode 100644 web_app/src/DataFixtures/WishListFixtures.php delete mode 100644 web_app/src/DataFixtures/WishListMemberFixtures.php delete mode 100644 web_app/src/Entity/.gitignore delete mode 100644 web_app/src/Entity/Item.php delete mode 100644 web_app/src/Entity/Purchase.php delete mode 100644 web_app/src/Entity/User.php delete mode 100644 web_app/src/Entity/WishList.php delete mode 100644 web_app/src/Entity/WishListMember.php delete mode 100644 web_app/src/Enum/UserRole.php delete mode 100644 web_app/src/Kernel.php delete mode 100644 web_app/src/Repository/.gitignore delete mode 100644 web_app/src/Repository/ItemRepository.php delete mode 100644 web_app/src/Repository/PurchaseRepository.php delete mode 100644 web_app/src/Repository/UserRepository.php delete mode 100644 web_app/src/Repository/WishListItemRepository.php delete mode 100644 web_app/src/Repository/WishListMemberRepository.php delete mode 100644 web_app/src/Repository/WishListRepository.php delete mode 100644 web_app/symfony.lock diff --git a/.docker/nginx/default.conf b/.docker/nginx/default.conf deleted file mode 100644 index 92f16ae..0000000 --- a/.docker/nginx/default.conf +++ /dev/null @@ -1,20 +0,0 @@ -server { - listen 80; - server_name localhost; - root /var/www/public; - - index index.php index.html; - - location / { - try_files $uri $uri/ /index.php?$query_string; - } - - location ~ \.php(/|$) { - fastcgi_pass app:9000; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include fastcgi_params; - } - - error_log /var/log/nginx/error.log; - access_log /var/log/nginx/access.log; -} \ No newline at end of file diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 1842af9..0000000 --- a/.gitignore +++ /dev/null @@ -1,60 +0,0 @@ -.DS_Store -Thumbs.db - -.env -.env.local -.env.*.local -/.vscode/ -/.idea/ -/nbproject/ - -/vendor/ -composer.lock - -# Caché y logs -/storage/logs/ -storage/framework/cache/ -storage/framework/sessions/ -storage/framework/views/ -bootstrap/cache/ - -*.log -*.cache -*.swp -*.bak -*.tmp - -Homestead.yaml -Homestead.json -Valet/ -.phpunit.result.cache - -public/uploads/ -storage/app/public/ - -*.sublime-project -*.sublime-workspace -/.vscode/ -/.idea/ -/nbproject/ - -node_modules/ -npm-debug.log -yarn-error.log - -phpunit.xml -phpunit.xml.dist -/tests/_output/ -tests/_support/_generated/ - -*.min.js -*.min.css -/build/ -dist/ - -.phpstorm.meta.php -/.phpunit.result.cache - -deploy/ - -mysql_data/ \ No newline at end of file diff --git a/compose.yaml b/compose.yaml deleted file mode 100644 index 0e9ab21..0000000 --- a/compose.yaml +++ /dev/null @@ -1,49 +0,0 @@ -services: - web: - image: nginx:alpine - container_name: nginx_server - working_dir: /var/www - ports: - - "8080:80" - volumes: - - ./web_app:/var/www - - ./.docker/nginx/default.conf:/etc/nginx/conf.d/default.conf - depends_on: - - app - - app: - image: php_composer - build: - context: . - dockerfile: symfony.dockerfile - container_name: symfony_app - working_dir: /var/www - volumes: - - ./web_app:/var/www - environment: - - APP_ENV=dev - depends_on: - - db - - db: - image: mysql:9.2.0 - container_name: symfony_db - environment: - MYSQL_DATABASE: wishlist_db - MYSQL_ROOT_PASSWORD: password - MYSQL_USER: admin - MYSQL_PASSWORD: admin_password - ports: - - "3306:3306" - volumes: - - ./mysql_data:/var/lib/mysql - - phpMyAdmin: - image: phpmyadmin:5.2.2-apache - container_name: phpMyAdmin - ports: - - "8081:80" - environment: - - MYSQL_ROOT_PASSWORD=password - - MYSQL_USER=admin - - MYSQL_PASSWORD=admin_password \ No newline at end of file diff --git a/symfony.dockerfile b/symfony.dockerfile deleted file mode 100644 index a773a2d..0000000 --- a/symfony.dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -# Use official PHP-FPM image -FROM php:8.2-fpm - -# Set working directory inside the container -WORKDIR /var/www - -# Install required system dependencies -RUN apt-get update && apt-get install -y \ - unzip \ - git \ - libpq-dev \ - libzip-dev \ - && docker-php-ext-install pdo pdo_mysql zip - -# Install Composer -RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \ - php composer-setup.php --install-dir=/usr/local/bin --filename=composer && \ - php -r "unlink('composer-setup.php');" - -# Copy existing application files to container -COPY ./web_app /var/www - -# Install Symfony dependencies -RUN composer install --no-scripts --no-autoloader && composer dump-autoload - -# Set permissions -RUN chown -R www-data:www-data /var/www - -CMD ["php-fpm"] \ No newline at end of file diff --git a/web_app/.env.dev b/web_app/.env.dev deleted file mode 100644 index 98485ae..0000000 --- a/web_app/.env.dev +++ /dev/null @@ -1,4 +0,0 @@ - -###> symfony/framework-bundle ### -APP_SECRET=5b91d9c00db21a1d640377b21cc0e39d -###< symfony/framework-bundle ### diff --git a/web_app/.gitignore b/web_app/.gitignore deleted file mode 100644 index a67f91e..0000000 --- a/web_app/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ - -###> symfony/framework-bundle ### -/.env.local -/.env.local.php -/.env.*.local -/config/secrets/prod/prod.decrypt.private.php -/public/bundles/ -/var/ -/vendor/ -###< symfony/framework-bundle ### diff --git a/web_app/bin/console b/web_app/bin/console deleted file mode 100755 index d8d530e..0000000 --- a/web_app/bin/console +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env php -<?php - -use App\Kernel; -use Symfony\Bundle\FrameworkBundle\Console\Application; - -if (!is_dir(dirname(__DIR__).'/vendor')) { - throw new LogicException('Dependencies are missing. Try running "composer install".'); -} - -if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) { - throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".'); -} - -require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; - -return function (array $context) { - $kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); - - return new Application($kernel); -}; diff --git a/web_app/composer.json b/web_app/composer.json deleted file mode 100644 index 8fc8bf2..0000000 --- a/web_app/composer.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "type": "project", - "license": "proprietary", - "minimum-stability": "stable", - "prefer-stable": true, - "require": { - "php": ">=8.2", - "ext-ctype": "*", - "ext-iconv": "*", - "doctrine/dbal": "^3", - "doctrine/doctrine-bundle": "^2.13", - "doctrine/doctrine-migrations-bundle": "^3.4", - "doctrine/orm": "^3.3", - "symfony/console": "7.2.*", - "symfony/dotenv": "7.2.*", - "symfony/flex": "^2", - "symfony/framework-bundle": "7.2.*", - "symfony/runtime": "7.2.*", - "symfony/security-bundle": "7.2.*", - "symfony/security-core": "7.2.*", - "symfony/yaml": "7.2.*" - }, - "config": { - "allow-plugins": { - "php-http/discovery": true, - "symfony/flex": true, - "symfony/runtime": true - }, - "bump-after-update": true, - "sort-packages": true - }, - "autoload": { - "psr-4": { - "App\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "App\\Tests\\": "tests/" - } - }, - "replace": { - "symfony/polyfill-ctype": "*", - "symfony/polyfill-iconv": "*", - "symfony/polyfill-php72": "*", - "symfony/polyfill-php73": "*", - "symfony/polyfill-php74": "*", - "symfony/polyfill-php80": "*", - "symfony/polyfill-php81": "*", - "symfony/polyfill-php82": "*" - }, - "scripts": { - "auto-scripts": { - "cache:clear": "symfony-cmd", - "assets:install %PUBLIC_DIR%": "symfony-cmd" - }, - "post-install-cmd": [ - "@auto-scripts" - ], - "post-update-cmd": [ - "@auto-scripts" - ] - }, - "conflict": { - "symfony/symfony": "*" - }, - "extra": { - "symfony": { - "allow-contrib": false, - "require": "7.2.*" - } - }, - "require-dev": { - "doctrine/doctrine-fixtures-bundle": "^4.0", - "symfony/maker-bundle": "^1.62" - } -} diff --git a/web_app/config/bundles.php b/web_app/config/bundles.php deleted file mode 100644 index d1c745a..0000000 --- a/web_app/config/bundles.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -return [ - Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], - Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], - Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], - Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], - Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true], - Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], -]; diff --git a/web_app/config/packages/cache.yaml b/web_app/config/packages/cache.yaml deleted file mode 100644 index 6899b72..0000000 --- a/web_app/config/packages/cache.yaml +++ /dev/null @@ -1,19 +0,0 @@ -framework: - cache: - # Unique name of your app: used to compute stable namespaces for cache keys. - #prefix_seed: your_vendor_name/app_name - - # The "app" cache stores to the filesystem by default. - # The data in this cache should persist between deploys. - # Other options include: - - # Redis - #app: cache.adapter.redis - #default_redis_provider: redis://localhost - - # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues) - #app: cache.adapter.apcu - - # Namespaced pools use the above "app" backend by default - #pools: - #my.dedicated.cache: null diff --git a/web_app/config/packages/doctrine.yaml b/web_app/config/packages/doctrine.yaml deleted file mode 100644 index 25138b9..0000000 --- a/web_app/config/packages/doctrine.yaml +++ /dev/null @@ -1,54 +0,0 @@ -doctrine: - dbal: - url: '%env(resolve:DATABASE_URL)%' - - # IMPORTANT: You MUST configure your server version, - # either here or in the DATABASE_URL env var (see .env file) - #server_version: '16' - - profiling_collect_backtrace: '%kernel.debug%' - use_savepoints: true - orm: - auto_generate_proxy_classes: true - enable_lazy_ghost_objects: true - report_fields_where_declared: true - validate_xml_mapping: true - naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware - identity_generation_preferences: - Doctrine\DBAL\Platforms\PostgreSQLPlatform: identity - auto_mapping: true - mappings: - App: - type: attribute - is_bundle: false - dir: '%kernel.project_dir%/src/Entity' - prefix: 'App\Entity' - alias: App - controller_resolver: - auto_mapping: false - -when@test: - doctrine: - dbal: - # "TEST_TOKEN" is typically set by ParaTest - dbname_suffix: '_test%env(default::TEST_TOKEN)%' - -when@prod: - doctrine: - orm: - auto_generate_proxy_classes: false - proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies' - query_cache_driver: - type: pool - pool: doctrine.system_cache_pool - result_cache_driver: - type: pool - pool: doctrine.result_cache_pool - - framework: - cache: - pools: - doctrine.result_cache_pool: - adapter: cache.app - doctrine.system_cache_pool: - adapter: cache.system diff --git a/web_app/config/packages/doctrine_migrations.yaml b/web_app/config/packages/doctrine_migrations.yaml deleted file mode 100644 index 29231d9..0000000 --- a/web_app/config/packages/doctrine_migrations.yaml +++ /dev/null @@ -1,6 +0,0 @@ -doctrine_migrations: - migrations_paths: - # namespace is arbitrary but should be different from App\Migrations - # as migrations classes should NOT be autoloaded - 'DoctrineMigrations': '%kernel.project_dir%/migrations' - enable_profiler: false diff --git a/web_app/config/packages/framework.yaml b/web_app/config/packages/framework.yaml deleted file mode 100644 index 7e1ee1f..0000000 --- a/web_app/config/packages/framework.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# see https://symfony.com/doc/current/reference/configuration/framework.html -framework: - secret: '%env(APP_SECRET)%' - - # Note that the session will be started ONLY if you read or write from it. - session: true - - #esi: true - #fragments: true - -when@test: - framework: - test: true - session: - storage_factory_id: session.storage.factory.mock_file diff --git a/web_app/config/packages/routing.yaml b/web_app/config/packages/routing.yaml deleted file mode 100644 index 8166181..0000000 --- a/web_app/config/packages/routing.yaml +++ /dev/null @@ -1,10 +0,0 @@ -framework: - router: - # Configure how to generate URLs in non-HTTP contexts, such as CLI commands. - # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands - #default_uri: http://localhost - -when@prod: - framework: - router: - strict_requirements: null diff --git a/web_app/config/packages/security.yaml b/web_app/config/packages/security.yaml deleted file mode 100644 index 367af25..0000000 --- a/web_app/config/packages/security.yaml +++ /dev/null @@ -1,39 +0,0 @@ -security: - # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords - password_hashers: - Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' - # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider - providers: - users_in_memory: { memory: null } - firewalls: - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - main: - lazy: true - provider: users_in_memory - - # activate different ways to authenticate - # https://symfony.com/doc/current/security.html#the-firewall - - # https://symfony.com/doc/current/security/impersonating_user.html - # switch_user: true - - # Easy way to control access for large sections of your site - # Note: Only the *first* access control that matches will be used - access_control: - # - { path: ^/admin, roles: ROLE_ADMIN } - # - { path: ^/profile, roles: ROLE_USER } - -when@test: - security: - password_hashers: - # By default, password hashers are resource intensive and take time. This is - # important to generate secure password hashes. In tests however, secure hashes - # are not important, waste resources and increase test times. The following - # reduces the work factor to the lowest possible values. - Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: - algorithm: auto - cost: 4 # Lowest possible value for bcrypt - time_cost: 3 # Lowest possible value for argon - memory_cost: 10 # Lowest possible value for argon diff --git a/web_app/config/preload.php b/web_app/config/preload.php deleted file mode 100644 index 5ebcdb2..0000000 --- a/web_app/config/preload.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) { - require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php'; -} diff --git a/web_app/config/routes.yaml b/web_app/config/routes.yaml deleted file mode 100644 index 41ef814..0000000 --- a/web_app/config/routes.yaml +++ /dev/null @@ -1,5 +0,0 @@ -controllers: - resource: - path: ../src/Controller/ - namespace: App\Controller - type: attribute diff --git a/web_app/config/routes/framework.yaml b/web_app/config/routes/framework.yaml deleted file mode 100644 index 0fc74bb..0000000 --- a/web_app/config/routes/framework.yaml +++ /dev/null @@ -1,4 +0,0 @@ -when@dev: - _errors: - resource: '@FrameworkBundle/Resources/config/routing/errors.xml' - prefix: /_error diff --git a/web_app/config/routes/security.yaml b/web_app/config/routes/security.yaml deleted file mode 100644 index f853be1..0000000 --- a/web_app/config/routes/security.yaml +++ /dev/null @@ -1,3 +0,0 @@ -_security_logout: - resource: security.route_loader.logout - type: service diff --git a/web_app/config/services.yaml b/web_app/config/services.yaml deleted file mode 100644 index 2d6a76f..0000000 --- a/web_app/config/services.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# This file is the entry point to configure your own services. -# Files in the packages/ subdirectory configure your dependencies. - -# Put parameters here that don't need to change on each machine where the app is deployed -# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration -parameters: - -services: - # default configuration for services in *this* file - _defaults: - autowire: true # Automatically injects dependencies in your services. - autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. - - # makes classes in src/ available to be used as services - # this creates a service per class whose id is the fully-qualified class name - App\: - resource: '../src/' - exclude: - - '../src/DependencyInjection/' - - '../src/Entity/' - - '../src/Kernel.php' - - # add more service definitions when explicit configuration is needed - # please note that last definitions always *replace* previous ones diff --git a/web_app/migrations/.gitignore b/web_app/migrations/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/web_app/migrations/Version20250225195907.php b/web_app/migrations/Version20250225195907.php deleted file mode 100644 index 967136e..0000000 --- a/web_app/migrations/Version20250225195907.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace DoctrineMigrations; - -use Doctrine\DBAL\Schema\Schema; -use Doctrine\Migrations\AbstractMigration; - -/** - * Auto-generated Migration: Please modify to your needs! - */ -final class Version20250225195907 extends AbstractMigration -{ - public function getDescription(): string - { - return ''; - } - - public function up(Schema $schema): void - { - // this up() migration is auto-generated, please modify it to your needs - $this->addSql('CREATE TABLE item (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, price DOUBLE PRECISION NOT NULL, purchase_url VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE purchase (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, wish_list_id INT NOT NULL, item_id INT NOT NULL, url_proof VARCHAR(255) DEFAULT NULL, message VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_6117D13BA76ED395 (user_id), INDEX IDX_6117D13BD69F3311 (wish_list_id), INDEX IDX_6117D13B126F525E (item_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, user_name VARCHAR(255) DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, surname VARCHAR(255) DEFAULT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, is_blocked TINYINT(1) DEFAULT NULL, role VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE wish_list (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, name VARCHAR(255) NOT NULL, expiration_date DATETIME DEFAULT NULL, is_active TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_5B8739BDA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE wishlist_item (wish_list_id INT NOT NULL, item_id INT NOT NULL, INDEX IDX_6424F4E8D69F3311 (wish_list_id), INDEX IDX_6424F4E8126F525E (item_id), PRIMARY KEY(wish_list_id, item_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE wish_list_member (id INT AUTO_INCREMENT NOT NULL, wish_list_id INT NOT NULL, user_id INT NOT NULL, can_edit TINYINT(1) NOT NULL, is_accepted TINYINT(1) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_F4CA81DFD69F3311 (wish_list_id), INDEX IDX_F4CA81DFA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('ALTER TABLE purchase ADD CONSTRAINT FK_6117D13BA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); - $this->addSql('ALTER TABLE purchase ADD CONSTRAINT FK_6117D13BD69F3311 FOREIGN KEY (wish_list_id) REFERENCES wish_list (id)'); - $this->addSql('ALTER TABLE purchase ADD CONSTRAINT FK_6117D13B126F525E FOREIGN KEY (item_id) REFERENCES item (id)'); - $this->addSql('ALTER TABLE wish_list ADD CONSTRAINT FK_5B8739BDA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); - $this->addSql('ALTER TABLE wishlist_item ADD CONSTRAINT FK_6424F4E8D69F3311 FOREIGN KEY (wish_list_id) REFERENCES wish_list (id) ON DELETE CASCADE'); - $this->addSql('ALTER TABLE wishlist_item ADD CONSTRAINT FK_6424F4E8126F525E FOREIGN KEY (item_id) REFERENCES item (id) ON DELETE CASCADE'); - $this->addSql('ALTER TABLE wish_list_member ADD CONSTRAINT FK_F4CA81DFD69F3311 FOREIGN KEY (wish_list_id) REFERENCES wish_list (id)'); - $this->addSql('ALTER TABLE wish_list_member ADD CONSTRAINT FK_F4CA81DFA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE purchase DROP FOREIGN KEY FK_6117D13BA76ED395'); - $this->addSql('ALTER TABLE purchase DROP FOREIGN KEY FK_6117D13BD69F3311'); - $this->addSql('ALTER TABLE purchase DROP FOREIGN KEY FK_6117D13B126F525E'); - $this->addSql('ALTER TABLE wish_list DROP FOREIGN KEY FK_5B8739BDA76ED395'); - $this->addSql('ALTER TABLE wishlist_item DROP FOREIGN KEY FK_6424F4E8D69F3311'); - $this->addSql('ALTER TABLE wishlist_item DROP FOREIGN KEY FK_6424F4E8126F525E'); - $this->addSql('ALTER TABLE wish_list_member DROP FOREIGN KEY FK_F4CA81DFD69F3311'); - $this->addSql('ALTER TABLE wish_list_member DROP FOREIGN KEY FK_F4CA81DFA76ED395'); - $this->addSql('DROP TABLE item'); - $this->addSql('DROP TABLE purchase'); - $this->addSql('DROP TABLE user'); - $this->addSql('DROP TABLE wish_list'); - $this->addSql('DROP TABLE wishlist_item'); - $this->addSql('DROP TABLE wish_list_member'); - } -} diff --git a/web_app/public/index.php b/web_app/public/index.php deleted file mode 100755 index 9982c21..0000000 --- a/web_app/public/index.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -use App\Kernel; - -require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; - -return function (array $context) { - return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); -}; diff --git a/web_app/src/Controller/.gitignore b/web_app/src/Controller/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/web_app/src/Controller/ItemController.php b/web_app/src/Controller/ItemController.php deleted file mode 100644 index ad855bf..0000000 --- a/web_app/src/Controller/ItemController.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace App\Controller; - -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Component\Routing\Attribute\Route; - -final class ItemController extends AbstractController -{ - #[Route('/item', name: 'app_item')] - public function index(): JsonResponse - { - return $this->json([ - 'message' => 'Welcome to your new controller!', - 'path' => 'src/Controller/ItemController.php', - ]); - } -} diff --git a/web_app/src/Controller/PurchaseController.php b/web_app/src/Controller/PurchaseController.php deleted file mode 100644 index fa85a6e..0000000 --- a/web_app/src/Controller/PurchaseController.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace App\Controller; - -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Component\Routing\Attribute\Route; - -final class PurchaseController extends AbstractController -{ - #[Route('/purchase', name: 'app_purchase')] - public function index(): JsonResponse - { - return $this->json([ - 'message' => 'Welcome to your new controller!', - 'path' => 'src/Controller/PurchaseController.php', - ]); - } -} diff --git a/web_app/src/Controller/UserController.php b/web_app/src/Controller/UserController.php deleted file mode 100644 index b80a3e4..0000000 --- a/web_app/src/Controller/UserController.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace App\Controller; - -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Component\Routing\Attribute\Route; - -final class UserController extends AbstractController -{ - #[Route('/user', name: 'app_user')] - public function index(): JsonResponse - { - return $this->json([ - 'message' => 'Welcome to your new controller!', - 'path' => 'src/Controller/UserController.php', - ]); - } -} diff --git a/web_app/src/Controller/WishListController.php b/web_app/src/Controller/WishListController.php deleted file mode 100644 index e28a0e5..0000000 --- a/web_app/src/Controller/WishListController.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace App\Controller; - -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Component\Routing\Attribute\Route; - -final class WishListController extends AbstractController -{ - #[Route('/wish/list', name: 'app_wish_list')] - public function index(): JsonResponse - { - return $this->json([ - 'message' => 'Welcome to your new controller!', - 'path' => 'src/Controller/WishListController.php', - ]); - } -} diff --git a/web_app/src/Controller/WishListMemberController.php b/web_app/src/Controller/WishListMemberController.php deleted file mode 100644 index 9ae8058..0000000 --- a/web_app/src/Controller/WishListMemberController.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace App\Controller; - -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Component\Routing\Attribute\Route; - -final class WishListMemberController extends AbstractController -{ - #[Route('/wish/list/member', name: 'app_wish_list_member')] - public function index(): JsonResponse - { - return $this->json([ - 'message' => 'Welcome to your new controller!', - 'path' => 'src/Controller/WishListMemberController.php', - ]); - } -} diff --git a/web_app/src/DataFixtures/ItemFixtures.php b/web_app/src/DataFixtures/ItemFixtures.php deleted file mode 100644 index a8dcc0c..0000000 --- a/web_app/src/DataFixtures/ItemFixtures.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -namespace App\DataFixtures; - -use App\Entity\Item; -use Doctrine\Bundle\FixturesBundle\Fixture; -use Doctrine\Persistence\ObjectManager; - -class ItemFixtures extends Fixture -{ - public function load(ObjectManager $manager): void - { - $itemsData = [ - [ - 'title' => 'Smartphone', - 'description' => 'Latest model with high-end specs', - 'price' => 799.99, - 'purchase_url' => 'https://example.com/smartphone', - ], - [ - 'title' => 'Laptop', - 'description' => 'Powerful laptop for work and gaming', - 'price' => 1299.49, - 'purchase_url' => 'https://example.com/laptop', - ], - [ - 'title' => 'Wireless Headphones', - 'description' => 'Noise-canceling headphones with long battery life', - 'price' => 199.99, - 'purchase_url' => 'https://example.com/headphones', - ], - [ - 'title' => 'Coffee Maker', - 'description' => 'Automatic coffee maker with multiple settings', - 'price' => 89.99, - 'purchase_url' => 'https://example.com/coffee-maker', - ], - [ - 'title' => 'Gaming Chair', - 'description' => 'Ergonomic chair for long gaming sessions', - 'price' => 249.99, - 'purchase_url' => 'https://example.com/gaming-chair', - ] - ]; - - foreach ($itemsData as $itemData) { - $item = new Item(); - $item->setTitle($itemData['title']); - $item->setDescription($itemData['description']); - $item->setPrice($itemData['price']); - $item->setPurchaseUrl($itemData['purchase_url']); - $item->setCreatedAt(new \DateTimeImmutable()); - - $manager->persist($item); - } - - $manager->flush(); - } -} diff --git a/web_app/src/DataFixtures/PurchaseFixtures.php b/web_app/src/DataFixtures/PurchaseFixtures.php deleted file mode 100644 index 9b6140a..0000000 --- a/web_app/src/DataFixtures/PurchaseFixtures.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -namespace App\DataFixtures; - -use Doctrine\Bundle\FixturesBundle\Fixture; -use Doctrine\Persistence\ObjectManager; - -class PurchaseFixtures extends Fixture -{ - public function load(ObjectManager $manager): void - { - // $product = new Product(); - // $manager->persist($product); - - $manager->flush(); - } -} diff --git a/web_app/src/DataFixtures/UserFixtures.php b/web_app/src/DataFixtures/UserFixtures.php deleted file mode 100644 index fdb357f..0000000 --- a/web_app/src/DataFixtures/UserFixtures.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php - -namespace App\DataFixtures; - -use App\Entity\User; -use App\Enum\UserRole; -use Doctrine\Bundle\FixturesBundle\Fixture; -use Doctrine\Persistence\ObjectManager; -use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; - -class UserFixtures extends Fixture -{ - private UserPasswordHasherInterface $passwordHasher; - - public function __construct(UserPasswordHasherInterface $passwordHasher) - { - $this->passwordHasher = $passwordHasher; - } - - public function load(ObjectManager $manager): void - { - $usersData = [ - [ - 'user_name' => 'john_doe', - 'name' => 'John', - 'surname' => 'Doe', - 'email' => 'john.doe@example.com', - 'password' => 'password123', - 'is_blocked' => false, - 'role' => UserRole::ADMIN, - ], - [ - 'user_name' => 'jane_smith', - 'name' => 'Jane', - 'surname' => 'Smith', - 'email' => 'jane.smith@example.com', - 'password' => 'securepass', - 'is_blocked' => false, - 'role' => UserRole::USER, - ], - [ - 'user_name' => 'bob_martin', - 'name' => 'Bob', - 'surname' => 'Martin', - 'email' => 'bob.martin@example.com', - 'password' => 'test123', - 'is_blocked' => true, - 'role' => UserRole::USER, - ] - ]; - - foreach ($usersData as $userData) { - $user = new User(); - $user->setUserName($userData['user_name']); - $user->setName($userData['name']); - $user->setSurname($userData['surname']); - $user->setEmail($userData['email']); - $user->setPassword($this->passwordHasher->hashPassword($user, $userData['password'])); - $user->setIsBlocked($userData['is_blocked']); - $user->setRole($userData['role']); - $user->setCreatedAt(new \DateTimeImmutable()); - - $manager->persist($user); - } - - $manager->flush(); - } -} diff --git a/web_app/src/DataFixtures/WishListFixtures.php b/web_app/src/DataFixtures/WishListFixtures.php deleted file mode 100644 index cd735e6..0000000 --- a/web_app/src/DataFixtures/WishListFixtures.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php - -namespace App\DataFixtures; - -use App\Entity\User; -use App\Entity\Item; -use App\Entity\WishList; -use Doctrine\Bundle\FixturesBundle\Fixture; -use Doctrine\Persistence\ObjectManager; -use Doctrine\Common\DataFixtures\DependentFixtureInterface; - -class WishListFixtures extends Fixture implements DependentFixtureInterface -{ - public function load(ObjectManager $manager): void - { - // Retrieve all users - $users = $manager->getRepository(User::class)->findAll(); - // Retrieve all items - $items = $manager->getRepository(Item::class)->findAll(); - - if (empty($users) || empty($items)) { - throw new \Exception('No users or items found. Please load UserFixtures and ItemFixtures first.'); - } - - $wishListsData = [ - [ - 'name' => 'John\'s Birthday Wishlist', - 'user' => $users[0], // Assuming at least one user exists - 'items' => [$items[0], $items[1]], // Adding first two items - 'expiration_date' => new \DateTime('+30 days'), - 'is_active' => true, - ], - [ - 'name' => 'Tech Gadgets Wishlist', - 'user' => $users[1], // Use second user if available, else first user - 'items' => [$items[2], $items[3], $items[4]], // Adding three different items - 'expiration_date' => new \DateTime('+60 days'), - 'is_active' => true, - ], - [ - 'name' => 'Home Essentials Wishlist', - 'user' => $users[2], // Use third user if available, else first user - 'items' => [$items[1], $items[4]], // Adding two different items - 'expiration_date' => new \DateTime('+90 days'), - 'is_active' => false, - ], - ]; - - foreach ($wishListsData as $wishListData) { - $wishList = new WishList(); - $wishList->setName($wishListData['name']); - $wishList->setUser($wishListData['user']); - $wishList->setExpirationDate($wishListData['expiration_date']); - $wishList->setIsActive($wishListData['is_active']); - $wishList->setCreatedAt(new \DateTimeImmutable()); - - foreach ($wishListData['items'] as $item) { - $wishList->getItems()->add($item); - } - - $manager->persist($wishList); - } - - $manager->flush(); - } - - public function getDependencies(): array - { - return [ - UserFixtures::class, - ItemFixtures::class, - ]; - } -} diff --git a/web_app/src/DataFixtures/WishListMemberFixtures.php b/web_app/src/DataFixtures/WishListMemberFixtures.php deleted file mode 100644 index b2100cd..0000000 --- a/web_app/src/DataFixtures/WishListMemberFixtures.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php - -namespace App\DataFixtures; - -use App\Entity\WishListMember; -use App\Entity\User; -use App\Entity\WishList; -use Doctrine\Bundle\FixturesBundle\Fixture; -use Doctrine\Persistence\ObjectManager; -use Doctrine\Common\DataFixtures\DependentFixtureInterface; - -class WishListMemberFixtures extends Fixture implements DependentFixtureInterface -{ - public function load(ObjectManager $manager): void - { - // Fetch existing users and wishlists from the database - $users = $manager->getRepository(User::class)->findAll(); - $wishLists = $manager->getRepository(WishList::class)->findAll(); - - if (empty($users) || empty($wishLists)) { - throw new \Exception('Make sure you have users and wishlists in the database before running this fixture.'); - } - - $wishListMembersData = [ - [ - 'wishList' => $wishLists[0], - 'user' => $users[0], - 'can_edit' => true, - 'is_accepted' => true, - ], - [ - 'wishList' => $wishLists[0], - 'user' => $users[1], - 'can_edit' => false, - 'is_accepted' => true, - ], - [ - 'wishList' => $wishLists[1], - 'user' => $users[2], - 'can_edit' => true, - 'is_accepted' => false, - ] - ]; - - foreach ($wishListMembersData as $data) { - $wishListMember = new WishListMember(); - $wishListMember->setWishList($data['wishList']); - $wishListMember->setUser($data['user']); - $wishListMember->setCanEdit($data['can_edit']); - $wishListMember->setIsAccepted($data['is_accepted']); - $wishListMember->setCreatedAt(new \DateTimeImmutable()); - - $manager->persist($wishListMember); - } - - $manager->flush(); - } - - public function getDependencies(): array - { - return [ - UserFixtures::class, - WishListFixtures::class, - ]; - } -} \ No newline at end of file diff --git a/web_app/src/Entity/.gitignore b/web_app/src/Entity/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/web_app/src/Entity/Item.php b/web_app/src/Entity/Item.php deleted file mode 100644 index 75a011f..0000000 --- a/web_app/src/Entity/Item.php +++ /dev/null @@ -1,95 +0,0 @@ -<?php - -namespace App\Entity; - -use App\Repository\ItemRepository; -use Doctrine\ORM\Mapping as ORM; - -#[ORM\Entity(repositoryClass: ItemRepository::class)] -class Item -{ - #[ORM\Id] - #[ORM\GeneratedValue] - #[ORM\Column] - private ?int $id = null; - - #[ORM\Column(length: 255)] - private ?string $title = null; - - #[ORM\Column(length: 255, nullable: true)] - private ?string $description = null; - - #[ORM\Column] - private ?float $price = null; - - #[ORM\Column(length: 255, nullable: true)] - private ?string $purchase_url = null; - - #[ORM\Column] - private ?\DateTimeImmutable $created_at = null; - - public function getId(): ?int - { - return $this->id; - } - - public function getTitle(): ?string - { - return $this->title; - } - - public function setTitle(string $title): static - { - $this->title = $title; - - return $this; - } - - public function getDescription(): ?string - { - return $this->description; - } - - public function setDescription(?string $description): static - { - $this->description = $description; - - return $this; - } - - public function getPrice(): ?float - { - return $this->price; - } - - public function setPrice(float $price): static - { - $this->price = $price; - - return $this; - } - - public function getPurchaseUrl(): ?string - { - return $this->purchase_url; - } - - public function setPurchaseUrl(?string $purchase_url): static - { - $this->purchase_url = $purchase_url; - - return $this; - } - - public function getCreatedAt(): ?\DateTimeImmutable - { - return $this->created_at; - } - - public function setCreatedAt(\DateTimeImmutable $created_at): static - { - $this->created_at = $created_at; - - return $this; - } -} diff --git a/web_app/src/Entity/Purchase.php b/web_app/src/Entity/Purchase.php deleted file mode 100644 index 7f65dc8..0000000 --- a/web_app/src/Entity/Purchase.php +++ /dev/null @@ -1,113 +0,0 @@ -<?php - -namespace App\Entity; - -use App\Repository\PurchaseRepository; -use Doctrine\ORM\Mapping as ORM; - -#[ORM\Entity(repositoryClass: PurchaseRepository::class)] -class Purchase -{ - #[ORM\Id] - #[ORM\GeneratedValue] - #[ORM\Column] - private ?int $id = null; - - #[ORM\ManyToOne(targetEntity: User::class)] - #[ORM\JoinColumn(nullable: false)] - private ?int $user = null; - - #[ORM\ManyToOne(targetEntity: WishList::class)] - #[ORM\JoinColumn(nullable: false)] - private ?int $wishList = null; - - #[ORM\ManyToOne(targetEntity: Item::class)] - #[ORM\JoinColumn(nullable: false)] - private ?int $item = null; - - #[ORM\Column(length: 255, nullable: true)] - private ?string $url_proof = null; - - #[ORM\Column(length: 255, nullable: true)] - private ?string $message = null; - - #[ORM\Column] - private ?\DateTimeImmutable $created_at = null; - - public function getId(): ?int - { - return $this->id; - } - - public function getUser(): ?int - { - return $this->user; - } - - public function setUser(int $user): static - { - $this->user = $user; - - return $this; - } - - public function getWishList(): ?int - { - return $this->wishlist; - } - - public function setWishList(int $wishList): static - { - $this->wishList = $wishList; - - return $this; - } - - public function getItem(): ?int - { - return $this->item; - } - - public function setItem(int $item): static - { - $this->item = $item; - - return $this; - } - - public function getUrlProof(): ?string - { - return $this->url_proof; - } - - public function setUrlProof(?string $url_proof): static - { - $this->url_proof = $url_proof; - - return $this; - } - - public function getMessage(): ?string - { - return $this->message; - } - - public function setMessage(?string $message): static - { - $this->message = $message; - - return $this; - } - - public function getCreatedAt(): ?\DateTimeImmutable - { - return $this->created_at; - } - - public function setCreatedAt(\DateTimeImmutable $created_at): static - { - $this->created_at = $created_at; - - return $this; - } -} diff --git a/web_app/src/Entity/User.php b/web_app/src/Entity/User.php deleted file mode 100644 index b986c66..0000000 --- a/web_app/src/Entity/User.php +++ /dev/null @@ -1,159 +0,0 @@ -<?php - -namespace App\Entity; - -use App\Enum\UserRole; -use App\Repository\UserRepository; -use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Security\Core\User\UserInterface; -use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; - -#[ORM\Entity(repositoryClass: UserRepository::class)] -class User implements UserInterface, PasswordAuthenticatedUserInterface -{ - #[ORM\Id] - #[ORM\GeneratedValue] - #[ORM\Column] - private ?int $id = null; - - #[ORM\Column(length: 255, nullable: true)] - private ?string $user_name = null; - - #[ORM\Column(length: 255, nullable: true)] - private ?string $name = null; - - #[ORM\Column(length: 255, nullable: true)] - private ?string $surname = null; - - #[ORM\Column(length: 255, unique: true)] - private ?string $email = null; - - #[ORM\Column(length: 255)] - private ?string $password = null; - - #[ORM\Column(nullable: true)] - private ?bool $is_blocked = null; - - #[ORM\Column(enumType: UserRole::class)] - private ?UserRole $role = null; - - #[ORM\Column] - private ?\DateTimeImmutable $created_at = null; - - public function getId(): ?int - { - return $this->id; - } - - public function getUserName(): ?string - { - return $this->user_name; - } - - public function setUserName(?string $user_name): static - { - $this->user_name = $user_name; - - return $this; - } - - public function getName(): ?string - { - return $this->name; - } - - public function setName(?string $name): static - { - $this->name = $name; - - return $this; - } - - public function getSurname(): ?string - { - return $this->surname; - } - - public function setSurname(?string $surname): static - { - $this->surname = $surname; - - return $this; - } - - public function getEmail(): ?string - { - return $this->email; - } - - public function setEmail(string $email): static - { - $this->email = $email; - - return $this; - } - - public function getPassword(): ?string - { - return $this->password; - } - - public function setPassword(string $password): static - { - $this->password = $password; - - return $this; - } - - public function isBlocked(): ?bool - { - return $this->is_blocked; - } - - public function setIsBlocked(?bool $is_blocked): static - { - $this->is_blocked = $is_blocked; - - return $this; - } - - public function getRole(): ?UserRole - { - return $this->role; - } - - public function setRole(UserRole $role): static - { - $this->role = $role; - - return $this; - } - - public function getCreatedAt(): ?\DateTimeImmutable - { - return $this->created_at; - } - - public function setCreatedAt(\DateTimeImmutable $created_at): static - { - $this->created_at = $created_at; - - return $this; - } - - //Methods neeeded to be implemented here because of the extension of UserInterface, PasswordAuthenticatedUserInterface - public function getRoles(): array - { - return [$this->role->value]; // Assuming UserRole is an enum with string values - } - - public function getUserIdentifier(): string - { - return $this->email; // Or another unique identifier like username - } - - public function eraseCredentials(): void - { - // If storing temporary sensitive data, clear it here - } -} diff --git a/web_app/src/Entity/WishList.php b/web_app/src/Entity/WishList.php deleted file mode 100644 index cb593dc..0000000 --- a/web_app/src/Entity/WishList.php +++ /dev/null @@ -1,132 +0,0 @@ -<?php - -namespace App\Entity; - -use App\Repository\WishListRepository; -use Doctrine\Common\Collections\ArrayCollection; -use Doctrine\Common\Collections\Collection; -use Doctrine\DBAL\Types\Types; -use Doctrine\ORM\Mapping as ORM; - -#[ORM\Entity(repositoryClass: WishListRepository::class)] -class WishList -{ - #[ORM\Id] - #[ORM\GeneratedValue] - #[ORM\Column] - private ?int $id = null; - - #[ORM\ManyToOne(targetEntity: User::class)] - #[ORM\JoinColumn(nullable: false)] - private ?User $user = null; - - #[ORM\Column(length: 255)] - private ?string $name = null; - - #[ORM\ManyToMany(targetEntity: Item::class)] - #[ORM\JoinTable(name: "wishlist_item")] - private Collection $items; - - #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)] - private ?\DateTimeInterface $expiration_date = null; - - #[ORM\Column] - private ?bool $is_active = null; - - #[ORM\Column] - private ?\DateTimeImmutable $created_at = null; - - public function __construct() - { - $this->items = new ArrayCollection(); - } - - public function getId(): ?int - { - return $this->id; - } - - public function getUser(): ?User - { - return $this->user; - } - - public function setUser(User $user): static - { - $this->user = $user; - - return $this; - } - - public function getName(): ?string - { - return $this->name; - } - - public function setName(string $name): static - { - $this->name = $name; - - return $this; - } - - public function getExpirationDate(): ?\DateTimeInterface - { - return $this->expiration_date; - } - - public function setExpirationDate(?\DateTimeInterface $expiration_date): static - { - $this->expiration_date = $expiration_date; - - return $this; - } - - public function isActive(): ?bool - { - return $this->is_active; - } - - public function setIsActive(bool $is_active): static - { - $this->is_active = $is_active; - - return $this; - } - - public function getCreatedAt(): ?\DateTimeImmutable - { - return $this->created_at; - } - - public function setCreatedAt(\DateTimeImmutable $created_at): static - { - $this->created_at = $created_at; - - return $this; - } - - /** - * @return Collection<int, Item> - */ - public function getItems(): Collection - { - return $this->items; - } - - public function addItem(Item $item): static - { - if (!$this->items->contains($item)) { - $this->items->add($item); - } - - return $this; - } - - public function removeItem(Item $item): static - { - $this->items->removeElement($item); - - return $this; - } -} diff --git a/web_app/src/Entity/WishListMember.php b/web_app/src/Entity/WishListMember.php deleted file mode 100644 index 5143481..0000000 --- a/web_app/src/Entity/WishListMember.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php - -namespace App\Entity; - -use App\Repository\WishListMemberRepository; -use Doctrine\ORM\Mapping as ORM; - -#[ORM\Entity(repositoryClass: WishListMemberRepository::class)] -class WishListMember -{ - #[ORM\Id] - #[ORM\GeneratedValue] - #[ORM\Column] - private ?int $id = null; - - #[ORM\ManyToOne(targetEntity: WishList::class)] - #[ORM\JoinColumn(nullable: false)] - private ?WishList $wishList = null; - - #[ORM\ManyToOne(targetEntity: User::class)] - #[ORM\JoinColumn(nullable: false)] - private ?User $user = null; - - #[ORM\Column] - private ?bool $can_edit = null; - - #[ORM\Column(nullable: true)] - private ?bool $is_accepted = null; - - #[ORM\Column] - private ?\DateTimeImmutable $created_at = null; - - public function getId(): ?int - { - return $this->id; - } - - public function getWishList(): ?WishList - { - return $this->wishList; - } - - public function setWishList(WishList $wishList): static - { - $this->wishList = $wishList; - - return $this; - } - - public function getUser(): ?User - { - return $this->user; - } - - public function setUser(User $user): static - { - $this->user = $user; - - return $this; - } - - public function isCanEdit(): ?bool - { - return $this->can_edit; - } - - public function setCanEdit(bool $can_edit): static - { - $this->can_edit = $can_edit; - - return $this; - } - - public function isAccepted(): ?bool - { - return $this->is_accepted; - } - - public function setIsAccepted(?bool $is_accepted): static - { - $this->is_accepted = $is_accepted; - - return $this; - } - - public function getCreatedAt(): ?\DateTimeImmutable - { - return $this->created_at; - } - - public function setCreatedAt(\DateTimeImmutable $created_at): static - { - $this->created_at = $created_at; - - return $this; - } -} diff --git a/web_app/src/Enum/UserRole.php b/web_app/src/Enum/UserRole.php deleted file mode 100644 index 4b04056..0000000 --- a/web_app/src/Enum/UserRole.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace App\Enum; - -enum UserRole: string -{ - case ADMIN = 'admin'; - case USER = 'user'; - - public function label(): string - { - return match($this) { - self::ADMIN => 'Administrator', - self::USER => 'Regular User' - }; - } -} - -?> \ No newline at end of file diff --git a/web_app/src/Kernel.php b/web_app/src/Kernel.php deleted file mode 100644 index 779cd1f..0000000 --- a/web_app/src/Kernel.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -namespace App; - -use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; -use Symfony\Component\HttpKernel\Kernel as BaseKernel; - -class Kernel extends BaseKernel -{ - use MicroKernelTrait; -} diff --git a/web_app/src/Repository/.gitignore b/web_app/src/Repository/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/web_app/src/Repository/ItemRepository.php b/web_app/src/Repository/ItemRepository.php deleted file mode 100644 index 229f406..0000000 --- a/web_app/src/Repository/ItemRepository.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -namespace App\Repository; - -use App\Entity\Item; -use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; -use Doctrine\Persistence\ManagerRegistry; - -/** - * @extends ServiceEntityRepository<Item> - */ -class ItemRepository extends ServiceEntityRepository -{ - public function __construct(ManagerRegistry $registry) - { - parent::__construct($registry, Item::class); - } - - // /** - // * @return Item[] Returns an array of Item objects - // */ - // public function findByExampleField($value): array - // { - // return $this->createQueryBuilder('i') - // ->andWhere('i.exampleField = :val') - // ->setParameter('val', $value) - // ->orderBy('i.id', 'ASC') - // ->setMaxResults(10) - // ->getQuery() - // ->getResult() - // ; - // } - - // public function findOneBySomeField($value): ?Item - // { - // return $this->createQueryBuilder('i') - // ->andWhere('i.exampleField = :val') - // ->setParameter('val', $value) - // ->getQuery() - // ->getOneOrNullResult() - // ; - // } -} diff --git a/web_app/src/Repository/PurchaseRepository.php b/web_app/src/Repository/PurchaseRepository.php deleted file mode 100644 index 6f189b3..0000000 --- a/web_app/src/Repository/PurchaseRepository.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -namespace App\Repository; - -use App\Entity\Purchase; -use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; -use Doctrine\Persistence\ManagerRegistry; - -/** - * @extends ServiceEntityRepository<Purchase> - */ -class PurchaseRepository extends ServiceEntityRepository -{ - public function __construct(ManagerRegistry $registry) - { - parent::__construct($registry, Purchase::class); - } - - // /** - // * @return Purchase[] Returns an array of Purchase objects - // */ - // public function findByExampleField($value): array - // { - // return $this->createQueryBuilder('p') - // ->andWhere('p.exampleField = :val') - // ->setParameter('val', $value) - // ->orderBy('p.id', 'ASC') - // ->setMaxResults(10) - // ->getQuery() - // ->getResult() - // ; - // } - - // public function findOneBySomeField($value): ?Purchase - // { - // return $this->createQueryBuilder('p') - // ->andWhere('p.exampleField = :val') - // ->setParameter('val', $value) - // ->getQuery() - // ->getOneOrNullResult() - // ; - // } -} diff --git a/web_app/src/Repository/UserRepository.php b/web_app/src/Repository/UserRepository.php deleted file mode 100644 index b29153b..0000000 --- a/web_app/src/Repository/UserRepository.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -namespace App\Repository; - -use App\Entity\User; -use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; -use Doctrine\Persistence\ManagerRegistry; - -/** - * @extends ServiceEntityRepository<User> - */ -class UserRepository extends ServiceEntityRepository -{ - public function __construct(ManagerRegistry $registry) - { - parent::__construct($registry, User::class); - } - - // /** - // * @return User[] Returns an array of User objects - // */ - // public function findByExampleField($value): array - // { - // return $this->createQueryBuilder('u') - // ->andWhere('u.exampleField = :val') - // ->setParameter('val', $value) - // ->orderBy('u.id', 'ASC') - // ->setMaxResults(10) - // ->getQuery() - // ->getResult() - // ; - // } - - // public function findOneBySomeField($value): ?User - // { - // return $this->createQueryBuilder('u') - // ->andWhere('u.exampleField = :val') - // ->setParameter('val', $value) - // ->getQuery() - // ->getOneOrNullResult() - // ; - // } -} diff --git a/web_app/src/Repository/WishListItemRepository.php b/web_app/src/Repository/WishListItemRepository.php deleted file mode 100644 index 1b7d0ff..0000000 --- a/web_app/src/Repository/WishListItemRepository.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -namespace App\Repository; - -use App\Entity\WishListItem; -use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; -use Doctrine\Persistence\ManagerRegistry; - -/** - * @extends ServiceEntityRepository<WishListItem> - */ -class WishListItemRepository extends ServiceEntityRepository -{ - public function __construct(ManagerRegistry $registry) - { - parent::__construct($registry, WishListItem::class); - } - - // /** - // * @return WishListItem[] Returns an array of WishListItem objects - // */ - // public function findByExampleField($value): array - // { - // return $this->createQueryBuilder('w') - // ->andWhere('w.exampleField = :val') - // ->setParameter('val', $value) - // ->orderBy('w.id', 'ASC') - // ->setMaxResults(10) - // ->getQuery() - // ->getResult() - // ; - // } - - // public function findOneBySomeField($value): ?WishListItem - // { - // return $this->createQueryBuilder('w') - // ->andWhere('w.exampleField = :val') - // ->setParameter('val', $value) - // ->getQuery() - // ->getOneOrNullResult() - // ; - // } -} diff --git a/web_app/src/Repository/WishListMemberRepository.php b/web_app/src/Repository/WishListMemberRepository.php deleted file mode 100644 index cd0e76f..0000000 --- a/web_app/src/Repository/WishListMemberRepository.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -namespace App\Repository; - -use App\Entity\WishListMember; -use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; -use Doctrine\Persistence\ManagerRegistry; - -/** - * @extends ServiceEntityRepository<WishListMember> - */ -class WishListMemberRepository extends ServiceEntityRepository -{ - public function __construct(ManagerRegistry $registry) - { - parent::__construct($registry, WishListMember::class); - } - - // /** - // * @return WishListMember[] Returns an array of WishListMember objects - // */ - // public function findByExampleField($value): array - // { - // return $this->createQueryBuilder('w') - // ->andWhere('w.exampleField = :val') - // ->setParameter('val', $value) - // ->orderBy('w.id', 'ASC') - // ->setMaxResults(10) - // ->getQuery() - // ->getResult() - // ; - // } - - // public function findOneBySomeField($value): ?WishListMember - // { - // return $this->createQueryBuilder('w') - // ->andWhere('w.exampleField = :val') - // ->setParameter('val', $value) - // ->getQuery() - // ->getOneOrNullResult() - // ; - // } -} diff --git a/web_app/src/Repository/WishListRepository.php b/web_app/src/Repository/WishListRepository.php deleted file mode 100644 index 846c543..0000000 --- a/web_app/src/Repository/WishListRepository.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -namespace App\Repository; - -use App\Entity\WishList; -use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; -use Doctrine\Persistence\ManagerRegistry; - -/** - * @extends ServiceEntityRepository<WishList> - */ -class WishListRepository extends ServiceEntityRepository -{ - public function __construct(ManagerRegistry $registry) - { - parent::__construct($registry, WishList::class); - } - - // /** - // * @return WishList[] Returns an array of WishList objects - // */ - // public function findByExampleField($value): array - // { - // return $this->createQueryBuilder('w') - // ->andWhere('w.exampleField = :val') - // ->setParameter('val', $value) - // ->orderBy('w.id', 'ASC') - // ->setMaxResults(10) - // ->getQuery() - // ->getResult() - // ; - // } - - // public function findOneBySomeField($value): ?WishList - // { - // return $this->createQueryBuilder('w') - // ->andWhere('w.exampleField = :val') - // ->setParameter('val', $value) - // ->getQuery() - // ->getOneOrNullResult() - // ; - // } -} diff --git a/web_app/symfony.lock b/web_app/symfony.lock deleted file mode 100644 index 65f77fc..0000000 --- a/web_app/symfony.lock +++ /dev/null @@ -1,120 +0,0 @@ -{ - "doctrine/doctrine-bundle": { - "version": "2.13", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "2.13", - "ref": "8d96c0b51591ffc26794d865ba3ee7d193438a83" - }, - "files": [ - "config/packages/doctrine.yaml", - "src/Entity/.gitignore", - "src/Repository/.gitignore" - ] - }, - "doctrine/doctrine-fixtures-bundle": { - "version": "4.0", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "3.0", - "ref": "1f5514cfa15b947298df4d771e694e578d4c204d" - }, - "files": [ - "src/DataFixtures/AppFixtures.php" - ] - }, - "doctrine/doctrine-migrations-bundle": { - "version": "3.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "3.1", - "ref": "1d01ec03c6ecbd67c3375c5478c9a423ae5d6a33" - }, - "files": [ - "config/packages/doctrine_migrations.yaml", - "migrations/.gitignore" - ] - }, - "symfony/console": { - "version": "7.2", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "5.3", - "ref": "1781ff40d8a17d87cf53f8d4cf0c8346ed2bb461" - }, - "files": [ - "bin/console" - ] - }, - "symfony/flex": { - "version": "2.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "2.4", - "ref": "52e9754527a15e2b79d9a610f98185a1fe46622a" - }, - "files": [ - ".env", - ".env.dev" - ] - }, - "symfony/framework-bundle": { - "version": "7.2", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "7.2", - "ref": "87bcf6f7c55201f345d8895deda46d2adbdbaa89" - }, - "files": [ - "config/packages/cache.yaml", - "config/packages/framework.yaml", - "config/preload.php", - "config/routes/framework.yaml", - "config/services.yaml", - "public/index.php", - "src/Controller/.gitignore", - "src/Kernel.php" - ] - }, - "symfony/maker-bundle": { - "version": "1.62", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "1.0", - "ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f" - } - }, - "symfony/routing": { - "version": "7.2", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "7.0", - "ref": "21b72649d5622d8f7da329ffb5afb232a023619d" - }, - "files": [ - "config/packages/routing.yaml", - "config/routes.yaml" - ] - }, - "symfony/security-bundle": { - "version": "7.2", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "6.4", - "ref": "2ae08430db28c8eb4476605894296c82a642028f" - }, - "files": [ - "config/packages/security.yaml", - "config/routes/security.yaml" - ] - } -} -- GitLab