routes#




Functions#

get_breakdown

Return the first one of these to be found (prioritized in this order):

get_morphemes_for_breakdown

recreate_incorrect_word_from_breakdown_items

recreate_word_from_breakdown_items

submit_breakdown

Submit a breakdown on behalf of a user.

get_breakdown()#

rootski.main.endpoints.breakdown.routes.get_breakdown(request: starlette.requests.Request, word_id: Union[str, int], user: rootski.schemas.user.User = Depends(get_current_user))[source]#

Return the first one of these to be found (prioritized in this order):

  1. A verified breakdown

  2. The breakdown last submitted by the requesting user

  3. The breakdown last submitted by another user

  4. The inferenced breakdown

  5. The breakdown was not found

If this request does not have a “Bearer …” Authorization header, the user is assumed to be anonymous.

get_morphemes_for_breakdown()#

rootski.main.endpoints.breakdown.routes.get_morphemes_for_breakdown(user_submitted_breakdown: rootski.schemas.breakdown.BreakdownUpsert, db: rootski.services.database.dynamo.db_service.DBService) Dict[str, rootski.services.database.dynamo.models.morpheme.Morpheme][source]#

recreate_incorrect_word_from_breakdown_items()#

rootski.main.endpoints.breakdown.routes.recreate_incorrect_word_from_breakdown_items(breakdown_items: List[rootski.services.database.dynamo.models.breakdown_item.BreakdownItemItem])[source]#

recreate_word_from_breakdown_items()#

rootski.main.endpoints.breakdown.routes.recreate_word_from_breakdown_items(breakdown_items: List[rootski.services.database.dynamo.models.breakdown_item.BreakdownItemItem])[source]#

submit_breakdown()#

rootski.main.endpoints.breakdown.routes.submit_breakdown(request: starlette.requests.Request, payload: rootski.schemas.breakdown.BreakdownUpsert = Body(Ellipsis), user: rootski.schemas.user.User = Depends(get_current_user))[source]#

Submit a breakdown on behalf of a user.

Case: If the breakdown is not valid, an error is returned. Case: If the user is an admin user, the breakdown is marked as “verified”. Otherwise it is unverified. Case: If the user has already submitted a breakdown for this same word before, the previously submitted breakdown is replaced for that user.

NOTE: We assume the word a breakdown is being submitted for always exists.