mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-07 22:07:49 -06:00
Initial commit
This commit is contained in:
46
lib/core/model/document_processing_status.dart
Normal file
46
lib/core/model/document_processing_status.dart
Normal file
@@ -0,0 +1,46 @@
|
||||
enum ProcessingStatus { starting, working, success, error }
|
||||
|
||||
enum ProcessingMessage {
|
||||
new_file,
|
||||
parsing_document,
|
||||
generating_thumbnail,
|
||||
parse_date,
|
||||
save_document,
|
||||
finished
|
||||
}
|
||||
|
||||
class DocumentProcessingStatus {
|
||||
final int currentProgress;
|
||||
final int? documentId;
|
||||
final String filename;
|
||||
final int maxProgress;
|
||||
final ProcessingMessage message;
|
||||
final ProcessingStatus status;
|
||||
final String taskId;
|
||||
final bool isApproximated;
|
||||
|
||||
static const String UNKNOWN_TASK_ID = "NO_TASK_ID";
|
||||
|
||||
DocumentProcessingStatus({
|
||||
required this.currentProgress,
|
||||
this.documentId,
|
||||
required this.filename,
|
||||
required this.maxProgress,
|
||||
required this.message,
|
||||
required this.status,
|
||||
required this.taskId,
|
||||
this.isApproximated = false,
|
||||
});
|
||||
|
||||
factory DocumentProcessingStatus.fromJson(Map<dynamic, dynamic> json) {
|
||||
return DocumentProcessingStatus(
|
||||
currentProgress: json['current_progress'],
|
||||
documentId: json['documentId'],
|
||||
filename: json['filename'],
|
||||
maxProgress: json['max_progress'],
|
||||
message: ProcessingMessage.values.byName(json['message']),
|
||||
status: ProcessingStatus.values.byName(json['status']),
|
||||
taskId: json['task_id'],
|
||||
);
|
||||
}
|
||||
}
|
||||
50
lib/core/model/error_message.dart
Normal file
50
lib/core/model/error_message.dart
Normal file
@@ -0,0 +1,50 @@
|
||||
class ErrorMessage implements Exception {
|
||||
final ErrorCode code;
|
||||
final StackTrace? stackTrace;
|
||||
final int? httpStatusCode;
|
||||
|
||||
const ErrorMessage(this.code, {this.stackTrace, this.httpStatusCode});
|
||||
|
||||
factory ErrorMessage.unknown() {
|
||||
return const ErrorMessage(ErrorCode.unknown);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return "ErrorMessage(code: $code${stackTrace != null ? ', stackTrace: ${stackTrace.toString()}' : ''}${httpStatusCode != null ? ', httpStatusCode: $httpStatusCode' : ''})";
|
||||
}
|
||||
}
|
||||
|
||||
enum ErrorCode {
|
||||
unknown,
|
||||
authenticationFailed,
|
||||
notAuthenticated,
|
||||
documentUploadFailed,
|
||||
documentUpdateFailed,
|
||||
documentLoadFailed,
|
||||
documentDeleteFailed,
|
||||
documentBulkDeleteFailed,
|
||||
documentPreviewFailed,
|
||||
documentAsnQueryFailed,
|
||||
tagCreateFailed,
|
||||
tagLoadFailed,
|
||||
documentTypeCreateFailed,
|
||||
documentTypeLoadFailed,
|
||||
correspondentCreateFailed,
|
||||
correspondentLoadFailed,
|
||||
scanRemoveFailed,
|
||||
invalidClientCertificateConfiguration,
|
||||
biometricsNotSupported,
|
||||
biometricAuthenticationFailed,
|
||||
deviceOffline,
|
||||
serverUnreachable,
|
||||
similarQueryError,
|
||||
autocompleteQueryError,
|
||||
storagePathLoadFailed,
|
||||
storagePathCreateFailed,
|
||||
loadSavedViewsError,
|
||||
createSavedViewError,
|
||||
deleteSavedViewError,
|
||||
requestTimedOut,
|
||||
storagePathAlreadyExists;
|
||||
}
|
||||
Reference in New Issue
Block a user