aiondemand / AIOD-rest-api

A containerized application using FastAPI and SQLAlchemy connected to a MySQL database.
MIT License
10 stars 7 forks source link

Update Platform Validation Endpoint #308

Open jsmatias opened 2 months ago

jsmatias commented 2 months ago

Description: The current validation mechanism in the endpoint platforms/{platform_name}/{assets}/v1/{platform_resource_identifier} is restricting users from retrieving assets from new platforms that are not listed in the enum class. This limitation arises from the validation process against the platforms defined in the enum class, rather than against the platforms stored in the database.

The enum class is primarily intended to automatically populate the database if it is initially empty, rather than serving as the sole reference for platform validation. As a result, the validation logic should be revised to align with the platforms stored in the database, enabling users to retrieve assets from newly added platforms such as "aida_cms," "bonseyes," and others.

Proposed Solution: To address this issue, the validation process should be modified to query the database for the list of available platforms and validate against them instead of relying solely on the enum class. This adjustment will ensure that users can retrieve assets from any platform present in the database, thereby accommodating new additions without requiring manual updates to the enum class.

Next Steps:

  1. Modify the validation logic to query the database for available platforms and validate against them dynamically.

_Originally from discussion in https://github.com/aiondemand/AIOD-rest-api/pull/298#discussion_r1587278722_

jsmatias commented 2 months ago

Same is done on the search endpoints. There might be other endpoints doing the same and they should be checked.