feat: update user

This commit is contained in:
efrilm
2025-08-19 15:05:08 +07:00
parent bfd4604897
commit 7919825955
37 changed files with 2531 additions and 897 deletions
+1 -1
View File
@@ -2,10 +2,10 @@ import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:dartz/dartz.dart';
import '../../common/api/api_failure.dart';
import '../user/user.dart';
part 'failures/auth_failure.dart';
part 'repositories/i_auth_repository.dart';
part 'entities/auth_entity.dart';
part 'entities/user_entity.dart';
part 'auth.freezed.dart';
-346
View File
@@ -691,349 +691,3 @@ abstract class _Auth extends Auth {
_$$AuthImplCopyWith<_$AuthImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$User {
String get id => throw _privateConstructorUsedError;
String get organizationId => throw _privateConstructorUsedError;
String get outletId => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String get email => throw _privateConstructorUsedError;
String get role => throw _privateConstructorUsedError;
Map<String, dynamic> get permissions => throw _privateConstructorUsedError;
bool get isActive => throw _privateConstructorUsedError;
DateTime get createdAt => throw _privateConstructorUsedError;
DateTime get updatedAt => throw _privateConstructorUsedError;
/// Create a copy of User
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$UserCopyWith<User> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $UserCopyWith<$Res> {
factory $UserCopyWith(User value, $Res Function(User) then) =
_$UserCopyWithImpl<$Res, User>;
@useResult
$Res call({
String id,
String organizationId,
String outletId,
String name,
String email,
String role,
Map<String, dynamic> permissions,
bool isActive,
DateTime createdAt,
DateTime updatedAt,
});
}
/// @nodoc
class _$UserCopyWithImpl<$Res, $Val extends User>
implements $UserCopyWith<$Res> {
_$UserCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of User
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? organizationId = null,
Object? outletId = null,
Object? name = null,
Object? email = null,
Object? role = null,
Object? permissions = null,
Object? isActive = null,
Object? createdAt = null,
Object? updatedAt = null,
}) {
return _then(
_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
organizationId: null == organizationId
? _value.organizationId
: organizationId // ignore: cast_nullable_to_non_nullable
as String,
outletId: null == outletId
? _value.outletId
: outletId // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
email: null == email
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as String,
role: null == role
? _value.role
: role // ignore: cast_nullable_to_non_nullable
as String,
permissions: null == permissions
? _value.permissions
: permissions // ignore: cast_nullable_to_non_nullable
as Map<String, dynamic>,
isActive: null == isActive
? _value.isActive
: isActive // ignore: cast_nullable_to_non_nullable
as bool,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$UserImplCopyWith<$Res> implements $UserCopyWith<$Res> {
factory _$$UserImplCopyWith(
_$UserImpl value,
$Res Function(_$UserImpl) then,
) = __$$UserImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
String id,
String organizationId,
String outletId,
String name,
String email,
String role,
Map<String, dynamic> permissions,
bool isActive,
DateTime createdAt,
DateTime updatedAt,
});
}
/// @nodoc
class __$$UserImplCopyWithImpl<$Res>
extends _$UserCopyWithImpl<$Res, _$UserImpl>
implements _$$UserImplCopyWith<$Res> {
__$$UserImplCopyWithImpl(_$UserImpl _value, $Res Function(_$UserImpl) _then)
: super(_value, _then);
/// Create a copy of User
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? organizationId = null,
Object? outletId = null,
Object? name = null,
Object? email = null,
Object? role = null,
Object? permissions = null,
Object? isActive = null,
Object? createdAt = null,
Object? updatedAt = null,
}) {
return _then(
_$UserImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
organizationId: null == organizationId
? _value.organizationId
: organizationId // ignore: cast_nullable_to_non_nullable
as String,
outletId: null == outletId
? _value.outletId
: outletId // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
email: null == email
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as String,
role: null == role
? _value.role
: role // ignore: cast_nullable_to_non_nullable
as String,
permissions: null == permissions
? _value._permissions
: permissions // ignore: cast_nullable_to_non_nullable
as Map<String, dynamic>,
isActive: null == isActive
? _value.isActive
: isActive // ignore: cast_nullable_to_non_nullable
as bool,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
),
);
}
}
/// @nodoc
class _$UserImpl extends _User {
const _$UserImpl({
required this.id,
required this.organizationId,
required this.outletId,
required this.name,
required this.email,
required this.role,
required final Map<String, dynamic> permissions,
required this.isActive,
required this.createdAt,
required this.updatedAt,
}) : _permissions = permissions,
super._();
@override
final String id;
@override
final String organizationId;
@override
final String outletId;
@override
final String name;
@override
final String email;
@override
final String role;
final Map<String, dynamic> _permissions;
@override
Map<String, dynamic> get permissions {
if (_permissions is EqualUnmodifiableMapView) return _permissions;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_permissions);
}
@override
final bool isActive;
@override
final DateTime createdAt;
@override
final DateTime updatedAt;
@override
String toString() {
return 'User(id: $id, organizationId: $organizationId, outletId: $outletId, name: $name, email: $email, role: $role, permissions: $permissions, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$UserImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.organizationId, organizationId) ||
other.organizationId == organizationId) &&
(identical(other.outletId, outletId) ||
other.outletId == outletId) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.email, email) || other.email == email) &&
(identical(other.role, role) || other.role == role) &&
const DeepCollectionEquality().equals(
other._permissions,
_permissions,
) &&
(identical(other.isActive, isActive) ||
other.isActive == isActive) &&
(identical(other.createdAt, createdAt) ||
other.createdAt == createdAt) &&
(identical(other.updatedAt, updatedAt) ||
other.updatedAt == updatedAt));
}
@override
int get hashCode => Object.hash(
runtimeType,
id,
organizationId,
outletId,
name,
email,
role,
const DeepCollectionEquality().hash(_permissions),
isActive,
createdAt,
updatedAt,
);
/// Create a copy of User
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$UserImplCopyWith<_$UserImpl> get copyWith =>
__$$UserImplCopyWithImpl<_$UserImpl>(this, _$identity);
}
abstract class _User extends User {
const factory _User({
required final String id,
required final String organizationId,
required final String outletId,
required final String name,
required final String email,
required final String role,
required final Map<String, dynamic> permissions,
required final bool isActive,
required final DateTime createdAt,
required final DateTime updatedAt,
}) = _$UserImpl;
const _User._() : super._();
@override
String get id;
@override
String get organizationId;
@override
String get outletId;
@override
String get name;
@override
String get email;
@override
String get role;
@override
Map<String, dynamic> get permissions;
@override
bool get isActive;
@override
DateTime get createdAt;
@override
DateTime get updatedAt;
/// Create a copy of User
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$UserImplCopyWith<_$UserImpl> get copyWith =>
throw _privateConstructorUsedError;
}
-32
View File
@@ -1,32 +0,0 @@
part of '../auth.dart';
@freezed
class User with _$User {
const User._();
const factory User({
required String id,
required String organizationId,
required String outletId,
required String name,
required String email,
required String role,
required Map<String, dynamic> permissions,
required bool isActive,
required DateTime createdAt,
required DateTime updatedAt,
}) = _User;
factory User.empty() => User(
id: '',
organizationId: '',
outletId: '',
name: '',
email: '',
role: '',
permissions: {},
isActive: false,
createdAt: DateTime.now(),
updatedAt: DateTime.now(),
);
}