ShayestehHS / DjangoUltimateURLShortener

0 stars 1 forks source link

Create an endpoint to list available tokens #6

Open ShayestehHS opened 2 weeks ago

ShayestehHS commented 2 weeks ago

We need an endpoint that lists the currently available tokens. The application is configured to always have 4 ready-to-use tokens. However, there might be instances where fewer than 4 tokens are available.

The endpoint should perform the following actions:

  1. Retrieve the available ready-to-use tokens.
  2. If fewer than 4 tokens are available, generate the remaining tokens to ensure there are always 4 tokens available.
  3. Return the list of available tokens after ensuring the count is up to 4.

Acceptance Criteria:

  1. Create an endpoint to list available tokens.
  2. The endpoint should first retrieve the ready-to-use tokens from the database.
  3. If there are fewer than 4 tokens available:
    • Generate the remaining tokens to ensure a total of 4 tokens.
    • Save the newly generated tokens to the database.
  4. Return a list of 4 available tokens.

Additional Notes: