This PR introduces a controller and service function to retrieve course details by ID with dynamic field selection. The key updates include:
Controller (getCourseById):
Accepts a dynamic query parameter fields to specify which course fields to retrieve.
If no fields are specified, the title field is returned by default.
Returns a 404 response if the course is not found.
Handles errors by returning a 500 response with the error message.
Service (getCourseDetailsById):
Fetches the course details from the database by ID and includes only the requested fields.
The fields parameter is optional, and if provided, it splits the comma-separated string into individual field names for the query.
This PR introduces a controller and service function to retrieve course details by ID with dynamic field selection. The key updates include:
Controller (getCourseById):
Accepts a dynamic query parameter fields to specify which course fields to retrieve. If no fields are specified, the title field is returned by default. Returns a 404 response if the course is not found. Handles errors by returning a 500 response with the error message. Service (getCourseDetailsById):
Fetches the course details from the database by ID and includes only the requested fields. The fields parameter is optional, and if provided, it splits the comma-separated string into individual field names for the query.