refactor: Repository 패턴 적용 및 Clean Architecture 완성
Some checks failed
Flutter Test & Quality Check / Test on macos-latest (push) Has been cancelled
Flutter Test & Quality Check / Test on ubuntu-latest (push) Has been cancelled
Flutter Test & Quality Check / Build APK (push) Has been cancelled

## 주요 변경사항

### 🏗️ Architecture
- Repository 패턴 전면 도입 (인터페이스/구현체 분리)
- Domain Layer에 Repository 인터페이스 정의
- Data Layer에 Repository 구현체 배치
- UseCase 의존성을 Service에서 Repository로 전환

### 📦 Dependency Injection
- GetIt 기반 DI Container 재구성 (lib/injection_container.dart)
- Repository 인터페이스와 구현체 등록
- Service와 Repository 공존 (마이그레이션 기간)

### 🔄 Migration Status
완료:
- License 모듈 (6개 UseCase)
- Warehouse Location 모듈 (5개 UseCase)

진행중:
- Auth 모듈 (2/5 UseCase)
- Company 모듈 (1/6 UseCase)

대기:
- User 모듈 (7개 UseCase)
- Equipment 모듈 (4개 UseCase)

### 🎯 Controller 통합
- 중복 Controller 제거 (with_usecase 버전)
- 단일 Controller로 통합
- UseCase 패턴 직접 적용

### 🧹 코드 정리
- 임시 파일 제거 (test_*.md, task.md)
- Node.js 아티팩트 제거 (package.json)
- 불필요한 테스트 파일 정리

###  테스트 개선
- Real API 중심 테스트 구조
- Mock 제거, 실제 API 엔드포인트 사용
- 통합 테스트 프레임워크 강화

## 기술적 영향
- 의존성 역전 원칙 적용
- 레이어 간 결합도 감소
- 테스트 용이성 향상
- 확장성 및 유지보수성 개선

## 다음 단계
1. User/Equipment 모듈 Repository 마이그레이션
2. Service Layer 점진적 제거
3. 캐싱 전략 구현
4. 성능 최적화
This commit is contained in:
JiWoong Sul
2025-08-11 20:14:10 +09:00
parent d64aa26157
commit 731dcd816b
105 changed files with 5225 additions and 3941 deletions

View File

@@ -8,8 +8,8 @@ enum UserRole {
admin,
@JsonValue('manager')
manager,
@JsonValue('staff')
staff,
@JsonValue('member')
member,
}
@freezed
@@ -17,13 +17,16 @@ class UserDto with _$UserDto {
const factory UserDto({
required int id,
required String username,
required String email,
required String name,
String? email,
String? phone,
required String role,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'branch_id') int? branchId,
@JsonKey(name: 'branch_name') String? branchName,
@JsonKey(name: 'is_active') required bool isActive,
@JsonKey(name: 'last_login_at') DateTime? lastLoginAt,
@JsonKey(name: 'created_at') required DateTime createdAt,
@JsonKey(name: 'updated_at') required DateTime updatedAt,
}) = _UserDto;
@@ -36,7 +39,7 @@ class UserDto with _$UserDto {
class CreateUserRequest with _$CreateUserRequest {
const factory CreateUserRequest({
required String username,
required String email,
String? email,
required String password,
required String name,
String? phone,
@@ -59,6 +62,7 @@ class UpdateUserRequest with _$UpdateUserRequest {
String? role,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'branch_id') int? branchId,
@JsonKey(name: 'is_active') bool? isActive,
}) = _UpdateUserRequest;
factory UpdateUserRequest.fromJson(Map<String, dynamic> json) =>
@@ -88,6 +92,8 @@ class ChangePasswordRequest with _$ChangePasswordRequest {
@freezed
class UserListDto with _$UserListDto {
const UserListDto._();
const factory UserListDto({
required List<UserDto> users,
required int total,
@@ -96,7 +102,35 @@ class UserListDto with _$UserListDto {
@JsonKey(name: 'total_pages') required int totalPages,
}) = _UserListDto;
// 페이지네이션 응답과 호환성을 위한 getter들
List<UserDto> get items => users;
int get size => perPage;
int get totalElements => total;
bool get first => page <= 1;
bool get last => page >= totalPages;
factory UserListDto.fromJson(Map<String, dynamic> json) =>
_$UserListDtoFromJson(json);
}
@freezed
class UserDetailDto with _$UserDetailDto {
const factory UserDetailDto({
required UserDto user,
}) = _UserDetailDto;
factory UserDetailDto.fromJson(Map<String, dynamic> json) =>
_$UserDetailDtoFromJson(json);
}
@freezed
class UserResponse with _$UserResponse {
const factory UserResponse({
required UserDto user,
String? message,
}) = _UserResponse;
factory UserResponse.fromJson(Map<String, dynamic> json) =>
_$UserResponseFromJson(json);
}

View File

@@ -22,16 +22,22 @@ UserDto _$UserDtoFromJson(Map<String, dynamic> json) {
mixin _$UserDto {
int get id => throw _privateConstructorUsedError;
String get username => throw _privateConstructorUsedError;
String get email => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String? get email => throw _privateConstructorUsedError;
String? get phone => throw _privateConstructorUsedError;
String get role => throw _privateConstructorUsedError;
@JsonKey(name: 'company_id')
int? get companyId => throw _privateConstructorUsedError;
@JsonKey(name: 'company_name')
String? get companyName => throw _privateConstructorUsedError;
@JsonKey(name: 'branch_id')
int? get branchId => throw _privateConstructorUsedError;
@JsonKey(name: 'branch_name')
String? get branchName => throw _privateConstructorUsedError;
@JsonKey(name: 'is_active')
bool get isActive => throw _privateConstructorUsedError;
@JsonKey(name: 'last_login_at')
DateTime? get lastLoginAt => throw _privateConstructorUsedError;
@JsonKey(name: 'created_at')
DateTime get createdAt => throw _privateConstructorUsedError;
@JsonKey(name: 'updated_at')
@@ -54,13 +60,16 @@ abstract class $UserDtoCopyWith<$Res> {
$Res call(
{int id,
String username,
String email,
String name,
String? email,
String? phone,
String role,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'branch_id') int? branchId,
@JsonKey(name: 'branch_name') String? branchName,
@JsonKey(name: 'is_active') bool isActive,
@JsonKey(name: 'last_login_at') DateTime? lastLoginAt,
@JsonKey(name: 'created_at') DateTime createdAt,
@JsonKey(name: 'updated_at') DateTime updatedAt});
}
@@ -82,13 +91,16 @@ class _$UserDtoCopyWithImpl<$Res, $Val extends UserDto>
$Res call({
Object? id = null,
Object? username = null,
Object? email = null,
Object? name = null,
Object? email = freezed,
Object? phone = freezed,
Object? role = null,
Object? companyId = freezed,
Object? companyName = freezed,
Object? branchId = freezed,
Object? branchName = freezed,
Object? isActive = null,
Object? lastLoginAt = freezed,
Object? createdAt = null,
Object? updatedAt = null,
}) {
@@ -101,14 +113,14 @@ class _$UserDtoCopyWithImpl<$Res, $Val extends UserDto>
? _value.username
: username // ignore: cast_nullable_to_non_nullable
as String,
email: null == email
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
email: freezed == email
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as String?,
phone: freezed == phone
? _value.phone
: phone // ignore: cast_nullable_to_non_nullable
@@ -121,14 +133,26 @@ class _$UserDtoCopyWithImpl<$Res, $Val extends UserDto>
? _value.companyId
: companyId // ignore: cast_nullable_to_non_nullable
as int?,
companyName: freezed == companyName
? _value.companyName
: companyName // ignore: cast_nullable_to_non_nullable
as String?,
branchId: freezed == branchId
? _value.branchId
: branchId // ignore: cast_nullable_to_non_nullable
as int?,
branchName: freezed == branchName
? _value.branchName
: branchName // ignore: cast_nullable_to_non_nullable
as String?,
isActive: null == isActive
? _value.isActive
: isActive // ignore: cast_nullable_to_non_nullable
as bool,
lastLoginAt: freezed == lastLoginAt
? _value.lastLoginAt
: lastLoginAt // ignore: cast_nullable_to_non_nullable
as DateTime?,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
@@ -151,13 +175,16 @@ abstract class _$$UserDtoImplCopyWith<$Res> implements $UserDtoCopyWith<$Res> {
$Res call(
{int id,
String username,
String email,
String name,
String? email,
String? phone,
String role,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'branch_id') int? branchId,
@JsonKey(name: 'branch_name') String? branchName,
@JsonKey(name: 'is_active') bool isActive,
@JsonKey(name: 'last_login_at') DateTime? lastLoginAt,
@JsonKey(name: 'created_at') DateTime createdAt,
@JsonKey(name: 'updated_at') DateTime updatedAt});
}
@@ -177,13 +204,16 @@ class __$$UserDtoImplCopyWithImpl<$Res>
$Res call({
Object? id = null,
Object? username = null,
Object? email = null,
Object? name = null,
Object? email = freezed,
Object? phone = freezed,
Object? role = null,
Object? companyId = freezed,
Object? companyName = freezed,
Object? branchId = freezed,
Object? branchName = freezed,
Object? isActive = null,
Object? lastLoginAt = freezed,
Object? createdAt = null,
Object? updatedAt = null,
}) {
@@ -196,14 +226,14 @@ class __$$UserDtoImplCopyWithImpl<$Res>
? _value.username
: username // ignore: cast_nullable_to_non_nullable
as String,
email: null == email
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
email: freezed == email
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as String?,
phone: freezed == phone
? _value.phone
: phone // ignore: cast_nullable_to_non_nullable
@@ -216,14 +246,26 @@ class __$$UserDtoImplCopyWithImpl<$Res>
? _value.companyId
: companyId // ignore: cast_nullable_to_non_nullable
as int?,
companyName: freezed == companyName
? _value.companyName
: companyName // ignore: cast_nullable_to_non_nullable
as String?,
branchId: freezed == branchId
? _value.branchId
: branchId // ignore: cast_nullable_to_non_nullable
as int?,
branchName: freezed == branchName
? _value.branchName
: branchName // ignore: cast_nullable_to_non_nullable
as String?,
isActive: null == isActive
? _value.isActive
: isActive // ignore: cast_nullable_to_non_nullable
as bool,
lastLoginAt: freezed == lastLoginAt
? _value.lastLoginAt
: lastLoginAt // ignore: cast_nullable_to_non_nullable
as DateTime?,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
@@ -242,13 +284,16 @@ class _$UserDtoImpl implements _UserDto {
const _$UserDtoImpl(
{required this.id,
required this.username,
required this.email,
required this.name,
this.email,
this.phone,
required this.role,
@JsonKey(name: 'company_id') this.companyId,
@JsonKey(name: 'company_name') this.companyName,
@JsonKey(name: 'branch_id') this.branchId,
@JsonKey(name: 'branch_name') this.branchName,
@JsonKey(name: 'is_active') required this.isActive,
@JsonKey(name: 'last_login_at') this.lastLoginAt,
@JsonKey(name: 'created_at') required this.createdAt,
@JsonKey(name: 'updated_at') required this.updatedAt});
@@ -260,10 +305,10 @@ class _$UserDtoImpl implements _UserDto {
@override
final String username;
@override
final String email;
@override
final String name;
@override
final String? email;
@override
final String? phone;
@override
final String role;
@@ -271,12 +316,21 @@ class _$UserDtoImpl implements _UserDto {
@JsonKey(name: 'company_id')
final int? companyId;
@override
@JsonKey(name: 'company_name')
final String? companyName;
@override
@JsonKey(name: 'branch_id')
final int? branchId;
@override
@JsonKey(name: 'branch_name')
final String? branchName;
@override
@JsonKey(name: 'is_active')
final bool isActive;
@override
@JsonKey(name: 'last_login_at')
final DateTime? lastLoginAt;
@override
@JsonKey(name: 'created_at')
final DateTime createdAt;
@override
@@ -285,7 +339,7 @@ class _$UserDtoImpl implements _UserDto {
@override
String toString() {
return 'UserDto(id: $id, username: $username, email: $email, name: $name, phone: $phone, role: $role, companyId: $companyId, branchId: $branchId, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt)';
return 'UserDto(id: $id, username: $username, name: $name, email: $email, phone: $phone, role: $role, companyId: $companyId, companyName: $companyName, branchId: $branchId, branchName: $branchName, isActive: $isActive, lastLoginAt: $lastLoginAt, createdAt: $createdAt, updatedAt: $updatedAt)';
}
@override
@@ -296,16 +350,22 @@ class _$UserDtoImpl implements _UserDto {
(identical(other.id, id) || other.id == id) &&
(identical(other.username, username) ||
other.username == username) &&
(identical(other.email, email) || other.email == email) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.email, email) || other.email == email) &&
(identical(other.phone, phone) || other.phone == phone) &&
(identical(other.role, role) || other.role == role) &&
(identical(other.companyId, companyId) ||
other.companyId == companyId) &&
(identical(other.companyName, companyName) ||
other.companyName == companyName) &&
(identical(other.branchId, branchId) ||
other.branchId == branchId) &&
(identical(other.branchName, branchName) ||
other.branchName == branchName) &&
(identical(other.isActive, isActive) ||
other.isActive == isActive) &&
(identical(other.lastLoginAt, lastLoginAt) ||
other.lastLoginAt == lastLoginAt) &&
(identical(other.createdAt, createdAt) ||
other.createdAt == createdAt) &&
(identical(other.updatedAt, updatedAt) ||
@@ -314,8 +374,22 @@ class _$UserDtoImpl implements _UserDto {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, username, email, name, phone,
role, companyId, branchId, isActive, createdAt, updatedAt);
int get hashCode => Object.hash(
runtimeType,
id,
username,
name,
email,
phone,
role,
companyId,
companyName,
branchId,
branchName,
isActive,
lastLoginAt,
createdAt,
updatedAt);
/// Create a copy of UserDto
/// with the given fields replaced by the non-null parameter values.
@@ -337,13 +411,16 @@ abstract class _UserDto implements UserDto {
const factory _UserDto(
{required final int id,
required final String username,
required final String email,
required final String name,
final String? email,
final String? phone,
required final String role,
@JsonKey(name: 'company_id') final int? companyId,
@JsonKey(name: 'company_name') final String? companyName,
@JsonKey(name: 'branch_id') final int? branchId,
@JsonKey(name: 'branch_name') final String? branchName,
@JsonKey(name: 'is_active') required final bool isActive,
@JsonKey(name: 'last_login_at') final DateTime? lastLoginAt,
@JsonKey(name: 'created_at') required final DateTime createdAt,
@JsonKey(name: 'updated_at') required final DateTime updatedAt}) =
_$UserDtoImpl;
@@ -355,10 +432,10 @@ abstract class _UserDto implements UserDto {
@override
String get username;
@override
String get email;
@override
String get name;
@override
String? get email;
@override
String? get phone;
@override
String get role;
@@ -366,12 +443,21 @@ abstract class _UserDto implements UserDto {
@JsonKey(name: 'company_id')
int? get companyId;
@override
@JsonKey(name: 'company_name')
String? get companyName;
@override
@JsonKey(name: 'branch_id')
int? get branchId;
@override
@JsonKey(name: 'branch_name')
String? get branchName;
@override
@JsonKey(name: 'is_active')
bool get isActive;
@override
@JsonKey(name: 'last_login_at')
DateTime? get lastLoginAt;
@override
@JsonKey(name: 'created_at')
DateTime get createdAt;
@override
@@ -393,7 +479,7 @@ CreateUserRequest _$CreateUserRequestFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$CreateUserRequest {
String get username => throw _privateConstructorUsedError;
String get email => throw _privateConstructorUsedError;
String? get email => throw _privateConstructorUsedError;
String get password => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String? get phone => throw _privateConstructorUsedError;
@@ -421,7 +507,7 @@ abstract class $CreateUserRequestCopyWith<$Res> {
@useResult
$Res call(
{String username,
String email,
String? email,
String password,
String name,
String? phone,
@@ -446,7 +532,7 @@ class _$CreateUserRequestCopyWithImpl<$Res, $Val extends CreateUserRequest>
@override
$Res call({
Object? username = null,
Object? email = null,
Object? email = freezed,
Object? password = null,
Object? name = null,
Object? phone = freezed,
@@ -459,10 +545,10 @@ class _$CreateUserRequestCopyWithImpl<$Res, $Val extends CreateUserRequest>
? _value.username
: username // ignore: cast_nullable_to_non_nullable
as String,
email: null == email
email: freezed == email
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as String,
as String?,
password: null == password
? _value.password
: password // ignore: cast_nullable_to_non_nullable
@@ -501,7 +587,7 @@ abstract class _$$CreateUserRequestImplCopyWith<$Res>
@useResult
$Res call(
{String username,
String email,
String? email,
String password,
String name,
String? phone,
@@ -524,7 +610,7 @@ class __$$CreateUserRequestImplCopyWithImpl<$Res>
@override
$Res call({
Object? username = null,
Object? email = null,
Object? email = freezed,
Object? password = null,
Object? name = null,
Object? phone = freezed,
@@ -537,10 +623,10 @@ class __$$CreateUserRequestImplCopyWithImpl<$Res>
? _value.username
: username // ignore: cast_nullable_to_non_nullable
as String,
email: null == email
email: freezed == email
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as String,
as String?,
password: null == password
? _value.password
: password // ignore: cast_nullable_to_non_nullable
@@ -574,7 +660,7 @@ class __$$CreateUserRequestImplCopyWithImpl<$Res>
class _$CreateUserRequestImpl implements _CreateUserRequest {
const _$CreateUserRequestImpl(
{required this.username,
required this.email,
this.email,
required this.password,
required this.name,
this.phone,
@@ -588,7 +674,7 @@ class _$CreateUserRequestImpl implements _CreateUserRequest {
@override
final String username;
@override
final String email;
final String? email;
@override
final String password;
@override
@@ -653,7 +739,7 @@ class _$CreateUserRequestImpl implements _CreateUserRequest {
abstract class _CreateUserRequest implements CreateUserRequest {
const factory _CreateUserRequest(
{required final String username,
required final String email,
final String? email,
required final String password,
required final String name,
final String? phone,
@@ -668,7 +754,7 @@ abstract class _CreateUserRequest implements CreateUserRequest {
@override
String get username;
@override
String get email;
String? get email;
@override
String get password;
@override
@@ -707,6 +793,8 @@ mixin _$UpdateUserRequest {
int? get companyId => throw _privateConstructorUsedError;
@JsonKey(name: 'branch_id')
int? get branchId => throw _privateConstructorUsedError;
@JsonKey(name: 'is_active')
bool? get isActive => throw _privateConstructorUsedError;
/// Serializes this UpdateUserRequest to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -731,7 +819,8 @@ abstract class $UpdateUserRequestCopyWith<$Res> {
String? phone,
String? role,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'branch_id') int? branchId});
@JsonKey(name: 'branch_id') int? branchId,
@JsonKey(name: 'is_active') bool? isActive});
}
/// @nodoc
@@ -756,6 +845,7 @@ class _$UpdateUserRequestCopyWithImpl<$Res, $Val extends UpdateUserRequest>
Object? role = freezed,
Object? companyId = freezed,
Object? branchId = freezed,
Object? isActive = freezed,
}) {
return _then(_value.copyWith(
name: freezed == name
@@ -786,6 +876,10 @@ class _$UpdateUserRequestCopyWithImpl<$Res, $Val extends UpdateUserRequest>
? _value.branchId
: branchId // ignore: cast_nullable_to_non_nullable
as int?,
isActive: freezed == isActive
? _value.isActive
: isActive // ignore: cast_nullable_to_non_nullable
as bool?,
) as $Val);
}
}
@@ -805,7 +899,8 @@ abstract class _$$UpdateUserRequestImplCopyWith<$Res>
String? phone,
String? role,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'branch_id') int? branchId});
@JsonKey(name: 'branch_id') int? branchId,
@JsonKey(name: 'is_active') bool? isActive});
}
/// @nodoc
@@ -828,6 +923,7 @@ class __$$UpdateUserRequestImplCopyWithImpl<$Res>
Object? role = freezed,
Object? companyId = freezed,
Object? branchId = freezed,
Object? isActive = freezed,
}) {
return _then(_$UpdateUserRequestImpl(
name: freezed == name
@@ -858,6 +954,10 @@ class __$$UpdateUserRequestImplCopyWithImpl<$Res>
? _value.branchId
: branchId // ignore: cast_nullable_to_non_nullable
as int?,
isActive: freezed == isActive
? _value.isActive
: isActive // ignore: cast_nullable_to_non_nullable
as bool?,
));
}
}
@@ -872,7 +972,8 @@ class _$UpdateUserRequestImpl implements _UpdateUserRequest {
this.phone,
this.role,
@JsonKey(name: 'company_id') this.companyId,
@JsonKey(name: 'branch_id') this.branchId});
@JsonKey(name: 'branch_id') this.branchId,
@JsonKey(name: 'is_active') this.isActive});
factory _$UpdateUserRequestImpl.fromJson(Map<String, dynamic> json) =>
_$$UpdateUserRequestImplFromJson(json);
@@ -893,10 +994,13 @@ class _$UpdateUserRequestImpl implements _UpdateUserRequest {
@override
@JsonKey(name: 'branch_id')
final int? branchId;
@override
@JsonKey(name: 'is_active')
final bool? isActive;
@override
String toString() {
return 'UpdateUserRequest(name: $name, email: $email, password: $password, phone: $phone, role: $role, companyId: $companyId, branchId: $branchId)';
return 'UpdateUserRequest(name: $name, email: $email, password: $password, phone: $phone, role: $role, companyId: $companyId, branchId: $branchId, isActive: $isActive)';
}
@override
@@ -913,13 +1017,15 @@ class _$UpdateUserRequestImpl implements _UpdateUserRequest {
(identical(other.companyId, companyId) ||
other.companyId == companyId) &&
(identical(other.branchId, branchId) ||
other.branchId == branchId));
other.branchId == branchId) &&
(identical(other.isActive, isActive) ||
other.isActive == isActive));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, name, email, password, phone, role, companyId, branchId);
int get hashCode => Object.hash(runtimeType, name, email, password, phone,
role, companyId, branchId, isActive);
/// Create a copy of UpdateUserRequest
/// with the given fields replaced by the non-null parameter values.
@@ -946,7 +1052,8 @@ abstract class _UpdateUserRequest implements UpdateUserRequest {
final String? phone,
final String? role,
@JsonKey(name: 'company_id') final int? companyId,
@JsonKey(name: 'branch_id') final int? branchId}) =
@JsonKey(name: 'branch_id') final int? branchId,
@JsonKey(name: 'is_active') final bool? isActive}) =
_$UpdateUserRequestImpl;
factory _UpdateUserRequest.fromJson(Map<String, dynamic> json) =
@@ -968,6 +1075,9 @@ abstract class _UpdateUserRequest implements UpdateUserRequest {
@override
@JsonKey(name: 'branch_id')
int? get branchId;
@override
@JsonKey(name: 'is_active')
bool? get isActive;
/// Create a copy of UpdateUserRequest
/// with the given fields replaced by the non-null parameter values.
@@ -1467,14 +1577,15 @@ class __$$UserListDtoImplCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$UserListDtoImpl implements _UserListDto {
class _$UserListDtoImpl extends _UserListDto {
const _$UserListDtoImpl(
{required final List<UserDto> users,
required this.total,
required this.page,
@JsonKey(name: 'per_page') required this.perPage,
@JsonKey(name: 'total_pages') required this.totalPages})
: _users = users;
: _users = users,
super._();
factory _$UserListDtoImpl.fromJson(Map<String, dynamic> json) =>
_$$UserListDtoImplFromJson(json);
@@ -1542,7 +1653,7 @@ class _$UserListDtoImpl implements _UserListDto {
}
}
abstract class _UserListDto implements UserListDto {
abstract class _UserListDto extends UserListDto {
const factory _UserListDto(
{required final List<UserDto> users,
required final int total,
@@ -1550,6 +1661,7 @@ abstract class _UserListDto implements UserListDto {
@JsonKey(name: 'per_page') required final int perPage,
@JsonKey(name: 'total_pages') required final int totalPages}) =
_$UserListDtoImpl;
const _UserListDto._() : super._();
factory _UserListDto.fromJson(Map<String, dynamic> json) =
_$UserListDtoImpl.fromJson;
@@ -1574,3 +1686,350 @@ abstract class _UserListDto implements UserListDto {
_$$UserListDtoImplCopyWith<_$UserListDtoImpl> get copyWith =>
throw _privateConstructorUsedError;
}
UserDetailDto _$UserDetailDtoFromJson(Map<String, dynamic> json) {
return _UserDetailDto.fromJson(json);
}
/// @nodoc
mixin _$UserDetailDto {
UserDto get user => throw _privateConstructorUsedError;
/// Serializes this UserDetailDto to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of UserDetailDto
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$UserDetailDtoCopyWith<UserDetailDto> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $UserDetailDtoCopyWith<$Res> {
factory $UserDetailDtoCopyWith(
UserDetailDto value, $Res Function(UserDetailDto) then) =
_$UserDetailDtoCopyWithImpl<$Res, UserDetailDto>;
@useResult
$Res call({UserDto user});
$UserDtoCopyWith<$Res> get user;
}
/// @nodoc
class _$UserDetailDtoCopyWithImpl<$Res, $Val extends UserDetailDto>
implements $UserDetailDtoCopyWith<$Res> {
_$UserDetailDtoCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of UserDetailDto
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? user = null,
}) {
return _then(_value.copyWith(
user: null == user
? _value.user
: user // ignore: cast_nullable_to_non_nullable
as UserDto,
) as $Val);
}
/// Create a copy of UserDetailDto
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserDtoCopyWith<$Res> get user {
return $UserDtoCopyWith<$Res>(_value.user, (value) {
return _then(_value.copyWith(user: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$UserDetailDtoImplCopyWith<$Res>
implements $UserDetailDtoCopyWith<$Res> {
factory _$$UserDetailDtoImplCopyWith(
_$UserDetailDtoImpl value, $Res Function(_$UserDetailDtoImpl) then) =
__$$UserDetailDtoImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({UserDto user});
@override
$UserDtoCopyWith<$Res> get user;
}
/// @nodoc
class __$$UserDetailDtoImplCopyWithImpl<$Res>
extends _$UserDetailDtoCopyWithImpl<$Res, _$UserDetailDtoImpl>
implements _$$UserDetailDtoImplCopyWith<$Res> {
__$$UserDetailDtoImplCopyWithImpl(
_$UserDetailDtoImpl _value, $Res Function(_$UserDetailDtoImpl) _then)
: super(_value, _then);
/// Create a copy of UserDetailDto
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? user = null,
}) {
return _then(_$UserDetailDtoImpl(
user: null == user
? _value.user
: user // ignore: cast_nullable_to_non_nullable
as UserDto,
));
}
}
/// @nodoc
@JsonSerializable()
class _$UserDetailDtoImpl implements _UserDetailDto {
const _$UserDetailDtoImpl({required this.user});
factory _$UserDetailDtoImpl.fromJson(Map<String, dynamic> json) =>
_$$UserDetailDtoImplFromJson(json);
@override
final UserDto user;
@override
String toString() {
return 'UserDetailDto(user: $user)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$UserDetailDtoImpl &&
(identical(other.user, user) || other.user == user));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, user);
/// Create a copy of UserDetailDto
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$UserDetailDtoImplCopyWith<_$UserDetailDtoImpl> get copyWith =>
__$$UserDetailDtoImplCopyWithImpl<_$UserDetailDtoImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$UserDetailDtoImplToJson(
this,
);
}
}
abstract class _UserDetailDto implements UserDetailDto {
const factory _UserDetailDto({required final UserDto user}) =
_$UserDetailDtoImpl;
factory _UserDetailDto.fromJson(Map<String, dynamic> json) =
_$UserDetailDtoImpl.fromJson;
@override
UserDto get user;
/// Create a copy of UserDetailDto
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$UserDetailDtoImplCopyWith<_$UserDetailDtoImpl> get copyWith =>
throw _privateConstructorUsedError;
}
UserResponse _$UserResponseFromJson(Map<String, dynamic> json) {
return _UserResponse.fromJson(json);
}
/// @nodoc
mixin _$UserResponse {
UserDto get user => throw _privateConstructorUsedError;
String? get message => throw _privateConstructorUsedError;
/// Serializes this UserResponse to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of UserResponse
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$UserResponseCopyWith<UserResponse> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $UserResponseCopyWith<$Res> {
factory $UserResponseCopyWith(
UserResponse value, $Res Function(UserResponse) then) =
_$UserResponseCopyWithImpl<$Res, UserResponse>;
@useResult
$Res call({UserDto user, String? message});
$UserDtoCopyWith<$Res> get user;
}
/// @nodoc
class _$UserResponseCopyWithImpl<$Res, $Val extends UserResponse>
implements $UserResponseCopyWith<$Res> {
_$UserResponseCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of UserResponse
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? user = null,
Object? message = freezed,
}) {
return _then(_value.copyWith(
user: null == user
? _value.user
: user // ignore: cast_nullable_to_non_nullable
as UserDto,
message: freezed == message
? _value.message
: message // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
/// Create a copy of UserResponse
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserDtoCopyWith<$Res> get user {
return $UserDtoCopyWith<$Res>(_value.user, (value) {
return _then(_value.copyWith(user: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$UserResponseImplCopyWith<$Res>
implements $UserResponseCopyWith<$Res> {
factory _$$UserResponseImplCopyWith(
_$UserResponseImpl value, $Res Function(_$UserResponseImpl) then) =
__$$UserResponseImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({UserDto user, String? message});
@override
$UserDtoCopyWith<$Res> get user;
}
/// @nodoc
class __$$UserResponseImplCopyWithImpl<$Res>
extends _$UserResponseCopyWithImpl<$Res, _$UserResponseImpl>
implements _$$UserResponseImplCopyWith<$Res> {
__$$UserResponseImplCopyWithImpl(
_$UserResponseImpl _value, $Res Function(_$UserResponseImpl) _then)
: super(_value, _then);
/// Create a copy of UserResponse
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? user = null,
Object? message = freezed,
}) {
return _then(_$UserResponseImpl(
user: null == user
? _value.user
: user // ignore: cast_nullable_to_non_nullable
as UserDto,
message: freezed == message
? _value.message
: message // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$UserResponseImpl implements _UserResponse {
const _$UserResponseImpl({required this.user, this.message});
factory _$UserResponseImpl.fromJson(Map<String, dynamic> json) =>
_$$UserResponseImplFromJson(json);
@override
final UserDto user;
@override
final String? message;
@override
String toString() {
return 'UserResponse(user: $user, message: $message)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$UserResponseImpl &&
(identical(other.user, user) || other.user == user) &&
(identical(other.message, message) || other.message == message));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, user, message);
/// Create a copy of UserResponse
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$UserResponseImplCopyWith<_$UserResponseImpl> get copyWith =>
__$$UserResponseImplCopyWithImpl<_$UserResponseImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$UserResponseImplToJson(
this,
);
}
}
abstract class _UserResponse implements UserResponse {
const factory _UserResponse(
{required final UserDto user,
final String? message}) = _$UserResponseImpl;
factory _UserResponse.fromJson(Map<String, dynamic> json) =
_$UserResponseImpl.fromJson;
@override
UserDto get user;
@override
String? get message;
/// Create a copy of UserResponse
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$UserResponseImplCopyWith<_$UserResponseImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -10,13 +10,18 @@ _$UserDtoImpl _$$UserDtoImplFromJson(Map<String, dynamic> json) =>
_$UserDtoImpl(
id: (json['id'] as num).toInt(),
username: json['username'] as String,
email: json['email'] as String,
name: json['name'] as String,
email: json['email'] as String?,
phone: json['phone'] as String?,
role: json['role'] as String,
companyId: (json['company_id'] as num?)?.toInt(),
companyName: json['company_name'] as String?,
branchId: (json['branch_id'] as num?)?.toInt(),
branchName: json['branch_name'] as String?,
isActive: json['is_active'] as bool,
lastLoginAt: json['last_login_at'] == null
? null
: DateTime.parse(json['last_login_at'] as String),
createdAt: DateTime.parse(json['created_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String),
);
@@ -25,13 +30,16 @@ Map<String, dynamic> _$$UserDtoImplToJson(_$UserDtoImpl instance) =>
<String, dynamic>{
'id': instance.id,
'username': instance.username,
'email': instance.email,
'name': instance.name,
'email': instance.email,
'phone': instance.phone,
'role': instance.role,
'company_id': instance.companyId,
'company_name': instance.companyName,
'branch_id': instance.branchId,
'branch_name': instance.branchName,
'is_active': instance.isActive,
'last_login_at': instance.lastLoginAt?.toIso8601String(),
'created_at': instance.createdAt.toIso8601String(),
'updated_at': instance.updatedAt.toIso8601String(),
};
@@ -40,7 +48,7 @@ _$CreateUserRequestImpl _$$CreateUserRequestImplFromJson(
Map<String, dynamic> json) =>
_$CreateUserRequestImpl(
username: json['username'] as String,
email: json['email'] as String,
email: json['email'] as String?,
password: json['password'] as String,
name: json['name'] as String,
phone: json['phone'] as String?,
@@ -72,6 +80,7 @@ _$UpdateUserRequestImpl _$$UpdateUserRequestImplFromJson(
role: json['role'] as String?,
companyId: (json['company_id'] as num?)?.toInt(),
branchId: (json['branch_id'] as num?)?.toInt(),
isActive: json['is_active'] as bool?,
);
Map<String, dynamic> _$$UpdateUserRequestImplToJson(
@@ -84,6 +93,7 @@ Map<String, dynamic> _$$UpdateUserRequestImplToJson(
'role': instance.role,
'company_id': instance.companyId,
'branch_id': instance.branchId,
'is_active': instance.isActive,
};
_$ChangeStatusRequestImpl _$$ChangeStatusRequestImplFromJson(
@@ -131,3 +141,25 @@ Map<String, dynamic> _$$UserListDtoImplToJson(_$UserListDtoImpl instance) =>
'per_page': instance.perPage,
'total_pages': instance.totalPages,
};
_$UserDetailDtoImpl _$$UserDetailDtoImplFromJson(Map<String, dynamic> json) =>
_$UserDetailDtoImpl(
user: UserDto.fromJson(json['user'] as Map<String, dynamic>),
);
Map<String, dynamic> _$$UserDetailDtoImplToJson(_$UserDetailDtoImpl instance) =>
<String, dynamic>{
'user': instance.user,
};
_$UserResponseImpl _$$UserResponseImplFromJson(Map<String, dynamic> json) =>
_$UserResponseImpl(
user: UserDto.fromJson(json['user'] as Map<String, dynamic>),
message: json['message'] as String?,
);
Map<String, dynamic> _$$UserResponseImplToJson(_$UserResponseImpl instance) =>
<String, dynamic>{
'user': instance.user,
'message': instance.message,
};