mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-15 00:12:22 -06:00
feat: Add notes
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_api/src/converters/local_date_time_json_converter.dart';
|
||||
import 'package:paperless_api/src/models/custom_field_model.dart';
|
||||
import 'package:paperless_api/src/models/note_model.dart';
|
||||
import 'package:paperless_api/src/models/search_hit.dart';
|
||||
|
||||
part 'document_model.g.dart';
|
||||
@@ -48,10 +47,11 @@ class DocumentModel extends Equatable {
|
||||
|
||||
final int? owner;
|
||||
final bool? userCanChange;
|
||||
final Iterable<NoteModel> notes;
|
||||
|
||||
// Only present if full_perms=true
|
||||
/// Only present if full_perms=true
|
||||
final Permissions? permissions;
|
||||
final Iterable<CustomFieldModel>? customFields;
|
||||
final Iterable<CustomFieldModel> customFields;
|
||||
|
||||
const DocumentModel({
|
||||
required this.id,
|
||||
@@ -71,7 +71,8 @@ class DocumentModel extends Equatable {
|
||||
this.owner,
|
||||
this.userCanChange,
|
||||
this.permissions,
|
||||
this.customFields,
|
||||
this.customFields = const [],
|
||||
this.notes = const [],
|
||||
});
|
||||
|
||||
factory DocumentModel.fromJson(Map<String, dynamic> json) =>
|
||||
|
||||
17
packages/paperless_api/lib/src/models/note_model.dart
Normal file
17
packages/paperless_api/lib/src/models/note_model.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
part 'note_model.freezed.dart';
|
||||
part 'note_model.g.dart';
|
||||
|
||||
@freezed
|
||||
class NoteModel with _$NoteModel {
|
||||
const factory NoteModel({
|
||||
required int id,
|
||||
required String note,
|
||||
required DateTime created,
|
||||
required int document,
|
||||
required int? user,
|
||||
}) = _NoteModel;
|
||||
|
||||
factory NoteModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$NoteModelFromJson(json);
|
||||
}
|
||||
Reference in New Issue
Block a user