dto / mapper / model separation of verification purpose

This commit is contained in:
Stephan D
2026-02-26 22:38:31 +01:00
parent 20ce4485e8
commit 947cd7f4c9
5 changed files with 74 additions and 22 deletions

View File

@@ -1,24 +1,24 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:pshared/models/verification/purpose.dart';
import 'package:pshared/api/requests/tokens/session_identifier.dart';
import 'package:pshared/data/dto/verification/purpose.dart';
part 'login.g.dart';
@JsonSerializable(explicitToJson: true)
class LoginVerificationRequest {
final VerificationPurpose purpose;
final VerificationPurposeDTO purpose;
final String? target;
final String idempotencyKey;
const LoginVerificationRequest({
this.purpose = VerificationPurpose.login,
this.purpose = VerificationPurposeDTO.login,
this.target,
required this.idempotencyKey,
});
factory LoginVerificationRequest.fromJson(Map<String, dynamic> json) => _$LoginVerificationRequestFromJson(json);
factory LoginVerificationRequest.fromJson(Map<String, dynamic> json) =>
_$LoginVerificationRequestFromJson(json);
Map<String, dynamic> toJson() => _$LoginVerificationRequestToJson(this);
}
@@ -28,14 +28,15 @@ class LoginCodeVerifyicationRequest extends LoginVerificationRequest {
final SessionIdentifierDTO sessionIdentifier;
const LoginCodeVerifyicationRequest({
super.purpose = VerificationPurpose.login,
super.purpose = VerificationPurposeDTO.login,
super.target,
required super.idempotencyKey,
required this.code,
required this.sessionIdentifier,
});
factory LoginCodeVerifyicationRequest.fromJson(Map<String, dynamic> json) => _$LoginCodeVerifyicationRequestFromJson(json);
factory LoginCodeVerifyicationRequest.fromJson(Map<String, dynamic> json) =>
_$LoginCodeVerifyicationRequestFromJson(json);
@override
Map<String, dynamic> toJson() => _$LoginCodeVerifyicationRequestToJson(this);
}