Update Saqel Platform: 2026-09-10 12:26:22
This commit is contained in:
@@ -387,6 +387,7 @@ class TeacherRepository {
|
||||
required String gradeLevel,
|
||||
required String subject,
|
||||
required String curriculumKey,
|
||||
required String videoVersionId,
|
||||
String? fileName,
|
||||
double? fileSizeMb,
|
||||
String? filePath,
|
||||
@@ -410,6 +411,7 @@ class TeacherRepository {
|
||||
'grade_level': gradeLevel,
|
||||
'subject': subject,
|
||||
'curriculum_key': curriculumKey,
|
||||
'video_version_id': videoVersionId,
|
||||
});
|
||||
AppLogger.request(
|
||||
method: 'POST',
|
||||
@@ -420,6 +422,7 @@ class TeacherRepository {
|
||||
'grade_level': gradeLevel,
|
||||
'subject': subject,
|
||||
'curriculum_key': curriculumKey,
|
||||
'video_version_id': videoVersionId,
|
||||
'file_name': fileName,
|
||||
'file_size_mb': fileSizeMb
|
||||
},
|
||||
@@ -468,6 +471,42 @@ class TeacherRepository {
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> preflightSubmission({
|
||||
required String curriculumLessonId,
|
||||
required String idempotencyKey,
|
||||
bool replacement = false,
|
||||
String? submissionId,
|
||||
}) async {
|
||||
final uri = Uri.parse('$baseUrl/api/teacher/submissions/preflight');
|
||||
try {
|
||||
final headers = await _authHeaders();
|
||||
headers['Idempotency-Key'] = idempotencyKey;
|
||||
final response = await _client
|
||||
.post(
|
||||
uri,
|
||||
headers: headers,
|
||||
body: json.encode({
|
||||
'curriculum_lesson_id': curriculumLessonId,
|
||||
'replacement': replacement,
|
||||
if (submissionId != null) 'submission_id': submissionId,
|
||||
}),
|
||||
)
|
||||
.timeout(const Duration(seconds: 15));
|
||||
final decoded = json.decode(response.body);
|
||||
if (decoded is! Map) {
|
||||
throw StateError('استجاب الخادم بصيغة غير صالحة عند تجهيز الحصة.');
|
||||
}
|
||||
final result = Map<String, dynamic>.from(decoded);
|
||||
if (response.statusCode == 201 || response.statusCode == 200 || response.statusCode == 409 || response.statusCode == 400 || response.statusCode == 404) {
|
||||
return result;
|
||||
}
|
||||
throw StateError(result['message']?.toString() ?? 'تعذر تجهيز نسخة الحصة.');
|
||||
} catch (error) {
|
||||
if (error is StateError) rethrow;
|
||||
throw StateError('تعذر تجهيز نسخة الحصة: $error');
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> getCurriculumTree() async {
|
||||
final headers = await _authHeaders();
|
||||
final response = await _client
|
||||
|
||||
Reference in New Issue
Block a user