Skip to content

Commit 0339896

Browse files
committed
Update le-utils for request schema changes
1 parent 9efc574 commit 0339896

7 files changed

Lines changed: 24 additions & 14 deletions

File tree

contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/SearchOrBrowseWindow.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,9 @@
389389
description: this.importDestinationFolder.description,
390390
language: this.recommendationsLanguage,
391391
ancestors: this.topicAncestors,
392+
channel_id: formatUUID4(this.importDestinationFolder.channel_id),
392393
},
393394
],
394-
metadata: {
395-
channel_id: formatUUID4(this.importDestinationFolder.channel_id),
396-
},
397395
};
398396
},
399397
importDestinationAncestors() {

contentcuration/contentcuration/tests/viewsets/test_recommendations.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import uuid
2+
13
from automation.utils.appnexus import errors
24
from django.urls import reverse
35
from le_utils.constants import content_kinds
@@ -9,19 +11,20 @@
911
from contentcuration.tests.base import StudioAPITestCase
1012

1113

12-
class CRUDTestCase(StudioAPITestCase):
14+
class RecommendationsCRUDTestCase(StudioAPITestCase):
1315
@property
1416
def topics(self):
1517
return {
1618
"topics": [
1719
{
18-
"id": "00000000000000000000000000000001",
20+
"id": str(uuid.uuid4()),
21+
"channel_id": str(uuid.uuid4()),
1922
"title": "Target topic",
2023
"description": "Target description",
2124
"language": "en",
2225
"ancestors": [
2326
{
24-
"id": "00000000000000000000000000000001",
27+
"id": str(uuid.uuid4()),
2528
"title": "Parent topic",
2629
"description": "Parent description",
2730
"language": "en",
@@ -55,7 +58,7 @@ def recommendations_list(self):
5558
]
5659

5760
def setUp(self):
58-
super(CRUDTestCase, self).setUp()
61+
super(RecommendationsCRUDTestCase, self).setUp()
5962

6063
@patch(
6164
"contentcuration.utils.automation_manager.AutomationManager.load_recommendations"

contentcuration/contentcuration/viewsets/recommendation.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from automation.utils.appnexus import errors
66
from django.http import HttpResponseServerError
77
from django.http import JsonResponse
8-
from le_utils.validators import embed_topics_request
8+
from le_utils.constants import embed_topics_request
99
from rest_framework.permissions import IsAuthenticated
1010
from rest_framework.views import APIView
1111

@@ -15,6 +15,10 @@
1515
logger = logging.getLogger(__name__)
1616

1717

18+
def validate_recommendations_request(data):
19+
jsonschema.validate(instance=data, schema=embed_topics_request.SCHEMA)
20+
21+
1822
class RecommendationView(APIView):
1923

2024
permission_classes = [
@@ -29,7 +33,7 @@ def post(self, request):
2933
# Remove and store override_threshold as it isn't defined in the schema
3034
override_threshold = request_data.pop("override_threshold", False)
3135

32-
embed_topics_request.validate(request_data)
36+
validate_recommendations_request(request_data)
3337
except jsonschema.ValidationError as e:
3438
logger.error("Schema validation error: %s", str(e))
3539
return JsonResponse(

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"jquery": "^2.2.4",
7272
"jspdf": "https://github.com/parallax/jsPDF.git#b7a1d8239c596292ce86dafa77f05987bcfa2e6e",
7373
"jszip": "^3.10.1",
74-
"kolibri-constants": "^0.2.0",
74+
"kolibri-constants": "^0.2.12",
7575
"kolibri-design-system": "5.2.0",
7676
"lodash": "^4.17.21",
7777
"material-icons": "0.3.1",

pnpm-lock.yaml

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ djangorestframework==3.15.1
55
psycopg2-binary==2.9.10
66
django-js-reverse==0.10.2
77
django-registration==3.4
8-
le-utils==0.2.10
8+
le-utils>=0.2.12
99
gunicorn==23.0.0
1010
django-postmark==0.1.6
1111
jsonfield==3.1.0

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ jsonschema-specifications==2024.10.1
154154
# via jsonschema
155155
kombu==5.5.2
156156
# via celery
157-
le-utils==0.2.10
157+
le-utils==0.2.12
158158
# via -r requirements.in
159159
packaging==25.0
160160
# via

0 commit comments

Comments
 (0)