* integrate CoursePlansRepo.translateActivity, translateTopic, translateCoursePlan * move translation functions to requisite files * integrate translation endpoint * refactor: reorganize course-related repos, add request and response model classes * remove l2s from translation requests * update translation request and response models, use translation endpoint to get course info, cache courses with L1s in cache key * update topics repo to use translation endpoint * use activity translation endpoint * refactor: incremental loading of individual course info, account for discrepancy between translated IDs and original IDs * incremental loading of course batches * Update lib/pangea/course_plans/courses/course_plan_room_extension.dart Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * cleanup * cleanup * fix: some name changes * formatting --------- Co-authored-by: WilsonLe <leanhminh2907@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: wcjord <32568597+wcjord@users.noreply.github.com>
28 lines
767 B
Dart
28 lines
767 B
Dart
import 'package:fluffychat/pangea/course_plans/courses/course_plan_model.dart';
|
|
|
|
class GetLocalizedCoursesResponse {
|
|
final Map<String, CoursePlanModel> coursePlans;
|
|
|
|
GetLocalizedCoursesResponse({required this.coursePlans});
|
|
|
|
factory GetLocalizedCoursesResponse.fromJson(Map<String, dynamic> json) {
|
|
final plansEntry = json['course_plans'] as Map<String, dynamic>;
|
|
return GetLocalizedCoursesResponse(
|
|
coursePlans: plansEntry.map(
|
|
(key, value) => MapEntry(
|
|
key,
|
|
CoursePlanModel.fromJson(value),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"course_plans": coursePlans.map(
|
|
(key, value) => MapEntry(
|
|
key,
|
|
value.toJson(),
|
|
),
|
|
),
|
|
};
|
|
}
|