Fix student grade registration: set grade_10 as default, add auto-heal for legacy tawjihi_2008, add student grade selector and update-grade API
This commit is contained in:
@@ -119,6 +119,27 @@ class AuthRepository {
|
||||
throw ApiException('فشل استكمال فتح الملف الأكاديمي');
|
||||
}
|
||||
|
||||
Future<UserModel> updateStudentGrade(String gradeLevel, {String stream = 'general'}) async {
|
||||
final res = await _api.post(
|
||||
'/api/student/profile/update-grade',
|
||||
body: {
|
||||
'grade_level': gradeLevel,
|
||||
'stream': stream,
|
||||
},
|
||||
requiresAuth: true,
|
||||
);
|
||||
|
||||
if (res is Map<String, dynamic> && res['data'] != null) {
|
||||
final data = res['data'];
|
||||
if (data['user'] != null) {
|
||||
final user = UserModel.fromJson(Map<String, dynamic>.from(data['user']));
|
||||
await _storage.saveUser(user);
|
||||
return user;
|
||||
}
|
||||
}
|
||||
throw ApiException('فشل تحديث الصف الدراسي');
|
||||
}
|
||||
|
||||
Future<UserModel?> getMe() async {
|
||||
try {
|
||||
final res = await _api.get(AppConfig.meEndpoint);
|
||||
|
||||
Reference in New Issue
Block a user