added frontend
This commit is contained in:
15
hartmann-foto-documentation-frontend/lib/dto/base_dto.dart
Normal file
15
hartmann-foto-documentation-frontend/lib/dto/base_dto.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
final class ErrorDto {
|
||||
int error;
|
||||
String message;
|
||||
|
||||
ErrorDto(this.error, this.message);
|
||||
|
||||
ErrorDto.fromJson(Map<String, dynamic> json)
|
||||
: error = json['error'] as int,
|
||||
message = json['message'];
|
||||
}
|
||||
|
||||
abstract interface class DtoMapAble {
|
||||
Map<String, dynamic> toMap();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/// DTO representing a failes login attempt request for 2fa token.
|
||||
class TokenRequiredDto {
|
||||
final bool? tokenRequired;
|
||||
final bool? tokenInValid;
|
||||
|
||||
TokenRequiredDto({
|
||||
required this.tokenRequired,
|
||||
required this.tokenInValid,
|
||||
});
|
||||
|
||||
/// Create from JSON response
|
||||
factory TokenRequiredDto.fromJson(Map<String, dynamic> json) {
|
||||
return TokenRequiredDto(
|
||||
tokenRequired: json['tokenRequired'] as bool,
|
||||
tokenInValid: json['tokenInValid'] as bool,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// DTO representing a pair of JWT tokens from the backend.
|
||||
class JwtTokenPairDto {
|
||||
final String accessToken;
|
||||
final String refreshToken;
|
||||
|
||||
JwtTokenPairDto({
|
||||
required this.accessToken,
|
||||
required this.refreshToken,
|
||||
});
|
||||
|
||||
/// Create from JSON response
|
||||
factory JwtTokenPairDto.fromJson(Map<String, dynamic> json) {
|
||||
return JwtTokenPairDto(
|
||||
accessToken: json['accessToken'] as String,
|
||||
refreshToken: json['refreshToken'] as String,
|
||||
);
|
||||
}
|
||||
|
||||
/// Convert to JSON (for serialization if needed)
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'accessToken': accessToken,
|
||||
'refreshToken': refreshToken,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'JwtTokenPairDto{accessToken: [REDACTED], refreshToken: [REDACTED]}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user