A question can be associated with a set of categories using the
categories
relationship.
The
main_category
relationship links a question with its main category.
Note: The main category is in the set of categories
.
"relationships": { "categories": { "data": [ { "id": "1", "type": "categories" }, ... ] }, ... }
Two routes exist to query questions by category and categories by question respectively.
GET /questions/#Questionid/categories
GET /categories/#CategoryId/questions
description
field to categoriesThe description field is optional and is unset by default.
Reduced size of database connection pool to 1 to avoid errors on concurrent requests.
PATCH /answers/#AnswerId
Fixed handler for answer patches. The error prevented relationships to be patched.
Included answer contents on
GET /answer_translations
now show the correct type.
GET /answer_translations?filter=needle
GET /answer_contents/#AnswerContentId/translations?filter=needle
Note: Filtering is applied on the
translation
field.
The collection endpoints for answer translations now include answer contents.
shuffle
attribute to question modelThe shuffle attribute indicates whether answers should be sorted randomly or by their ordinal in a quiz session.
Clients are not allowed to delete locales. We consider the deletion of locales very dangerous (cascading deletes will delete all corresponding question and answer translations) and rarely useful.
/answer_contents
endpointThe value of the query parameter
filter
will be used to filter on the
disambiguation
field using the SQL
LIKE
filter.
Example: The query
GET /answer_contents?filter=alex
will return answer contents where the value of
disambiguation
contains the string alex
, i.e. it performs a query like
SELECT * FROM answer_content WHERE disambiguation LIKE '%alex%';
.
Please note that the syntax for the
filter
parameter is very likely to change in the future.
The actual deletion action was missing. Note: There is still a bad error message, when trying to delete an entity that is referenced in a foreign key field, such as a locale that is in use.
{ "errors": [ { "title": "internal server error", "detail": "SQLite3 returned ErrorConstraint while attempting to perform step: FOREIGN KEY constraint failed" } ] }
Here a decision has to be made whether to perform cascading deletes for all entities or not.
Added display name field to locale model.
The server now returns codes like en
in the language code field instead of the language names.
The ISO-639-1 standard is used for language codes.
Handlers for
POST /locales
,
PATCH /locales/#LocaleId
, and
DELETE /locales/#LocaleId
were implemented to allow the client to edit locales.
Note: The server currently only accepts language codes en
and de
and literals Metric
and Imperial
for units.
This restriction is easily removed if needed in the future.
The handlers for locale entities have improved error messages, including meaningful 400 responses when unique constraints are violated.
The language model is replaced by the locale model. Language codes and units are no longer separate entities, but literal attributes of the locale model. Locales are stored as database entities.
Models:
A question now refers to an answer set, allowing for multiple questions to refer to the same answer set, effectively enabling question variants. The answers refer to answer contents, which refer to answer translations. An answer content represents some general entity that can be referred to by multiple answers, this enables sharing of answers and their translations as well as allowing an answer content to appear as both correct and wrong in answer sets. The answer content has a disambiguation attribute to enable distinction of entities that share the same name, e.g. Tesla, the car company, or Tesla, the electrical engineer.
Questions can now be categorized. A category has a name and an optional parent category. A question may be associated with multiple categories.
/var/www/html/app
that can be used to let the web server also serve the client app.
The client app will be available under the
/app
path.Access-Control-Allow-Origin: *
will be included in the response.Note: The web server setup is very likely to change in the future.
Implemented routes for categories:
GET
/categories
GET /categories/#CategoryId
POST /categories
PATCH /categories/#CategoryId
Categories have a single name
attribute and an optional to-one relationship parent_category
to a parent category.
If the relationships is not set for a category, the category is a top-level category.
Implemented routes for units and language codes.
GET /language_codes
GET /language_codes/#LanguageCode
GET /units
GET /units/#Units
404 Not Found
to DELETE
requests on non-existing entities.PATCH /answers/#AnswerId
requests.
Now the related question can actually be updated.POST
and PATCH
requests.
(Relationship objects that do not contain a data
member are considered ill-formed, see here.)POST
and PATCH
requests, e.g. {"answers": {"data": []}}
or {"answers": {"data": [{"id": "1", "type": "answers"}, {"id": "4", "type": "answers"}]}}
.
Note that currently no route handler actually uses information on to-many-relationships.