Part of #614. See parent for use case, acceptance criteria, and architecture rationale.
Depends on: data model ticket (CompetencyTaxonomy model must exist) #613
Files to modify
| File |
Change |
src/openedx_tagging/rest_api/v1/serializers.py |
Add taxonomy_type as write_only=True ChoiceField with required=False, choices=["tags", "competency"]. Define the valid-value constants in a shared location — #618 will reference them for the read side. |
src/openedx_tagging/rest_api/v1/views.py |
Update perform_create() and create_import() to surface taxonomy_type from validated data. Do not call CompetencyTaxonomy from this layer. |
openedx_learning/applets/cbe/api.py |
Add create_competency_taxonomy(): call create_taxonomy() then create the linked CompetencyTaxonomy row in transaction.atomic(). |
Key constraint
openedx_tagging must not import from openedx_learning. The dispatch to
create_competency_taxonomy() must happen at a layer that can see both packages — a
CBE-provided view mixin overriding perform_create() is one viable approach.
Example Resolution Prompt
In src/openedx_tagging/rest_api/v1/serializers.py, add taxonomy_type as a
write-only ChoiceField with required=False and choices=["tags", "competency"];
define the valid-value constants (e.g. TAXONOMY_TYPE_COMPETENCY = "competency") in a
shared location so issue #618 can reference them for the read side. In
src/openedx_tagging/rest_api/v1/views.py, update both perform_create() (around line
262) and the create_import() action to surface taxonomy_type from validated data —
do not call CompetencyTaxonomy directly from this layer. In
openedx_learning/applets/cbe/api.py, add create_competency_taxonomy(): call
create_taxonomy() from openedx_tagging, then create the linked CompetencyTaxonomy
row wrapped in transaction.atomic(). Wire the dispatch to
create_competency_taxonomy() at a layer that can see both packages — a CBE-provided
view mixin overriding perform_create() is one viable approach.
Part of #614. See parent for use case, acceptance criteria, and architecture rationale.
Depends on: data model ticket (CompetencyTaxonomy model must exist) #613
Files to modify
src/openedx_tagging/rest_api/v1/serializers.pytaxonomy_typeaswrite_only=TrueChoiceFieldwithrequired=False,choices=["tags", "competency"]. Define the valid-value constants in a shared location — #618 will reference them for the read side.src/openedx_tagging/rest_api/v1/views.pyperform_create()andcreate_import()to surfacetaxonomy_typefrom validated data. Do not callCompetencyTaxonomyfrom this layer.openedx_learning/applets/cbe/api.pycreate_competency_taxonomy(): callcreate_taxonomy()then create the linkedCompetencyTaxonomyrow intransaction.atomic().Key constraint
openedx_taggingmust not import fromopenedx_learning. The dispatch tocreate_competency_taxonomy()must happen at a layer that can see both packages — aCBE-provided view mixin overriding
perform_create()is one viable approach.Example Resolution Prompt
In
src/openedx_tagging/rest_api/v1/serializers.py, addtaxonomy_typeas awrite-only
ChoiceFieldwithrequired=Falseandchoices=["tags", "competency"];define the valid-value constants (e.g.
TAXONOMY_TYPE_COMPETENCY = "competency") in ashared location so issue #618 can reference them for the read side. In
src/openedx_tagging/rest_api/v1/views.py, update bothperform_create()(around line262) and the
create_import()action to surfacetaxonomy_typefrom validated data —do not call
CompetencyTaxonomydirectly from this layer. Inopenedx_learning/applets/cbe/api.py, addcreate_competency_taxonomy(): callcreate_taxonomy()fromopenedx_tagging, then create the linkedCompetencyTaxonomyrow wrapped in
transaction.atomic(). Wire the dispatch tocreate_competency_taxonomy()at a layer that can see both packages — a CBE-providedview mixin overriding
perform_create()is one viable approach.