Add comprehensive project documentation for ClinicPro in CLAUDE.md and README.md

- Introduced CLAUDE.md for internal guidance on project structure, commands, and architecture.
- Created README.md with detailed project overview, technology stack, directory structure, setup instructions, API endpoints, authentication flow, and external services.
This commit is contained in:
hamed
2026-06-10 11:12:15 +03:30
parent c7ae591e49
commit e9075e8c92
18 changed files with 3533 additions and 142 deletions
+244
View File
@@ -12,12 +12,14 @@ use App\Rating\Repository\LikeRepository;
use App\Rating\Repository\RateRepository;
use App\Shared\Constant\ErrorCodes;
use App\Shared\Controller\BaseController;
use OpenApi\Attributes as OA;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\CurrentUser;
use Symfony\Component\Security\Http\Attribute\IsGranted;
#[OA\Tag(name: 'Ratings & Comments')]
class RatingController extends BaseController
{
public function __construct(
@@ -29,6 +31,36 @@ class RatingController extends BaseController
// ── Ratings ───────────────────────────────────────────────────────────────
#[OA\Post(
path: '/api/v1/rate',
summary: 'Submit or update a rating for a doctor',
security: [['bearerAuth' => []]],
requestBody: new OA\RequestBody(
required: true,
content: new OA\JsonContent(
required: ['doctor_uuid', 'score'],
properties: [
new OA\Property(property: 'doctor_uuid', type: 'string', description: 'UUID of the doctor'),
new OA\Property(property: 'score', type: 'integer', minimum: 1, maximum: 5, description: 'Rating score (15)'),
]
)
),
responses: [
new OA\Response(
response: 201,
description: 'Rate object created',
content: new OA\JsonContent(
properties: [
new OA\Property(property: 'success', type: 'boolean', example: true),
new OA\Property(property: 'data', type: 'object', description: 'Rate object'),
]
)
),
new OA\Response(response: 401, description: 'Unauthorized'),
new OA\Response(response: 404, description: 'Doctor not found'),
new OA\Response(response: 422, description: 'Validation error — score out of range'),
]
)]
#[IsGranted('IS_AUTHENTICATED_FULLY')]
#[Route('/api/v1/rate', methods: ['POST'])]
public function rate(Request $request, #[CurrentUser] User $user): JsonResponse
@@ -59,6 +91,32 @@ class RatingController extends BaseController
return $this->success(['data' => $rate->toArray()], 201);
}
#[OA\Get(
path: '/api/v1/rate/{doctorUuid}',
summary: 'Get average rating for a doctor',
parameters: [
new OA\Parameter(name: 'doctorUuid', in: 'path', required: true, schema: new OA\Schema(type: 'string')),
],
responses: [
new OA\Response(
response: 200,
description: 'Average rating',
content: new OA\JsonContent(
properties: [
new OA\Property(property: 'success', type: 'boolean', example: true),
new OA\Property(
property: 'data',
properties: [
new OA\Property(property: 'average', type: 'number', format: 'float'),
],
type: 'object'
),
]
)
),
new OA\Response(response: 404, description: 'Doctor not found'),
]
)]
#[Route('/api/v1/rate/{doctorUuid}', methods: ['GET'])]
public function getAverage(string $doctorUuid): JsonResponse
{
@@ -72,6 +130,36 @@ class RatingController extends BaseController
// ── Comments ──────────────────────────────────────────────────────────────
#[OA\Post(
path: '/api/v1/comment',
summary: 'Submit a comment for a doctor',
security: [['bearerAuth' => []]],
requestBody: new OA\RequestBody(
required: true,
content: new OA\JsonContent(
required: ['doctor_uuid', 'body'],
properties: [
new OA\Property(property: 'doctor_uuid', type: 'string', description: 'UUID of the doctor'),
new OA\Property(property: 'body', type: 'string', description: 'Comment text'),
]
)
),
responses: [
new OA\Response(
response: 201,
description: 'Comment created',
content: new OA\JsonContent(
properties: [
new OA\Property(property: 'success', type: 'boolean', example: true),
new OA\Property(property: 'data', type: 'object', description: 'Comment object'),
]
)
),
new OA\Response(response: 401, description: 'Unauthorized'),
new OA\Response(response: 404, description: 'Doctor not found'),
new OA\Response(response: 422, description: 'Validation error'),
]
)]
#[IsGranted('IS_AUTHENTICATED_FULLY')]
#[Route('/api/v1/comment', methods: ['POST'])]
public function createComment(Request $request, #[CurrentUser] User $user): JsonResponse
@@ -95,6 +183,26 @@ class RatingController extends BaseController
return $this->success(['data' => $comment->toArray()], 201);
}
#[OA\Get(
path: '/api/v1/comments/{doctorUuid}',
summary: 'List approved comments for a doctor',
parameters: [
new OA\Parameter(name: 'doctorUuid', in: 'path', required: true, schema: new OA\Schema(type: 'string')),
],
responses: [
new OA\Response(
response: 200,
description: 'Array of comment objects',
content: new OA\JsonContent(
properties: [
new OA\Property(property: 'success', type: 'boolean', example: true),
new OA\Property(property: 'data', type: 'array', items: new OA\Items(type: 'object')),
]
)
),
new OA\Response(response: 404, description: 'Doctor not found'),
]
)]
#[Route('/api/v1/comments/{doctorUuid}', methods: ['GET'])]
public function listComments(string $doctorUuid): JsonResponse
{
@@ -111,6 +219,31 @@ class RatingController extends BaseController
return $this->success(['data' => $comments]);
}
#[OA\Delete(
path: '/api/v1/comment/{uuid}',
summary: 'Delete a comment (owner or ROLE_ADMIN)',
security: [['bearerAuth' => []]],
parameters: [
new OA\Parameter(name: 'uuid', in: 'path', required: true, schema: new OA\Schema(type: 'string')),
],
responses: [
new OA\Response(
response: 200,
description: 'Comment deleted',
content: new OA\JsonContent(
properties: [
new OA\Property(property: 'success', type: 'boolean', example: true),
new OA\Property(property: 'data', type: 'object', properties: [
new OA\Property(property: 'message', type: 'string'),
]),
]
)
),
new OA\Response(response: 401, description: 'Unauthorized'),
new OA\Response(response: 403, description: 'Forbidden'),
new OA\Response(response: 404, description: 'Comment not found'),
]
)]
#[IsGranted('IS_AUTHENTICATED_FULLY')]
#[Route('/api/v1/comment/{uuid}', methods: ['DELETE'])]
public function deleteComment(string $uuid, #[CurrentUser] User $user): JsonResponse
@@ -130,6 +263,25 @@ class RatingController extends BaseController
// ── Admin: comment moderation ─────────────────────────────────────────────
#[OA\Get(
path: '/api/v1/admin/comments/pending',
summary: 'List all pending comments (ROLE_ADMIN only)',
security: [['bearerAuth' => []]],
responses: [
new OA\Response(
response: 200,
description: 'Array of pending comment objects',
content: new OA\JsonContent(
properties: [
new OA\Property(property: 'success', type: 'boolean', example: true),
new OA\Property(property: 'data', type: 'array', items: new OA\Items(type: 'object')),
]
)
),
new OA\Response(response: 401, description: 'Unauthorized'),
new OA\Response(response: 403, description: 'Forbidden — ROLE_ADMIN required'),
]
)]
#[IsGranted('ROLE_ADMIN')]
#[Route('/api/v1/admin/comments/pending', methods: ['GET'])]
public function pendingComments(): JsonResponse
@@ -138,6 +290,29 @@ class RatingController extends BaseController
return $this->success(['data' => $comments]);
}
#[OA\Post(
path: '/api/v1/admin/comment/{uuid}/approve',
summary: 'Approve a comment (ROLE_ADMIN only)',
security: [['bearerAuth' => []]],
parameters: [
new OA\Parameter(name: 'uuid', in: 'path', required: true, schema: new OA\Schema(type: 'string')),
],
responses: [
new OA\Response(
response: 200,
description: 'Comment approved',
content: new OA\JsonContent(
properties: [
new OA\Property(property: 'success', type: 'boolean', example: true),
new OA\Property(property: 'data', type: 'object', description: 'Comment object'),
]
)
),
new OA\Response(response: 401, description: 'Unauthorized'),
new OA\Response(response: 403, description: 'Forbidden — ROLE_ADMIN required'),
new OA\Response(response: 404, description: 'Comment not found'),
]
)]
#[IsGranted('ROLE_ADMIN')]
#[Route('/api/v1/admin/comment/{uuid}/approve', methods: ['POST'])]
public function approveComment(string $uuid): JsonResponse
@@ -151,6 +326,29 @@ class RatingController extends BaseController
return $this->success(['data' => $comment->toArray()]);
}
#[OA\Post(
path: '/api/v1/admin/comment/{uuid}/reject',
summary: 'Reject a comment (ROLE_ADMIN only)',
security: [['bearerAuth' => []]],
parameters: [
new OA\Parameter(name: 'uuid', in: 'path', required: true, schema: new OA\Schema(type: 'string')),
],
responses: [
new OA\Response(
response: 200,
description: 'Comment rejected',
content: new OA\JsonContent(
properties: [
new OA\Property(property: 'success', type: 'boolean', example: true),
new OA\Property(property: 'data', type: 'object', description: 'Comment object'),
]
)
),
new OA\Response(response: 401, description: 'Unauthorized'),
new OA\Response(response: 403, description: 'Forbidden — ROLE_ADMIN required'),
new OA\Response(response: 404, description: 'Comment not found'),
]
)]
#[IsGranted('ROLE_ADMIN')]
#[Route('/api/v1/admin/comment/{uuid}/reject', methods: ['POST'])]
public function rejectComment(string $uuid): JsonResponse
@@ -166,6 +364,52 @@ class RatingController extends BaseController
// ── Likes (toggle) ────────────────────────────────────────────────────────
#[OA\Post(
path: '/api/v1/like/{commentUuid}',
summary: 'Toggle like on a comment',
security: [['bearerAuth' => []]],
parameters: [
new OA\Parameter(name: 'commentUuid', in: 'path', required: true, schema: new OA\Schema(type: 'string')),
],
responses: [
new OA\Response(
response: 200,
description: 'Like removed (unliked)',
content: new OA\JsonContent(
properties: [
new OA\Property(property: 'success', type: 'boolean', example: true),
new OA\Property(
property: 'data',
properties: [
new OA\Property(property: 'liked', type: 'boolean', example: false),
new OA\Property(property: 'likes', type: 'integer'),
],
type: 'object'
),
]
)
),
new OA\Response(
response: 201,
description: 'Like added',
content: new OA\JsonContent(
properties: [
new OA\Property(property: 'success', type: 'boolean', example: true),
new OA\Property(
property: 'data',
properties: [
new OA\Property(property: 'liked', type: 'boolean', example: true),
new OA\Property(property: 'likes', type: 'integer'),
],
type: 'object'
),
]
)
),
new OA\Response(response: 401, description: 'Unauthorized'),
new OA\Response(response: 404, description: 'Comment not found'),
]
)]
#[IsGranted('IS_AUTHENTICATED_FULLY')]
#[Route('/api/v1/like/{commentUuid}', methods: ['POST'])]
public function toggleLike(string $commentUuid, #[CurrentUser] User $user): JsonResponse