Compare commits

...

5 Commits

6 changed files with 1553 additions and 6 deletions

View File

@ -0,0 +1,45 @@
/*
Firka, alternative e-Kréta client.
Copyright (C) 2025 QwIT Development
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
class Guardian {
final String email;
final bool isLegalRepresentative;
final String name;
final String phoneNumber;
final String uid;
Guardian({
required this.email,
required this.isLegalRepresentative,
required this.name,
required this.phoneNumber,
required this.uid
});
factory Guardian.fromJson(Map<String, dynamic> json) {
return Guardian(
email: json['EmailCim'],
isLegalRepresentative: json['IsTorvenyesKepviselo'],
name: json['Nev'],
phoneNumber: json['Telefonszam'],
uid: json['Uid']
);
}
}

View File

@ -0,0 +1,89 @@
/*
Firka, alternative e-Kréta client.
Copyright (C) 2025 QwIT Development
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
class Institution {
final CustomizationSettings customizationSettings;
final String shortName;
final List<SystemModule> systemModuleList;
final String uid;
Institution({
required this.customizationSettings,
required this.shortName,
required this.systemModuleList,
required this.uid
});
factory Institution.fromJson(Map<String, dynamic> json) {
return Institution(
customizationSettings: json['TestreszabasBeallitasok'],
shortName: json['RovidNev'],
systemModuleList: json['Rendszermodulok'],
uid: json['Uid'],
);
}
}
class CustomizationSettings {
final int delayForNotifications;
final bool isClassAverageVisible;
final bool isLessonsThemeVisible;
final String nextServerDeployAsString;
CustomizationSettings({
required this.delayForNotifications,
required this.isClassAverageVisible,
required this.isLessonsThemeVisible,
required this.nextServerDeployAsString
});
factory CustomizationSettings.fromJson(Map<String, dynamic> json) {
return CustomizationSettings(
delayForNotifications: json['ErtekelesekMegjelenitesenekKesleltetesenekMerteke'],
isClassAverageVisible: json['IsOsztalyAtlagMegjeleniteseEllenorzoben'],
isLessonsThemeVisible: json['IsTanorakTemajaMegtekinthetoEllenorzoben'],
nextServerDeployAsString: json['KovetkezoTelepitesDatuma']
);
}
}
class SystemModule {
final bool isActive;
final String type;
final String url;
SystemModule({
required this.isActive,
required this.type,
required this.url
});
factory SystemModule.fromJson(Map<String, dynamic> json) {
return SystemModule(
isActive: json['IsAktiv'],
type: json['Tipus'],
url: json['Url']
);
}
}

View File

@ -0,0 +1,82 @@
/*
Firka, alternative e-Kréta client.
Copyright (C) 2025 QwIT Development
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import 'package:firka/helpers/api/model/bank_account.dart';
import 'package:firka/helpers/api/model/guardian.dart';
import 'package:firka/helpers/api/model/institution.dart';
class Student {
final List<String> addressDataList;
final BankAccount bankAccount;
final int yearOfBirth;
final int monthOfBirth;
final int dayOfBirth;
final String emailAddress;
final String name;
final String phoneNumber;
final int schoolYearUID;
final String uid;
final List<Guardian> guardianList;
final String instituteCode;
final String instituteName;
final Institution institution;
Student({
required this.addressDataList,
required this.bankAccount,
required this.yearOfBirth,
required this.monthOfBirth,
required this.dayOfBirth,
required this.emailAddress,
required this.name,
required this.phoneNumber,
required this.schoolYearUID,
required this.uid,
required this.guardianList,
required this.instituteCode,
required this.instituteName,
required this.institution
});
factory Student.fromJson(Map<String, dynamic> json) {
return Student(
addressDataList: json['Cimek'],
bankAccount: json['Bankszamla'],
yearOfBirth: json['SzuletesiEv'],
monthOfBirth: json['SzuletesiHonap'],
dayOfBirth: json['SzuletesiNap'],
emailAddress: json['EmailCim'],
name: json['Nev'],
phoneNumber: json['Telefonszam'],
schoolYearUID: json['TanevUid'],
uid: json['Uid'],
guardianList: json['Gondviselok'],
instituteCode: json['IntezmenyAzonosito'],
instituteName: json['IntezmenyNev'],
institution: json['Intezmeny']
);
}
}

View File

@ -21,10 +21,8 @@ import 'package:isar/isar.dart';
part 'token_model.g.dart';
class TokenModel {
Id id = Isar.autoIncrement; // Auto-increment internal ID
@Index(unique: true, replace: true)
int? StudentId; // Custom unique student identifier
@Id()
int studentId = 0; // Custom unique student identifier
String? tokenId; // Unique identifier for the token if needed
String? accessToken; // The main auth token

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@
import 'package:isar/isar.dart';
import 'package:path_provider/path_provider.dart';
import 'models/token_model.dart';
import '../models/token_model.dart';
class TokenService {
late Future<Isar> db;
@ -32,8 +32,10 @@ class TokenService {
Future<Isar> openDB() async {
final dir = await getApplicationDocumentsDirectory();
return await Isar.open(
[TokenModelSchema],
inspector: true,
schemas: [TokenModelSchema],
directory: dir.path,
);
}
}