Skip to content

feat(RoleController): add RoleController - #9

Merged
Makima0106 merged 1 commit into
mainfrom
feature/RoleController
Mar 23, 2026
Merged

feat(RoleController): add RoleController#9
Makima0106 merged 1 commit into
mainfrom
feature/RoleController

Conversation

@Makima0106

Copy link
Copy Markdown
Collaborator

No description provided.

@NegK01

NegK01 commented Mar 23, 2026

Copy link
Copy Markdown
Owner

@copilot

Copilot AI commented Mar 23, 2026

Copy link
Copy Markdown

@NegK01 I've opened a new pull request, #10, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new RoleController and exposes read-only role endpoints via routes/api.php, while also adjusting the existing user routes to use a pluralized base path.

Changes:

  • Add RoleController with index (paginated list) and show (single role) responses.
  • Add /roles and /roles/{role} API routes.
  • Rename user endpoints from /user to /users, including the restore route.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
routes/api.php Adds role routes and pluralizes user routes (userusers).
app/Http/Controllers/RoleController.php Implements role listing and retrieval endpoints.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread routes/api.php
Comment on lines +9 to +14
Route::apiResource('users', UserController::class)->missing(function (Request $request) {
return response()->json([
'message' => 'Usuario no encontrado',
], 404);
});
Route::patch('user/{id}/restore', [UserController::class, 'restore']);
Route::patch('users/{id}/restore', [UserController::class, 'restore']);

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esta PR cambia los endpoints de usuarios de /user a /users (y también el restore), lo cual es un cambio breaking para cualquier cliente que ya consuma la API. Si es intencional, actualiza el título/descrpción de la PR y considera mantener temporalmente las rutas antiguas como alias/deprecadas (o versionar la API) para evitar romper integraciones existentes.

Copilot uses AI. Check for mistakes.
Comment thread routes/api.php
Comment on lines +16 to +17
Route::get('roles', [RoleController::class, 'index']);
Route::get('roles/{role}', [RoleController::class, 'show']); No newline at end of file

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Para consistencia y menor duplicación, considera declarar las rutas de roles como apiResource (p. ej. limitado a index/show) en lugar de dos Route::get manuales; así mantienes el patrón usado para users y unificas parámetros/nombres de rutas.

Suggested change
Route::get('roles', [RoleController::class, 'index']);
Route::get('roles/{role}', [RoleController::class, 'show']);
Route::apiResource('roles', RoleController::class)->only(['index', 'show']);

Copilot uses AI. Check for mistakes.
@Makima0106
Makima0106 merged commit 6a6b341 into main Mar 23, 2026
4 checks passed
@Makima0106
Makima0106 deleted the feature/RoleController branch March 23, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants