Skip to content

Feature/epmedu 4867 faq ordering#291

Open
Giorgi217 wants to merge 3 commits intodevelopfrom
feature/EPMEDU-4867-faq-ordering
Open

Feature/epmedu 4867 faq ordering#291
Giorgi217 wants to merge 3 commits intodevelopfrom
feature/EPMEDU-4867-faq-ordering

Conversation

@Giorgi217
Copy link
Copy Markdown
Collaborator

@Giorgi217 Giorgi217 commented Mar 3, 2026

Pull Request overview

Regenerate Amplify models and integrate FAQ orderNum field with deterministic sorting


Problem

The FAQ backend schema was updated to include a new optional field: orderNum.

However, the local iOS project did not reflect this change because the generated Amplify Swift models were outdated. As a result:

  • Question model did not contain orderNum
  • FAQ ordering could not be implemented
  • Schema and generated models were out of sync

Root cause: Amplify models were not regenerated after schema updates, causing stale generated files in amplify/generated/models.


Summary

This PR regenerates Amplify models to reflect the updated backend schema and integrates the new orderNum field into the FAQ flow.

Changes include:

  • Regenerated AmplifyModels with updated schema version
  • Added orderNum to Question model
  • Updated Question+Schema.swift to include the new field
  • Updated FeedingPoint schema artifacts (auto-generated)
  • Implemented deterministic FAQ sorting based on orderNum in FAQModel

All non-FAQ file changes are auto-generated artifacts produced by running:

amplify codegen models


Changes

File What changed
AmplifyModels.swift Updated schema version hash (auto-generated)
Question.swift Auto-generated Added optional orderNum: Int? property
Question+Schema.swift Auto-generated Added .field(question.orderNum, is: .optional, ofType: .int)
FeedingPoint.swift Auto-generated schema updates
FeedingPoint+Schema.swift Auto-generated schema updates
FAQModel.swift Applied deterministic sorting using orderNum before mapping

🧠 What happened (Root cause analysis)

During implementation of FAQ ordering:

  1. Backend schema already contained orderNum
  2. Local schema.graphql confirmed the field existed
  3. Generated Swift models did NOT include the field
  4. Root cause identified as stale generated models
  5. Running amplify codegen models regenerated updated Swift models
  6. FAQ sorting logic was then implemented safely

This clarified the Amplify generation pipeline:

AWS AppSync Schema

Local schema.graphql

Generated Swift models (amplify/generated/models)

Models must be regenerated manually after schema updates.


How to test

1 open Animeal Studio platform
2. add or modify question with order number
3. build the app and open FAQ page


Simulator Screenshot - iPhone 15 Pro - 2026-03-04 at 00 41 31 Screenshot 2026-03-04 at 00 43 25

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 updates the iOS app’s data models (Amplify-generated) to include new backend fields and applies a deterministic display order for FAQ questions based on a new orderNum field.

Changes:

  • Add orderNum to the Amplify Question model schema and struct.
  • Add disabled to the Amplify FeedingPoint model schema and struct.
  • Update FAQ fetching to order questions by orderNum (with unordered questions appended last).

Reviewed changes

Copilot reviewed 1 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
animeal/src/Flows/Main/Modules/More/Submodules/FAQ/Model/FAQModel.swift Sorts fetched FAQ questions by orderNum before mapping to view models.
amplify/generated/models/Question+Schema.swift Adds orderNum to the Amplify model schema.
amplify/generated/models/Question.swift Adds orderNum property and initializer parameter to Question.
amplify/generated/models/FeedingPoint+Schema.swift Adds disabled to the Amplify model schema.
amplify/generated/models/FeedingPoint.swift Adds disabled property and initializer parameter to FeedingPoint.
amplify/generated/models/AmplifyModels.swift Updates Amplify models version hash due to schema regeneration.

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

You can also share your feedback on Copilot code review. Take the survey.

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