feat: API 통합 2차 작업 완료
- 자동 로그인 구현: 앱 시작 시 토큰 확인 후 적절한 화면으로 라우팅 - AuthInterceptor 개선: AuthService와 통합하여 토큰 관리 일원화 - 로그아웃 기능 개선: AuthService를 사용한 API 로그아웃 처리 - 대시보드 API 연동: MockDataService에서 실제 API로 완전 전환 - Dashboard DTO 모델 생성 (OverviewStats, RecentActivity 등) - DashboardRemoteDataSource 및 DashboardService 구현 - OverviewController를 ChangeNotifier 패턴으로 개선 - OverviewScreenRedesign에 Provider 패턴 적용 - API 통합 진행 상황 문서 업데이트
This commit is contained in:
17
lib/data/models/dashboard/equipment_status_distribution.dart
Normal file
17
lib/data/models/dashboard/equipment_status_distribution.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'equipment_status_distribution.freezed.dart';
|
||||
part 'equipment_status_distribution.g.dart';
|
||||
|
||||
@freezed
|
||||
class EquipmentStatusDistribution with _$EquipmentStatusDistribution {
|
||||
const factory EquipmentStatusDistribution({
|
||||
required int available,
|
||||
@JsonKey(name: 'in_use') required int inUse,
|
||||
required int maintenance,
|
||||
required int disposed,
|
||||
}) = _EquipmentStatusDistribution;
|
||||
|
||||
factory EquipmentStatusDistribution.fromJson(Map<String, dynamic> json) =>
|
||||
_$EquipmentStatusDistributionFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'equipment_status_distribution.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
EquipmentStatusDistribution _$EquipmentStatusDistributionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return _EquipmentStatusDistribution.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$EquipmentStatusDistribution {
|
||||
int get available => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'in_use')
|
||||
int get inUse => throw _privateConstructorUsedError;
|
||||
int get maintenance => throw _privateConstructorUsedError;
|
||||
int get disposed => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this EquipmentStatusDistribution to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of EquipmentStatusDistribution
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$EquipmentStatusDistributionCopyWith<EquipmentStatusDistribution>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $EquipmentStatusDistributionCopyWith<$Res> {
|
||||
factory $EquipmentStatusDistributionCopyWith(
|
||||
EquipmentStatusDistribution value,
|
||||
$Res Function(EquipmentStatusDistribution) then) =
|
||||
_$EquipmentStatusDistributionCopyWithImpl<$Res,
|
||||
EquipmentStatusDistribution>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int available,
|
||||
@JsonKey(name: 'in_use') int inUse,
|
||||
int maintenance,
|
||||
int disposed});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$EquipmentStatusDistributionCopyWithImpl<$Res,
|
||||
$Val extends EquipmentStatusDistribution>
|
||||
implements $EquipmentStatusDistributionCopyWith<$Res> {
|
||||
_$EquipmentStatusDistributionCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of EquipmentStatusDistribution
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? available = null,
|
||||
Object? inUse = null,
|
||||
Object? maintenance = null,
|
||||
Object? disposed = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
available: null == available
|
||||
? _value.available
|
||||
: available // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
inUse: null == inUse
|
||||
? _value.inUse
|
||||
: inUse // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
maintenance: null == maintenance
|
||||
? _value.maintenance
|
||||
: maintenance // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
disposed: null == disposed
|
||||
? _value.disposed
|
||||
: disposed // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$EquipmentStatusDistributionImplCopyWith<$Res>
|
||||
implements $EquipmentStatusDistributionCopyWith<$Res> {
|
||||
factory _$$EquipmentStatusDistributionImplCopyWith(
|
||||
_$EquipmentStatusDistributionImpl value,
|
||||
$Res Function(_$EquipmentStatusDistributionImpl) then) =
|
||||
__$$EquipmentStatusDistributionImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int available,
|
||||
@JsonKey(name: 'in_use') int inUse,
|
||||
int maintenance,
|
||||
int disposed});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$EquipmentStatusDistributionImplCopyWithImpl<$Res>
|
||||
extends _$EquipmentStatusDistributionCopyWithImpl<$Res,
|
||||
_$EquipmentStatusDistributionImpl>
|
||||
implements _$$EquipmentStatusDistributionImplCopyWith<$Res> {
|
||||
__$$EquipmentStatusDistributionImplCopyWithImpl(
|
||||
_$EquipmentStatusDistributionImpl _value,
|
||||
$Res Function(_$EquipmentStatusDistributionImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of EquipmentStatusDistribution
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? available = null,
|
||||
Object? inUse = null,
|
||||
Object? maintenance = null,
|
||||
Object? disposed = null,
|
||||
}) {
|
||||
return _then(_$EquipmentStatusDistributionImpl(
|
||||
available: null == available
|
||||
? _value.available
|
||||
: available // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
inUse: null == inUse
|
||||
? _value.inUse
|
||||
: inUse // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
maintenance: null == maintenance
|
||||
? _value.maintenance
|
||||
: maintenance // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
disposed: null == disposed
|
||||
? _value.disposed
|
||||
: disposed // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$EquipmentStatusDistributionImpl
|
||||
implements _EquipmentStatusDistribution {
|
||||
const _$EquipmentStatusDistributionImpl(
|
||||
{required this.available,
|
||||
@JsonKey(name: 'in_use') required this.inUse,
|
||||
required this.maintenance,
|
||||
required this.disposed});
|
||||
|
||||
factory _$EquipmentStatusDistributionImpl.fromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$$EquipmentStatusDistributionImplFromJson(json);
|
||||
|
||||
@override
|
||||
final int available;
|
||||
@override
|
||||
@JsonKey(name: 'in_use')
|
||||
final int inUse;
|
||||
@override
|
||||
final int maintenance;
|
||||
@override
|
||||
final int disposed;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'EquipmentStatusDistribution(available: $available, inUse: $inUse, maintenance: $maintenance, disposed: $disposed)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$EquipmentStatusDistributionImpl &&
|
||||
(identical(other.available, available) ||
|
||||
other.available == available) &&
|
||||
(identical(other.inUse, inUse) || other.inUse == inUse) &&
|
||||
(identical(other.maintenance, maintenance) ||
|
||||
other.maintenance == maintenance) &&
|
||||
(identical(other.disposed, disposed) ||
|
||||
other.disposed == disposed));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, available, inUse, maintenance, disposed);
|
||||
|
||||
/// Create a copy of EquipmentStatusDistribution
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$EquipmentStatusDistributionImplCopyWith<_$EquipmentStatusDistributionImpl>
|
||||
get copyWith => __$$EquipmentStatusDistributionImplCopyWithImpl<
|
||||
_$EquipmentStatusDistributionImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$EquipmentStatusDistributionImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _EquipmentStatusDistribution
|
||||
implements EquipmentStatusDistribution {
|
||||
const factory _EquipmentStatusDistribution(
|
||||
{required final int available,
|
||||
@JsonKey(name: 'in_use') required final int inUse,
|
||||
required final int maintenance,
|
||||
required final int disposed}) = _$EquipmentStatusDistributionImpl;
|
||||
|
||||
factory _EquipmentStatusDistribution.fromJson(Map<String, dynamic> json) =
|
||||
_$EquipmentStatusDistributionImpl.fromJson;
|
||||
|
||||
@override
|
||||
int get available;
|
||||
@override
|
||||
@JsonKey(name: 'in_use')
|
||||
int get inUse;
|
||||
@override
|
||||
int get maintenance;
|
||||
@override
|
||||
int get disposed;
|
||||
|
||||
/// Create a copy of EquipmentStatusDistribution
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$EquipmentStatusDistributionImplCopyWith<_$EquipmentStatusDistributionImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'equipment_status_distribution.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$EquipmentStatusDistributionImpl _$$EquipmentStatusDistributionImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$EquipmentStatusDistributionImpl(
|
||||
available: (json['available'] as num).toInt(),
|
||||
inUse: (json['in_use'] as num).toInt(),
|
||||
maintenance: (json['maintenance'] as num).toInt(),
|
||||
disposed: (json['disposed'] as num).toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$EquipmentStatusDistributionImplToJson(
|
||||
_$EquipmentStatusDistributionImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'available': instance.available,
|
||||
'in_use': instance.inUse,
|
||||
'maintenance': instance.maintenance,
|
||||
'disposed': instance.disposed,
|
||||
};
|
||||
19
lib/data/models/dashboard/expiring_license.dart
Normal file
19
lib/data/models/dashboard/expiring_license.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'expiring_license.freezed.dart';
|
||||
part 'expiring_license.g.dart';
|
||||
|
||||
@freezed
|
||||
class ExpiringLicense with _$ExpiringLicense {
|
||||
const factory ExpiringLicense({
|
||||
required int id,
|
||||
@JsonKey(name: 'license_name') required String licenseName,
|
||||
@JsonKey(name: 'company_name') required String companyName,
|
||||
@JsonKey(name: 'expiry_date') required DateTime expiryDate,
|
||||
@JsonKey(name: 'days_remaining') required int daysRemaining,
|
||||
@JsonKey(name: 'license_type') required String licenseType,
|
||||
}) = _ExpiringLicense;
|
||||
|
||||
factory ExpiringLicense.fromJson(Map<String, dynamic> json) =>
|
||||
_$ExpiringLicenseFromJson(json);
|
||||
}
|
||||
291
lib/data/models/dashboard/expiring_license.freezed.dart
Normal file
291
lib/data/models/dashboard/expiring_license.freezed.dart
Normal file
@@ -0,0 +1,291 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'expiring_license.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
ExpiringLicense _$ExpiringLicenseFromJson(Map<String, dynamic> json) {
|
||||
return _ExpiringLicense.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ExpiringLicense {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'license_name')
|
||||
String get licenseName => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'company_name')
|
||||
String get companyName => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'expiry_date')
|
||||
DateTime get expiryDate => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'days_remaining')
|
||||
int get daysRemaining => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'license_type')
|
||||
String get licenseType => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this ExpiringLicense to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of ExpiringLicense
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$ExpiringLicenseCopyWith<ExpiringLicense> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ExpiringLicenseCopyWith<$Res> {
|
||||
factory $ExpiringLicenseCopyWith(
|
||||
ExpiringLicense value, $Res Function(ExpiringLicense) then) =
|
||||
_$ExpiringLicenseCopyWithImpl<$Res, ExpiringLicense>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
@JsonKey(name: 'license_name') String licenseName,
|
||||
@JsonKey(name: 'company_name') String companyName,
|
||||
@JsonKey(name: 'expiry_date') DateTime expiryDate,
|
||||
@JsonKey(name: 'days_remaining') int daysRemaining,
|
||||
@JsonKey(name: 'license_type') String licenseType});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ExpiringLicenseCopyWithImpl<$Res, $Val extends ExpiringLicense>
|
||||
implements $ExpiringLicenseCopyWith<$Res> {
|
||||
_$ExpiringLicenseCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ExpiringLicense
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? licenseName = null,
|
||||
Object? companyName = null,
|
||||
Object? expiryDate = null,
|
||||
Object? daysRemaining = null,
|
||||
Object? licenseType = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
licenseName: null == licenseName
|
||||
? _value.licenseName
|
||||
: licenseName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
companyName: null == companyName
|
||||
? _value.companyName
|
||||
: companyName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
expiryDate: null == expiryDate
|
||||
? _value.expiryDate
|
||||
: expiryDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
daysRemaining: null == daysRemaining
|
||||
? _value.daysRemaining
|
||||
: daysRemaining // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
licenseType: null == licenseType
|
||||
? _value.licenseType
|
||||
: licenseType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ExpiringLicenseImplCopyWith<$Res>
|
||||
implements $ExpiringLicenseCopyWith<$Res> {
|
||||
factory _$$ExpiringLicenseImplCopyWith(_$ExpiringLicenseImpl value,
|
||||
$Res Function(_$ExpiringLicenseImpl) then) =
|
||||
__$$ExpiringLicenseImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
@JsonKey(name: 'license_name') String licenseName,
|
||||
@JsonKey(name: 'company_name') String companyName,
|
||||
@JsonKey(name: 'expiry_date') DateTime expiryDate,
|
||||
@JsonKey(name: 'days_remaining') int daysRemaining,
|
||||
@JsonKey(name: 'license_type') String licenseType});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ExpiringLicenseImplCopyWithImpl<$Res>
|
||||
extends _$ExpiringLicenseCopyWithImpl<$Res, _$ExpiringLicenseImpl>
|
||||
implements _$$ExpiringLicenseImplCopyWith<$Res> {
|
||||
__$$ExpiringLicenseImplCopyWithImpl(
|
||||
_$ExpiringLicenseImpl _value, $Res Function(_$ExpiringLicenseImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of ExpiringLicense
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? licenseName = null,
|
||||
Object? companyName = null,
|
||||
Object? expiryDate = null,
|
||||
Object? daysRemaining = null,
|
||||
Object? licenseType = null,
|
||||
}) {
|
||||
return _then(_$ExpiringLicenseImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
licenseName: null == licenseName
|
||||
? _value.licenseName
|
||||
: licenseName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
companyName: null == companyName
|
||||
? _value.companyName
|
||||
: companyName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
expiryDate: null == expiryDate
|
||||
? _value.expiryDate
|
||||
: expiryDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
daysRemaining: null == daysRemaining
|
||||
? _value.daysRemaining
|
||||
: daysRemaining // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
licenseType: null == licenseType
|
||||
? _value.licenseType
|
||||
: licenseType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$ExpiringLicenseImpl implements _ExpiringLicense {
|
||||
const _$ExpiringLicenseImpl(
|
||||
{required this.id,
|
||||
@JsonKey(name: 'license_name') required this.licenseName,
|
||||
@JsonKey(name: 'company_name') required this.companyName,
|
||||
@JsonKey(name: 'expiry_date') required this.expiryDate,
|
||||
@JsonKey(name: 'days_remaining') required this.daysRemaining,
|
||||
@JsonKey(name: 'license_type') required this.licenseType});
|
||||
|
||||
factory _$ExpiringLicenseImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$ExpiringLicenseImplFromJson(json);
|
||||
|
||||
@override
|
||||
final int id;
|
||||
@override
|
||||
@JsonKey(name: 'license_name')
|
||||
final String licenseName;
|
||||
@override
|
||||
@JsonKey(name: 'company_name')
|
||||
final String companyName;
|
||||
@override
|
||||
@JsonKey(name: 'expiry_date')
|
||||
final DateTime expiryDate;
|
||||
@override
|
||||
@JsonKey(name: 'days_remaining')
|
||||
final int daysRemaining;
|
||||
@override
|
||||
@JsonKey(name: 'license_type')
|
||||
final String licenseType;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ExpiringLicense(id: $id, licenseName: $licenseName, companyName: $companyName, expiryDate: $expiryDate, daysRemaining: $daysRemaining, licenseType: $licenseType)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ExpiringLicenseImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.licenseName, licenseName) ||
|
||||
other.licenseName == licenseName) &&
|
||||
(identical(other.companyName, companyName) ||
|
||||
other.companyName == companyName) &&
|
||||
(identical(other.expiryDate, expiryDate) ||
|
||||
other.expiryDate == expiryDate) &&
|
||||
(identical(other.daysRemaining, daysRemaining) ||
|
||||
other.daysRemaining == daysRemaining) &&
|
||||
(identical(other.licenseType, licenseType) ||
|
||||
other.licenseType == licenseType));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, id, licenseName, companyName,
|
||||
expiryDate, daysRemaining, licenseType);
|
||||
|
||||
/// Create a copy of ExpiringLicense
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ExpiringLicenseImplCopyWith<_$ExpiringLicenseImpl> get copyWith =>
|
||||
__$$ExpiringLicenseImplCopyWithImpl<_$ExpiringLicenseImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$ExpiringLicenseImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _ExpiringLicense implements ExpiringLicense {
|
||||
const factory _ExpiringLicense(
|
||||
{required final int id,
|
||||
@JsonKey(name: 'license_name') required final String licenseName,
|
||||
@JsonKey(name: 'company_name') required final String companyName,
|
||||
@JsonKey(name: 'expiry_date') required final DateTime expiryDate,
|
||||
@JsonKey(name: 'days_remaining') required final int daysRemaining,
|
||||
@JsonKey(name: 'license_type') required final String licenseType}) =
|
||||
_$ExpiringLicenseImpl;
|
||||
|
||||
factory _ExpiringLicense.fromJson(Map<String, dynamic> json) =
|
||||
_$ExpiringLicenseImpl.fromJson;
|
||||
|
||||
@override
|
||||
int get id;
|
||||
@override
|
||||
@JsonKey(name: 'license_name')
|
||||
String get licenseName;
|
||||
@override
|
||||
@JsonKey(name: 'company_name')
|
||||
String get companyName;
|
||||
@override
|
||||
@JsonKey(name: 'expiry_date')
|
||||
DateTime get expiryDate;
|
||||
@override
|
||||
@JsonKey(name: 'days_remaining')
|
||||
int get daysRemaining;
|
||||
@override
|
||||
@JsonKey(name: 'license_type')
|
||||
String get licenseType;
|
||||
|
||||
/// Create a copy of ExpiringLicense
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ExpiringLicenseImplCopyWith<_$ExpiringLicenseImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
29
lib/data/models/dashboard/expiring_license.g.dart
Normal file
29
lib/data/models/dashboard/expiring_license.g.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'expiring_license.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$ExpiringLicenseImpl _$$ExpiringLicenseImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$ExpiringLicenseImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
licenseName: json['license_name'] as String,
|
||||
companyName: json['company_name'] as String,
|
||||
expiryDate: DateTime.parse(json['expiry_date'] as String),
|
||||
daysRemaining: (json['days_remaining'] as num).toInt(),
|
||||
licenseType: json['license_type'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ExpiringLicenseImplToJson(
|
||||
_$ExpiringLicenseImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'license_name': instance.licenseName,
|
||||
'company_name': instance.companyName,
|
||||
'expiry_date': instance.expiryDate.toIso8601String(),
|
||||
'days_remaining': instance.daysRemaining,
|
||||
'license_type': instance.licenseType,
|
||||
};
|
||||
23
lib/data/models/dashboard/overview_stats.dart
Normal file
23
lib/data/models/dashboard/overview_stats.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'overview_stats.freezed.dart';
|
||||
part 'overview_stats.g.dart';
|
||||
|
||||
@freezed
|
||||
class OverviewStats with _$OverviewStats {
|
||||
const factory OverviewStats({
|
||||
@JsonKey(name: 'total_equipment') required int totalEquipment,
|
||||
@JsonKey(name: 'available_equipment') required int availableEquipment,
|
||||
@JsonKey(name: 'in_use_equipment') required int inUseEquipment,
|
||||
@JsonKey(name: 'maintenance_equipment') required int maintenanceEquipment,
|
||||
@JsonKey(name: 'total_companies') required int totalCompanies,
|
||||
@JsonKey(name: 'total_users') required int totalUsers,
|
||||
@JsonKey(name: 'active_licenses') required int activeLicenses,
|
||||
@JsonKey(name: 'expiring_licenses') required int expiringLicenses,
|
||||
@JsonKey(name: 'total_rentals') required int totalRentals,
|
||||
@JsonKey(name: 'active_rentals') required int activeRentals,
|
||||
}) = _OverviewStats;
|
||||
|
||||
factory OverviewStats.fromJson(Map<String, dynamic> json) =>
|
||||
_$OverviewStatsFromJson(json);
|
||||
}
|
||||
403
lib/data/models/dashboard/overview_stats.freezed.dart
Normal file
403
lib/data/models/dashboard/overview_stats.freezed.dart
Normal file
@@ -0,0 +1,403 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'overview_stats.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
OverviewStats _$OverviewStatsFromJson(Map<String, dynamic> json) {
|
||||
return _OverviewStats.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$OverviewStats {
|
||||
@JsonKey(name: 'total_equipment')
|
||||
int get totalEquipment => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'available_equipment')
|
||||
int get availableEquipment => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'in_use_equipment')
|
||||
int get inUseEquipment => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'maintenance_equipment')
|
||||
int get maintenanceEquipment => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'total_companies')
|
||||
int get totalCompanies => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'total_users')
|
||||
int get totalUsers => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'active_licenses')
|
||||
int get activeLicenses => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'expiring_licenses')
|
||||
int get expiringLicenses => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'total_rentals')
|
||||
int get totalRentals => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'active_rentals')
|
||||
int get activeRentals => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this OverviewStats to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of OverviewStats
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$OverviewStatsCopyWith<OverviewStats> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $OverviewStatsCopyWith<$Res> {
|
||||
factory $OverviewStatsCopyWith(
|
||||
OverviewStats value, $Res Function(OverviewStats) then) =
|
||||
_$OverviewStatsCopyWithImpl<$Res, OverviewStats>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'total_equipment') int totalEquipment,
|
||||
@JsonKey(name: 'available_equipment') int availableEquipment,
|
||||
@JsonKey(name: 'in_use_equipment') int inUseEquipment,
|
||||
@JsonKey(name: 'maintenance_equipment') int maintenanceEquipment,
|
||||
@JsonKey(name: 'total_companies') int totalCompanies,
|
||||
@JsonKey(name: 'total_users') int totalUsers,
|
||||
@JsonKey(name: 'active_licenses') int activeLicenses,
|
||||
@JsonKey(name: 'expiring_licenses') int expiringLicenses,
|
||||
@JsonKey(name: 'total_rentals') int totalRentals,
|
||||
@JsonKey(name: 'active_rentals') int activeRentals});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$OverviewStatsCopyWithImpl<$Res, $Val extends OverviewStats>
|
||||
implements $OverviewStatsCopyWith<$Res> {
|
||||
_$OverviewStatsCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of OverviewStats
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? totalEquipment = null,
|
||||
Object? availableEquipment = null,
|
||||
Object? inUseEquipment = null,
|
||||
Object? maintenanceEquipment = null,
|
||||
Object? totalCompanies = null,
|
||||
Object? totalUsers = null,
|
||||
Object? activeLicenses = null,
|
||||
Object? expiringLicenses = null,
|
||||
Object? totalRentals = null,
|
||||
Object? activeRentals = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
totalEquipment: null == totalEquipment
|
||||
? _value.totalEquipment
|
||||
: totalEquipment // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
availableEquipment: null == availableEquipment
|
||||
? _value.availableEquipment
|
||||
: availableEquipment // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
inUseEquipment: null == inUseEquipment
|
||||
? _value.inUseEquipment
|
||||
: inUseEquipment // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
maintenanceEquipment: null == maintenanceEquipment
|
||||
? _value.maintenanceEquipment
|
||||
: maintenanceEquipment // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalCompanies: null == totalCompanies
|
||||
? _value.totalCompanies
|
||||
: totalCompanies // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalUsers: null == totalUsers
|
||||
? _value.totalUsers
|
||||
: totalUsers // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
activeLicenses: null == activeLicenses
|
||||
? _value.activeLicenses
|
||||
: activeLicenses // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
expiringLicenses: null == expiringLicenses
|
||||
? _value.expiringLicenses
|
||||
: expiringLicenses // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalRentals: null == totalRentals
|
||||
? _value.totalRentals
|
||||
: totalRentals // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
activeRentals: null == activeRentals
|
||||
? _value.activeRentals
|
||||
: activeRentals // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$OverviewStatsImplCopyWith<$Res>
|
||||
implements $OverviewStatsCopyWith<$Res> {
|
||||
factory _$$OverviewStatsImplCopyWith(
|
||||
_$OverviewStatsImpl value, $Res Function(_$OverviewStatsImpl) then) =
|
||||
__$$OverviewStatsImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'total_equipment') int totalEquipment,
|
||||
@JsonKey(name: 'available_equipment') int availableEquipment,
|
||||
@JsonKey(name: 'in_use_equipment') int inUseEquipment,
|
||||
@JsonKey(name: 'maintenance_equipment') int maintenanceEquipment,
|
||||
@JsonKey(name: 'total_companies') int totalCompanies,
|
||||
@JsonKey(name: 'total_users') int totalUsers,
|
||||
@JsonKey(name: 'active_licenses') int activeLicenses,
|
||||
@JsonKey(name: 'expiring_licenses') int expiringLicenses,
|
||||
@JsonKey(name: 'total_rentals') int totalRentals,
|
||||
@JsonKey(name: 'active_rentals') int activeRentals});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$OverviewStatsImplCopyWithImpl<$Res>
|
||||
extends _$OverviewStatsCopyWithImpl<$Res, _$OverviewStatsImpl>
|
||||
implements _$$OverviewStatsImplCopyWith<$Res> {
|
||||
__$$OverviewStatsImplCopyWithImpl(
|
||||
_$OverviewStatsImpl _value, $Res Function(_$OverviewStatsImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of OverviewStats
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? totalEquipment = null,
|
||||
Object? availableEquipment = null,
|
||||
Object? inUseEquipment = null,
|
||||
Object? maintenanceEquipment = null,
|
||||
Object? totalCompanies = null,
|
||||
Object? totalUsers = null,
|
||||
Object? activeLicenses = null,
|
||||
Object? expiringLicenses = null,
|
||||
Object? totalRentals = null,
|
||||
Object? activeRentals = null,
|
||||
}) {
|
||||
return _then(_$OverviewStatsImpl(
|
||||
totalEquipment: null == totalEquipment
|
||||
? _value.totalEquipment
|
||||
: totalEquipment // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
availableEquipment: null == availableEquipment
|
||||
? _value.availableEquipment
|
||||
: availableEquipment // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
inUseEquipment: null == inUseEquipment
|
||||
? _value.inUseEquipment
|
||||
: inUseEquipment // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
maintenanceEquipment: null == maintenanceEquipment
|
||||
? _value.maintenanceEquipment
|
||||
: maintenanceEquipment // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalCompanies: null == totalCompanies
|
||||
? _value.totalCompanies
|
||||
: totalCompanies // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalUsers: null == totalUsers
|
||||
? _value.totalUsers
|
||||
: totalUsers // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
activeLicenses: null == activeLicenses
|
||||
? _value.activeLicenses
|
||||
: activeLicenses // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
expiringLicenses: null == expiringLicenses
|
||||
? _value.expiringLicenses
|
||||
: expiringLicenses // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalRentals: null == totalRentals
|
||||
? _value.totalRentals
|
||||
: totalRentals // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
activeRentals: null == activeRentals
|
||||
? _value.activeRentals
|
||||
: activeRentals // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$OverviewStatsImpl implements _OverviewStats {
|
||||
const _$OverviewStatsImpl(
|
||||
{@JsonKey(name: 'total_equipment') required this.totalEquipment,
|
||||
@JsonKey(name: 'available_equipment') required this.availableEquipment,
|
||||
@JsonKey(name: 'in_use_equipment') required this.inUseEquipment,
|
||||
@JsonKey(name: 'maintenance_equipment')
|
||||
required this.maintenanceEquipment,
|
||||
@JsonKey(name: 'total_companies') required this.totalCompanies,
|
||||
@JsonKey(name: 'total_users') required this.totalUsers,
|
||||
@JsonKey(name: 'active_licenses') required this.activeLicenses,
|
||||
@JsonKey(name: 'expiring_licenses') required this.expiringLicenses,
|
||||
@JsonKey(name: 'total_rentals') required this.totalRentals,
|
||||
@JsonKey(name: 'active_rentals') required this.activeRentals});
|
||||
|
||||
factory _$OverviewStatsImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$OverviewStatsImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'total_equipment')
|
||||
final int totalEquipment;
|
||||
@override
|
||||
@JsonKey(name: 'available_equipment')
|
||||
final int availableEquipment;
|
||||
@override
|
||||
@JsonKey(name: 'in_use_equipment')
|
||||
final int inUseEquipment;
|
||||
@override
|
||||
@JsonKey(name: 'maintenance_equipment')
|
||||
final int maintenanceEquipment;
|
||||
@override
|
||||
@JsonKey(name: 'total_companies')
|
||||
final int totalCompanies;
|
||||
@override
|
||||
@JsonKey(name: 'total_users')
|
||||
final int totalUsers;
|
||||
@override
|
||||
@JsonKey(name: 'active_licenses')
|
||||
final int activeLicenses;
|
||||
@override
|
||||
@JsonKey(name: 'expiring_licenses')
|
||||
final int expiringLicenses;
|
||||
@override
|
||||
@JsonKey(name: 'total_rentals')
|
||||
final int totalRentals;
|
||||
@override
|
||||
@JsonKey(name: 'active_rentals')
|
||||
final int activeRentals;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'OverviewStats(totalEquipment: $totalEquipment, availableEquipment: $availableEquipment, inUseEquipment: $inUseEquipment, maintenanceEquipment: $maintenanceEquipment, totalCompanies: $totalCompanies, totalUsers: $totalUsers, activeLicenses: $activeLicenses, expiringLicenses: $expiringLicenses, totalRentals: $totalRentals, activeRentals: $activeRentals)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$OverviewStatsImpl &&
|
||||
(identical(other.totalEquipment, totalEquipment) ||
|
||||
other.totalEquipment == totalEquipment) &&
|
||||
(identical(other.availableEquipment, availableEquipment) ||
|
||||
other.availableEquipment == availableEquipment) &&
|
||||
(identical(other.inUseEquipment, inUseEquipment) ||
|
||||
other.inUseEquipment == inUseEquipment) &&
|
||||
(identical(other.maintenanceEquipment, maintenanceEquipment) ||
|
||||
other.maintenanceEquipment == maintenanceEquipment) &&
|
||||
(identical(other.totalCompanies, totalCompanies) ||
|
||||
other.totalCompanies == totalCompanies) &&
|
||||
(identical(other.totalUsers, totalUsers) ||
|
||||
other.totalUsers == totalUsers) &&
|
||||
(identical(other.activeLicenses, activeLicenses) ||
|
||||
other.activeLicenses == activeLicenses) &&
|
||||
(identical(other.expiringLicenses, expiringLicenses) ||
|
||||
other.expiringLicenses == expiringLicenses) &&
|
||||
(identical(other.totalRentals, totalRentals) ||
|
||||
other.totalRentals == totalRentals) &&
|
||||
(identical(other.activeRentals, activeRentals) ||
|
||||
other.activeRentals == activeRentals));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
totalEquipment,
|
||||
availableEquipment,
|
||||
inUseEquipment,
|
||||
maintenanceEquipment,
|
||||
totalCompanies,
|
||||
totalUsers,
|
||||
activeLicenses,
|
||||
expiringLicenses,
|
||||
totalRentals,
|
||||
activeRentals);
|
||||
|
||||
/// Create a copy of OverviewStats
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$OverviewStatsImplCopyWith<_$OverviewStatsImpl> get copyWith =>
|
||||
__$$OverviewStatsImplCopyWithImpl<_$OverviewStatsImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$OverviewStatsImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _OverviewStats implements OverviewStats {
|
||||
const factory _OverviewStats(
|
||||
{@JsonKey(name: 'total_equipment') required final int totalEquipment,
|
||||
@JsonKey(name: 'available_equipment')
|
||||
required final int availableEquipment,
|
||||
@JsonKey(name: 'in_use_equipment') required final int inUseEquipment,
|
||||
@JsonKey(name: 'maintenance_equipment')
|
||||
required final int maintenanceEquipment,
|
||||
@JsonKey(name: 'total_companies') required final int totalCompanies,
|
||||
@JsonKey(name: 'total_users') required final int totalUsers,
|
||||
@JsonKey(name: 'active_licenses') required final int activeLicenses,
|
||||
@JsonKey(name: 'expiring_licenses') required final int expiringLicenses,
|
||||
@JsonKey(name: 'total_rentals') required final int totalRentals,
|
||||
@JsonKey(name: 'active_rentals')
|
||||
required final int activeRentals}) = _$OverviewStatsImpl;
|
||||
|
||||
factory _OverviewStats.fromJson(Map<String, dynamic> json) =
|
||||
_$OverviewStatsImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'total_equipment')
|
||||
int get totalEquipment;
|
||||
@override
|
||||
@JsonKey(name: 'available_equipment')
|
||||
int get availableEquipment;
|
||||
@override
|
||||
@JsonKey(name: 'in_use_equipment')
|
||||
int get inUseEquipment;
|
||||
@override
|
||||
@JsonKey(name: 'maintenance_equipment')
|
||||
int get maintenanceEquipment;
|
||||
@override
|
||||
@JsonKey(name: 'total_companies')
|
||||
int get totalCompanies;
|
||||
@override
|
||||
@JsonKey(name: 'total_users')
|
||||
int get totalUsers;
|
||||
@override
|
||||
@JsonKey(name: 'active_licenses')
|
||||
int get activeLicenses;
|
||||
@override
|
||||
@JsonKey(name: 'expiring_licenses')
|
||||
int get expiringLicenses;
|
||||
@override
|
||||
@JsonKey(name: 'total_rentals')
|
||||
int get totalRentals;
|
||||
@override
|
||||
@JsonKey(name: 'active_rentals')
|
||||
int get activeRentals;
|
||||
|
||||
/// Create a copy of OverviewStats
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$OverviewStatsImplCopyWith<_$OverviewStatsImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
35
lib/data/models/dashboard/overview_stats.g.dart
Normal file
35
lib/data/models/dashboard/overview_stats.g.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'overview_stats.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$OverviewStatsImpl _$$OverviewStatsImplFromJson(Map<String, dynamic> json) =>
|
||||
_$OverviewStatsImpl(
|
||||
totalEquipment: (json['total_equipment'] as num).toInt(),
|
||||
availableEquipment: (json['available_equipment'] as num).toInt(),
|
||||
inUseEquipment: (json['in_use_equipment'] as num).toInt(),
|
||||
maintenanceEquipment: (json['maintenance_equipment'] as num).toInt(),
|
||||
totalCompanies: (json['total_companies'] as num).toInt(),
|
||||
totalUsers: (json['total_users'] as num).toInt(),
|
||||
activeLicenses: (json['active_licenses'] as num).toInt(),
|
||||
expiringLicenses: (json['expiring_licenses'] as num).toInt(),
|
||||
totalRentals: (json['total_rentals'] as num).toInt(),
|
||||
activeRentals: (json['active_rentals'] as num).toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$OverviewStatsImplToJson(_$OverviewStatsImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'total_equipment': instance.totalEquipment,
|
||||
'available_equipment': instance.availableEquipment,
|
||||
'in_use_equipment': instance.inUseEquipment,
|
||||
'maintenance_equipment': instance.maintenanceEquipment,
|
||||
'total_companies': instance.totalCompanies,
|
||||
'total_users': instance.totalUsers,
|
||||
'active_licenses': instance.activeLicenses,
|
||||
'expiring_licenses': instance.expiringLicenses,
|
||||
'total_rentals': instance.totalRentals,
|
||||
'active_rentals': instance.activeRentals,
|
||||
};
|
||||
19
lib/data/models/dashboard/recent_activity.dart
Normal file
19
lib/data/models/dashboard/recent_activity.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'recent_activity.freezed.dart';
|
||||
part 'recent_activity.g.dart';
|
||||
|
||||
@freezed
|
||||
class RecentActivity with _$RecentActivity {
|
||||
const factory RecentActivity({
|
||||
required int id,
|
||||
@JsonKey(name: 'activity_type') required String activityType,
|
||||
required String description,
|
||||
@JsonKey(name: 'user_name') required String userName,
|
||||
@JsonKey(name: 'created_at') required DateTime createdAt,
|
||||
Map<String, dynamic>? metadata,
|
||||
}) = _RecentActivity;
|
||||
|
||||
factory RecentActivity.fromJson(Map<String, dynamic> json) =>
|
||||
_$RecentActivityFromJson(json);
|
||||
}
|
||||
291
lib/data/models/dashboard/recent_activity.freezed.dart
Normal file
291
lib/data/models/dashboard/recent_activity.freezed.dart
Normal file
@@ -0,0 +1,291 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'recent_activity.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
RecentActivity _$RecentActivityFromJson(Map<String, dynamic> json) {
|
||||
return _RecentActivity.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$RecentActivity {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'activity_type')
|
||||
String get activityType => throw _privateConstructorUsedError;
|
||||
String get description => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'user_name')
|
||||
String get userName => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'created_at')
|
||||
DateTime get createdAt => throw _privateConstructorUsedError;
|
||||
Map<String, dynamic>? get metadata => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this RecentActivity to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of RecentActivity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$RecentActivityCopyWith<RecentActivity> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $RecentActivityCopyWith<$Res> {
|
||||
factory $RecentActivityCopyWith(
|
||||
RecentActivity value, $Res Function(RecentActivity) then) =
|
||||
_$RecentActivityCopyWithImpl<$Res, RecentActivity>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
@JsonKey(name: 'activity_type') String activityType,
|
||||
String description,
|
||||
@JsonKey(name: 'user_name') String userName,
|
||||
@JsonKey(name: 'created_at') DateTime createdAt,
|
||||
Map<String, dynamic>? metadata});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$RecentActivityCopyWithImpl<$Res, $Val extends RecentActivity>
|
||||
implements $RecentActivityCopyWith<$Res> {
|
||||
_$RecentActivityCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of RecentActivity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? activityType = null,
|
||||
Object? description = null,
|
||||
Object? userName = null,
|
||||
Object? createdAt = null,
|
||||
Object? metadata = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
activityType: null == activityType
|
||||
? _value.activityType
|
||||
: activityType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
description: null == description
|
||||
? _value.description
|
||||
: description // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
userName: null == userName
|
||||
? _value.userName
|
||||
: userName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
createdAt: null == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
metadata: freezed == metadata
|
||||
? _value.metadata
|
||||
: metadata // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$RecentActivityImplCopyWith<$Res>
|
||||
implements $RecentActivityCopyWith<$Res> {
|
||||
factory _$$RecentActivityImplCopyWith(_$RecentActivityImpl value,
|
||||
$Res Function(_$RecentActivityImpl) then) =
|
||||
__$$RecentActivityImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
@JsonKey(name: 'activity_type') String activityType,
|
||||
String description,
|
||||
@JsonKey(name: 'user_name') String userName,
|
||||
@JsonKey(name: 'created_at') DateTime createdAt,
|
||||
Map<String, dynamic>? metadata});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$RecentActivityImplCopyWithImpl<$Res>
|
||||
extends _$RecentActivityCopyWithImpl<$Res, _$RecentActivityImpl>
|
||||
implements _$$RecentActivityImplCopyWith<$Res> {
|
||||
__$$RecentActivityImplCopyWithImpl(
|
||||
_$RecentActivityImpl _value, $Res Function(_$RecentActivityImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of RecentActivity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? activityType = null,
|
||||
Object? description = null,
|
||||
Object? userName = null,
|
||||
Object? createdAt = null,
|
||||
Object? metadata = freezed,
|
||||
}) {
|
||||
return _then(_$RecentActivityImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
activityType: null == activityType
|
||||
? _value.activityType
|
||||
: activityType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
description: null == description
|
||||
? _value.description
|
||||
: description // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
userName: null == userName
|
||||
? _value.userName
|
||||
: userName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
createdAt: null == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
metadata: freezed == metadata
|
||||
? _value._metadata
|
||||
: metadata // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$RecentActivityImpl implements _RecentActivity {
|
||||
const _$RecentActivityImpl(
|
||||
{required this.id,
|
||||
@JsonKey(name: 'activity_type') required this.activityType,
|
||||
required this.description,
|
||||
@JsonKey(name: 'user_name') required this.userName,
|
||||
@JsonKey(name: 'created_at') required this.createdAt,
|
||||
final Map<String, dynamic>? metadata})
|
||||
: _metadata = metadata;
|
||||
|
||||
factory _$RecentActivityImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$RecentActivityImplFromJson(json);
|
||||
|
||||
@override
|
||||
final int id;
|
||||
@override
|
||||
@JsonKey(name: 'activity_type')
|
||||
final String activityType;
|
||||
@override
|
||||
final String description;
|
||||
@override
|
||||
@JsonKey(name: 'user_name')
|
||||
final String userName;
|
||||
@override
|
||||
@JsonKey(name: 'created_at')
|
||||
final DateTime createdAt;
|
||||
final Map<String, dynamic>? _metadata;
|
||||
@override
|
||||
Map<String, dynamic>? get metadata {
|
||||
final value = _metadata;
|
||||
if (value == null) return null;
|
||||
if (_metadata is EqualUnmodifiableMapView) return _metadata;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(value);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RecentActivity(id: $id, activityType: $activityType, description: $description, userName: $userName, createdAt: $createdAt, metadata: $metadata)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$RecentActivityImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.activityType, activityType) ||
|
||||
other.activityType == activityType) &&
|
||||
(identical(other.description, description) ||
|
||||
other.description == description) &&
|
||||
(identical(other.userName, userName) ||
|
||||
other.userName == userName) &&
|
||||
(identical(other.createdAt, createdAt) ||
|
||||
other.createdAt == createdAt) &&
|
||||
const DeepCollectionEquality().equals(other._metadata, _metadata));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, id, activityType, description,
|
||||
userName, createdAt, const DeepCollectionEquality().hash(_metadata));
|
||||
|
||||
/// Create a copy of RecentActivity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$RecentActivityImplCopyWith<_$RecentActivityImpl> get copyWith =>
|
||||
__$$RecentActivityImplCopyWithImpl<_$RecentActivityImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$RecentActivityImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _RecentActivity implements RecentActivity {
|
||||
const factory _RecentActivity(
|
||||
{required final int id,
|
||||
@JsonKey(name: 'activity_type') required final String activityType,
|
||||
required final String description,
|
||||
@JsonKey(name: 'user_name') required final String userName,
|
||||
@JsonKey(name: 'created_at') required final DateTime createdAt,
|
||||
final Map<String, dynamic>? metadata}) = _$RecentActivityImpl;
|
||||
|
||||
factory _RecentActivity.fromJson(Map<String, dynamic> json) =
|
||||
_$RecentActivityImpl.fromJson;
|
||||
|
||||
@override
|
||||
int get id;
|
||||
@override
|
||||
@JsonKey(name: 'activity_type')
|
||||
String get activityType;
|
||||
@override
|
||||
String get description;
|
||||
@override
|
||||
@JsonKey(name: 'user_name')
|
||||
String get userName;
|
||||
@override
|
||||
@JsonKey(name: 'created_at')
|
||||
DateTime get createdAt;
|
||||
@override
|
||||
Map<String, dynamic>? get metadata;
|
||||
|
||||
/// Create a copy of RecentActivity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$RecentActivityImplCopyWith<_$RecentActivityImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
28
lib/data/models/dashboard/recent_activity.g.dart
Normal file
28
lib/data/models/dashboard/recent_activity.g.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'recent_activity.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$RecentActivityImpl _$$RecentActivityImplFromJson(Map<String, dynamic> json) =>
|
||||
_$RecentActivityImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
activityType: json['activity_type'] as String,
|
||||
description: json['description'] as String,
|
||||
userName: json['user_name'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
metadata: json['metadata'] as Map<String, dynamic>?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$RecentActivityImplToJson(
|
||||
_$RecentActivityImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'activity_type': instance.activityType,
|
||||
'description': instance.description,
|
||||
'user_name': instance.userName,
|
||||
'created_at': instance.createdAt.toIso8601String(),
|
||||
'metadata': instance.metadata,
|
||||
};
|
||||
Reference in New Issue
Block a user