Files
superport/lib/data/models/license/license_dto.dart
JiWoong Sul 8384423cf2 feat: 라이선스 및 창고 관리 API 연동 구현
- 라이선스 관리 API 연동 완료
  - LicenseRemoteDataSource, LicenseService 구현
  - LicenseListController, LicenseFormController API 연동
  - 페이지네이션, 검색, 필터링 기능 추가
  - 라이선스 할당/해제 기능 구현

- 창고 관리 API 연동 완료
  - WarehouseRemoteDataSource, WarehouseService 구현
  - WarehouseLocationListController, WarehouseLocationFormController API 연동
  - 창고별 장비 조회 및 용량 관리 기능 추가

- DI 컨테이너에 새로운 서비스 등록
- API 통합 문서 업데이트 (전체 진행률 100% 달성)
2025-07-25 00:18:49 +09:00

80 lines
3.0 KiB
Dart

import 'package:freezed_annotation/freezed_annotation.dart';
part 'license_dto.freezed.dart';
part 'license_dto.g.dart';
/// 라이선스 전체 정보 DTO
@freezed
class LicenseDto with _$LicenseDto {
const factory LicenseDto({
required int id,
@JsonKey(name: 'license_key') required String licenseKey,
@JsonKey(name: 'product_name') String? productName,
String? vendor,
@JsonKey(name: 'license_type') String? licenseType,
@JsonKey(name: 'user_count') int? userCount,
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'expiry_date') DateTime? expiryDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'branch_id') int? branchId,
@JsonKey(name: 'assigned_user_id') int? assignedUserId,
String? remark,
@JsonKey(name: 'is_active') required bool isActive,
@JsonKey(name: 'created_at') required DateTime createdAt,
@JsonKey(name: 'updated_at') required DateTime updatedAt,
// 추가 필드 (조인된 데이터)
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'branch_name') String? branchName,
@JsonKey(name: 'assigned_user_name') String? assignedUserName,
}) = _LicenseDto;
factory LicenseDto.fromJson(Map<String, dynamic> json) => _$LicenseDtoFromJson(json);
}
/// 라이선스 목록 응답 DTO
@freezed
class LicenseListResponseDto with _$LicenseListResponseDto {
const factory LicenseListResponseDto({
required List<LicenseDto> items,
required int total,
required int page,
@JsonKey(name: 'per_page') required int perPage,
@JsonKey(name: 'total_pages') required int totalPages,
}) = _LicenseListResponseDto;
factory LicenseListResponseDto.fromJson(Map<String, dynamic> json) =>
_$LicenseListResponseDtoFromJson(json);
}
/// 만료 예정 라이선스 DTO
@freezed
class ExpiringLicenseDto with _$ExpiringLicenseDto {
const factory ExpiringLicenseDto({
required int id,
@JsonKey(name: 'license_key') required String licenseKey,
@JsonKey(name: 'product_name') String? productName,
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'expiry_date') required DateTime expiryDate,
@JsonKey(name: 'days_until_expiry') required int daysUntilExpiry,
@JsonKey(name: 'is_active') required bool isActive,
}) = _ExpiringLicenseDto;
factory ExpiringLicenseDto.fromJson(Map<String, dynamic> json) =>
_$ExpiringLicenseDtoFromJson(json);
}
/// 만료 예정 라이선스 목록 응답 DTO
@freezed
class ExpiringLicenseListDto with _$ExpiringLicenseListDto {
const factory ExpiringLicenseListDto({
required List<ExpiringLicenseDto> items,
required int total,
required int page,
@JsonKey(name: 'per_page') required int perPage,
@JsonKey(name: 'total_pages') required int totalPages,
}) = _ExpiringLicenseListDto;
factory ExpiringLicenseListDto.fromJson(Map<String, dynamic> json) =>
_$ExpiringLicenseListDtoFromJson(json);
}