Refactor Tagstore models to be more django-ish [LX-227]

Description

  1. 🚧 WIP 🚧

  1.  

    1. Description

  1.  

    1.  

      1. Python API Changes

The Tagstore python API was a bit messy because I designed it with a pluggable backend, but then we reduced it to one backend and build an API and Admin interface that assume the django backend.

This PR makes the code much easier to follow and understand by removing the backend abstraction and assuming the django implementation.

In addition, the various confusing `Tag`, `TagId`, and `TagModel`, `Entity`, `EntityId`, and `EntityModel`, `Taxonomy`, `TaxonomyModel`, `TaxonomyId` are simplified to something almost sensible:

Although the python API has changed significantly, there are no significant changes to any important implementation details and the relatively unmodified test suite passes as before.

  1.  

    1.  

      1. REST API Changes

  • Changed schema generation to use [drf-yasg](https://github.com/axnsan12/drf-yasg) (recommended by DRF and maintained) instead of django-rest-swagger (unmaintained)

  • Removed trailing slash from URLs for consistency with Blockstore API

  • Added `/taxonomies` REST API for CRUD of Taxonomies and Tags

  • Changed Entity API to return results whether or not an Entity exists (because if an entity exists in an external system, but has no tags yet in tagstore, this allows a consistent way to get its tags)

  • Removed the Freeform taxonomy (we'll need to keep the LabXchange freeform tags separate from edX ones, so it's better to let the client applications manage their taxonomy.)

  • Expanded test suite

  1.  

    1. Test Instructions

Run the tests, play with the API in the django admin, make sure you can use an existing database+tags with this branch without and changes to the database.

To check the REST API, run the test suite which covers it quite well, and/or explore the API yourself at http://localhost:18250/tagstore/api/v1

  1.  

    1. TODOs

  • [x] Update the django admin

  • [x] Update the REST API

  • [ ] Update the README

  • [x] Rename `tagstore_rest` to `api`

  • [x] Fully remove FREEFORM taxonomy

  • [x] Add working API spec file

  • [ ] Set limits on all API list methods

  1.  

    1. Future considerations:

  • How will we identify taxonomies when importing/exporting tag data from an Open edX instance (e.g. when exporting a course from Blockstore?) Currently Taxonomies are keyed by integer primary key only.

Won't Do

Assignee

Unassigned

Reporter

Open Source Pull Request Bot

Labels

None

Contributor Name

Braden MacDonald

Repo

edx/blockstore

Customer

Epic Link

None

OSCM Assignee

None

Platform Map Area (Levels 1 & 2)

None

Platform Map Area (Levels 3 & 4)

None

Blended Hour Utilization Percentage

None

edX Theme

None

edX Squad

None

Github Lines Added

4146

Github Lines Deleted

1404

Priority

Unset