From 7390ae6116b616597f20a0a94be9cf3ce958bf1f Mon Sep 17 00:00:00 2001 From: Giovanni-Josserand Date: Wed, 17 Dec 2025 14:32:01 +0100 Subject: [PATCH] create notification bruno request and move some routes --- app/Providers/AppServiceProvider.php | 1 + public/index.html | 2 +- routes/notifications.php | 14 ++++++++++ routes/users.php | 15 ----------- tests/Login.bru | 6 ++--- tests/Logout.bru | 2 +- tests/Notifications/Create notification.bru | 27 +++++++++++++++++++ .../Delete user notification.bru | 21 +++++++++++++++ .../Notifications/Get user notifications.bru | 20 ++++++++++++++ tests/Notifications/folder.bru | 8 ++++++ tests/Users/Create user.bru | 12 ++++----- tests/Users/Delete user by id.bru | 2 +- tests/Users/Delete user.bru | 2 +- tests/Users/Get User.bru | 2 +- tests/Users/Modify user role.bru | 2 +- tests/Users/Search users.bru | 2 +- tests/Users/Update User.bru | 2 +- tests/Users/Validate User.bru | 4 +-- tests/Users/folder.bru | 2 +- tests/collection.bru | 2 +- tests/me.bru | 2 +- 21 files changed, 113 insertions(+), 37 deletions(-) create mode 100644 routes/notifications.php create mode 100644 tests/Notifications/Create notification.bru create mode 100644 tests/Notifications/Delete user notification.bru create mode 100644 tests/Notifications/Get user notifications.bru create mode 100644 tests/Notifications/folder.bru diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 1187d01..52ab291 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -23,5 +23,6 @@ class AppServiceProvider extends ServiceProvider Route::middleware('api')->prefix('api')->group(base_path('routes/users.php')); Route::middleware('api')->prefix('api')->group(base_path('routes/auth.php')); Route::middleware('api')->prefix('api')->group(base_path('routes/events.php')); + Route::middleware('api')->prefix('api')->group(base_path('routes/notifications.php')); } } diff --git a/public/index.html b/public/index.html index 2203962..44047c1 100644 --- a/public/index.html +++ b/public/index.html @@ -5,7 +5,7 @@ ComitĂ© des fĂȘtes de Beaupont - + diff --git a/routes/notifications.php b/routes/notifications.php new file mode 100644 index 0000000..95c5026 --- /dev/null +++ b/routes/notifications.php @@ -0,0 +1,14 @@ +get('/users/{id}/notifications', [NotificationsController::class, "getNotifications"]) + ->whereNumber('id'); + +Route::middleware(['web', 'auth:sanctum'])->post("/users/{id}/create/notification", [NotificationsController::class, "createNotification"]) + ->whereNumber('id'); + +Route::middleware(['web', 'auth:sanctum'])->delete('/users/{userId}/delete/notification/{notificationId}', [NotificationsController::class, 'deleteNotification']) + ->whereNumber('userId') + ->whereNumber('notificationId'); diff --git a/routes/users.php b/routes/users.php index ca9f953..ae98784 100644 --- a/routes/users.php +++ b/routes/users.php @@ -1,13 +1,8 @@ get('/users/{id}/tasks', [UserContro Route::middleware(['web', 'auth:sanctum'])->get('/users/tasks/{idTask}', [UserController::class, "getUserTaskById"]); -Route::middleware(['web', 'auth:sanctum'])->get('/users/{id}/notifications', [NotificationsController::class, "getNotifications"]) - ->whereNumber('id'); - -Route::middleware(['web', 'auth:sanctum'])->post("/users/{id}/create/notification", [NotificationsController::class, "createNotification"]) - ->whereNumber('id'); - -Route::middleware(['web', 'auth:sanctum'])->delete('/users/{userId}/delete/notification/{notificationId}', [NotificationsController::class, 'deleteNotification']) - ->whereNumber('userId') - ->whereNumber('notificationId'); - Route::middleware(['web', 'auth:sanctum'])->get('/users/search', [SearchController::class, "searchUsers"]); diff --git a/tests/Login.bru b/tests/Login.bru index 8cfacb5..7ee2c12 100644 --- a/tests/Login.bru +++ b/tests/Login.bru @@ -1,7 +1,7 @@ meta { name: Login type: http - seq: 6 + seq: 5 } post { @@ -18,8 +18,8 @@ body:json { } vars:pre-request { - email: user@test.com - password: 1234 + email: gio@gmail.com + password: 12345678 } assert { diff --git a/tests/Logout.bru b/tests/Logout.bru index 82691a8..ae01bf9 100644 --- a/tests/Logout.bru +++ b/tests/Logout.bru @@ -1,7 +1,7 @@ meta { name: Logout type: http - seq: 7 + seq: 8 } post { diff --git a/tests/Notifications/Create notification.bru b/tests/Notifications/Create notification.bru new file mode 100644 index 0000000..996753a --- /dev/null +++ b/tests/Notifications/Create notification.bru @@ -0,0 +1,27 @@ +meta { + name: Create notification + type: http + seq: 12 +} + +post { + url: {{url}}/api/users/{{id}}/create/notification + body: json + auth: inherit +} + +body:json { + { + "content": "{{content}}" + } +} + +vars:pre-request { + id: 12 + content: test +} + +settings { + encodeUrl: true + timeout: 0 +} diff --git a/tests/Notifications/Delete user notification.bru b/tests/Notifications/Delete user notification.bru new file mode 100644 index 0000000..0362d0a --- /dev/null +++ b/tests/Notifications/Delete user notification.bru @@ -0,0 +1,21 @@ +meta { + name: Delete user notification + type: http + seq: 3 +} + +delete { + url: {{url}}/api/users/{{userId}}/delete/notification/{{notificationId}} + body: none + auth: inherit +} + +vars:pre-request { + userId: + notificationId: +} + +settings { + encodeUrl: true + timeout: 0 +} diff --git a/tests/Notifications/Get user notifications.bru b/tests/Notifications/Get user notifications.bru new file mode 100644 index 0000000..7c058fe --- /dev/null +++ b/tests/Notifications/Get user notifications.bru @@ -0,0 +1,20 @@ +meta { + name: Get user notifications + type: http + seq: 12 +} + +get { + url: {{url}}/api/users/{{id}}/notifications + body: none + auth: inherit +} + +vars:pre-request { + id: 12 +} + +settings { + encodeUrl: true + timeout: 0 +} diff --git a/tests/Notifications/folder.bru b/tests/Notifications/folder.bru new file mode 100644 index 0000000..2289671 --- /dev/null +++ b/tests/Notifications/folder.bru @@ -0,0 +1,8 @@ +meta { + name: Notifications + seq: 8 +} + +auth { + mode: inherit +} diff --git a/tests/Users/Create user.bru b/tests/Users/Create user.bru index 3a58ad7..586cbaa 100644 --- a/tests/Users/Create user.bru +++ b/tests/Users/Create user.bru @@ -1,7 +1,7 @@ meta { name: Create user type: http - seq: 6 + seq: 5 } post { @@ -21,11 +21,11 @@ body:json { } vars:pre-request { - name: - email: - password: - lastname: - phone: + name: test + email: test@gmail.com + password: 12345678 + lastname: test + phone: 0607070707 } assert { diff --git a/tests/Users/Delete user by id.bru b/tests/Users/Delete user by id.bru index f35ca22..e814a8b 100644 --- a/tests/Users/Delete user by id.bru +++ b/tests/Users/Delete user by id.bru @@ -11,7 +11,7 @@ delete { } vars:pre-request { - id: + id: 15 } settings { diff --git a/tests/Users/Delete user.bru b/tests/Users/Delete user.bru index 2479dd4..9de6b6d 100644 --- a/tests/Users/Delete user.bru +++ b/tests/Users/Delete user.bru @@ -1,7 +1,7 @@ meta { name: Delete user type: http - seq: 8 + seq: 6 } delete { diff --git a/tests/Users/Get User.bru b/tests/Users/Get User.bru index 300d56d..9705298 100644 --- a/tests/Users/Get User.bru +++ b/tests/Users/Get User.bru @@ -1,7 +1,7 @@ meta { name: Get User type: http - seq: 3 + seq: 1 } get { diff --git a/tests/Users/Modify user role.bru b/tests/Users/Modify user role.bru index da9aed1..2842c82 100644 --- a/tests/Users/Modify user role.bru +++ b/tests/Users/Modify user role.bru @@ -1,7 +1,7 @@ meta { name: Modify user role type: http - seq: 6 + seq: 3 } post { diff --git a/tests/Users/Search users.bru b/tests/Users/Search users.bru index 325ccfb..e75c176 100644 --- a/tests/Users/Search users.bru +++ b/tests/Users/Search users.bru @@ -1,7 +1,7 @@ meta { name: Search users type: http - seq: 12 + seq: 11 } get { diff --git a/tests/Users/Update User.bru b/tests/Users/Update User.bru index ef236e9..6305ae5 100644 --- a/tests/Users/Update User.bru +++ b/tests/Users/Update User.bru @@ -1,7 +1,7 @@ meta { name: Update User type: http - seq: 4 + seq: 2 } post { diff --git a/tests/Users/Validate User.bru b/tests/Users/Validate User.bru index 689621b..ae98e7e 100644 --- a/tests/Users/Validate User.bru +++ b/tests/Users/Validate User.bru @@ -1,7 +1,7 @@ meta { name: Validate User type: http - seq: 5 + seq: 4 } post { @@ -11,7 +11,7 @@ post { } vars:pre-request { - id: + id: 13 } settings { diff --git a/tests/Users/folder.bru b/tests/Users/folder.bru index 0ed84a8..9877207 100644 --- a/tests/Users/folder.bru +++ b/tests/Users/folder.bru @@ -1,6 +1,6 @@ meta { name: Users - seq: 8 + seq: 9 } auth { diff --git a/tests/collection.bru b/tests/collection.bru index 084fc3b..57682fb 100644 --- a/tests/collection.bru +++ b/tests/collection.bru @@ -1,4 +1,4 @@ headers { Accept: application/json - X-XSRF-TOKEN: eyJpdiI6Ii9YZURUS2taQlBjVXB3azhoelpqS3c9PSIsInZhbHVlIjoiYzdpSmVhVWlZRnlvVWR1RWlHbEtwcUp5R1dQNUJXckFTRm9Tb0xYcGszdmZNb0p4NTFDM2tBMEZjTkdqYWlnSmRWZi9LdFgyczJZam1DdUVUcW84TXBOaDRmU1g5c2pseDVKMW50eTJGd3cxd3p5RjV2b2pGOGNwYzlmWDFkREkiLCJtYWMiOiI5NDY1YWM3YmE0ZDgyNWMxZDQwNTRiZWIxNWU3OTA0NjYxNDkxMjRmZmVkOTA1Y2U3YTE2ZGY2YWViYWE2ZmRjIiwidGFnIjoiIn0= + X-XSRF-TOKEN: eyJpdiI6ImhRZnBQM1N5RFQ4L0duVm5wMEdHcUE9PSIsInZhbHVlIjoiSXFYdGt6Uk1vRUNmYnpnRXNXMVpzeW5sWTlBaW1yRmsvWG9pR01JQnYyTzNvclpoaVZZUkgwL2VYWlBjaEYzcDVnUXprUnBFa3dVL09nTVphQUhsTEtENjhjbUFoRzB0RkMzenRleit1SXVWQWFqNTgwSWFMZ0RuNHNtenpDQ1ciLCJtYWMiOiJmMDM4YjVhMDAzNjE0Y2VlZTY0NDA2YTY5ZWRmYjExZTRkYzlhNmIzMWNmNjcyMmIxYTg0YjFhNWUxZDZlMDM1IiwidGFnIjoiIn0= } diff --git a/tests/me.bru b/tests/me.bru index 3fc87b7..8d97605 100644 --- a/tests/me.bru +++ b/tests/me.bru @@ -1,7 +1,7 @@ meta { name: me type: http - seq: 5 + seq: 6 } get {