From dd2ec7ae2914072e63a642b3277c09d84b187d58 Mon Sep 17 00:00:00 2001 From: Regis Freyd Date: Thu, 11 Jan 2024 22:21:27 -0500 Subject: [PATCH 1/6] feat: vote a list --- app/Helpers/StringHelper.php | 7 + app/Http/Controllers/ShareController.php | 13 ++ app/Http/ViewModels/User/ListViewModel.php | 1 + app/Models/NameList.php | 1 + app/Services/CreateList.php | 2 + bun.lockb | Bin 100738 -> 101138 bytes composer.lock | 207 +++++++++--------- .../2023_12_27_025637_create_lists_table.php | 1 + package.json | 1 + resources/css/app.css | 4 + resources/js/app.js | 3 + resources/views/names/show.blade.php | 2 +- resources/views/user/lists/index.blade.php | 4 + resources/views/user/lists/show.blade.php | 27 ++- routes/web.php | 4 +- .../ViewModels/User/ListViewModelTest.php | 5 +- 16 files changed, 170 insertions(+), 112 deletions(-) create mode 100644 app/Http/Controllers/ShareController.php diff --git a/app/Helpers/StringHelper.php b/app/Helpers/StringHelper.php index 10a3a30..2d77f6e 100644 --- a/app/Helpers/StringHelper.php +++ b/app/Helpers/StringHelper.php @@ -40,4 +40,11 @@ public static function formatNameFromDB(string $name): string return $formattedName; } + + public static function shareLink(string $uuid): string + { + return route('share.show', [ + 'uuid' => $uuid, + ]); + } } diff --git a/app/Http/Controllers/ShareController.php b/app/Http/Controllers/ShareController.php new file mode 100644 index 0000000..89bbe3b --- /dev/null +++ b/app/Http/Controllers/ShareController.php @@ -0,0 +1,13 @@ + $list->name, 'description' => $list->description, 'names' => $names, + 'uuid' => StringHelper::shareLink($list->uuid), 'url' => [ 'show' => route('list.show', [ 'liste' => $list->id, diff --git a/app/Models/NameList.php b/app/Models/NameList.php index 7a31c99..f621954 100644 --- a/app/Models/NameList.php +++ b/app/Models/NameList.php @@ -19,6 +19,7 @@ class NameList extends Model protected $fillable = [ 'user_id', + 'uuid', 'name', 'description', 'is_public', diff --git a/app/Services/CreateList.php b/app/Services/CreateList.php index 7e8e15d..3baa266 100644 --- a/app/Services/CreateList.php +++ b/app/Services/CreateList.php @@ -3,6 +3,7 @@ namespace App\Services; use App\Models\NameList; +use Illuminate\Support\Str; class CreateList extends BaseService { @@ -27,6 +28,7 @@ private function createList(): void { $this->nameList = NameList::create([ 'user_id' => auth()->id(), + 'uuid' => Str::uuid(), 'name' => $this->name, 'description' => $this->description, 'is_public' => $this->isPublic, diff --git a/bun.lockb b/bun.lockb index 707fee944b35b43d0c25bb273fa131576ca9b2f5..de09d1a183358b129a0286dec448d26588fcdc0c 100755 GIT binary patch delta 16085 zcmeHO33wGnw(h#g4QU``-$+6d)&xk%$_)f^0TD@RWkmrO#uJ`z%RL3@H6JeaR=oY?njZU)tYt*7DS?*%K@8AHTDp{@h2$F3-7d z{z9Sg5K9YUtLI!X%GaG5P;Q}VHI>uGSGX&Sv>cnJg@7+Fu5ecsRccdanaVLnu8bQt|jnh_tw}XhsoeH}uAUY-r4m%iUFzlI|&* z*&ZXqe*J7(wc%-RXhlNM7BmWU9VjF40}TbOD5@+gxwlBWgkEF8p95tCCqe1hBzI-m z^ioYr4>CJijtOS_W8hgozOu5Ya=fN-;>nknRaQZ!oeG9EdNvXjG+62`Eh{e6G>?Jl za;Yu6IuW(>cZ#Kz9%i;0YneL^o~_H71~?9YH!{ZRCJ%ZXr(TwRnq}wl2-EJk3io&< zmga{spq*Pl>E=36^jlryabR+BRWUm#u1qqrYFTTuK^v=sP*B6sqKb({X`1GdkHesH z!X~&YtEQrTMbWfM`r0m9(}E#C14$rTLHiytNF(1MvJ>Cz>p?(pRzD$E9OnQxH5l*s7l`=h?%n52TppF%DWBw2CTA zic70dNH+)lUW<0iFbATf=w2)cP3r)jlVY=IOHia$O<_?{c~WtuHWBTx%4+(7b^x7R znKaWqr9^XAOe}X-R2F4Gj$G_nlZXOmpm<_wSp{Y+4!jPYiRdn=)LLYj{Dk7t!lY^C z+7j^8Um%D3ga<9?VR8Xz#d!+rDQEe#ai8yLiYJt~tE!3$HGyh+Q&c&vsu)I#DyL2> zs+g(8_cEg>sw}T4Lg#0Z+`-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z-KVFE$)*nE+yshZZeG@;1!WZZBJb(vw)vgG0rnCT)w+b~5f2 zF>4Y;A*vcn+iI~q4L$v1L-t-;LxaRMQqLC+I)RjlR-KS=+S1vQ-bgh>Cx!D*`%anB zTlle0QA>v8V4C&>DW!{fomf|_1tktw{seqi*K_cDt-o%&r47fUBCQYNc2d{;SMC1y zZ`oYP=`14ZCA33+oF6c0MfUngOC@;fa%#|kMn456f4E9ylG?A@TE~Cc+I_Ysq-)-O XIYTthU{CLSErXqDz4J>ai*EH_kh$Aa diff --git a/composer.lock b/composer.lock index 55083fc..279a8f9 100644 --- a/composer.lock +++ b/composer.lock @@ -1711,16 +1711,16 @@ }, { "name": "laravel/prompts", - "version": "v0.1.14", + "version": "v0.1.15", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "2219fa9c4b944add1e825c3bdb8ecae8bc503bc6" + "reference": "d814a27514d99b03c85aa42b22cfd946568636c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/2219fa9c4b944add1e825c3bdb8ecae8bc503bc6", - "reference": "2219fa9c4b944add1e825c3bdb8ecae8bc503bc6", + "url": "https://api.github.com/repos/laravel/prompts/zipball/d814a27514d99b03c85aa42b22cfd946568636c1", + "reference": "d814a27514d99b03c85aa42b22cfd946568636c1", "shasum": "" }, "require": { @@ -1762,9 +1762,9 @@ ], "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.14" + "source": "https://github.com/laravel/prompts/tree/v0.1.15" }, - "time": "2023-12-27T04:18:09+00:00" + "time": "2023-12-29T22:37:42+00:00" }, { "name": "laravel/sanctum", @@ -1834,16 +1834,16 @@ }, { "name": "laravel/scout", - "version": "v10.6.1", + "version": "v10.7.0", "source": { "type": "git", "url": "https://github.com/laravel/scout.git", - "reference": "fc9bc0c2061eb54b31d9dba0999755177a8f1a0e" + "reference": "adbcd2eab7bee46cc8c1183977a69c3b97184e38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/scout/zipball/fc9bc0c2061eb54b31d9dba0999755177a8f1a0e", - "reference": "fc9bc0c2061eb54b31d9dba0999755177a8f1a0e", + "url": "https://api.github.com/repos/laravel/scout/zipball/adbcd2eab7bee46cc8c1183977a69c3b97184e38", + "reference": "adbcd2eab7bee46cc8c1183977a69c3b97184e38", "shasum": "" }, "require": { @@ -1863,11 +1863,13 @@ "orchestra/testbench": "^7.31|^8.11", "php-http/guzzle7-adapter": "^1.0", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.3", + "typesense/typesense-php": "^4.9" }, "suggest": { "algolia/algoliasearch-client-php": "Required to use the Algolia engine (^3.2).", - "meilisearch/meilisearch-php": "Required to use the Meilisearch engine (^1.0)." + "meilisearch/meilisearch-php": "Required to use the Meilisearch engine (^1.0).", + "typesense/typesense-php": "Required to use the Typesense engine (^4.9)." }, "type": "library", "extra": { @@ -1905,7 +1907,7 @@ "issues": "https://github.com/laravel/scout/issues", "source": "https://github.com/laravel/scout" }, - "time": "2023-12-05T19:44:31+00:00" + "time": "2024-01-09T18:11:37+00:00" }, { "name": "laravel/serializable-closure", @@ -1969,25 +1971,25 @@ }, { "name": "laravel/tinker", - "version": "v2.8.2", + "version": "v2.9.0", "source": { "type": "git", "url": "https://github.com/laravel/tinker.git", - "reference": "b936d415b252b499e8c3b1f795cd4fc20f57e1f3" + "reference": "502e0fe3f0415d06d5db1f83a472f0f3b754bafe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/b936d415b252b499e8c3b1f795cd4fc20f57e1f3", - "reference": "b936d415b252b499e8c3b1f795cd4fc20f57e1f3", + "url": "https://api.github.com/repos/laravel/tinker/zipball/502e0fe3f0415d06d5db1f83a472f0f3b754bafe", + "reference": "502e0fe3f0415d06d5db1f83a472f0f3b754bafe", "shasum": "" }, "require": { - "illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0", - "illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0", - "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", "php": "^7.2.5|^8.0", - "psy/psysh": "^0.10.4|^0.11.1", - "symfony/var-dumper": "^4.3.4|^5.0|^6.0" + "psy/psysh": "^0.11.1|^0.12.0", + "symfony/var-dumper": "^4.3.4|^5.0|^6.0|^7.0" }, "require-dev": { "mockery/mockery": "~1.3.3|^1.4.2", @@ -1995,13 +1997,10 @@ "phpunit/phpunit": "^8.5.8|^9.3.3" }, "suggest": { - "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0|^10.0)." + "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0|^10.0|^11.0)." }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - }, "laravel": { "providers": [ "Laravel\\Tinker\\TinkerServiceProvider" @@ -2032,9 +2031,9 @@ ], "support": { "issues": "https://github.com/laravel/tinker/issues", - "source": "https://github.com/laravel/tinker/tree/v2.8.2" + "source": "https://github.com/laravel/tinker/tree/v2.9.0" }, - "time": "2023-08-15T14:27:00+00:00" + "time": "2024-01-04T16:10:04+00:00" }, { "name": "league/commonmark", @@ -4069,25 +4068,25 @@ }, { "name": "psy/psysh", - "version": "v0.11.22", + "version": "v0.12.0", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "128fa1b608be651999ed9789c95e6e2a31b5802b" + "reference": "750bf031a48fd07c673dbe3f11f72362ea306d0d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/128fa1b608be651999ed9789c95e6e2a31b5802b", - "reference": "128fa1b608be651999ed9789c95e6e2a31b5802b", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/750bf031a48fd07c673dbe3f11f72362ea306d0d", + "reference": "750bf031a48fd07c673dbe3f11f72362ea306d0d", "shasum": "" }, "require": { "ext-json": "*", "ext-tokenizer": "*", - "nikic/php-parser": "^4.0 || ^3.1", - "php": "^8.0 || ^7.0.8", - "symfony/console": "^6.0 || ^5.0 || ^4.0 || ^3.4", - "symfony/var-dumper": "^6.0 || ^5.0 || ^4.0 || ^3.4" + "nikic/php-parser": "^5.0 || ^4.0", + "php": "^8.0 || ^7.4", + "symfony/console": "^7.0 || ^6.0 || ^5.0 || ^4.0 || ^3.4", + "symfony/var-dumper": "^7.0 || ^6.0 || ^5.0 || ^4.0 || ^3.4" }, "conflict": { "symfony/console": "4.4.37 || 5.3.14 || 5.3.15 || 5.4.3 || 5.4.4 || 6.0.3 || 6.0.4" @@ -4098,8 +4097,7 @@ "suggest": { "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", "ext-pdo-sqlite": "The doc command requires SQLite to work.", - "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", - "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history." + "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well." }, "bin": [ "bin/psysh" @@ -4107,7 +4105,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-0.11": "0.11.x-dev" + "dev-main": "0.12.x-dev" }, "bamarni-bin": { "bin-links": false, @@ -4143,9 +4141,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.11.22" + "source": "https://github.com/bobthecow/psysh/tree/v0.12.0" }, - "time": "2023-10-14T21:56:36+00:00" + "time": "2023-12-20T15:28:09+00:00" }, { "name": "ralouphie/getallheaders", @@ -4509,20 +4507,20 @@ }, { "name": "spatie/laravel-package-tools", - "version": "1.16.1", + "version": "1.16.2", "source": { "type": "git", "url": "https://github.com/spatie/laravel-package-tools.git", - "reference": "cc7c991555a37f9fa6b814aa03af73f88026a83d" + "reference": "e62eeb1fe8a8a0b2e83227a6c279c8c59f7d3a15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/cc7c991555a37f9fa6b814aa03af73f88026a83d", - "reference": "cc7c991555a37f9fa6b814aa03af73f88026a83d", + "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/e62eeb1fe8a8a0b2e83227a6c279c8c59f7d3a15", + "reference": "e62eeb1fe8a8a0b2e83227a6c279c8c59f7d3a15", "shasum": "" }, "require": { - "illuminate/contracts": "^9.28|^10.0", + "illuminate/contracts": "^9.28|^10.0|^11.0", "php": "^8.0" }, "require-dev": { @@ -4557,7 +4555,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-package-tools/issues", - "source": "https://github.com/spatie/laravel-package-tools/tree/1.16.1" + "source": "https://github.com/spatie/laravel-package-tools/tree/1.16.2" }, "funding": [ { @@ -4565,7 +4563,7 @@ "type": "github" } ], - "time": "2023-08-23T09:04:39+00:00" + "time": "2024-01-11T08:43:00+00:00" }, { "name": "spatie/laravel-sitemap", @@ -8832,16 +8830,16 @@ }, { "name": "laravel/breeze", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/laravel/breeze.git", - "reference": "b0ac214483b5cf42fe5a8007d643d0fe9f95e2e1" + "reference": "6856cd4725b0f261b2d383b01a3875744051acf5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/breeze/zipball/b0ac214483b5cf42fe5a8007d643d0fe9f95e2e1", - "reference": "b0ac214483b5cf42fe5a8007d643d0fe9f95e2e1", + "url": "https://api.github.com/repos/laravel/breeze/zipball/6856cd4725b0f261b2d383b01a3875744051acf5", + "reference": "6856cd4725b0f261b2d383b01a3875744051acf5", "shasum": "" }, "require": { @@ -8890,20 +8888,20 @@ "issues": "https://github.com/laravel/breeze/issues", "source": "https://github.com/laravel/breeze" }, - "time": "2023-12-19T14:44:20+00:00" + "time": "2024-01-06T17:23:00+00:00" }, { "name": "laravel/dusk", - "version": "v7.12.0", + "version": "v7.12.1", "source": { "type": "git", "url": "https://github.com/laravel/dusk.git", - "reference": "94534fa924600e7a103f177d41b74e9b94f0994d" + "reference": "e7c2509034753dd4b2339b082884eef357673bf7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/dusk/zipball/94534fa924600e7a103f177d41b74e9b94f0994d", - "reference": "94534fa924600e7a103f177d41b74e9b94f0994d", + "url": "https://api.github.com/repos/laravel/dusk/zipball/e7c2509034753dd4b2339b082884eef357673bf7", + "reference": "e7c2509034753dd4b2339b082884eef357673bf7", "shasum": "" }, "require": { @@ -8964,22 +8962,22 @@ ], "support": { "issues": "https://github.com/laravel/dusk/issues", - "source": "https://github.com/laravel/dusk/tree/v7.12.0" + "source": "https://github.com/laravel/dusk/tree/v7.12.1" }, - "time": "2023-12-05T15:05:04+00:00" + "time": "2024-01-03T22:54:48+00:00" }, { "name": "laravel/pint", - "version": "v1.13.7", + "version": "v1.13.8", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "4157768980dbd977f1c4b4cc94997416d8b30ece" + "reference": "69def89df9e0babc0f0a8bea184804a7d8a9c5c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/4157768980dbd977f1c4b4cc94997416d8b30ece", - "reference": "4157768980dbd977f1c4b4cc94997416d8b30ece", + "url": "https://api.github.com/repos/laravel/pint/zipball/69def89df9e0babc0f0a8bea184804a7d8a9c5c0", + "reference": "69def89df9e0babc0f0a8bea184804a7d8a9c5c0", "shasum": "" }, "require": { @@ -8990,13 +8988,13 @@ "php": "^8.1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.38.0", - "illuminate/view": "^10.30.1", + "friendsofphp/php-cs-fixer": "^3.46.0", + "illuminate/view": "^10.39.0", + "larastan/larastan": "^2.8.1", "laravel-zero/framework": "^10.3.0", - "mockery/mockery": "^1.6.6", - "nunomaduro/larastan": "^2.6.4", + "mockery/mockery": "^1.6.7", "nunomaduro/termwind": "^1.15.1", - "pestphp/pest": "^2.24.2" + "pestphp/pest": "^2.30.0" }, "bin": [ "builds/pint" @@ -9032,20 +9030,20 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2023-12-05T19:43:12+00:00" + "time": "2024-01-09T18:03:54+00:00" }, { "name": "laravel/sail", - "version": "v1.26.3", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/laravel/sail.git", - "reference": "fa1ad5fbb03686dfc752bfd1861d86091cc1c32d" + "reference": "65a7764af5daadbd122e3b0d67be371d158a9b9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/sail/zipball/fa1ad5fbb03686dfc752bfd1861d86091cc1c32d", - "reference": "fa1ad5fbb03686dfc752bfd1861d86091cc1c32d", + "url": "https://api.github.com/repos/laravel/sail/zipball/65a7764af5daadbd122e3b0d67be371d158a9b9a", + "reference": "65a7764af5daadbd122e3b0d67be371d158a9b9a", "shasum": "" }, "require": { @@ -9097,7 +9095,7 @@ "issues": "https://github.com/laravel/sail/issues", "source": "https://github.com/laravel/sail" }, - "time": "2023-12-02T18:26:39+00:00" + "time": "2024-01-03T14:07:34+00:00" }, { "name": "mockery/mockery", @@ -9639,24 +9637,24 @@ }, { "name": "orchestra/testbench", - "version": "v8.19.0", + "version": "v8.20.0", "source": { "type": "git", "url": "https://github.com/orchestral/testbench.git", - "reference": "a3c7b35102f76135962451324703738f5551d46b" + "reference": "533df85bd4a084b5f505ad9182cc9031b2f81a03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench/zipball/a3c7b35102f76135962451324703738f5551d46b", - "reference": "a3c7b35102f76135962451324703738f5551d46b", + "url": "https://api.github.com/repos/orchestral/testbench/zipball/533df85bd4a084b5f505ad9182cc9031b2f81a03", + "reference": "533df85bd4a084b5f505ad9182cc9031b2f81a03", "shasum": "" }, "require": { "composer-runtime-api": "^2.2", "fakerphp/faker": "^1.21", - "laravel/framework": "^10.39", + "laravel/framework": "^10.40", "mockery/mockery": "^1.5.1", - "orchestra/testbench-core": "^8.19", + "orchestra/testbench-core": "^8.20", "orchestra/workbench": "^1.2 || ^8.2", "php": "^8.1", "phpunit/phpunit": "^9.6 || ^10.1", @@ -9688,22 +9686,22 @@ ], "support": { "issues": "https://github.com/orchestral/testbench/issues", - "source": "https://github.com/orchestral/testbench/tree/v8.19.0" + "source": "https://github.com/orchestral/testbench/tree/v8.20.0" }, - "time": "2023-12-28T14:58:57+00:00" + "time": "2024-01-10T04:33:51+00:00" }, { "name": "orchestra/testbench-core", - "version": "v8.19.0", + "version": "v8.20.0", "source": { "type": "git", "url": "https://github.com/orchestral/testbench-core.git", - "reference": "15645dd792968f48a27a26fc4f542c16d9f07e0d" + "reference": "beb3af0737b0ac49c29b4bc26de548845f097abc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/15645dd792968f48a27a26fc4f542c16d9f07e0d", - "reference": "15645dd792968f48a27a26fc4f542c16d9f07e0d", + "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/beb3af0737b0ac49c29b4bc26de548845f097abc", + "reference": "beb3af0737b0ac49c29b4bc26de548845f097abc", "shasum": "" }, "require": { @@ -9713,14 +9711,14 @@ }, "conflict": { "brianium/paratest": "<6.4.0 || >=7.0.0 <7.1.4 || >=8.0.0", - "laravel/framework": "<10.39 || >=11.0.0", + "laravel/framework": "<10.40 || >=11.0.0", "nunomaduro/collision": "<6.4.0 || >=7.0.0 <7.4.0 || >=8.0.0", "orchestra/workbench": "<1.0.0", - "phpunit/phpunit": "<9.6.0 || 10.5.4 || >=10.6.0" + "phpunit/phpunit": "<9.6.0 || >=10.6.0" }, "require-dev": { "fakerphp/faker": "^1.21", - "laravel/framework": "^10.39", + "laravel/framework": "^10.40", "laravel/pint": "^1.6", "mockery/mockery": "^1.5.1", "phpstan/phpstan": "^1.10.7", @@ -9734,14 +9732,15 @@ "brianium/paratest": "Allow using parallel testing (^6.4 || ^7.1.4).", "ext-pcntl": "Required to use all features of the console signal trapping.", "fakerphp/faker": "Allow using Faker for testing (^1.21).", - "laravel/framework": "Required for testing (^10.39).", + "laravel/framework": "Required for testing (^10.40).", "mockery/mockery": "Allow using Mockery for testing (^1.5.1).", "nunomaduro/collision": "Allow using Laravel style tests output and parallel testing (^6.4 || ^7.4).", "orchestra/testbench-browser-kit": "Allow using legacy Laravel BrowserKit for testing (^8.0).", "orchestra/testbench-dusk": "Allow using Laravel Dusk for testing (^8.0).", "phpunit/phpunit": "Allow using PHPUnit for testing (^9.6 || ^10.1).", - "symfony/yaml": "Required for CLI Commander (^6.2).", - "vlucas/phpdotenv": "Required for CLI Commander (^5.4.1)." + "symfony/process": "Required to use Orchestra\\Testbench\\remote function (^6.2).", + "symfony/yaml": "Required for Testbench CLI (^6.2).", + "vlucas/phpdotenv": "Required for Testbench CLI (^5.4.1)." }, "bin": [ "testbench" @@ -9780,7 +9779,7 @@ "issues": "https://github.com/orchestral/testbench/issues", "source": "https://github.com/orchestral/testbench-core" }, - "time": "2023-12-28T14:44:29+00:00" + "time": "2024-01-10T03:05:52+00:00" }, { "name": "orchestra/workbench", @@ -10141,16 +10140,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.7.3", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419" + "reference": "fad452781b3d774e3337b0c0b245dd8e5a4455fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419", - "reference": "3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fad452781b3d774e3337b0c0b245dd8e5a4455fc", + "reference": "fad452781b3d774e3337b0c0b245dd8e5a4455fc", "shasum": "" }, "require": { @@ -10193,9 +10192,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.3" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.0" }, - "time": "2023-08-12T11:01:26+00:00" + "time": "2024-01-11T11:49:22+00:00" }, { "name": "phpmyadmin/sql-parser", @@ -12888,16 +12887,16 @@ }, { "name": "vimeo/psalm", - "version": "5.18.0", + "version": "5.19.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "b113f3ed0259fd6e212d87c3df80eec95a6abf19" + "reference": "06b71be009a6bd6d81b9811855d6629b9fe90e1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/b113f3ed0259fd6e212d87c3df80eec95a6abf19", - "reference": "b113f3ed0259fd6e212d87c3df80eec95a6abf19", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/06b71be009a6bd6d81b9811855d6629b9fe90e1b", + "reference": "06b71be009a6bd6d81b9811855d6629b9fe90e1b", "shasum": "" }, "require": { @@ -12994,7 +12993,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2023-12-16T09:37:35+00:00" + "time": "2024-01-09T21:02:43+00:00" }, { "name": "zbateson/mail-mime-parser", diff --git a/database/migrations/2023_12_27_025637_create_lists_table.php b/database/migrations/2023_12_27_025637_create_lists_table.php index d2093bb..d1a41ee 100644 --- a/database/migrations/2023_12_27_025637_create_lists_table.php +++ b/database/migrations/2023_12_27_025637_create_lists_table.php @@ -14,6 +14,7 @@ public function up(): void Schema::create('lists', function (Blueprint $table) { $table->id(); $table->unsignedBigInteger('user_id'); + $table->string('uuid')->nullable(); $table->string('name')->nullable(); $table->string('description')->nullable(); $table->boolean('is_public')->default(true); diff --git a/package.json b/package.json index 2573e3f..ffc8ae1 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "vite": "^4.0.0" }, "dependencies": { + "@ryangjchandler/alpine-clipboard": "^2.3.0", "@tailwindcss/forms": "^0.5.2", "@tailwindcss/typography": "^0.5.10", "alpinejs": "^3.4.2", diff --git a/resources/css/app.css b/resources/css/app.css index 21b94e1..0fcef93 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -20,3 +20,7 @@ grid-template-columns: 1fr; } } + +[x-cloak] { + display: none !important; +} diff --git a/resources/js/app.js b/resources/js/app.js index 6f35946..e22d0c2 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,10 +1,13 @@ import './bootstrap'; import Alpine from 'alpinejs'; +import Clipboard from "@ryangjchandler/alpine-clipboard"; import htmx from 'htmx.org'; import 'charts.css'; window.Alpine = Alpine; window.htmx = htmx; +Alpine.plugin(Clipboard); +window.Alpine = Alpine; Alpine.start(); diff --git a/resources/views/names/show.blade.php b/resources/views/names/show.blade.php index 9fff547..7939db3 100644 --- a/resources/views/names/show.blade.php +++ b/resources/views/names/show.blade.php @@ -189,7 +189,7 @@ @if (count($lists) !== 0)
-

Vous pouvez aussi l'ajouter à une ou plusieurs listes :

+

Vous pouvez aussi l'ajouter à une ou plusieurs listes en cliquant sur le petit plus :

-
+

{{ $list['name'] }}

@if ($list['description'] !== null) @@ -28,11 +28,32 @@ @endif
    -
  • Editer
  • +
  • Ajouter un prénom à la liste
  • +
  • Partager la liste et activer les votes
  • +
  • Editer
  • Supprimer
-
+
+

Pour permettre aux gens de voter sur cette liste, copier le lien ci-dessous et envoyez le à ceux qui comptent. Voter sur la liste ne nécessite pas de compte. De plus, chaque personne qui recoit le lien aura droit à un vote.

+

Vous pourrez réinitialiser les votes quand vous voudrez.

+
+ + +
+
+ +
@include('user.lists.partials.search-items')
diff --git a/routes/web.php b/routes/web.php index 6a52437..3c5b749 100644 --- a/routes/web.php +++ b/routes/web.php @@ -6,16 +6,16 @@ use App\Http\Controllers\ListController; use App\Http\Controllers\ListNameController; use App\Http\Controllers\ListSearchController; -use App\Http\Controllers\LocaleController; use App\Http\Controllers\MaleNameController; use App\Http\Controllers\MixteNameController; use App\Http\Controllers\NameController; use App\Http\Controllers\NameFavoriteController; use App\Http\Controllers\ProfileController; use App\Http\Controllers\SearchController; +use App\Http\Controllers\ShareController; use Illuminate\Support\Facades\Route; -Route::get('locale/{locale}', [LocaleController::class, 'update'])->name('locale.update'); +Route::get('partage/{uuid}', [ShareController::class, 'show'])->name('share.show'); Route::get('', [HomeController::class, 'index'])->name('home.index'); Route::get('recherche', [SearchController::class, 'index'])->name('search.index'); diff --git a/tests/Unit/ViewModels/User/ListViewModelTest.php b/tests/Unit/ViewModels/User/ListViewModelTest.php index 0d73f9f..161be40 100644 --- a/tests/Unit/ViewModels/User/ListViewModelTest.php +++ b/tests/Unit/ViewModels/User/ListViewModelTest.php @@ -64,18 +64,19 @@ public function it_gets_the_list_of_names_in_the_list(): void $array = ListViewModel::show($nameList); - $this->assertCount(5, $array); + $this->assertCount(6, $array); $this->assertArrayHasKey('id', $array); $this->assertArrayHasKey('name', $array); $this->assertArrayHasKey('description', $array); $this->assertArrayHasKey('names', $array); + $this->assertArrayHasKey('uuid', $array); $this->assertArrayHasKey('url', $array); $this->assertEquals( [ 0 => [ 'id' => $name->id, - 'name' => 'Test', 'total' => '1 000', + 'name' => 'Test', 'url' => [ 'show' => env('APP_URL') . '/prenoms/' . $name->id . '/test', 'destroy' => env('APP_URL') . '/listes/' . $nameList->id . '/prenoms/' . $name->id, From d930b7d653567adcee5d38b9f3833c05e7c3f4f0 Mon Sep 17 00:00:00 2001 From: Regis Freyd Date: Thu, 11 Jan 2024 22:26:03 -0500 Subject: [PATCH 2/6] wip --- database/factories/NameListFactory.php | 1 + tests/Unit/ViewModels/User/ListViewModelTest.php | 1 + 2 files changed, 2 insertions(+) diff --git a/database/factories/NameListFactory.php b/database/factories/NameListFactory.php index 9fbd5cc..6f9de16 100644 --- a/database/factories/NameListFactory.php +++ b/database/factories/NameListFactory.php @@ -24,6 +24,7 @@ public function definition(): array 'is_public' => fake()->boolean, 'can_be_modified' => fake()->boolean, 'is_list_of_favorites' => fake()->boolean, + 'uuid' => fake()->uuid, ]; } } diff --git a/tests/Unit/ViewModels/User/ListViewModelTest.php b/tests/Unit/ViewModels/User/ListViewModelTest.php index 161be40..3efb8dc 100644 --- a/tests/Unit/ViewModels/User/ListViewModelTest.php +++ b/tests/Unit/ViewModels/User/ListViewModelTest.php @@ -57,6 +57,7 @@ public function it_gets_the_list_of_names_in_the_list(): void $user = User::factory()->create(); $nameList = $user->lists()->create([ 'is_list_of_favorites' => true, + 'uuid' => '1234567890', ]); $nameList->names()->attach($name->id); From b72c917638db884e926ea8eb0149897cce49a353 Mon Sep 17 00:00:00 2001 From: Regis Freyd Date: Thu, 11 Jan 2024 22:27:30 -0500 Subject: [PATCH 3/6] Update ShareController.php --- app/Http/Controllers/ShareController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ShareController.php b/app/Http/Controllers/ShareController.php index 89bbe3b..d82c2f0 100644 --- a/app/Http/Controllers/ShareController.php +++ b/app/Http/Controllers/ShareController.php @@ -7,7 +7,7 @@ class ShareController extends Controller { - public function show(Request $request): View + public function show(Request $request): void { } } From 2863a60e05c561126134ff262beb71d7f6baf474 Mon Sep 17 00:00:00 2001 From: Regis Freyd Date: Thu, 11 Jan 2024 22:45:03 -0500 Subject: [PATCH 4/6] Update show.blade.php --- resources/views/user/lists/show.blade.php | 34 +++++++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/resources/views/user/lists/show.blade.php b/resources/views/user/lists/show.blade.php index a971529..0008eac 100644 --- a/resources/views/user/lists/show.blade.php +++ b/resources/views/user/lists/show.blade.php @@ -27,12 +27,34 @@

{{ $list['description'] }}

@endif -
    -
  • Ajouter un prénom à la liste
  • -
  • Partager la liste et activer les votes
  • -
  • Editer
  • -
  • Supprimer
  • -
+
+
+ + + + Ajouter un prénom à la liste + + +
+
+ + + Partager la liste et activer les votes + +
+ + +

Pour permettre aux gens de voter sur cette liste, copier le lien ci-dessous et envoyez le à ceux qui comptent. Voter sur la liste ne nécessite pas de compte. De plus, chaque personne qui recoit le lien aura droit à un vote.

From f0b610fb3db635576379cca3a0925cca09572912 Mon Sep 17 00:00:00 2001 From: Regis Freyd Date: Tue, 16 Jan 2024 20:42:07 -0500 Subject: [PATCH 5/6] feat: add note to name --- app/Http/Controllers/NameController.php | 4 ++ app/Http/Controllers/ShareController.php | 1 - app/Http/Controllers/UserNameController.php | 31 +++++++++++ app/Http/ViewModels/Names/NameViewModel.php | 4 ++ .../ViewModels/Search/SearchViewModel.php | 1 + app/Models/Name.php | 17 ++++++ app/Models/Note.php | 30 +++++++++++ app/Services/AddNoteToName.php | 34 ++++++++++++ app/Services/CreateAccount.php | 2 + database/factories/NoteFactory.php | 29 ++++++++++ ...24_01_16_223956_create_name_user_table.php | 24 +++++++++ resources/views/names/partials/note.blade.php | 54 +++++++++++++++++++ resources/views/names/show.blade.php | 17 +++--- routes/web.php | 4 ++ tests/Unit/Models/NameTest.php | 20 +++++++ tests/Unit/Models/NoteTest.php | 36 +++++++++++++ .../ViewModels/Names/NameViewModelTest.php | 1 + 17 files changed, 302 insertions(+), 7 deletions(-) create mode 100644 app/Http/Controllers/UserNameController.php create mode 100644 app/Models/Note.php create mode 100644 app/Services/AddNoteToName.php create mode 100644 database/factories/NoteFactory.php create mode 100644 database/migrations/2024_01_16_223956_create_name_user_table.php create mode 100644 resources/views/names/partials/note.blade.php create mode 100644 tests/Unit/Models/NoteTest.php diff --git a/app/Http/Controllers/NameController.php b/app/Http/Controllers/NameController.php index 05baf06..19dbce1 100644 --- a/app/Http/Controllers/NameController.php +++ b/app/Http/Controllers/NameController.php @@ -77,12 +77,15 @@ public function show(Request $request): View if (! auth()->check()) { $favoritedNamesForLoggedUser = collect(); $lists = []; + $note = ''; } else { $favoritedNamesForLoggedUser = Cache::remember('user-favorites-' . auth()->id(), 604800, function () { return UserViewModel::favorites(); }); $lists = ListViewModel::lists($requestedName); + + $note = $requestedName->getNoteForUser(); } return view('names.show', [ @@ -93,6 +96,7 @@ public function show(Request $request): View 'numerology' => $numerology, 'favorites' => $favoritedNamesForLoggedUser, 'lists' => $lists, + 'note' => $note, ]); } diff --git a/app/Http/Controllers/ShareController.php b/app/Http/Controllers/ShareController.php index d82c2f0..c84e51d 100644 --- a/app/Http/Controllers/ShareController.php +++ b/app/Http/Controllers/ShareController.php @@ -3,7 +3,6 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; -use Illuminate\View\View; class ShareController extends Controller { diff --git a/app/Http/Controllers/UserNameController.php b/app/Http/Controllers/UserNameController.php new file mode 100644 index 0000000..efff119 --- /dev/null +++ b/app/Http/Controllers/UserNameController.php @@ -0,0 +1,31 @@ +attributes->get('name'); + + (new AddNoteToName( + nameId: $name->id, + userId: auth()->id(), + noteText: $request->input('note'), + ))->execute(); + + return Redirect::route('name.show', [ + 'id' => $name->id, + 'name' => StringHelper::sanitizeNameForURL($name->name), + ]); + } +} diff --git a/app/Http/ViewModels/Names/NameViewModel.php b/app/Http/ViewModels/Names/NameViewModel.php index 2308ceb..b2dc8b1 100644 --- a/app/Http/ViewModels/Names/NameViewModel.php +++ b/app/Http/ViewModels/Names/NameViewModel.php @@ -56,6 +56,10 @@ public static function details(Name $name): array 'favorite' => route('favorite.name.update', [ 'id' => $name->id, ]), + 'note_edit' => route('user.name.update', [ + 'id' => $name->id, + 'name' => StringHelper::sanitizeNameForURL($name->name), + ]), ], ]; } diff --git a/app/Http/ViewModels/Search/SearchViewModel.php b/app/Http/ViewModels/Search/SearchViewModel.php index e28d14e..0d35512 100644 --- a/app/Http/ViewModels/Search/SearchViewModel.php +++ b/app/Http/ViewModels/Search/SearchViewModel.php @@ -16,6 +16,7 @@ public static function names(?string $term = null, int $limit = 20): array ->map(fn (Name $name) => [ 'id' => $name->id, 'name' => StringHelper::formatNameFromDB($name->name), + 'gender' => $name->gender == 'male' ? 'masculin' : 'feminin', 'url' => [ 'show' => route('name.show', [ 'id' => $name->id, diff --git a/app/Models/Name.php b/app/Models/Name.php index e92e345..6193ee8 100644 --- a/app/Models/Name.php +++ b/app/Models/Name.php @@ -77,4 +77,21 @@ public function toSitemapTag(): Url|string|array ->setChangeFrequency(Url::CHANGE_FREQUENCY_MONTHLY) ->setPriority(0.1); } + + public function getNoteForUser(): ?string + { + if (! auth()->check()) { + return null; + } + + $note = Note::where('name_id', $this->id) + ->where('user_id', auth()->id()) + ->first(); + + if (! $note) { + return null; + } + + return $note->content; + } } diff --git a/app/Models/Note.php b/app/Models/Note.php new file mode 100644 index 0000000..0c4e23a --- /dev/null +++ b/app/Models/Note.php @@ -0,0 +1,30 @@ +belongsTo(User::class); + } + + public function name(): BelongsTo + { + return $this->belongsTo(Name::class); + } +} diff --git a/app/Services/AddNoteToName.php b/app/Services/AddNoteToName.php new file mode 100644 index 0000000..3c7c9f9 --- /dev/null +++ b/app/Services/AddNoteToName.php @@ -0,0 +1,34 @@ +create(); + + return $this->note; + } + + private function create(): void + { + $this->note = Note::updateOrCreate([ + 'name_id' => $this->nameId, + 'user_id' => $this->userId, + ], [ + 'content' => $this->noteText, + ]); + } +} diff --git a/app/Services/CreateAccount.php b/app/Services/CreateAccount.php index 5e20c6b..efb51af 100644 --- a/app/Services/CreateAccount.php +++ b/app/Services/CreateAccount.php @@ -5,6 +5,7 @@ use App\Models\NameList; use App\Models\User; use Illuminate\Support\Facades\Hash; +use Illuminate\Support\Str; /** * Create an account for the user. @@ -55,6 +56,7 @@ private function createDefaultList(): void 'is_public' => false, 'can_be_modified' => true, 'is_list_of_favorites' => false, + 'uuid' => Str::uuid(), ]); } } diff --git a/database/factories/NoteFactory.php b/database/factories/NoteFactory.php new file mode 100644 index 0000000..c161a7e --- /dev/null +++ b/database/factories/NoteFactory.php @@ -0,0 +1,29 @@ + + */ +class NoteFactory extends Factory +{ + protected static ?string $password; + + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + 'user_id' => User::factory(), + 'name_id' => Name::factory(), + 'content' => fake()->sentence(), + ]; + } +} diff --git a/database/migrations/2024_01_16_223956_create_name_user_table.php b/database/migrations/2024_01_16_223956_create_name_user_table.php new file mode 100644 index 0000000..6c61fb2 --- /dev/null +++ b/database/migrations/2024_01_16_223956_create_name_user_table.php @@ -0,0 +1,24 @@ +id(); + $table->unsignedBigInteger('user_id'); + $table->unsignedBigInteger('name_id'); + $table->string('content'); + $table->timestamps(); + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + $table->foreign('name_id')->references('id')->on('names')->onDelete('cascade'); + }); + } +}; diff --git a/resources/views/names/partials/note.blade.php b/resources/views/names/partials/note.blade.php new file mode 100644 index 0000000..f241cd9 --- /dev/null +++ b/resources/views/names/partials/note.blade.php @@ -0,0 +1,54 @@ +@if ($note != '') + +
+ Note privée + +
    +
  • Editer
  • +
  • Supprimer
  • +
+
+
+ {!! $note !!} +
+ +@else + +
+

Ajoutez une note privée à ce prénom.

+ @auth + + + Ajouter + + @else + + + Ajouter + + @endauth +
+ +@endif + +
+
+ {{ old('note', $note) }} + + +
+ +
+ + + Annuler +
+
diff --git a/resources/views/names/show.blade.php b/resources/views/names/show.blade.php index 7939db3..82fdaef 100644 --- a/resources/views/names/show.blade.php +++ b/resources/views/names/show.blade.php @@ -65,22 +65,22 @@ @@ -108,6 +108,11 @@
+ +
+ @include('names.partials.note') +
+

diff --git a/routes/web.php b/routes/web.php index 3c5b749..04513b4 100644 --- a/routes/web.php +++ b/routes/web.php @@ -13,6 +13,7 @@ use App\Http\Controllers\ProfileController; use App\Http\Controllers\SearchController; use App\Http\Controllers\ShareController; +use App\Http\Controllers\UserNameController; use Illuminate\Support\Facades\Route; Route::get('partage/{uuid}', [ShareController::class, 'show'])->name('share.show'); @@ -46,6 +47,9 @@ // used on the show page Route::put('prenoms/{id}/show/favorite', [NameFavoriteController::class, 'update'])->name('favorite.name.update'); + + // set the note for the given name + Route::put('prenoms/{id}/{name}/note', [UserNameController::class, 'update'])->name('user.name.update'); }); Route::get('favoris', [FavoriteController::class, 'index'])->name('favorite.index'); diff --git a/tests/Unit/Models/NameTest.php b/tests/Unit/Models/NameTest.php index e7a5026..81ecef5 100644 --- a/tests/Unit/Models/NameTest.php +++ b/tests/Unit/Models/NameTest.php @@ -5,6 +5,8 @@ use App\Models\Name; use App\Models\NameList; use App\Models\NameStatistic; +use App\Models\Note; +use App\Models\User; use Illuminate\Foundation\Testing\DatabaseTransactions; use Tests\TestCase; @@ -32,4 +34,22 @@ public function it_has_many_name_lists(): void $this->assertTrue($name->lists()->exists()); } + + /** @test */ + public function it_gets_the_content_of_the_note_for_the_user_if_it_is_set(): void + { + $name = Name::factory()->create(); + $user = User::factory()->create(); + $this->be($user); + Note::factory()->create([ + 'name_id' => $name->id, + 'user_id' => $user->id, + 'content' => 'This is a note', + ]); + + $this->assertEquals( + 'This is a note', + $name->getNoteForUser() + ); + } } diff --git a/tests/Unit/Models/NoteTest.php b/tests/Unit/Models/NoteTest.php new file mode 100644 index 0000000..2b08e4f --- /dev/null +++ b/tests/Unit/Models/NoteTest.php @@ -0,0 +1,36 @@ +create(); + $note = Note::factory()->create([ + 'name_id' => $name->id, + ]); + + $this->assertTrue($note->name()->exists()); + } + + /** @test */ + public function it_belongs_to_a_user(): void + { + $user = User::factory()->create(); + $note = Note::factory()->create([ + 'user_id' => $user->id, + ]); + + $this->assertTrue($note->user()->exists()); + } +} diff --git a/tests/Unit/ViewModels/Names/NameViewModelTest.php b/tests/Unit/ViewModels/Names/NameViewModelTest.php index b73ec1b..7e22e10 100644 --- a/tests/Unit/ViewModels/Names/NameViewModelTest.php +++ b/tests/Unit/ViewModels/Names/NameViewModelTest.php @@ -78,6 +78,7 @@ public function it_gets_the_details_of_a_name(): void [ 'show' => env('APP_URL') . '/prenoms/' . $name->id . '/heloise', 'favorite' => env('APP_URL') . '/prenoms/' . $name->id . '/show/favorite', + 'note_edit' => env('APP_URL') . '/prenoms/' . $name->id . '/heloise/note', ], $array['url'] ); From 8df35dc47ed8782f51a420aa3bf4ec0447d1a03d Mon Sep 17 00:00:00 2001 From: Regis Freyd Date: Mon, 22 Jan 2024 07:50:52 -0500 Subject: [PATCH 6/6] wip --- app/Http/Controllers/NameController.php | 8 + .../Controllers/NameFavoriteController.php | 1 + app/Http/Controllers/UserNameController.php | 76 ++++++- app/Http/ViewModels/Names/NameViewModel.php | 1 - app/Http/ViewModels/User/UserViewModel.php | 1 + app/Services/DestroyNote.php | 31 +++ bun.lockb | Bin 101138 -> 102580 bytes composer.lock | 187 +++++++++--------- .../views/components/note-show.blade.php | 39 ++++ .../views/names/partials/edit-note.blade.php | 21 ++ resources/views/names/partials/note.blade.php | 54 ----- resources/views/names/show.blade.php | 4 +- resources/views/user/index.blade.php | 3 + routes/web.php | 5 +- .../ViewModels/Names/NameViewModelTest.php | 2 +- .../ViewModels/User/UserViewModelTest.php | 7 + 16 files changed, 281 insertions(+), 159 deletions(-) create mode 100644 app/Services/DestroyNote.php create mode 100644 resources/views/components/note-show.blade.php create mode 100644 resources/views/names/partials/edit-note.blade.php delete mode 100644 resources/views/names/partials/note.blade.php diff --git a/app/Http/Controllers/NameController.php b/app/Http/Controllers/NameController.php index 19dbce1..299be2d 100644 --- a/app/Http/Controllers/NameController.php +++ b/app/Http/Controllers/NameController.php @@ -97,6 +97,14 @@ public function show(Request $request): View 'favorites' => $favoritedNamesForLoggedUser, 'lists' => $lists, 'note' => $note, + 'url' => [ + 'edit' => route('user.name.edit', [ + 'id' => $requestedName->id, + ]), + 'delete' => route('user.name.destroy', [ + 'id' => $requestedName->id, + ]), + ], ]); } diff --git a/app/Http/Controllers/NameFavoriteController.php b/app/Http/Controllers/NameFavoriteController.php index cffdf13..b0a7fea 100644 --- a/app/Http/Controllers/NameFavoriteController.php +++ b/app/Http/Controllers/NameFavoriteController.php @@ -19,6 +19,7 @@ public function update(Request $request): View ))->execute(); Cache::forget('user-favorites-' . auth()->id()); + Cache::forget('user-favorites-details-' . auth()->id()); return view('components.favorite', [ 'name' => NameViewModel::details($name), diff --git a/app/Http/Controllers/UserNameController.php b/app/Http/Controllers/UserNameController.php index efff119..d55579b 100644 --- a/app/Http/Controllers/UserNameController.php +++ b/app/Http/Controllers/UserNameController.php @@ -3,17 +3,48 @@ namespace App\Http\Controllers; use App\Helpers\StringHelper; -use App\Http\ViewModels\Names\NameViewModel; use App\Services\AddNoteToName; -use Illuminate\Http\RedirectResponse; +use App\Services\DestroyNote; use Illuminate\Http\Request; use Illuminate\Support\Facades\Cache; -use Illuminate\Support\Facades\Redirect; use Illuminate\View\View; class UserNameController extends Controller { - public function update(Request $request): RedirectResponse + public function show(Request $request): View + { + $name = $request->attributes->get('name'); + + return view('components.note-show', [ + 'note' => $name->getNoteForUser(), + 'url' => route('user.name.edit', [ + 'id' => $name->id, + ]), + 'deleteUrl' => route('user.name.destroy', [ + 'id' => $name->id, + ]), + ]); + } + + public function edit(Request $request): View + { + $name = $request->attributes->get('name'); + + return view('names.partials.edit-note', [ + 'note' => $name->getNoteForUser(), + 'url' => [ + 'show' => route('user.name.show', [ + 'id' => $name->id, + ]), + 'update' => route('user.name.update', [ + 'id' => $name->id, + 'name' => StringHelper::sanitizeNameForURL($name->name), + ]), + ], + ]); + } + + public function update(Request $request): View { $name = $request->attributes->get('name'); @@ -23,9 +54,40 @@ public function update(Request $request): RedirectResponse noteText: $request->input('note'), ))->execute(); - return Redirect::route('name.show', [ - 'id' => $name->id, - 'name' => StringHelper::sanitizeNameForURL($name->name), + Cache::forget('user-favorites-' . auth()->id()); + Cache::forget('user-favorites-details-' . auth()->id()); + + return view('components.note-show', [ + 'note' => $name->getNoteForUser(), + 'url' => route('user.name.edit', [ + 'id' => $name->id, + ]), + 'deleteUrl' => route('user.name.destroy', [ + 'id' => $name->id, + ]), + ]); + } + + public function destroy(Request $request): View + { + $name = $request->attributes->get('name'); + + (new DestroyNote( + userId: auth()->id(), + nameId: $name->id, + ))->execute(); + + Cache::forget('user-favorites-' . auth()->id()); + Cache::forget('user-favorites-details-' . auth()->id()); + + return view('components.note-show', [ + 'note' => $name->getNoteForUser(), + 'url' => route('user.name.edit', [ + 'id' => $name->id, + ]), + 'deleteUrl' => route('user.name.destroy', [ + 'id' => $name->id, + ]), ]); } } diff --git a/app/Http/ViewModels/Names/NameViewModel.php b/app/Http/ViewModels/Names/NameViewModel.php index b2dc8b1..210c81f 100644 --- a/app/Http/ViewModels/Names/NameViewModel.php +++ b/app/Http/ViewModels/Names/NameViewModel.php @@ -58,7 +58,6 @@ public static function details(Name $name): array ]), 'note_edit' => route('user.name.update', [ 'id' => $name->id, - 'name' => StringHelper::sanitizeNameForURL($name->name), ]), ], ]; diff --git a/app/Http/ViewModels/User/UserViewModel.php b/app/Http/ViewModels/User/UserViewModel.php index 662b196..6f6307f 100644 --- a/app/Http/ViewModels/User/UserViewModel.php +++ b/app/Http/ViewModels/User/UserViewModel.php @@ -35,6 +35,7 @@ public static function index(): array 'id' => $name->id, 'name' => StringHelper::formatNameFromDB($name->name), 'total' => Number::format($name->total, locale: 'fr'), + 'note' => $name->getNoteForUser(), 'url' => [ 'show' => route('name.show', [ 'id' => $name->id, diff --git a/app/Services/DestroyNote.php b/app/Services/DestroyNote.php new file mode 100644 index 0000000..d65faa4 --- /dev/null +++ b/app/Services/DestroyNote.php @@ -0,0 +1,31 @@ +check(); + } + + private function check(): void + { + $this->note = Note::where([ + 'name_id' => $this->nameId, + 'user_id' => $this->userId, + ])->firstOrFail(); + + $this->note->delete(); + } +} diff --git a/bun.lockb b/bun.lockb index de09d1a183358b129a0286dec448d26588fcdc0c..edc0dbbf3d62fe795a9de847bd4d1764da7ce61d 100755 GIT binary patch delta 2019 zcmb7_Yfuwc6vy`_gpgGsgohD=5T3)f&O#k)mi~0Nt!<>cUz?n4 zQ7sawOH#70R95Afwuv)6nNOy?!?cNQOj5PcmDn=}#ePh@R>X8JD(0WESQw+&hcW7< z2p&^6Jk$4TJ;l=2f5A<_H#X5?b4b^<+zC>gHGn7Uf zkFJBFY)6NI<`Q}#MJ#L<6?Jg%y-YMJRd~M^2YF+G$fx4|nV%{uPrezfJ%P+0nury@PCU;@+ zQ0DoMPb&{!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m!!)wHsimq`4sB7- zJ@ifGU9aiQsGUBWpAnAtw~gh5C+;7J1TL;TWqoS8bL9P@6Md6j`s!wH_~pWUxvc#5 z&JFKgZU5jiIynB?UoSPSYkq5_`s9~t+_GdKD|UDP{<5UFm-s>ScUKBq(kc3qm7*$H zD{{WA6l(Wb@tf+2=k;82i>}KaQPs00e*Ra|9K9)SP*Hv&dC)+m>8VF^;%pSmb}k1D zVn~-DLtEy@fTnL z{{nudg3ke8p5Gq7hcrf}nb4yLmSwc^S3b}N4+B=FzU~S5 zHGtRoWD~Y1%F>tTAld-9EL+c(!&d+<^Xu6If`J+>iJ#5XZCvmj=KOQ;&%p2Fh9cYT zR4-KrWy=x=J!`ihg$A7x70VMB9CY4D74o)=auY2sT4h{WipSHu1}h(7cnDIU9LxY4 zZwwtPN!&>zD_OZ|=o>dZmuJ!fT2QVpCynxDLpgmS`@>WqH->4WW3Xhd&|8*pt)XUe zJYO~!)E`ZBuBB8iX^D?_Qm5aSAK16OzIyNO19i1~>)w35Zr?U75DbKZ!JxJ}BqPUY vT&|0eUxtrUNDdq)k391sos`3kWRkmL6qVmc(eJew1+A+KHQr2Y?&=7.0.0 <7.1.4 || >=8.0.0", "laravel/framework": "<10.40 || >=11.0.0", "nunomaduro/collision": "<6.4.0 || >=7.0.0 <7.4.0 || >=8.0.0", + "orchestra/testbench-dusk": "<8.21.0 || >=9.0.0", "orchestra/workbench": "<1.0.0", "phpunit/phpunit": "<9.6.0 || >=10.6.0" }, @@ -9779,7 +9780,7 @@ "issues": "https://github.com/orchestral/testbench/issues", "source": "https://github.com/orchestral/testbench-core" }, - "time": "2024-01-10T03:05:52+00:00" + "time": "2024-01-19T14:40:27+00:00" }, { "name": "orchestra/workbench", @@ -10332,16 +10333,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.55", + "version": "1.10.56", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949" + "reference": "27816a01aea996191ee14d010f325434c0ee76fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9a88f9d18ddf4cf54c922fbeac16c4cb164c5949", - "reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/27816a01aea996191ee14d010f325434c0ee76fa", + "reference": "27816a01aea996191ee14d010f325434c0ee76fa", "shasum": "" }, "require": { @@ -10390,7 +10391,7 @@ "type": "tidelift" } ], - "time": "2024-01-08T12:32:40+00:00" + "time": "2024-01-15T10:43:00+00:00" }, { "name": "phpunit/php-code-coverage", @@ -10715,16 +10716,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.5", + "version": "10.5.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "ed21115d505b4b4f7dc7b5651464e19a2c7f7856" + "reference": "08f4fa74d5fbfff1ef22abffee47aaedcaea227e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ed21115d505b4b4f7dc7b5651464e19a2c7f7856", - "reference": "ed21115d505b4b4f7dc7b5651464e19a2c7f7856", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/08f4fa74d5fbfff1ef22abffee47aaedcaea227e", + "reference": "08f4fa74d5fbfff1ef22abffee47aaedcaea227e", "shasum": "" }, "require": { @@ -10796,7 +10797,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.5" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.8" }, "funding": [ { @@ -10812,7 +10813,7 @@ "type": "tidelift" } ], - "time": "2023-12-27T15:13:52+00:00" + "time": "2024-01-19T07:07:27+00:00" }, { "name": "pimple/pimple", @@ -12184,16 +12185,16 @@ }, { "name": "spatie/laravel-ignition", - "version": "2.4.0", + "version": "2.4.1", "source": { "type": "git", "url": "https://github.com/spatie/laravel-ignition.git", - "reference": "b9395ba48d3f30d42092cf6ceff75ed7256cd604" + "reference": "005e1e7b1232f3b22d7e7be3f602693efc7dba67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/b9395ba48d3f30d42092cf6ceff75ed7256cd604", - "reference": "b9395ba48d3f30d42092cf6ceff75ed7256cd604", + "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/005e1e7b1232f3b22d7e7be3f602693efc7dba67", + "reference": "005e1e7b1232f3b22d7e7be3f602693efc7dba67", "shasum": "" }, "require": { @@ -12272,7 +12273,7 @@ "type": "github" } ], - "time": "2024-01-04T14:51:24+00:00" + "time": "2024-01-12T13:14:58+00:00" }, { "name": "spatie/laravel-ray", @@ -12817,29 +12818,29 @@ }, { "name": "tightenco/duster", - "version": "v2.7.2", + "version": "v2.7.3", "source": { "type": "git", "url": "https://github.com/tighten/duster.git", - "reference": "84fcb71992b6a70c1741f056ed17ae14dd9c847f" + "reference": "6d1a598bd3cc13d61e7cda17b4ae4deffce0e0e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tighten/duster/zipball/84fcb71992b6a70c1741f056ed17ae14dd9c847f", - "reference": "84fcb71992b6a70c1741f056ed17ae14dd9c847f", + "url": "https://api.github.com/repos/tighten/duster/zipball/6d1a598bd3cc13d61e7cda17b4ae4deffce0e0e4", + "reference": "6d1a598bd3cc13d61e7cda17b4ae4deffce0e0e4", "shasum": "" }, "require": { "php": "^8.1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.21.1", - "laravel-zero/framework": "^10.1.1", - "laravel/pint": "^v1.11.0", - "nunomaduro/termwind": "^1.15.1", + "friendsofphp/php-cs-fixer": "^3.46", + "laravel-zero/framework": "^10.3", + "laravel/pint": "^1.13", + "nunomaduro/termwind": "^1.15", "spatie/invade": "^1.1", - "squizlabs/php_codesniffer": "^3.7.2", - "tightenco/tlint": "^9.0" + "squizlabs/php_codesniffer": "^3.8", + "tightenco/tlint": "^9.2" }, "bin": [ "builds/duster" @@ -12883,20 +12884,20 @@ "issues": "https://github.com/tighten/duster/issues", "source": "https://github.com/tighten/duster" }, - "time": "2024-01-05T20:30:54+00:00" + "time": "2024-01-12T23:26:01+00:00" }, { "name": "vimeo/psalm", - "version": "5.19.0", + "version": "5.20.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "06b71be009a6bd6d81b9811855d6629b9fe90e1b" + "reference": "3f284e96c9d9be6fe6b15c79416e1d1903dcfef4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/06b71be009a6bd6d81b9811855d6629b9fe90e1b", - "reference": "06b71be009a6bd6d81b9811855d6629b9fe90e1b", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/3f284e96c9d9be6fe6b15c79416e1d1903dcfef4", + "reference": "3f284e96c9d9be6fe6b15c79416e1d1903dcfef4", "shasum": "" }, "require": { @@ -12993,7 +12994,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2024-01-09T21:02:43+00:00" + "time": "2024-01-18T12:15:06+00:00" }, { "name": "zbateson/mail-mime-parser", diff --git a/resources/views/components/note-show.blade.php b/resources/views/components/note-show.blade.php new file mode 100644 index 0000000..36d0451 --- /dev/null +++ b/resources/views/components/note-show.blade.php @@ -0,0 +1,39 @@ +@props(['note', 'url', 'deleteUrl']) + +@if ($note != '') + +
+
+ Note privée + +
    +
  • Editer
  • +
  • Supprimer
  • +
+
+
+ {!! $note !!} +
+
+ +@else + +
+

Ajoutez une note privée à ce prénom.

+ @auth + + + Ajouter + + @else + + + Ajouter + + @endauth +
+ +@endif diff --git a/resources/views/names/partials/edit-note.blade.php b/resources/views/names/partials/edit-note.blade.php new file mode 100644 index 0000000..a4cc037 --- /dev/null +++ b/resources/views/names/partials/edit-note.blade.php @@ -0,0 +1,21 @@ +
+
+ {{ old('note', $note) }} + + +
+ +
+ + + Annuler +
+
diff --git a/resources/views/names/partials/note.blade.php b/resources/views/names/partials/note.blade.php deleted file mode 100644 index f241cd9..0000000 --- a/resources/views/names/partials/note.blade.php +++ /dev/null @@ -1,54 +0,0 @@ -@if ($note != '') - -
- Note privée - -
    -
  • Editer
  • -
  • Supprimer
  • -
-
-
- {!! $note !!} -
- -@else - -
-

Ajoutez une note privée à ce prénom.

- @auth - - - Ajouter - - @else - - - Ajouter - - @endauth -
- -@endif - -
-
- {{ old('note', $note) }} - - -
- -
- - - Annuler -
-
diff --git a/resources/views/names/show.blade.php b/resources/views/names/show.blade.php index 82fdaef..cf2749d 100644 --- a/resources/views/names/show.blade.php +++ b/resources/views/names/show.blade.php @@ -109,8 +109,8 @@

-
- @include('names.partials.note') +
+
diff --git a/resources/views/user/index.blade.php b/resources/views/user/index.blade.php index 83563dd..c25a6cc 100644 --- a/resources/views/user/index.blade.php +++ b/resources/views/user/index.blade.php @@ -44,6 +44,9 @@ class="flex items-center justify-between border border-transparent hover:bg-gray
{{ $name['name'] }}

{{ $name['total'] }} utilisations depuis 1900

+ @if ($name['note']) +

{{ $name['note'] }}

+ @endif
diff --git a/routes/web.php b/routes/web.php index 04513b4..5b3c9a4 100644 --- a/routes/web.php +++ b/routes/web.php @@ -49,7 +49,10 @@ Route::put('prenoms/{id}/show/favorite', [NameFavoriteController::class, 'update'])->name('favorite.name.update'); // set the note for the given name - Route::put('prenoms/{id}/{name}/note', [UserNameController::class, 'update'])->name('user.name.update'); + Route::get('notes/{id}', [UserNameController::class, 'show'])->name('user.name.show'); + Route::get('notes/{id}/edit', [UserNameController::class, 'edit'])->name('user.name.edit'); + Route::put('notes/{id}', [UserNameController::class, 'update'])->name('user.name.update'); + Route::delete('notes/{id}', [UserNameController::class, 'destroy'])->name('user.name.destroy'); }); Route::get('favoris', [FavoriteController::class, 'index'])->name('favorite.index'); diff --git a/tests/Unit/ViewModels/Names/NameViewModelTest.php b/tests/Unit/ViewModels/Names/NameViewModelTest.php index 7e22e10..bcc56b5 100644 --- a/tests/Unit/ViewModels/Names/NameViewModelTest.php +++ b/tests/Unit/ViewModels/Names/NameViewModelTest.php @@ -78,7 +78,7 @@ public function it_gets_the_details_of_a_name(): void [ 'show' => env('APP_URL') . '/prenoms/' . $name->id . '/heloise', 'favorite' => env('APP_URL') . '/prenoms/' . $name->id . '/show/favorite', - 'note_edit' => env('APP_URL') . '/prenoms/' . $name->id . '/heloise/note', + 'note_edit' => env('APP_URL') . '/notes/' . $name->id, ], $array['url'] ); diff --git a/tests/Unit/ViewModels/User/UserViewModelTest.php b/tests/Unit/ViewModels/User/UserViewModelTest.php index ca9fa6b..501f32b 100644 --- a/tests/Unit/ViewModels/User/UserViewModelTest.php +++ b/tests/Unit/ViewModels/User/UserViewModelTest.php @@ -4,6 +4,7 @@ use App\Http\ViewModels\User\UserViewModel; use App\Models\Name; +use App\Models\Note; use App\Models\User; use Illuminate\Foundation\Testing\DatabaseTransactions; use Tests\TestCase; @@ -46,6 +47,11 @@ public function it_gets_the_list_of_favorites_for_the_index_page(): void 'is_list_of_favorites' => true, ]); $nameList->names()->attach($name->id); + Note::factory()->create([ + 'name_id' => $name->id, + 'user_id' => $user->id, + 'content' => 'this is a note', + ]); $this->be($user); @@ -57,6 +63,7 @@ public function it_gets_the_list_of_favorites_for_the_index_page(): void 'id' => $name->id, 'name' => 'Test', 'total' => '1 000', + 'note' => 'this is a note', 'url' => [ 'show' => env('APP_URL') . '/prenoms/' . $name->id . '/test', 'favorite' => env('APP_URL') . '/prenoms/' . $name->id . '/favorite',