Skip to content

Resource creation#9416

Merged
pallakartheekreddy merged 2 commits intoSunbird-Ed:release-8.1.0from
akshitha-1210:resource-creation
Nov 18, 2025
Merged

Resource creation#9416
pallakartheekreddy merged 2 commits intoSunbird-Ed:release-8.1.0from
akshitha-1210:resource-creation

Conversation

@akshitha-1210
Copy link
Copy Markdown
Contributor

SunbirdEd - Portal


Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.


Please choose applicable option

Example

  • Applicable
  • Not applicable

Type of change

Please choose appropriate options.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Enhancement (additive changes to improve performance)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 18, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes framework category normalization logic from the EditorService.create() method that was responsible for converting non-array framework category values to arrays before sending content creation requests to the API.

Key Changes:

  • Removed 11 lines of code that iterated through framework categories and converted single values to arrays
  • The logic was specifically handling cases where form inputs provided string values instead of arrays for framework category fields (e.g., board, medium, gradeLevel, subject)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -46,17 +46,6 @@ export class EditorService {
* @param req OBJECT
*/
create(req): Observable<ServerResponse> {
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of framework category normalization logic could cause API failures. The deleted code was converting non-array framework category values to arrays before sending them to the content creation API.

Form fields can use either select (single value) or multiSelect (array) input types for framework categories. Without this normalization, single-value selections from select dropdowns will be sent as strings instead of arrays, which may cause the API to reject the request if it expects array values for framework category fields (e.g., board, medium, gradeLevel, subject).

If this removal is intentional because the API now accepts both formats or the normalization has been moved elsewhere, please ensure:

  1. The API endpoint accepts both string and array values for framework category fields, or
  2. The form component or data generation logic now handles this normalization before calling editorService.create()

Otherwise, consider restoring this logic or implementing the normalization in the generateData() method of the data-driven component.

Suggested change
create(req): Observable<ServerResponse> {
create(req): Observable<ServerResponse> {
// Normalize framework category fields to arrays
const frameworkCategories = ['board', 'medium', 'gradeLevel', 'subject'];
frameworkCategories.forEach(field => {
if (req.hasOwnProperty(field) && !_.isArray(req[field]) && !_.isNil(req[field])) {
req[field] = [req[field]];
}
});

Copilot uses AI. Check for mistakes.
@pallakartheekreddy pallakartheekreddy merged commit 828122c into Sunbird-Ed:release-8.1.0 Nov 18, 2025
7 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.

3 participants