Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add wordpress dataloader and API #62

Merged
merged 1 commit into from
Sep 11, 2023

Conversation

hinakhadim
Copy link

@hinakhadim hinakhadim commented Sep 11, 2023

Description

  • This PR contains Wordpress DataLoader API which is used to sync data with Wordpress.
  • Also Keep a Record of Instructors Assigned on the WP end.

Dataloader API: {DISCOVERY_URL}/api/v1/dataloader_app/dataloader/
CourseRun APIs: {DISCOVERY_URL}/api/v1/dataloader_app/search/course_runs/, {DISCOVERY_URL}/api/v1/dataloader_app/course_runs/

Flow: When Publish button of course is pressed in Wordpress, Wordpress hit the API to dataloader which triggers the data loader task. The dataloader task hit the API to wordpress for getting courses data. The courses data is then updated into the corresponding course_runs. Moreover, It also creates or updates the Subject (category in Wordpress) and People(Instructor in Wordpress) data.

Supporting information

JIRA Link: https://edlyio.atlassian.net/browse/SDAIA-13

Configurations/Additional Information

  • wordpress related plugins should be installed.
  • tutor plugin common should be installed with the following config fields.
# discovery-production-settings

WORDPRESS_APP_AUTH_USERNAME='{{ WORDPRESS_ADMIN_USER }}'
WORDPRESS_APP_AUTH_PASSWORD='{{ WORDPRESS_ADMIN_PASSWORD }}'
CELERY_BROKER_URL='{{ CELERY_BROKER_URL }}'
DEFAULT_PRODUCT_SOURCE_SLUG='{{ DISCOVERY_PRODUCT_SOURCE_SLUG }}' (Required for CourseDataLoader API)
  • Add the following configs in your tutor/config.yml
CELERY_BROKER_URL: redis://@redis:6379
DISCOVERY_PRODUCT_SOURCE_SLUG: sdaia
  • Add sdaia source in discovery django admin http://{DISCOVERY_URL}/admin/course_metadata/source/. It should match with the DISCOVERY_PRODUCT_SOURCE_SLUG entered above in config.yml
  • Add http://wordpress.local.overhang.io/wp-json/ in Marketing Site API URL field of Partner model in Course Discovery django admin.
  • Lastly, Celery worker of discovery should be run for syncing data from wordpress to discovery. Cmd: python -m celery -A course_discovery worker -l info

Other Important Info related to fetch courses API for wordpress:

  1. profile_image_url and marketing_url of Instructor is mapped to major_works field as json object.
  2. permalink of Wordpress Category is mapped to banner_image_url field of Subject.
  3. featured of wordpress Course is mapped to course_overridden field of Course Run.

Testing instructions

N/A

Merge checklist:

  • At least one reviewers should approve.
  • Documentation updated (not only docstrings) if needed to.
  • Translations are updated.
  • Latest pull of sdaia-dev branch before merge after reviewing.
  • Commits are (reasonably) squashed.

Post merge:

  • Delete working branch (except for develop and master).

Screenshots:

  • N/A

Other information

  • This change will not affect course-discovery already working functionality.
  • If there is multi_email_field error, then pip install django-multi-email-field
  • If there is some xyz field doesn't exist error on container start, then do python manage.py migrate

@hinakhadim hinakhadim merged commit 28b5955 into sdaia-develop Sep 11, 2023
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant