diff --git a/sigap-mobile/lib/src/cores/repositories/auth/auth_repositories.dart b/sigap-mobile/lib/src/cores/repositories/auth/auth_repositories.dart deleted file mode 100644 index e69de29..0000000 diff --git a/sigap-mobile/lib/src/features/daily-ops/models/supadart-models/officers_model_supadart.dart b/sigap-mobile/lib/src/features/daily-ops/models/supadart-models/officers_model_supadart.dart index 0a32517..c1f50e9 100644 --- a/sigap-mobile/lib/src/features/daily-ops/models/supadart-models/officers_model_supadart.dart +++ b/sigap-mobile/lib/src/features/daily-ops/models/supadart-models/officers_model_supadart.dart @@ -4,7 +4,7 @@ import 'package:sigap/supadart/supadart_exports.dart'; import 'package:sigap/supadart/supadart_header.dart'; -class Officers implements SupadartClass { +class OfficerSupadartModel implements SupadartClass { final String unitId; final String roleId; final String nrp; @@ -25,11 +25,11 @@ class Officers implements SupadartClass { final bool isBanned; final int panicStrike; final int spoofingAttempts; - final PatrolUnits? patrolUnit; - final Roles? roleObj; - final Units? unit; + final PatrolUnitSupadartModel? patrolUnit; + final RoleSupadartModel? role; + final UnitSupadartModel? unit; - const Officers({ + const OfficerSupadartModel({ required this.unitId, required this.roleId, required this.nrp, @@ -51,11 +51,11 @@ class Officers implements SupadartClass { required this.panicStrike, required this.spoofingAttempts, this.patrolUnit, - this.roleObj, + this.role, this.unit, }); - static String get table_name => 'officers'; + static String get table_name => 'officerSupadartModel'; static String get c_unitId => 'unit_id'; static String get c_roleId => 'role_id'; static String get c_nrp => 'nrp'; @@ -77,12 +77,12 @@ class Officers implements SupadartClass { static String get c_panicStrike => 'panic_strike'; static String get c_spoofingAttempts => 'spoofing_attempts'; - static List converter(List> data) { - return data.map(Officers.fromJson).toList(); + static List converter(List> data) { + return data.map(OfficerSupadartModel.fromJson).toList(); } - static Officers converterSingle(Map data) { - return Officers.fromJson(data); + static OfficerSupadartModel converterSingle(Map data) { + return OfficerSupadartModel.fromJson(data); } static Map _generateMap({ @@ -223,8 +223,8 @@ class Officers implements SupadartClass { ); } - factory Officers.fromJson(Map jsonn) { - return Officers( + factory OfficerSupadartModel.fromJson(Map jsonn) { + return OfficerSupadartModel( unitId: jsonn['unit_id'] != null ? jsonn['unit_id'].toString() : '', roleId: jsonn['role_id'] != null ? jsonn['role_id'].toString() : '', nrp: jsonn['nrp'] != null ? jsonn['nrp'].toString() : '', @@ -271,17 +271,21 @@ class Officers implements SupadartClass { : 0, patrolUnit: jsonn['patrol_units'] != null - ? PatrolUnits.fromJson( + ? PatrolUnitSupadartModel.fromJson( jsonn['patrol_units'] as Map, ) : null, - roleObj: + role: jsonn['roles'] != null - ? Roles.fromJson(jsonn['roles'] as Map) + ? RoleSupadartModel.fromJson( + jsonn['roles'] as Map, + ) : null, unit: - jsonn['units'] != null - ? Units.fromJson(jsonn['units'] as Map) + jsonn['unitSupadartModel'] != null + ? UnitSupadartModel.fromJson( + jsonn['unitSupadartModel'] as Map, + ) : null, ); } @@ -309,13 +313,13 @@ class Officers implements SupadartClass { panicStrike: panicStrike, spoofingAttempts: spoofingAttempts, // 'patrol_units': patrolUnit?.toJson(), - // 'roles': roleObj?.toJson(), - // 'units': unit?.toJson(), + // 'roles': role?.toJson(), + // 'unitSupadartModel': unit?.toJson(), ); } static const _unset = Object(); - Officers copyWith({ + OfficerSupadartModel copyWith({ Object? unitId = _unset, Object? roleId = _unset, Object? nrp = _unset, @@ -337,10 +341,10 @@ class Officers implements SupadartClass { Object? panicStrike = _unset, Object? spoofingAttempts = _unset, Object? patrolUnit = _unset, - Object? roleObj = _unset, + Object? role = _unset, Object? unit = _unset, }) { - return Officers( + return OfficerSupadartModel( unitId: unitId == _unset ? this.unitId : unitId as String, roleId: roleId == _unset ? this.roleId : roleId as String, nrp: nrp == _unset ? this.nrp : nrp as String, @@ -370,9 +374,11 @@ class Officers implements SupadartClass { ? this.spoofingAttempts : spoofingAttempts as int, patrolUnit: - patrolUnit == _unset ? this.patrolUnit : patrolUnit as PatrolUnits?, - roleObj: roleObj == _unset ? this.roleObj : roleObj as Roles?, - unit: unit == _unset ? this.unit : unit as Units?, + patrolUnit == _unset + ? this.patrolUnit + : patrolUnit as PatrolUnitSupadartModel?, + role: role == _unset ? this.role : role as RoleSupadartModel?, + unit: unit == _unset ? this.unit : unit as UnitSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/daily-ops/models/supadart-models/patrol_units_model_supadart.dart b/sigap-mobile/lib/src/features/daily-ops/models/supadart-models/patrol_units_model_supadart.dart index 23421d2..7b72692 100644 --- a/sigap-mobile/lib/src/features/daily-ops/models/supadart-models/patrol_units_model_supadart.dart +++ b/sigap-mobile/lib/src/features/daily-ops/models/supadart-models/patrol_units_model_supadart.dart @@ -4,7 +4,8 @@ import 'package:sigap/supadart/supadart_exports.dart'; import 'package:sigap/supadart/supadart_header.dart'; -class PatrolUnits implements SupadartClass { +class PatrolUnitSupadartModel + implements SupadartClass { final String unitId; final String locationId; final String name; @@ -13,10 +14,10 @@ class PatrolUnits implements SupadartClass { final double radius; final DateTime createdAt; final String id; - final Locations? locationObj; - final Units? unitObj; + final LocationSupadartModel? location; + final UnitSupadartModel? unit; - const PatrolUnits({ + const PatrolUnitSupadartModel({ required this.unitId, required this.locationId, required this.name, @@ -25,8 +26,8 @@ class PatrolUnits implements SupadartClass { required this.radius, required this.createdAt, required this.id, - this.locationObj, - this.unitObj, + this.location, + this.unit, }); static String get table_name => 'patrol_units'; @@ -39,12 +40,14 @@ class PatrolUnits implements SupadartClass { static String get c_createdAt => 'created_at'; static String get c_id => 'id'; - static List converter(List> data) { - return data.map(PatrolUnits.fromJson).toList(); + static List converter( + List> data, + ) { + return data.map(PatrolUnitSupadartModel.fromJson).toList(); } - static PatrolUnits converterSingle(Map data) { - return PatrolUnits.fromJson(data); + static PatrolUnitSupadartModel converterSingle(Map data) { + return PatrolUnitSupadartModel.fromJson(data); } static Map _generateMap({ @@ -113,8 +116,8 @@ class PatrolUnits implements SupadartClass { ); } - factory PatrolUnits.fromJson(Map jsonn) { - return PatrolUnits( + factory PatrolUnitSupadartModel.fromJson(Map jsonn) { + return PatrolUnitSupadartModel( unitId: jsonn['unit_id'] != null ? jsonn['unit_id'].toString() : '', locationId: jsonn['location_id'] != null ? jsonn['location_id'].toString() : '', @@ -130,13 +133,17 @@ class PatrolUnits implements SupadartClass { ? DateTime.parse(jsonn['created_at'].toString()) : DateTime.fromMillisecondsSinceEpoch(0), id: jsonn['id'] != null ? jsonn['id'].toString() : '', - locationObj: + location: jsonn['locations'] != null - ? Locations.fromJson(jsonn['locations'] as Map) + ? LocationSupadartModel.fromJson( + jsonn['locations'] as Map, + ) : null, - unitObj: - jsonn['units'] != null - ? Units.fromJson(jsonn['units'] as Map) + unit: + jsonn['unitSupadartModel'] != null + ? UnitSupadartModel.fromJson( + jsonn['unitSupadartModel'] as Map, + ) : null, ); } @@ -151,13 +158,13 @@ class PatrolUnits implements SupadartClass { radius: radius, createdAt: createdAt, id: id, - // 'locations': locationObj?.toJson(), - // 'units': unitObj?.toJson(), + // 'locations': location?.toJson(), + // 'unitSupadartModel': unit?.toJson(), ); } static const _unset = Object(); - PatrolUnits copyWith({ + PatrolUnitSupadartModel copyWith({ Object? unitId = _unset, Object? locationId = _unset, Object? name = _unset, @@ -166,10 +173,10 @@ class PatrolUnits implements SupadartClass { Object? radius = _unset, Object? createdAt = _unset, Object? id = _unset, - Object? locationObj = _unset, - Object? unitObj = _unset, + Object? location = _unset, + Object? unit = _unset, }) { - return PatrolUnits( + return PatrolUnitSupadartModel( unitId: unitId == _unset ? this.unitId : unitId as String, locationId: locationId == _unset ? this.locationId : locationId as String, name: name == _unset ? this.name : name as String, @@ -178,9 +185,11 @@ class PatrolUnits implements SupadartClass { radius: radius == _unset ? this.radius : radius as double, createdAt: createdAt == _unset ? this.createdAt : createdAt as DateTime, id: id == _unset ? this.id : id as String, - locationObj: - locationObj == _unset ? this.locationObj : locationObj as Locations?, - unitObj: unitObj == _unset ? this.unitObj : unitObj as Units?, + location: + location == _unset + ? this.location + : location as LocationSupadartModel?, + unit: unit == _unset ? this.unit : unit as UnitSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/daily-ops/models/supadart-models/unit_statistics_model_supadart.dart b/sigap-mobile/lib/src/features/daily-ops/models/supadart-models/unit_statistics_model_supadart.dart index 4480722..8e7105c 100644 --- a/sigap-mobile/lib/src/features/daily-ops/models/supadart-models/unit_statistics_model_supadart.dart +++ b/sigap-mobile/lib/src/features/daily-ops/models/supadart-models/unit_statistics_model_supadart.dart @@ -4,7 +4,8 @@ import 'package:sigap/supadart/supadart_exports.dart'; import 'package:sigap/supadart/supadart_header.dart'; -class UnitStatistics implements SupadartClass { +class UnitStatisticSupadartModel + implements SupadartClass { final String id; final int crimeTotal; final int crimeCleared; @@ -15,9 +16,9 @@ class UnitStatistics implements SupadartClass { final DateTime? createdAt; final DateTime? updatedAt; final String codeUnit; - final Units? unit; + final UnitSupadartModel? unit; - const UnitStatistics({ + const UnitStatisticSupadartModel({ required this.id, required this.crimeTotal, required this.crimeCleared, @@ -43,12 +44,14 @@ class UnitStatistics implements SupadartClass { static String get c_updatedAt => 'updated_at'; static String get c_codeUnit => 'code_unit'; - static List converter(List> data) { - return data.map(UnitStatistics.fromJson).toList(); + static List converter( + List> data, + ) { + return data.map(UnitStatisticSupadartModel.fromJson).toList(); } - static UnitStatistics converterSingle(Map data) { - return UnitStatistics.fromJson(data); + static UnitStatisticSupadartModel converterSingle(Map data) { + return UnitStatisticSupadartModel.fromJson(data); } static Map _generateMap({ @@ -129,8 +132,8 @@ class UnitStatistics implements SupadartClass { ); } - factory UnitStatistics.fromJson(Map jsonn) { - return UnitStatistics( + factory UnitStatisticSupadartModel.fromJson(Map jsonn) { + return UnitStatisticSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', crimeTotal: jsonn['crime_total'] != null @@ -160,8 +163,10 @@ class UnitStatistics implements SupadartClass { : null, codeUnit: jsonn['code_unit'] != null ? jsonn['code_unit'].toString() : '', unit: - jsonn['units'] != null - ? Units.fromJson(jsonn['units'] as Map) + jsonn['unitUnitSupadartModel'] != null + ? UnitSupadartModel.fromJson( + jsonn['unitUnitSupadartModel'] as Map, + ) : null, ); } @@ -178,12 +183,12 @@ class UnitStatistics implements SupadartClass { createdAt: createdAt, updatedAt: updatedAt, codeUnit: codeUnit, - // 'units': unit?.toJson(), + // 'unitUnitSupadartModel': unit?.toJson(), ); } static const _unset = Object(); - UnitStatistics copyWith({ + UnitStatisticSupadartModel copyWith({ Object? id = _unset, Object? crimeTotal = _unset, Object? crimeCleared = _unset, @@ -196,7 +201,7 @@ class UnitStatistics implements SupadartClass { Object? codeUnit = _unset, Object? unit = _unset, }) { - return UnitStatistics( + return UnitStatisticSupadartModel( id: id == _unset ? this.id : id as String, crimeTotal: crimeTotal == _unset ? this.crimeTotal : crimeTotal as int, crimeCleared: @@ -209,7 +214,7 @@ class UnitStatistics implements SupadartClass { createdAt: createdAt == _unset ? this.createdAt : createdAt as DateTime?, updatedAt: updatedAt == _unset ? this.updatedAt : updatedAt as DateTime?, codeUnit: codeUnit == _unset ? this.codeUnit : codeUnit as String, - unit: unit == _unset ? this.unit : unit as Units?, + unit: unit == _unset ? this.unit : unit as UnitSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/daily-ops/models/supadart-models/units_model_supadart.dart b/sigap-mobile/lib/src/features/daily-ops/models/supadart-models/units_model_supadart.dart index b45f372..b245bd5 100644 --- a/sigap-mobile/lib/src/features/daily-ops/models/supadart-models/units_model_supadart.dart +++ b/sigap-mobile/lib/src/features/daily-ops/models/supadart-models/units_model_supadart.dart @@ -6,7 +6,7 @@ import 'package:sigap/supadart/supadart_header.dart'; enum UNIT_TYPE { other, polda, polres, polsek } -class Units implements SupadartClass { +class UnitSupadartModel implements SupadartClass { final String codeUnit; final String? districtId; final String name; @@ -21,10 +21,10 @@ class Units implements SupadartClass { final String location; final String cityId; final String? phone; - final Cities? city; - final Districts? district; + final CitySupadartModel? city; + final DistrictSupadartModel? district; - const Units({ + const UnitSupadartModel({ required this.codeUnit, this.districtId, required this.name, @@ -43,7 +43,7 @@ class Units implements SupadartClass { this.district, }); - static String get table_name => 'units'; + static String get table_name => 'unitSupadartModel'; static String get c_codeUnit => 'code_unit'; static String get c_districtId => 'district_id'; static String get c_name => 'name'; @@ -59,12 +59,12 @@ class Units implements SupadartClass { static String get c_cityId => 'city_id'; static String get c_phone => 'phone'; - static List converter(List> data) { - return data.map(Units.fromJson).toList(); + static List converter(List> data) { + return data.map(UnitSupadartModel.fromJson).toList(); } - static Units converterSingle(Map data) { - return Units.fromJson(data); + static UnitSupadartModel converterSingle(Map data) { + return UnitSupadartModel.fromJson(data); } static Map _generateMap({ @@ -169,8 +169,8 @@ class Units implements SupadartClass { ); } - factory Units.fromJson(Map jsonn) { - return Units( + factory UnitSupadartModel.fromJson(Map jsonn) { + return UnitSupadartModel( codeUnit: jsonn['code_unit'] != null ? jsonn['code_unit'].toString() : '', districtId: jsonn['district_id'] != null ? jsonn['district_id'].toString() : null, @@ -207,11 +207,15 @@ class Units implements SupadartClass { phone: jsonn['phone'] != null ? jsonn['phone'].toString() : null, city: jsonn['cities'] != null - ? Cities.fromJson(jsonn['cities'] as Map) + ? CitySupadartModel.fromJson( + jsonn['cities'] as Map, + ) : null, district: jsonn['districts'] != null - ? Districts.fromJson(jsonn['districts'] as Map) + ? DistrictSupadartModel.fromJson( + jsonn['districts'] as Map, + ) : null, ); } @@ -238,7 +242,7 @@ class Units implements SupadartClass { } static const _unset = Object(); - Units copyWith({ + UnitSupadartModel copyWith({ Object? codeUnit = _unset, Object? districtId = _unset, Object? name = _unset, @@ -256,7 +260,7 @@ class Units implements SupadartClass { Object? city = _unset, Object? district = _unset, }) { - return Units( + return UnitSupadartModel( codeUnit: codeUnit == _unset ? this.codeUnit : codeUnit as String, districtId: districtId == _unset ? this.districtId : districtId as String?, @@ -273,8 +277,11 @@ class Units implements SupadartClass { location: location == _unset ? this.location : location as String, cityId: cityId == _unset ? this.cityId : cityId as String, phone: phone == _unset ? this.phone : phone as String?, - city: city == _unset ? this.city : city as Cities?, - district: district == _unset ? this.district : district as Districts?, + city: city == _unset ? this.city : city as CitySupadartModel?, + district: + district == _unset + ? this.district + : district as DistrictSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/map/models/supadart-models/cities_model_supadart.dart b/sigap-mobile/lib/src/features/map/models/supadart-models/cities_model_supadart.dart index e1e2076..698dae8 100644 --- a/sigap-mobile/lib/src/features/map/models/supadart-models/cities_model_supadart.dart +++ b/sigap-mobile/lib/src/features/map/models/supadart-models/cities_model_supadart.dart @@ -3,31 +3,31 @@ // WARNING: Modifications may be overwritten. Please make changes in the Supadart configuration. import 'package:sigap/supadart/supadart_header.dart'; -class Cities implements SupadartClass { +class CitySupadartModel implements SupadartClass { final String id; final String name; final DateTime? createdAt; final DateTime? updatedAt; - const Cities({ + const CitySupadartModel({ required this.id, required this.name, this.createdAt, this.updatedAt, }); - static String get table_name => 'cities'; + static String get table_name => 'citySupadartModel'; static String get c_id => 'id'; static String get c_name => 'name'; static String get c_createdAt => 'created_at'; static String get c_updatedAt => 'updated_at'; - static List converter(List> data) { - return data.map(Cities.fromJson).toList(); + static List converter(List> data) { + return data.map(CitySupadartModel.fromJson).toList(); } - static Cities converterSingle(Map data) { - return Cities.fromJson(data); + static CitySupadartModel converterSingle(Map data) { + return CitySupadartModel.fromJson(data); } static Map _generateMap({ @@ -72,8 +72,8 @@ class Cities implements SupadartClass { ); } - factory Cities.fromJson(Map jsonn) { - return Cities( + factory CitySupadartModel.fromJson(Map jsonn) { + return CitySupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', name: jsonn['name'] != null ? jsonn['name'].toString() : '', createdAt: @@ -97,13 +97,13 @@ class Cities implements SupadartClass { } static const _unset = Object(); - Cities copyWith({ + CitySupadartModel copyWith({ Object? id = _unset, Object? name = _unset, Object? createdAt = _unset, Object? updatedAt = _unset, }) { - return Cities( + return CitySupadartModel( id: id == _unset ? this.id : id as String, name: name == _unset ? this.name : name as String, createdAt: createdAt == _unset ? this.createdAt : createdAt as DateTime?, diff --git a/sigap-mobile/lib/src/features/map/models/supadart-models/demographics_model_supadart.dart b/sigap-mobile/lib/src/features/map/models/supadart-models/demographics_model_supadart.dart index da5caa2..7641f38 100644 --- a/sigap-mobile/lib/src/features/map/models/supadart-models/demographics_model_supadart.dart +++ b/sigap-mobile/lib/src/features/map/models/supadart-models/demographics_model_supadart.dart @@ -4,7 +4,8 @@ import 'package:sigap/supadart/supadart_exports.dart'; import 'package:sigap/supadart/supadart_header.dart'; -class Demographics implements SupadartClass { +class DemographicSupadartModel + implements SupadartClass { final String id; final String districtId; final int population; @@ -13,9 +14,9 @@ class Demographics implements SupadartClass { final int year; final DateTime? createdAt; final DateTime? updatedAt; - final Districts? district; + final DistrictSupadartModel? district; - const Demographics({ + const DemographicSupadartModel({ required this.id, required this.districtId, required this.population, @@ -27,7 +28,7 @@ class Demographics implements SupadartClass { this.district, }); - static String get table_name => 'demographics'; + static String get table_name => 'demographicSupadartModel'; static String get c_id => 'id'; static String get c_districtId => 'district_id'; static String get c_population => 'population'; @@ -37,12 +38,14 @@ class Demographics implements SupadartClass { static String get c_createdAt => 'created_at'; static String get c_updatedAt => 'updated_at'; - static List converter(List> data) { - return data.map(Demographics.fromJson).toList(); + static List converter( + List> data, + ) { + return data.map(DemographicSupadartModel.fromJson).toList(); } - static Demographics converterSingle(Map data) { - return Demographics.fromJson(data); + static DemographicSupadartModel converterSingle(Map data) { + return DemographicSupadartModel.fromJson(data); } static Map _generateMap({ @@ -113,8 +116,8 @@ class Demographics implements SupadartClass { ); } - factory Demographics.fromJson(Map jsonn) { - return Demographics( + factory DemographicSupadartModel.fromJson(Map jsonn) { + return DemographicSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', districtId: jsonn['district_id'] != null ? jsonn['district_id'].toString() : '', @@ -141,7 +144,9 @@ class Demographics implements SupadartClass { : null, district: jsonn['districts'] != null - ? Districts.fromJson(jsonn['districts'] as Map) + ? DistrictSupadartModel.fromJson( + jsonn['districts'] as Map, + ) : null, ); } @@ -161,7 +166,7 @@ class Demographics implements SupadartClass { } static const _unset = Object(); - Demographics copyWith({ + DemographicSupadartModel copyWith({ Object? id = _unset, Object? districtId = _unset, Object? population = _unset, @@ -172,7 +177,7 @@ class Demographics implements SupadartClass { Object? updatedAt = _unset, Object? district = _unset, }) { - return Demographics( + return DemographicSupadartModel( id: id == _unset ? this.id : id as String, districtId: districtId == _unset ? this.districtId : districtId as String, population: population == _unset ? this.population : population as int, @@ -187,7 +192,10 @@ class Demographics implements SupadartClass { year: year == _unset ? this.year : year as int, createdAt: createdAt == _unset ? this.createdAt : createdAt as DateTime?, updatedAt: updatedAt == _unset ? this.updatedAt : updatedAt as DateTime?, - district: district == _unset ? this.district : district as Districts?, + district: + district == _unset + ? this.district + : district as DistrictSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/map/models/supadart-models/districts_model_supadart.dart b/sigap-mobile/lib/src/features/map/models/supadart-models/districts_model_supadart.dart index 58be193..37eddf3 100644 --- a/sigap-mobile/lib/src/features/map/models/supadart-models/districts_model_supadart.dart +++ b/sigap-mobile/lib/src/features/map/models/supadart-models/districts_model_supadart.dart @@ -4,15 +4,15 @@ import 'package:sigap/supadart/supadart_exports.dart'; import 'package:sigap/supadart/supadart_header.dart'; -class Districts implements SupadartClass { +class DistrictSupadartModel implements SupadartClass { final String id; final String cityId; final String name; final DateTime? createdAt; final DateTime? updatedAt; - final Cities? city; + final CitySupadartModel? city; - const Districts({ + const DistrictSupadartModel({ required this.id, required this.cityId, required this.name, @@ -21,19 +21,21 @@ class Districts implements SupadartClass { this.city, }); - static String get table_name => 'districts'; + static String get table_name => 'districtSupadartModel'; static String get c_id => 'id'; static String get c_cityId => 'city_id'; static String get c_name => 'name'; static String get c_createdAt => 'created_at'; static String get c_updatedAt => 'updated_at'; - static List converter(List> data) { - return data.map(Districts.fromJson).toList(); + static List converter( + List> data, + ) { + return data.map(DistrictSupadartModel.fromJson).toList(); } - static Districts converterSingle(Map data) { - return Districts.fromJson(data); + static DistrictSupadartModel converterSingle(Map data) { + return DistrictSupadartModel.fromJson(data); } static Map _generateMap({ @@ -84,8 +86,8 @@ class Districts implements SupadartClass { ); } - factory Districts.fromJson(Map jsonn) { - return Districts( + factory DistrictSupadartModel.fromJson(Map jsonn) { + return DistrictSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', cityId: jsonn['city_id'] != null ? jsonn['city_id'].toString() : '', name: jsonn['name'] != null ? jsonn['name'].toString() : '', @@ -99,7 +101,9 @@ class Districts implements SupadartClass { : null, city: jsonn['cities'] != null - ? Cities.fromJson(jsonn['cities'] as Map) + ? CitySupadartModel.fromJson( + jsonn['cities'] as Map, + ) : null, ); } @@ -116,7 +120,7 @@ class Districts implements SupadartClass { } static const _unset = Object(); - Districts copyWith({ + DistrictSupadartModel copyWith({ Object? id = _unset, Object? cityId = _unset, Object? name = _unset, @@ -124,13 +128,13 @@ class Districts implements SupadartClass { Object? updatedAt = _unset, Object? city = _unset, }) { - return Districts( + return DistrictSupadartModel( id: id == _unset ? this.id : id as String, cityId: cityId == _unset ? this.cityId : cityId as String, name: name == _unset ? this.name : name as String, createdAt: createdAt == _unset ? this.createdAt : createdAt as DateTime?, updatedAt: updatedAt == _unset ? this.updatedAt : updatedAt as DateTime?, - city: city == _unset ? this.city : city as Cities?, + city: city == _unset ? this.city : city as CitySupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/map/models/supadart-models/geographics_model_supadart.dart b/sigap-mobile/lib/src/features/map/models/supadart-models/geographics_model_supadart.dart index 75f501a..50324db 100644 --- a/sigap-mobile/lib/src/features/map/models/supadart-models/geographics_model_supadart.dart +++ b/sigap-mobile/lib/src/features/map/models/supadart-models/geographics_model_supadart.dart @@ -4,7 +4,8 @@ import 'package:sigap/supadart/supadart_exports.dart'; import 'package:sigap/supadart/supadart_header.dart'; -class Geographics implements SupadartClass { +class GeographicSupadartModel + implements SupadartClass { final String id; final String districtId; final String? address; @@ -19,9 +20,9 @@ class Geographics implements SupadartClass { final String? type; final String location; final int? year; - final Districts? district; + final DistrictSupadartModel? district; - const Geographics({ + const GeographicSupadartModel({ required this.id, required this.districtId, this.address, @@ -39,7 +40,7 @@ class Geographics implements SupadartClass { this.district, }); - static String get table_name => 'geographics'; + static String get table_name => 'geographicSupadartModel'; static String get c_id => 'id'; static String get c_districtId => 'district_id'; static String get c_address => 'address'; @@ -55,12 +56,14 @@ class Geographics implements SupadartClass { static String get c_location => 'location'; static String get c_year => 'year'; - static List converter(List> data) { - return data.map(Geographics.fromJson).toList(); + static List converter( + List> data, + ) { + return data.map(GeographicSupadartModel.fromJson).toList(); } - static Geographics converterSingle(Map data) { - return Geographics.fromJson(data); + static GeographicSupadartModel converterSingle(Map data) { + return GeographicSupadartModel.fromJson(data); } static Map _generateMap({ @@ -165,8 +168,8 @@ class Geographics implements SupadartClass { ); } - factory Geographics.fromJson(Map jsonn) { - return Geographics( + factory GeographicSupadartModel.fromJson(Map jsonn) { + return GeographicSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', districtId: jsonn['district_id'] != null ? jsonn['district_id'].toString() : '', @@ -200,7 +203,9 @@ class Geographics implements SupadartClass { year: jsonn['year'] != null ? int.parse(jsonn['year'].toString()) : null, district: jsonn['districts'] != null - ? Districts.fromJson(jsonn['districts'] as Map) + ? DistrictSupadartModel.fromJson( + jsonn['districts'] as Map, + ) : null, ); } @@ -225,7 +230,7 @@ class Geographics implements SupadartClass { } static const _unset = Object(); - Geographics copyWith({ + GeographicSupadartModel copyWith({ Object? id = _unset, Object? districtId = _unset, Object? address = _unset, @@ -242,7 +247,7 @@ class Geographics implements SupadartClass { Object? year = _unset, Object? district = _unset, }) { - return Geographics( + return GeographicSupadartModel( id: id == _unset ? this.id : id as String, districtId: districtId == _unset ? this.districtId : districtId as String, address: address == _unset ? this.address : address as String?, @@ -258,7 +263,10 @@ class Geographics implements SupadartClass { type: type == _unset ? this.type : type as String?, location: location == _unset ? this.location : location as String, year: year == _unset ? this.year : year as int?, - district: district == _unset ? this.district : district as Districts?, + district: + district == _unset + ? this.district + : district as DistrictSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/map/models/supadart-models/location_logs_model_supadart.dart b/sigap-mobile/lib/src/features/map/models/supadart-models/location_logs_model_supadart.dart index 1ca818f..cc2074a 100644 --- a/sigap-mobile/lib/src/features/map/models/supadart-models/location_logs_model_supadart.dart +++ b/sigap-mobile/lib/src/features/map/models/supadart-models/location_logs_model_supadart.dart @@ -4,7 +4,8 @@ import 'package:sigap/supadart/supadart_exports.dart'; import 'package:sigap/supadart/supadart_header.dart'; -class LocationLogs implements SupadartClass { +class LocationLogSupadartModel + implements SupadartClass { final String id; final String userId; final double latitude; @@ -14,9 +15,9 @@ class LocationLogs implements SupadartClass { final String? description; final DateTime createdAt; final DateTime updatedAt; - final Users? user; + final UserSupadartModel? user; - const LocationLogs({ + const LocationLogSupadartModel({ required this.id, required this.userId, required this.latitude, @@ -40,12 +41,14 @@ class LocationLogs implements SupadartClass { static String get c_createdAt => 'created_at'; static String get c_updatedAt => 'updated_at'; - static List converter(List> data) { - return data.map(LocationLogs.fromJson).toList(); + static List converter( + List> data, + ) { + return data.map(LocationLogSupadartModel.fromJson).toList(); } - static LocationLogs converterSingle(Map data) { - return LocationLogs.fromJson(data); + static LocationLogSupadartModel converterSingle(Map data) { + return LocationLogSupadartModel.fromJson(data); } static Map _generateMap({ @@ -120,8 +123,8 @@ class LocationLogs implements SupadartClass { ); } - factory LocationLogs.fromJson(Map jsonn) { - return LocationLogs( + factory LocationLogSupadartModel.fromJson(Map jsonn) { + return LocationLogSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', userId: jsonn['user_id'] != null ? jsonn['user_id'].toString() : '', latitude: @@ -149,7 +152,9 @@ class LocationLogs implements SupadartClass { : DateTime.fromMillisecondsSinceEpoch(0), user: jsonn['users'] != null - ? Users.fromJson(jsonn['users'] as Map) + ? UserSupadartModel.fromJson( + jsonn['users'] as Map, + ) : null, ); } @@ -170,7 +175,7 @@ class LocationLogs implements SupadartClass { } static const _unset = Object(); - LocationLogs copyWith({ + LocationLogSupadartModel copyWith({ Object? id = _unset, Object? userId = _unset, Object? latitude = _unset, @@ -182,7 +187,7 @@ class LocationLogs implements SupadartClass { Object? updatedAt = _unset, Object? user = _unset, }) { - return LocationLogs( + return LocationLogSupadartModel( id: id == _unset ? this.id : id as String, userId: userId == _unset ? this.userId : userId as String, latitude: latitude == _unset ? this.latitude : latitude as double, @@ -193,7 +198,7 @@ class LocationLogs implements SupadartClass { description == _unset ? this.description : description as String?, createdAt: createdAt == _unset ? this.createdAt : createdAt as DateTime, updatedAt: updatedAt == _unset ? this.updatedAt : updatedAt as DateTime, - user: user == _unset ? this.user : user as Users?, + user: user == _unset ? this.user : user as UserSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/map/models/supadart-models/locations_model_supadart.dart b/sigap-mobile/lib/src/features/map/models/supadart-models/locations_model_supadart.dart index 38eff20..6d9a2bb 100644 --- a/sigap-mobile/lib/src/features/map/models/supadart-models/locations_model_supadart.dart +++ b/sigap-mobile/lib/src/features/map/models/supadart-models/locations_model_supadart.dart @@ -4,7 +4,7 @@ import 'package:sigap/supadart/supadart_exports.dart'; import 'package:sigap/supadart/supadart_header.dart'; -class Locations implements SupadartClass { +class LocationSupadartModel implements SupadartClass { final String id; final String districtId; final String eventId; @@ -19,10 +19,10 @@ class Locations implements SupadartClass { final DateTime? updatedAt; final String location; final double? distanceToUnit; - final Districts? district; - final Events? event; + final DistrictSupadartModel? district; + final EventSupadartModel? event; - const Locations({ + const LocationSupadartModel({ required this.id, required this.districtId, required this.eventId, @@ -41,7 +41,7 @@ class Locations implements SupadartClass { this.event, }); - static String get table_name => 'locations'; + static String get table_name => 'locationSupadartModel'; static String get c_id => 'id'; static String get c_districtId => 'district_id'; static String get c_eventId => 'event_id'; @@ -57,12 +57,14 @@ class Locations implements SupadartClass { static String get c_location => 'location'; static String get c_distanceToUnit => 'distance_to_unit'; - static List converter(List> data) { - return data.map(Locations.fromJson).toList(); + static List converter( + List> data, + ) { + return data.map(LocationSupadartModel.fromJson).toList(); } - static Locations converterSingle(Map data) { - return Locations.fromJson(data); + static LocationSupadartModel converterSingle(Map data) { + return LocationSupadartModel.fromJson(data); } static Map _generateMap({ @@ -167,8 +169,8 @@ class Locations implements SupadartClass { ); } - factory Locations.fromJson(Map jsonn) { - return Locations( + factory LocationSupadartModel.fromJson(Map jsonn) { + return LocationSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', districtId: jsonn['district_id'] != null ? jsonn['district_id'].toString() : '', @@ -204,11 +206,15 @@ class Locations implements SupadartClass { : null, district: jsonn['districts'] != null - ? Districts.fromJson(jsonn['districts'] as Map) + ? DistrictSupadartModel.fromJson( + jsonn['districts'] as Map, + ) : null, event: jsonn['events'] != null - ? Events.fromJson(jsonn['events'] as Map) + ? EventSupadartModel.fromJson( + jsonn['events'] as Map, + ) : null, ); } @@ -235,7 +241,7 @@ class Locations implements SupadartClass { } static const _unset = Object(); - Locations copyWith({ + LocationSupadartModel copyWith({ Object? id = _unset, Object? districtId = _unset, Object? eventId = _unset, @@ -253,7 +259,7 @@ class Locations implements SupadartClass { Object? district = _unset, Object? event = _unset, }) { - return Locations( + return LocationSupadartModel( id: id == _unset ? this.id : id as String, districtId: districtId == _unset ? this.districtId : districtId as String, eventId: eventId == _unset ? this.eventId : eventId as String, @@ -271,8 +277,11 @@ class Locations implements SupadartClass { distanceToUnit == _unset ? this.distanceToUnit : distanceToUnit as double?, - district: district == _unset ? this.district : district as Districts?, - event: event == _unset ? this.event : event as Events?, + district: + district == _unset + ? this.district + : district as DistrictSupadartModel?, + event: event == _unset ? this.event : event as EventSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/panic-button/models/supadart-models/crime_categories_model_supadart.dart b/sigap-mobile/lib/src/features/panic-button/models/supadart-models/crime_categories_model_supadart.dart index 72bb685..9986f2b 100644 --- a/sigap-mobile/lib/src/features/panic-button/models/supadart-models/crime_categories_model_supadart.dart +++ b/sigap-mobile/lib/src/features/panic-button/models/supadart-models/crime_categories_model_supadart.dart @@ -3,7 +3,8 @@ // WARNING: Modifications may be overwritten. Please make changes in the Supadart configuration. import 'package:sigap/supadart/supadart_header.dart'; -class CrimeCategories implements SupadartClass { +class CrimeCategorySupadartModel + implements SupadartClass { final String id; final String name; final String description; @@ -11,7 +12,7 @@ class CrimeCategories implements SupadartClass { final DateTime? updatedAt; final String? type; - const CrimeCategories({ + const CrimeCategorySupadartModel({ required this.id, required this.name, required this.description, @@ -28,12 +29,14 @@ class CrimeCategories implements SupadartClass { static String get c_updatedAt => 'updated_at'; static String get c_type => 'type'; - static List converter(List> data) { - return data.map(CrimeCategories.fromJson).toList(); + static List converter( + List> data, + ) { + return data.map(CrimeCategorySupadartModel.fromJson).toList(); } - static CrimeCategories converterSingle(Map data) { - return CrimeCategories.fromJson(data); + static CrimeCategorySupadartModel converterSingle(Map data) { + return CrimeCategorySupadartModel.fromJson(data); } static Map _generateMap({ @@ -90,8 +93,8 @@ class CrimeCategories implements SupadartClass { ); } - factory CrimeCategories.fromJson(Map jsonn) { - return CrimeCategories( + factory CrimeCategorySupadartModel.fromJson(Map jsonn) { + return CrimeCategorySupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', name: jsonn['name'] != null ? jsonn['name'].toString() : '', description: @@ -120,7 +123,7 @@ class CrimeCategories implements SupadartClass { } static const _unset = Object(); - CrimeCategories copyWith({ + CrimeCategorySupadartModel copyWith({ Object? id = _unset, Object? name = _unset, Object? description = _unset, @@ -128,7 +131,7 @@ class CrimeCategories implements SupadartClass { Object? updatedAt = _unset, Object? type = _unset, }) { - return CrimeCategories( + return CrimeCategorySupadartModel( id: id == _unset ? this.id : id as String, name: name == _unset ? this.name : name as String, description: diff --git a/sigap-mobile/lib/src/features/panic-button/models/supadart-models/crime_incidents_model_supadart.dart b/sigap-mobile/lib/src/features/panic-button/models/supadart-models/crime_incidents_model_supadart.dart index 82868c1..855e851 100644 --- a/sigap-mobile/lib/src/features/panic-button/models/supadart-models/crime_incidents_model_supadart.dart +++ b/sigap-mobile/lib/src/features/panic-button/models/supadart-models/crime_incidents_model_supadart.dart @@ -6,7 +6,8 @@ import 'package:sigap/supadart/supadart_header.dart'; enum CRIME_STATUS { closed, open, resolved, underInvestigation, unresolved } -class CrimeIncidents implements SupadartClass { +class CrimeIncidentSupadartModel + implements SupadartClass { final String id; final String crimeId; final String crimeCategoryId; @@ -18,11 +19,11 @@ class CrimeIncidents implements SupadartClass { final DateTime? updatedAt; final DateTime timestamp; - final CrimeCategories? crimeCategory; - final Crimes? crime; - final Locations? location; + final CrimeCategorySupadartModel? crimeCategory; + final CrimeSupadartModel? crime; + final LocationSupadartModel? location; - const CrimeIncidents({ + const CrimeIncidentSupadartModel({ required this.id, required this.crimeId, required this.crimeCategoryId, @@ -50,12 +51,14 @@ class CrimeIncidents implements SupadartClass { static String get c_updatedAt => 'updated_at'; static String get c_timestamp => 'timestamp'; - static List converter(List> data) { - return data.map(CrimeIncidents.fromJson).toList(); + static List converter( + List> data, + ) { + return data.map(CrimeIncidentSupadartModel.fromJson).toList(); } - static CrimeIncidents converterSingle(Map data) { - return CrimeIncidents.fromJson(data); + static CrimeIncidentSupadartModel converterSingle(Map data) { + return CrimeIncidentSupadartModel.fromJson(data); } static Map _generateMap({ @@ -136,8 +139,8 @@ class CrimeIncidents implements SupadartClass { ); } - factory CrimeIncidents.fromJson(Map jsonn) { - return CrimeIncidents( + factory CrimeIncidentSupadartModel.fromJson(Map jsonn) { + return CrimeIncidentSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', crimeId: jsonn['crime_id'] != null ? jsonn['crime_id'].toString() : '', crimeCategoryId: @@ -170,17 +173,21 @@ class CrimeIncidents implements SupadartClass { : DateTime.fromMillisecondsSinceEpoch(0), crimeCategory: jsonn['crime_categories'] != null - ? CrimeCategories.fromJson( + ? CrimeCategorySupadartModel.fromJson( jsonn['crime_categories'] as Map, ) : null, crime: jsonn['crimes'] != null - ? Crimes.fromJson(jsonn['crimes'] as Map) + ? CrimeSupadartModel.fromJson( + jsonn['crimes'] as Map, + ) : null, location: jsonn['locations'] != null - ? Locations.fromJson(jsonn['locations'] as Map) + ? LocationSupadartModel.fromJson( + jsonn['locations'] as Map, + ) : null, ); } @@ -201,7 +208,7 @@ class CrimeIncidents implements SupadartClass { } static const _unset = Object(); - CrimeIncidents copyWith({ + CrimeIncidentSupadartModel copyWith({ Object? id = _unset, Object? crimeId = _unset, Object? crimeCategoryId = _unset, @@ -216,7 +223,7 @@ class CrimeIncidents implements SupadartClass { Object? crime = _unset, Object? location = _unset, }) { - return CrimeIncidents( + return CrimeIncidentSupadartModel( id: id == _unset ? this.id : id as String, crimeId: crimeId == _unset ? this.crimeId : crimeId as String, crimeCategoryId: @@ -235,9 +242,12 @@ class CrimeIncidents implements SupadartClass { crimeCategory: crimeCategory == _unset ? this.crimeCategory - : crimeCategory as CrimeCategories?, - crime: crime == _unset ? this.crime : crime as Crimes?, - location: location == _unset ? this.location : location as Locations?, + : crimeCategory as CrimeCategorySupadartModel?, + crime: crime == _unset ? this.crime : crime as CrimeSupadartModel?, + location: + location == _unset + ? this.location + : location as LocationSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/panic-button/models/supadart-models/crimes_model_supadart.dart b/sigap-mobile/lib/src/features/panic-button/models/supadart-models/crimes_model_supadart.dart index b497eaf..1b8e07f 100644 --- a/sigap-mobile/lib/src/features/panic-button/models/supadart-models/crimes_model_supadart.dart +++ b/sigap-mobile/lib/src/features/panic-button/models/supadart-models/crimes_model_supadart.dart @@ -6,7 +6,7 @@ import 'package:sigap/supadart/supadart_header.dart'; enum CRIME_RATES { critical, high, low, medium } -class Crimes implements SupadartClass { +class CrimeSupadartModel implements SupadartClass { final String id; final String districtId; final DateTime? createdAt; @@ -20,9 +20,9 @@ class Crimes implements SupadartClass { final String? sourceType; final int crimeCleared; final double avgCrime; - final Districts? district; + final DistrictSupadartModel? district; - const Crimes({ + const CrimeSupadartModel({ required this.id, required this.districtId, this.createdAt, @@ -39,7 +39,7 @@ class Crimes implements SupadartClass { this.district, }); - static String get table_name => 'crimes'; + static String get table_name => 'crimeSupadartModel'; static String get c_id => 'id'; static String get c_districtId => 'district_id'; static String get c_createdAt => 'created_at'; @@ -54,12 +54,12 @@ class Crimes implements SupadartClass { static String get c_crimeCleared => 'crime_cleared'; static String get c_avgCrime => 'avg_crime'; - static List converter(List> data) { - return data.map(Crimes.fromJson).toList(); + static List converter(List> data) { + return data.map(CrimeSupadartModel.fromJson).toList(); } - static Crimes converterSingle(Map data) { - return Crimes.fromJson(data); + static CrimeSupadartModel converterSingle(Map data) { + return CrimeSupadartModel.fromJson(data); } static Map _generateMap({ @@ -158,8 +158,8 @@ class Crimes implements SupadartClass { ); } - factory Crimes.fromJson(Map jsonn) { - return Crimes( + factory CrimeSupadartModel.fromJson(Map jsonn) { + return CrimeSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', districtId: jsonn['district_id'] != null ? jsonn['district_id'].toString() : '', @@ -199,7 +199,9 @@ class Crimes implements SupadartClass { : 0.0, district: jsonn['districts'] != null - ? Districts.fromJson(jsonn['districts'] as Map) + ? DistrictSupadartModel.fromJson( + jsonn['districts'] as Map, + ) : null, ); } @@ -224,7 +226,7 @@ class Crimes implements SupadartClass { } static const _unset = Object(); - Crimes copyWith({ + CrimeSupadartModel copyWith({ Object? id = _unset, Object? districtId = _unset, Object? createdAt = _unset, @@ -240,7 +242,7 @@ class Crimes implements SupadartClass { Object? avgCrime = _unset, Object? district = _unset, }) { - return Crimes( + return CrimeSupadartModel( id: id == _unset ? this.id : id as String, districtId: districtId == _unset ? this.districtId : districtId as String, createdAt: createdAt == _unset ? this.createdAt : createdAt as DateTime?, @@ -257,7 +259,10 @@ class Crimes implements SupadartClass { crimeCleared: crimeCleared == _unset ? this.crimeCleared : crimeCleared as int, avgCrime: avgCrime == _unset ? this.avgCrime : avgCrime as double, - district: district == _unset ? this.district : district as Districts?, + district: + district == _unset + ? this.district + : district as DistrictSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/panic-button/models/supadart-models/events_model_supadart.dart b/sigap-mobile/lib/src/features/panic-button/models/supadart-models/events_model_supadart.dart index 5527a1a..c96035f 100644 --- a/sigap-mobile/lib/src/features/panic-button/models/supadart-models/events_model_supadart.dart +++ b/sigap-mobile/lib/src/features/panic-button/models/supadart-models/events_model_supadart.dart @@ -4,16 +4,16 @@ import 'package:sigap/supadart/supadart_exports.dart'; import 'package:sigap/supadart/supadart_header.dart'; -class Events implements SupadartClass { +class EventSupadartModel implements SupadartClass { final String id; final String name; final String? description; final String code; final DateTime createdAt; final String userId; - final Users? user; + final UserSupadartModel? user; - const Events({ + const EventSupadartModel({ required this.id, required this.name, this.description, @@ -23,7 +23,7 @@ class Events implements SupadartClass { this.user, }); - static String get table_name => 'events'; + static String get table_name => 'eventSupadartModel'; static String get c_id => 'id'; static String get c_name => 'name'; static String get c_description => 'description'; @@ -31,12 +31,12 @@ class Events implements SupadartClass { static String get c_createdAt => 'created_at'; static String get c_userId => 'user_id'; - static List converter(List> data) { - return data.map(Events.fromJson).toList(); + static List converter(List> data) { + return data.map(EventSupadartModel.fromJson).toList(); } - static Events converterSingle(Map data) { - return Events.fromJson(data); + static EventSupadartModel converterSingle(Map data) { + return EventSupadartModel.fromJson(data); } static Map _generateMap({ @@ -93,8 +93,8 @@ class Events implements SupadartClass { ); } - factory Events.fromJson(Map jsonn) { - return Events( + factory EventSupadartModel.fromJson(Map jsonn) { + return EventSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', name: jsonn['name'] != null ? jsonn['name'].toString() : '', description: @@ -107,7 +107,9 @@ class Events implements SupadartClass { userId: jsonn['user_id'] != null ? jsonn['user_id'].toString() : '', user: jsonn['users'] != null - ? Users.fromJson(jsonn['users'] as Map) + ? UserSupadartModel.fromJson( + jsonn['users'] as Map, + ) : null, ); } @@ -125,7 +127,7 @@ class Events implements SupadartClass { } static const _unset = Object(); - Events copyWith({ + EventSupadartModel copyWith({ Object? id = _unset, Object? name = _unset, Object? description = _unset, @@ -134,7 +136,7 @@ class Events implements SupadartClass { Object? userId = _unset, Object? user = _unset, }) { - return Events( + return EventSupadartModel( id: id == _unset ? this.id : id as String, name: name == _unset ? this.name : name as String, description: @@ -142,7 +144,7 @@ class Events implements SupadartClass { code: code == _unset ? this.code : code as String, createdAt: createdAt == _unset ? this.createdAt : createdAt as DateTime, userId: userId == _unset ? this.userId : userId as String, - user: user == _unset ? this.user : user as Users?, + user: user == _unset ? this.user : user as UserSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/panic-button/models/supadart-models/evidence_model_supadart.dart b/sigap-mobile/lib/src/features/panic-button/models/supadart-models/evidence_model_supadart.dart index 4310975..22de6e9 100644 --- a/sigap-mobile/lib/src/features/panic-button/models/supadart-models/evidence_model_supadart.dart +++ b/sigap-mobile/lib/src/features/panic-button/models/supadart-models/evidence_model_supadart.dart @@ -4,7 +4,7 @@ import 'package:sigap/supadart/supadart_exports.dart'; import 'package:sigap/supadart/supadart_header.dart'; -class Evidence implements SupadartClass { +class EvidenceSupadartModel implements SupadartClass { final String incidentId; final String type; final String url; @@ -13,9 +13,9 @@ class Evidence implements SupadartClass { final String? description; final Map? metadata; final String id; - final IncidentLogs? incident; + final IncidentLogSupadartModel? incident; - const Evidence({ + const EvidenceSupadartModel({ required this.incidentId, required this.type, required this.url, @@ -27,7 +27,7 @@ class Evidence implements SupadartClass { this.incident, }); - static String get table_name => 'evidence'; + static String get table_name => 'evidenceSupadartModel'; static String get c_incidentId => 'incident_id'; static String get c_type => 'type'; static String get c_url => 'url'; @@ -37,12 +37,14 @@ class Evidence implements SupadartClass { static String get c_metadata => 'metadata'; static String get c_id => 'id'; - static List converter(List> data) { - return data.map(Evidence.fromJson).toList(); + static List converter( + List> data, + ) { + return data.map(EvidenceSupadartModel.fromJson).toList(); } - static Evidence converterSingle(Map data) { - return Evidence.fromJson(data); + static EvidenceSupadartModel converterSingle(Map data) { + return EvidenceSupadartModel.fromJson(data); } static Map _generateMap({ @@ -112,8 +114,8 @@ class Evidence implements SupadartClass { ); } - factory Evidence.fromJson(Map jsonn) { - return Evidence( + factory EvidenceSupadartModel.fromJson(Map jsonn) { + return EvidenceSupadartModel( incidentId: jsonn['incident_id'] != null ? jsonn['incident_id'].toString() : '', type: jsonn['type'] != null ? jsonn['type'].toString() : '', @@ -132,7 +134,7 @@ class Evidence implements SupadartClass { id: jsonn['id'] != null ? jsonn['id'].toString() : '', incident: jsonn['incident_logs'] != null - ? IncidentLogs.fromJson( + ? IncidentLogSupadartModel.fromJson( jsonn['incident_logs'] as Map, ) : null, @@ -154,7 +156,7 @@ class Evidence implements SupadartClass { } static const _unset = Object(); - Evidence copyWith({ + EvidenceSupadartModel copyWith({ Object? incidentId = _unset, Object? type = _unset, Object? url = _unset, @@ -165,7 +167,7 @@ class Evidence implements SupadartClass { Object? id = _unset, Object? incident = _unset, }) { - return Evidence( + return EvidenceSupadartModel( incidentId: incidentId == _unset ? this.incidentId : incidentId as String, type: type == _unset ? this.type : type as String, url: url == _unset ? this.url : url as String, @@ -179,7 +181,10 @@ class Evidence implements SupadartClass { ? this.metadata : metadata as Map?, id: id == _unset ? this.id : id as String, - incident: incident == _unset ? this.incident : incident as IncidentLogs?, + incident: + incident == _unset + ? this.incident + : incident as IncidentLogSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/panic-button/models/supadart-models/incident_logs_model_supadart.dart b/sigap-mobile/lib/src/features/panic-button/models/supadart-models/incident_logs_model_supadart.dart index 7fc0e2f..da21b56 100644 --- a/sigap-mobile/lib/src/features/panic-button/models/supadart-models/incident_logs_model_supadart.dart +++ b/sigap-mobile/lib/src/features/panic-button/models/supadart-models/incident_logs_model_supadart.dart @@ -4,7 +4,8 @@ import 'package:sigap/supadart/supadart_exports.dart'; import 'package:sigap/supadart/supadart_header.dart'; -class IncidentLogs implements SupadartClass { +class IncidentLogSupadartModel + implements SupadartClass { final String id; final String userId; final String locationId; @@ -15,11 +16,11 @@ class IncidentLogs implements SupadartClass { final bool? verified; final DateTime? createdAt; final DateTime? updatedAt; - final CrimeCategories? category; - final Locations? locationObj; - final Users? user; + final CrimeCategorySupadartModel? category; + final LocationSupadartModel? location; + final UserSupadartModel? user; - const IncidentLogs({ + const IncidentLogSupadartModel({ required this.id, required this.userId, required this.locationId, @@ -31,7 +32,7 @@ class IncidentLogs implements SupadartClass { this.createdAt, this.updatedAt, this.category, - this.locationObj, + this.location, this.user, }); @@ -47,12 +48,14 @@ class IncidentLogs implements SupadartClass { static String get c_createdAt => 'created_at'; static String get c_updatedAt => 'updated_at'; - static List converter(List> data) { - return data.map(IncidentLogs.fromJson).toList(); + static List converter( + List> data, + ) { + return data.map(IncidentLogSupadartModel.fromJson).toList(); } - static IncidentLogs converterSingle(Map data) { - return IncidentLogs.fromJson(data); + static IncidentLogSupadartModel converterSingle(Map data) { + return IncidentLogSupadartModel.fromJson(data); } static Map _generateMap({ @@ -133,8 +136,8 @@ class IncidentLogs implements SupadartClass { ); } - factory IncidentLogs.fromJson(Map jsonn) { - return IncidentLogs( + factory IncidentLogSupadartModel.fromJson(Map jsonn) { + return IncidentLogSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', userId: jsonn['user_id'] != null ? jsonn['user_id'].toString() : '', locationId: @@ -159,17 +162,21 @@ class IncidentLogs implements SupadartClass { : null, category: jsonn['crime_categories'] != null - ? CrimeCategories.fromJson( + ? CrimeCategorySupadartModel.fromJson( jsonn['crime_categories'] as Map, ) : null, - locationObj: + location: jsonn['locations'] != null - ? Locations.fromJson(jsonn['locations'] as Map) + ? LocationSupadartModel.fromJson( + jsonn['locations'] as Map, + ) : null, user: jsonn['users'] != null - ? Users.fromJson(jsonn['users'] as Map) + ? UserSupadartModel.fromJson( + jsonn['users'] as Map, + ) : null, ); } @@ -187,13 +194,13 @@ class IncidentLogs implements SupadartClass { createdAt: createdAt, updatedAt: updatedAt, // 'crime_categories': category?.toJson(), - // 'locations': locationObj?.toJson(), + // 'locations': location?.toJson(), // 'users': user?.toJson(), ); } static const _unset = Object(); - IncidentLogs copyWith({ + IncidentLogSupadartModel copyWith({ Object? id = _unset, Object? userId = _unset, Object? locationId = _unset, @@ -205,10 +212,10 @@ class IncidentLogs implements SupadartClass { Object? createdAt = _unset, Object? updatedAt = _unset, Object? category = _unset, - Object? locationObj = _unset, + Object? location = _unset, Object? user = _unset, }) { - return IncidentLogs( + return IncidentLogSupadartModel( id: id == _unset ? this.id : id as String, userId: userId == _unset ? this.userId : userId as String, locationId: locationId == _unset ? this.locationId : locationId as String, @@ -221,10 +228,14 @@ class IncidentLogs implements SupadartClass { createdAt: createdAt == _unset ? this.createdAt : createdAt as DateTime?, updatedAt: updatedAt == _unset ? this.updatedAt : updatedAt as DateTime?, category: - category == _unset ? this.category : category as CrimeCategories?, - locationObj: - locationObj == _unset ? this.locationObj : locationObj as Locations?, - user: user == _unset ? this.user : user as Users?, + category == _unset + ? this.category + : category as CrimeCategorySupadartModel?, + location: + location == _unset + ? this.location + : location as LocationSupadartModel?, + user: user == _unset ? this.user : user as UserSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/panic-button/models/supadart-models/panic_button_logs_model_supadart.dart b/sigap-mobile/lib/src/features/panic-button/models/supadart-models/panic_button_logs_model_supadart.dart index 9e34bc3..2ab7b6e 100644 --- a/sigap-mobile/lib/src/features/panic-button/models/supadart-models/panic_button_logs_model_supadart.dart +++ b/sigap-mobile/lib/src/features/panic-button/models/supadart-models/panic_button_logs_model_supadart.dart @@ -4,17 +4,18 @@ import 'package:sigap/supadart/supadart_exports.dart'; import 'package:sigap/supadart/supadart_header.dart'; -class PanicButtonLogs implements SupadartClass { +class PanicButtonLogSupadartModel + implements SupadartClass { final String id; final String userId; final String? officerId; final String incidentId; final DateTime timestamp; - final IncidentLogs? incident; - final Officers? officer; - final Users? userObj; + final IncidentLogSupadartModel? incident; + final OfficerSupadartModel? officer; + final UserSupadartModel? user; - const PanicButtonLogs({ + const PanicButtonLogSupadartModel({ required this.id, required this.userId, this.officerId, @@ -22,7 +23,7 @@ class PanicButtonLogs implements SupadartClass { required this.timestamp, this.incident, this.officer, - this.userObj, + this.user, }); static String get table_name => 'panic_button_logs'; @@ -32,12 +33,16 @@ class PanicButtonLogs implements SupadartClass { static String get c_incidentId => 'incident_id'; static String get c_timestamp => 'timestamp'; - static List converter(List> data) { - return data.map(PanicButtonLogs.fromJson).toList(); + static List converter( + List> data, + ) { + return data.map(PanicButtonLogSupadartModel.fromJson).toList(); } - static PanicButtonLogs converterSingle(Map data) { - return PanicButtonLogs.fromJson(data); + static PanicButtonLogSupadartModel converterSingle( + Map data, + ) { + return PanicButtonLogSupadartModel.fromJson(data); } static Map _generateMap({ @@ -88,8 +93,8 @@ class PanicButtonLogs implements SupadartClass { ); } - factory PanicButtonLogs.fromJson(Map jsonn) { - return PanicButtonLogs( + factory PanicButtonLogSupadartModel.fromJson(Map jsonn) { + return PanicButtonLogSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', userId: jsonn['user_id'] != null ? jsonn['user_id'].toString() : '', officerId: @@ -102,17 +107,21 @@ class PanicButtonLogs implements SupadartClass { : DateTime.fromMillisecondsSinceEpoch(0), incident: jsonn['incident_logs'] != null - ? IncidentLogs.fromJson( + ? IncidentLogSupadartModel.fromJson( jsonn['incident_logs'] as Map, ) : null, officer: jsonn['officers'] != null - ? Officers.fromJson(jsonn['officers'] as Map) + ? OfficerSupadartModel.fromJson( + jsonn['officers'] as Map, + ) : null, - userObj: + user: jsonn['users'] != null - ? Users.fromJson(jsonn['users'] as Map) + ? UserSupadartModel.fromJson( + jsonn['users'] as Map, + ) : null, ); } @@ -126,12 +135,12 @@ class PanicButtonLogs implements SupadartClass { timestamp: timestamp, // 'incident_logs': incident?.toJson(), // 'officers': officer?.toJson(), - // 'users': userObj?.toJson(), + // 'users': user?.toJson(), ); } static const _unset = Object(); - PanicButtonLogs copyWith({ + PanicButtonLogSupadartModel copyWith({ Object? id = _unset, Object? userId = _unset, Object? officerId = _unset, @@ -139,17 +148,21 @@ class PanicButtonLogs implements SupadartClass { Object? timestamp = _unset, Object? incident = _unset, Object? officer = _unset, - Object? userObj = _unset, + Object? user = _unset, }) { - return PanicButtonLogs( + return PanicButtonLogSupadartModel( id: id == _unset ? this.id : id as String, userId: userId == _unset ? this.userId : userId as String, officerId: officerId == _unset ? this.officerId : officerId as String?, incidentId: incidentId == _unset ? this.incidentId : incidentId as String, timestamp: timestamp == _unset ? this.timestamp : timestamp as DateTime, - incident: incident == _unset ? this.incident : incident as IncidentLogs?, - officer: officer == _unset ? this.officer : officer as Officers?, - userObj: userObj == _unset ? this.userObj : userObj as Users?, + incident: + incident == _unset + ? this.incident + : incident as IncidentLogSupadartModel?, + officer: + officer == _unset ? this.officer : officer as OfficerSupadartModel?, + user: user == _unset ? this.user : user as UserSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/panic-button/models/supadart-models/sessions_model_supadart.dart b/sigap-mobile/lib/src/features/panic-button/models/supadart-models/sessions_model_supadart.dart index a21cf15..5a2d2d9 100644 --- a/sigap-mobile/lib/src/features/panic-button/models/supadart-models/sessions_model_supadart.dart +++ b/sigap-mobile/lib/src/features/panic-button/models/supadart-models/sessions_model_supadart.dart @@ -6,38 +6,38 @@ import 'package:sigap/supadart/supadart_header.dart'; enum SESSION_STATUS { active, completed } -class Sessions implements SupadartClass { +class SessionSupadartModel implements SupadartClass { final String id; final String userId; final String eventId; final SESSION_STATUS status; final DateTime createdAt; - final Events? eventObj; - final Users? userObj; + final EventSupadartModel? event; + final UserSupadartModel? user; - const Sessions({ + const SessionSupadartModel({ required this.id, required this.userId, required this.eventId, required this.status, required this.createdAt, - this.eventObj, - this.userObj, + this.event, + this.user, }); - static String get table_name => 'sessions'; + static String get table_name => 'sessionSupadartModel'; static String get c_id => 'id'; static String get c_userId => 'user_id'; static String get c_eventId => 'event_id'; static String get c_status => 'status'; static String get c_createdAt => 'created_at'; - static List converter(List> data) { - return data.map(Sessions.fromJson).toList(); + static List converter(List> data) { + return data.map(SessionSupadartModel.fromJson).toList(); } - static Sessions converterSingle(Map data) { - return Sessions.fromJson(data); + static SessionSupadartModel converterSingle(Map data) { + return SessionSupadartModel.fromJson(data); } static Map _generateMap({ @@ -88,8 +88,8 @@ class Sessions implements SupadartClass { ); } - factory Sessions.fromJson(Map jsonn) { - return Sessions( + factory SessionSupadartModel.fromJson(Map jsonn) { + return SessionSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', userId: jsonn['user_id'] != null ? jsonn['user_id'].toString() : '', eventId: jsonn['event_id'] != null ? jsonn['event_id'].toString() : '', @@ -101,13 +101,17 @@ class Sessions implements SupadartClass { jsonn['created_at'] != null ? DateTime.parse(jsonn['created_at'].toString()) : DateTime.fromMillisecondsSinceEpoch(0), - eventObj: + event: jsonn['events'] != null - ? Events.fromJson(jsonn['events'] as Map) + ? EventSupadartModel.fromJson( + jsonn['events'] as Map, + ) : null, - userObj: + user: jsonn['users'] != null - ? Users.fromJson(jsonn['users'] as Map) + ? UserSupadartModel.fromJson( + jsonn['users'] as Map, + ) : null, ); } @@ -119,29 +123,29 @@ class Sessions implements SupadartClass { eventId: eventId, status: status, createdAt: createdAt, - // 'events': eventObj?.toJson(), - // 'users': userObj?.toJson(), + // 'events': event?.toJson(), + // 'users': user?.toJson(), ); } static const _unset = Object(); - Sessions copyWith({ + SessionSupadartModel copyWith({ Object? id = _unset, Object? userId = _unset, Object? eventId = _unset, Object? status = _unset, Object? createdAt = _unset, - Object? eventObj = _unset, - Object? userObj = _unset, + Object? event = _unset, + Object? user = _unset, }) { - return Sessions( + return SessionSupadartModel( id: id == _unset ? this.id : id as String, userId: userId == _unset ? this.userId : userId as String, eventId: eventId == _unset ? this.eventId : eventId as String, status: status == _unset ? this.status : status as SESSION_STATUS, createdAt: createdAt == _unset ? this.createdAt : createdAt as DateTime, - eventObj: eventObj == _unset ? this.eventObj : eventObj as Events?, - userObj: userObj == _unset ? this.userObj : userObj as Users?, + event: event == _unset ? this.event : event as EventSupadartModel?, + user: user == _unset ? this.user : user as UserSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/personalization/models/supadart-models/permissions_model_supadart.dart b/sigap-mobile/lib/src/features/personalization/models/supadart-models/permissions_model_supadart.dart index 7b5f275..5701279 100644 --- a/sigap-mobile/lib/src/features/personalization/models/supadart-models/permissions_model_supadart.dart +++ b/sigap-mobile/lib/src/features/personalization/models/supadart-models/permissions_model_supadart.dart @@ -4,17 +4,18 @@ import 'package:sigap/supadart/supadart_exports.dart'; import 'package:sigap/supadart/supadart_header.dart'; -class Permissions implements SupadartClass { +class PermissionSupadartModel + implements SupadartClass { final String id; final String action; final String resourceId; final String roleId; final DateTime createdAt; final DateTime updatedAt; - final Resources? resource; - final Roles? roleObj; + final ResourceSupadartModel? resource; + final RoleSupadartModel? role; - const Permissions({ + const PermissionSupadartModel({ required this.id, required this.action, required this.resourceId, @@ -22,10 +23,10 @@ class Permissions implements SupadartClass { required this.createdAt, required this.updatedAt, this.resource, - this.roleObj, + this.role, }); - static String get table_name => 'permissions'; + static String get table_name => 'permissionSupadartModel'; static String get c_id => 'id'; static String get c_action => 'action'; static String get c_resourceId => 'resource_id'; @@ -33,12 +34,14 @@ class Permissions implements SupadartClass { static String get c_createdAt => 'created_at'; static String get c_updatedAt => 'updated_at'; - static List converter(List> data) { - return data.map(Permissions.fromJson).toList(); + static List converter( + List> data, + ) { + return data.map(PermissionSupadartModel.fromJson).toList(); } - static Permissions converterSingle(Map data) { - return Permissions.fromJson(data); + static PermissionSupadartModel converterSingle(Map data) { + return PermissionSupadartModel.fromJson(data); } static Map _generateMap({ @@ -95,8 +98,8 @@ class Permissions implements SupadartClass { ); } - factory Permissions.fromJson(Map jsonn) { - return Permissions( + factory PermissionSupadartModel.fromJson(Map jsonn) { + return PermissionSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', action: jsonn['action'] != null ? jsonn['action'].toString() : '', resourceId: @@ -112,11 +115,15 @@ class Permissions implements SupadartClass { : DateTime.fromMillisecondsSinceEpoch(0), resource: jsonn['resources'] != null - ? Resources.fromJson(jsonn['resources'] as Map) + ? ResourceSupadartModel.fromJson( + jsonn['resources'] as Map, + ) : null, - roleObj: + role: jsonn['roles'] != null - ? Roles.fromJson(jsonn['roles'] as Map) + ? RoleSupadartModel.fromJson( + jsonn['roles'] as Map, + ) : null, ); } @@ -130,12 +137,12 @@ class Permissions implements SupadartClass { createdAt: createdAt, updatedAt: updatedAt, // 'resources': resource?.toJson(), - // 'roles': roleObj?.toJson(), + // 'roles': role?.toJson(), ); } static const _unset = Object(); - Permissions copyWith({ + PermissionSupadartModel copyWith({ Object? id = _unset, Object? action = _unset, Object? resourceId = _unset, @@ -143,17 +150,20 @@ class Permissions implements SupadartClass { Object? createdAt = _unset, Object? updatedAt = _unset, Object? resource = _unset, - Object? roleObj = _unset, + Object? role = _unset, }) { - return Permissions( + return PermissionSupadartModel( id: id == _unset ? this.id : id as String, action: action == _unset ? this.action : action as String, resourceId: resourceId == _unset ? this.resourceId : resourceId as String, roleId: roleId == _unset ? this.roleId : roleId as String, createdAt: createdAt == _unset ? this.createdAt : createdAt as DateTime, updatedAt: updatedAt == _unset ? this.updatedAt : updatedAt as DateTime, - resource: resource == _unset ? this.resource : resource as Resources?, - roleObj: roleObj == _unset ? this.roleObj : roleObj as Roles?, + resource: + resource == _unset + ? this.resource + : resource as ResourceSupadartModel?, + role: role == _unset ? this.role : role as RoleSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/personalization/models/supadart-models/profiles_model_supadart.dart b/sigap-mobile/lib/src/features/personalization/models/supadart-models/profiles_model_supadart.dart index b6de9ae..9d8e718 100644 --- a/sigap-mobile/lib/src/features/personalization/models/supadart-models/profiles_model_supadart.dart +++ b/sigap-mobile/lib/src/features/personalization/models/supadart-models/profiles_model_supadart.dart @@ -4,7 +4,7 @@ import 'package:sigap/supadart/supadart_exports.dart'; import 'package:sigap/supadart/supadart_header.dart'; -class Profiles implements SupadartClass { +class ProfileSupadartModel implements SupadartClass { final String id; final String userId; final String? avatar; @@ -15,9 +15,9 @@ class Profiles implements SupadartClass { final Map? address; final DateTime? birthDate; final String nik; - final Users? user; + final UserSupadartModel? user; - const Profiles({ + const ProfileSupadartModel({ required this.id, required this.userId, this.avatar, @@ -31,7 +31,7 @@ class Profiles implements SupadartClass { this.user, }); - static String get table_name => 'profiles'; + static String get table_name => 'profileSupadartModel'; static String get c_id => 'id'; static String get c_userId => 'user_id'; static String get c_avatar => 'avatar'; @@ -43,12 +43,12 @@ class Profiles implements SupadartClass { static String get c_birthDate => 'birth_date'; static String get c_nik => 'nik'; - static List converter(List> data) { - return data.map(Profiles.fromJson).toList(); + static List converter(List> data) { + return data.map(ProfileSupadartModel.fromJson).toList(); } - static Profiles converterSingle(Map data) { - return Profiles.fromJson(data); + static ProfileSupadartModel converterSingle(Map data) { + return ProfileSupadartModel.fromJson(data); } static Map _generateMap({ @@ -129,8 +129,8 @@ class Profiles implements SupadartClass { ); } - factory Profiles.fromJson(Map jsonn) { - return Profiles( + factory ProfileSupadartModel.fromJson(Map jsonn) { + return ProfileSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', userId: jsonn['user_id'] != null ? jsonn['user_id'].toString() : '', avatar: jsonn['avatar'] != null ? jsonn['avatar'].toString() : null, @@ -151,7 +151,9 @@ class Profiles implements SupadartClass { nik: jsonn['nik'] != null ? jsonn['nik'].toString() : '', user: jsonn['users'] != null - ? Users.fromJson(jsonn['users'] as Map) + ? UserSupadartModel.fromJson( + jsonn['users'] as Map, + ) : null, ); } @@ -173,7 +175,7 @@ class Profiles implements SupadartClass { } static const _unset = Object(); - Profiles copyWith({ + ProfileSupadartModel copyWith({ Object? id = _unset, Object? userId = _unset, Object? avatar = _unset, @@ -186,7 +188,7 @@ class Profiles implements SupadartClass { Object? nik = _unset, Object? user = _unset, }) { - return Profiles( + return ProfileSupadartModel( id: id == _unset ? this.id : id as String, userId: userId == _unset ? this.userId : userId as String, avatar: avatar == _unset ? this.avatar : avatar as String?, @@ -198,7 +200,7 @@ class Profiles implements SupadartClass { address == _unset ? this.address : address as Map?, birthDate: birthDate == _unset ? this.birthDate : birthDate as DateTime?, nik: nik == _unset ? this.nik : nik as String, - user: user == _unset ? this.user : user as Users?, + user: user == _unset ? this.user : user as UserSupadartModel?, ); } } diff --git a/sigap-mobile/lib/src/features/personalization/models/supadart-models/resources_model_supadart.dart b/sigap-mobile/lib/src/features/personalization/models/supadart-models/resources_model_supadart.dart index 6bc1533..6d9d704 100644 --- a/sigap-mobile/lib/src/features/personalization/models/supadart-models/resources_model_supadart.dart +++ b/sigap-mobile/lib/src/features/personalization/models/supadart-models/resources_model_supadart.dart @@ -3,7 +3,7 @@ // WARNING: Modifications may be overwritten. Please make changes in the Supadart configuration. import 'package:sigap/supadart/supadart_header.dart'; -class Resources implements SupadartClass { +class ResourceSupadartModel implements SupadartClass { final String id; final String name; final String? type; @@ -14,7 +14,7 @@ class Resources implements SupadartClass { final DateTime createdAt; final DateTime updatedAt; - const Resources({ + const ResourceSupadartModel({ required this.id, required this.name, this.type, @@ -26,7 +26,7 @@ class Resources implements SupadartClass { required this.updatedAt, }); - static String get table_name => 'resources'; + static String get table_name => 'resourceSupadartModel'; static String get c_id => 'id'; static String get c_name => 'name'; static String get c_type => 'type'; @@ -37,12 +37,12 @@ class Resources implements SupadartClass { static String get c_createdAt => 'created_at'; static String get c_updatedAt => 'updated_at'; - static List converter(List> data) { - return data.map(Resources.fromJson).toList(); + static List converter(List> data) { + return data.map(ResourceSupadartModel.fromJson).toList(); } - static Resources converterSingle(Map data) { - return Resources.fromJson(data); + static ResourceSupadartModel converterSingle(Map data) { + return ResourceSupadartModel.fromJson(data); } static Map _generateMap({ @@ -117,8 +117,8 @@ class Resources implements SupadartClass { ); } - factory Resources.fromJson(Map jsonn) { - return Resources( + factory ResourceSupadartModel.fromJson(Map jsonn) { + return ResourceSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', name: jsonn['name'] != null ? jsonn['name'].toString() : '', type: jsonn['type'] != null ? jsonn['type'].toString() : null, @@ -160,7 +160,7 @@ class Resources implements SupadartClass { } static const _unset = Object(); - Resources copyWith({ + ResourceSupadartModel copyWith({ Object? id = _unset, Object? name = _unset, Object? type = _unset, @@ -171,7 +171,7 @@ class Resources implements SupadartClass { Object? createdAt = _unset, Object? updatedAt = _unset, }) { - return Resources( + return ResourceSupadartModel( id: id == _unset ? this.id : id as String, name: name == _unset ? this.name : name as String, type: type == _unset ? this.type : type as String?, diff --git a/sigap-mobile/lib/src/features/personalization/models/supadart-models/roles_model_supadart.dart b/sigap-mobile/lib/src/features/personalization/models/supadart-models/roles_model_supadart.dart index 6222e0a..e6dfc18 100644 --- a/sigap-mobile/lib/src/features/personalization/models/supadart-models/roles_model_supadart.dart +++ b/sigap-mobile/lib/src/features/personalization/models/supadart-models/roles_model_supadart.dart @@ -3,14 +3,14 @@ // WARNING: Modifications may be overwritten. Please make changes in the Supadart configuration. import 'package:sigap/supadart/supadart_header.dart'; -class Roles implements SupadartClass { +class RoleSupadartModel implements SupadartClass { final String id; final String name; final String? description; final DateTime createdAt; final DateTime updatedAt; - const Roles({ + const RoleSupadartModel({ required this.id, required this.name, this.description, @@ -18,19 +18,19 @@ class Roles implements SupadartClass { required this.updatedAt, }); - static String get table_name => 'roles'; + static String get table_name => 'roleSupadartModel'; static String get c_id => 'id'; static String get c_name => 'name'; static String get c_description => 'description'; static String get c_createdAt => 'created_at'; static String get c_updatedAt => 'updated_at'; - static List converter(List> data) { - return data.map(Roles.fromJson).toList(); + static List converter(List> data) { + return data.map(RoleSupadartModel.fromJson).toList(); } - static Roles converterSingle(Map data) { - return Roles.fromJson(data); + static RoleSupadartModel converterSingle(Map data) { + return RoleSupadartModel.fromJson(data); } static Map _generateMap({ @@ -81,8 +81,8 @@ class Roles implements SupadartClass { ); } - factory Roles.fromJson(Map jsonn) { - return Roles( + factory RoleSupadartModel.fromJson(Map jsonn) { + return RoleSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', name: jsonn['name'] != null ? jsonn['name'].toString() : '', description: @@ -109,14 +109,14 @@ class Roles implements SupadartClass { } static const _unset = Object(); - Roles copyWith({ + RoleSupadartModel copyWith({ Object? id = _unset, Object? name = _unset, Object? description = _unset, Object? createdAt = _unset, Object? updatedAt = _unset, }) { - return Roles( + return RoleSupadartModel( id: id == _unset ? this.id : id as String, name: name == _unset ? this.name : name as String, description: diff --git a/sigap-mobile/lib/src/features/personalization/models/supadart-models/users_model_supadart.dart b/sigap-mobile/lib/src/features/personalization/models/supadart-models/users_model_supadart.dart index ecd69dc..d17922d 100644 --- a/sigap-mobile/lib/src/features/personalization/models/supadart-models/users_model_supadart.dart +++ b/sigap-mobile/lib/src/features/personalization/models/supadart-models/users_model_supadart.dart @@ -4,7 +4,7 @@ import 'package:sigap/supadart/supadart_exports.dart'; import 'package:sigap/supadart/supadart_header.dart'; -class Users implements SupadartClass { +class UserSupadartModel implements SupadartClass { final String id; final String rolesId; final String email; @@ -25,10 +25,10 @@ class Users implements SupadartClass { final bool isBanned; final int panicStrike; final int spoofingAttempts; - final Roles? role; - final Profiles? profile; + final RoleSupadartModel? role; + final ProfileSupadartModel? profile; - const Users({ + const UserSupadartModel({ required this.id, required this.rolesId, required this.email, @@ -53,7 +53,7 @@ class Users implements SupadartClass { this.profile, }); - static String get table_name => 'users'; + static String get table_name => 'userSupadartModel'; static String get c_id => 'id'; static String get c_rolesId => 'roles_id'; static String get c_email => 'email'; @@ -75,12 +75,12 @@ class Users implements SupadartClass { static String get c_panicStrike => 'panic_strike'; static String get c_spoofingAttempts => 'spoofing_attempts'; - static List converter(List> data) { - return data.map(Users.fromJson).toList(); + static List converter(List> data) { + return data.map(UserSupadartModel.fromJson).toList(); } - static Users converterSingle(Map data) { - return Users.fromJson(data); + static UserSupadartModel converterSingle(Map data) { + return UserSupadartModel.fromJson(data); } static Map _generateMap({ @@ -226,8 +226,8 @@ class Users implements SupadartClass { ); } - factory Users.fromJson(Map jsonn) { - return Users( + factory UserSupadartModel.fromJson(Map jsonn) { + return UserSupadartModel( id: jsonn['id'] != null ? jsonn['id'].toString() : '', rolesId: jsonn['roles_id'] != null ? jsonn['roles_id'].toString() : '', email: jsonn['email'] != null ? jsonn['email'].toString() : '', @@ -293,11 +293,15 @@ class Users implements SupadartClass { : 0, role: jsonn['roles'] != null - ? Roles.fromJson(jsonn['roles'] as Map) + ? RoleSupadartModel.fromJson( + jsonn['roles'] as Map, + ) : null, profile: jsonn['profiles'] != null - ? Profiles.fromJson(jsonn['profiles'] as Map) + ? ProfileSupadartModel.fromJson( + jsonn['profiles'] as Map, + ) : null, ); } @@ -330,7 +334,7 @@ class Users implements SupadartClass { } static const _unset = Object(); - Users copyWith({ + UserSupadartModel copyWith({ Object? id = _unset, Object? rolesId = _unset, Object? email = _unset, @@ -354,7 +358,7 @@ class Users implements SupadartClass { Object? role = _unset, Object? profile = _unset, }) { - return Users( + return UserSupadartModel( id: id == _unset ? this.id : id as String, rolesId: rolesId == _unset ? this.rolesId : rolesId as String, email: email == _unset ? this.email : email as String, @@ -401,8 +405,9 @@ class Users implements SupadartClass { spoofingAttempts == _unset ? this.spoofingAttempts : spoofingAttempts as int, - role: role == _unset ? this.role : role as Roles?, - profile: profile == _unset ? this.profile : profile as Profiles?, + role: role == _unset ? this.role : role as RoleSupadartModel?, + profile: + profile == _unset ? this.profile : profile as ProfileSupadartModel?, ); } } diff --git a/sigap-mobile/supadart.yaml b/sigap-mobile/supadart.yaml index dee38a7..3bf2a87 100644 --- a/sigap-mobile/supadart.yaml +++ b/sigap-mobile/supadart.yaml @@ -16,7 +16,7 @@ enums: unit_type: ["other", "polda", "polres", "polsek"] # Optional, where to place the generated classes files default: ./lib/models/ -output: lib/models/ +output: lib/generated/ # Set to true, if you want to generate separated files for each classes separated: true # Set to true, if you are not using Flutter, just normal Dart project @@ -24,11 +24,33 @@ dart: false # Optional, used to map table names to class names(case-sensitive) mappings: - _prisma_migrations: PrismaMigrations - # books: book - # categories: category - # children: child - # people: person + _prisma_migrations: PrismaMigrationsSupadartModel + cities: CitySupadartModel + contact_messages: ContactMessageSupadartModel + crime_categories: CrimeCategorySupadartModel + crime_incidents: CrimeIncidentSupadartModel + crimes: CrimeSupadartModel + demographics: DemographicSupadartModel + districts: DistrictSupadartModel + events: EventSupadartModel + evidence: EvidenceSupadartModel + geographics: GeographicSupadartModel + incident_logs: IncidentLogSupadartModel + location_logs: LocationLogSupadartModel + locations: LocationSupadartModel + logs: LogSupadartModel + officers: OfficerSupadartModel + panic_button_logs: PanicButtonLogSupadartModel + patrol_units: PatrolUnitSupadartModel + permissions: PermissionSupadartModel + profiles: ProfileSupadartModel + resources: ResourceSupadartModel + roles: RoleSupadartModel + sessions: SessionSupadartModel + unit_statistics: UnitStatisticSupadartModel + units: UnitSupadartModel + users: UserSupadartModel + # Optional, used to exclude methods from generated classes, comment out to include them exclude: