Set Password Repo

This commit is contained in:
efrilm
2025-09-18 06:57:08 +07:00
parent c40f96fc88
commit 1a0c0cf49b
16 changed files with 2453 additions and 0 deletions
+1
View File
@@ -8,6 +8,7 @@ part 'auth.freezed.dart';
part 'entities/check_phone_entity.dart';
part 'entities/register_entity.dart';
part 'entities/verify_entity.dart';
part 'entities/login_entity.dart';
part 'failures/auth_failure.dart';
part 'repositories/i_auth_repository.dart';
+435
View File
@@ -598,6 +598,441 @@ abstract class _Verify implements Verify {
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$Login {
String get status => throw _privateConstructorUsedError;
String get message => throw _privateConstructorUsedError;
String get accessToken => throw _privateConstructorUsedError;
String get refreshToken => throw _privateConstructorUsedError;
User get user => throw _privateConstructorUsedError;
/// Create a copy of Login
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$LoginCopyWith<Login> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $LoginCopyWith<$Res> {
factory $LoginCopyWith(Login value, $Res Function(Login) then) =
_$LoginCopyWithImpl<$Res, Login>;
@useResult
$Res call({
String status,
String message,
String accessToken,
String refreshToken,
User user,
});
$UserCopyWith<$Res> get user;
}
/// @nodoc
class _$LoginCopyWithImpl<$Res, $Val extends Login>
implements $LoginCopyWith<$Res> {
_$LoginCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Login
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? status = null,
Object? message = null,
Object? accessToken = null,
Object? refreshToken = null,
Object? user = null,
}) {
return _then(
_value.copyWith(
status: null == status
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as String,
message: null == message
? _value.message
: message // ignore: cast_nullable_to_non_nullable
as String,
accessToken: null == accessToken
? _value.accessToken
: accessToken // ignore: cast_nullable_to_non_nullable
as String,
refreshToken: null == refreshToken
? _value.refreshToken
: refreshToken // ignore: cast_nullable_to_non_nullable
as String,
user: null == user
? _value.user
: user // ignore: cast_nullable_to_non_nullable
as User,
)
as $Val,
);
}
/// Create a copy of Login
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserCopyWith<$Res> get user {
return $UserCopyWith<$Res>(_value.user, (value) {
return _then(_value.copyWith(user: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$LoginImplCopyWith<$Res> implements $LoginCopyWith<$Res> {
factory _$$LoginImplCopyWith(
_$LoginImpl value,
$Res Function(_$LoginImpl) then,
) = __$$LoginImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
String status,
String message,
String accessToken,
String refreshToken,
User user,
});
@override
$UserCopyWith<$Res> get user;
}
/// @nodoc
class __$$LoginImplCopyWithImpl<$Res>
extends _$LoginCopyWithImpl<$Res, _$LoginImpl>
implements _$$LoginImplCopyWith<$Res> {
__$$LoginImplCopyWithImpl(
_$LoginImpl _value,
$Res Function(_$LoginImpl) _then,
) : super(_value, _then);
/// Create a copy of Login
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? status = null,
Object? message = null,
Object? accessToken = null,
Object? refreshToken = null,
Object? user = null,
}) {
return _then(
_$LoginImpl(
status: null == status
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as String,
message: null == message
? _value.message
: message // ignore: cast_nullable_to_non_nullable
as String,
accessToken: null == accessToken
? _value.accessToken
: accessToken // ignore: cast_nullable_to_non_nullable
as String,
refreshToken: null == refreshToken
? _value.refreshToken
: refreshToken // ignore: cast_nullable_to_non_nullable
as String,
user: null == user
? _value.user
: user // ignore: cast_nullable_to_non_nullable
as User,
),
);
}
}
/// @nodoc
class _$LoginImpl implements _Login {
const _$LoginImpl({
required this.status,
required this.message,
required this.accessToken,
required this.refreshToken,
required this.user,
});
@override
final String status;
@override
final String message;
@override
final String accessToken;
@override
final String refreshToken;
@override
final User user;
@override
String toString() {
return 'Login(status: $status, message: $message, accessToken: $accessToken, refreshToken: $refreshToken, user: $user)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$LoginImpl &&
(identical(other.status, status) || other.status == status) &&
(identical(other.message, message) || other.message == message) &&
(identical(other.accessToken, accessToken) ||
other.accessToken == accessToken) &&
(identical(other.refreshToken, refreshToken) ||
other.refreshToken == refreshToken) &&
(identical(other.user, user) || other.user == user));
}
@override
int get hashCode => Object.hash(
runtimeType,
status,
message,
accessToken,
refreshToken,
user,
);
/// Create a copy of Login
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$LoginImplCopyWith<_$LoginImpl> get copyWith =>
__$$LoginImplCopyWithImpl<_$LoginImpl>(this, _$identity);
}
abstract class _Login implements Login {
const factory _Login({
required final String status,
required final String message,
required final String accessToken,
required final String refreshToken,
required final User user,
}) = _$LoginImpl;
@override
String get status;
@override
String get message;
@override
String get accessToken;
@override
String get refreshToken;
@override
User get user;
/// Create a copy of Login
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$LoginImplCopyWith<_$LoginImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$User {
String get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String get phoneNumber => throw _privateConstructorUsedError;
String get birthDate => 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 name, String phoneNumber, String birthDate});
}
/// @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? name = null,
Object? phoneNumber = null,
Object? birthDate = null,
}) {
return _then(
_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
phoneNumber: null == phoneNumber
? _value.phoneNumber
: phoneNumber // ignore: cast_nullable_to_non_nullable
as String,
birthDate: null == birthDate
? _value.birthDate
: birthDate // ignore: cast_nullable_to_non_nullable
as String,
)
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 name, String phoneNumber, String birthDate});
}
/// @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? name = null,
Object? phoneNumber = null,
Object? birthDate = null,
}) {
return _then(
_$UserImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
phoneNumber: null == phoneNumber
? _value.phoneNumber
: phoneNumber // ignore: cast_nullable_to_non_nullable
as String,
birthDate: null == birthDate
? _value.birthDate
: birthDate // ignore: cast_nullable_to_non_nullable
as String,
),
);
}
}
/// @nodoc
class _$UserImpl implements _User {
const _$UserImpl({
required this.id,
required this.name,
required this.phoneNumber,
required this.birthDate,
});
@override
final String id;
@override
final String name;
@override
final String phoneNumber;
@override
final String birthDate;
@override
String toString() {
return 'User(id: $id, name: $name, phoneNumber: $phoneNumber, birthDate: $birthDate)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$UserImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.phoneNumber, phoneNumber) ||
other.phoneNumber == phoneNumber) &&
(identical(other.birthDate, birthDate) ||
other.birthDate == birthDate));
}
@override
int get hashCode =>
Object.hash(runtimeType, id, name, phoneNumber, birthDate);
/// 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 implements User {
const factory _User({
required final String id,
required final String name,
required final String phoneNumber,
required final String birthDate,
}) = _$UserImpl;
@override
String get id;
@override
String get name;
@override
String get phoneNumber;
@override
String get birthDate;
/// 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;
}
/// @nodoc
mixin _$AuthFailure {
@optionalTypeArgs
@@ -0,0 +1,33 @@
part of '../auth.dart';
@freezed
class Login with _$Login {
const factory Login({
required String status,
required String message,
required String accessToken,
required String refreshToken,
required User user,
}) = _Login;
factory Login.empty() => Login(
status: '',
message: '',
accessToken: '',
refreshToken: '',
user: User.empty(),
);
}
@freezed
class User with _$User {
const factory User({
required String id,
required String name,
required String phoneNumber,
required String birthDate,
}) = _User;
factory User.empty() =>
const User(id: '', name: '', phoneNumber: '', birthDate: '');
}
@@ -15,4 +15,10 @@ abstract class IAuthRepository {
required String registrationToken,
required String otpCode,
});
Future<Either<AuthFailure, Login>> setPassword({
required String registrationToken,
required String password,
required String confirmPassword,
});
}