mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-11 00:07:59 -06:00
fix: Add owner to labels
This commit is contained in:
@@ -11,14 +11,16 @@ class Correspondent extends Label {
|
||||
final DateTime? lastCorrespondence;
|
||||
|
||||
const Correspondent({
|
||||
super.id,
|
||||
this.lastCorrespondence,
|
||||
required super.name,
|
||||
super.id,
|
||||
super.slug,
|
||||
super.match,
|
||||
super.matchingAlgorithm,
|
||||
super.isInsensitive,
|
||||
super.documentCount,
|
||||
this.lastCorrespondence,
|
||||
super.owner,
|
||||
super.userCanChange,
|
||||
});
|
||||
|
||||
factory Correspondent.fromJson(Map<String, dynamic> json) =>
|
||||
|
||||
@@ -13,10 +13,11 @@ class DocumentType extends Label {
|
||||
super.matchingAlgorithm,
|
||||
super.isInsensitive,
|
||||
super.documentCount,
|
||||
super.owner,
|
||||
super.userCanChange,
|
||||
});
|
||||
|
||||
factory DocumentType.fromJson(Map<String, dynamic> json) =>
|
||||
_$DocumentTypeFromJson(json);
|
||||
factory DocumentType.fromJson(Map<String, dynamic> json) => _$DocumentTypeFromJson(json);
|
||||
|
||||
@override
|
||||
String get queryEndpoint => 'document_types';
|
||||
|
||||
@@ -19,6 +19,8 @@ abstract class Label extends Equatable implements Comparable {
|
||||
final MatchingAlgorithm matchingAlgorithm;
|
||||
final bool? isInsensitive;
|
||||
final int? documentCount;
|
||||
final int? owner;
|
||||
final bool? userCanChange;
|
||||
|
||||
const Label({
|
||||
this.id,
|
||||
@@ -28,6 +30,8 @@ abstract class Label extends Equatable implements Comparable {
|
||||
this.isInsensitive = true,
|
||||
this.documentCount,
|
||||
this.slug,
|
||||
this.owner,
|
||||
this.userCanChange,
|
||||
});
|
||||
|
||||
Label copyWith({
|
||||
|
||||
@@ -17,10 +17,11 @@ class StoragePath extends Label {
|
||||
super.matchingAlgorithm,
|
||||
super.isInsensitive,
|
||||
super.documentCount,
|
||||
super.owner,
|
||||
super.userCanChange,
|
||||
});
|
||||
|
||||
factory StoragePath.fromJson(Map<String, dynamic> json) =>
|
||||
_$StoragePathFromJson(json);
|
||||
factory StoragePath.fromJson(Map<String, dynamic> json) => _$StoragePathFromJson(json);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
||||
@@ -11,71 +11,33 @@ part 'tag_model.g.dart';
|
||||
|
||||
@HexColorJsonConverter()
|
||||
@JsonSerializable(
|
||||
fieldRename: FieldRename.snake, explicitToJson: true, constructor: "_")
|
||||
fieldRename: FieldRename.snake,
|
||||
explicitToJson: true,
|
||||
)
|
||||
class Tag extends Label {
|
||||
static const colorKey = 'color';
|
||||
static const isInboxTagKey = 'is_inbox_tag';
|
||||
static const textColorKey = 'text_color';
|
||||
static const legacyColourKey = 'colour';
|
||||
|
||||
final Color? textColor;
|
||||
final Color? color;
|
||||
|
||||
final bool isInboxTag;
|
||||
|
||||
@protected
|
||||
@JsonKey(name: colorKey)
|
||||
Color? colorv2;
|
||||
|
||||
@protected
|
||||
@Deprecated(
|
||||
"Alias for the field color. Deprecated since Paperless API v2. Please use the color getter to access the background color of this tag.",
|
||||
)
|
||||
@JsonKey(name: legacyColourKey)
|
||||
Color? colorv1;
|
||||
|
||||
Color? get color => colorv2 ?? colorv1;
|
||||
|
||||
/// Constructor to use for serialization.
|
||||
Tag._({
|
||||
Tag({
|
||||
super.id,
|
||||
required super.name,
|
||||
super.documentCount,
|
||||
super.isInsensitive = true,
|
||||
super.isInsensitive,
|
||||
super.match,
|
||||
super.matchingAlgorithm,
|
||||
super.matchingAlgorithm = MatchingAlgorithm.defaultValue,
|
||||
super.slug,
|
||||
this.colorv1,
|
||||
this.colorv2,
|
||||
this.color,
|
||||
this.textColor,
|
||||
this.isInboxTag = false,
|
||||
}) {
|
||||
colorv1 ??= colorv2;
|
||||
colorv2 ??= colorv1;
|
||||
}
|
||||
|
||||
Tag({
|
||||
int? id,
|
||||
required String name,
|
||||
int? documentCount,
|
||||
bool? isInsensitive,
|
||||
String? match,
|
||||
MatchingAlgorithm matchingAlgorithm = MatchingAlgorithm.defaultValue,
|
||||
String? slug,
|
||||
Color? color,
|
||||
Color? textColor,
|
||||
bool? isInboxTag,
|
||||
}) : this._(
|
||||
id: id,
|
||||
name: name,
|
||||
documentCount: documentCount,
|
||||
isInsensitive: isInsensitive,
|
||||
match: match,
|
||||
matchingAlgorithm: matchingAlgorithm,
|
||||
slug: slug,
|
||||
textColor: textColor,
|
||||
colorv1: color,
|
||||
colorv2: color,
|
||||
);
|
||||
super.owner,
|
||||
super.userCanChange,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() => name;
|
||||
|
||||
Reference in New Issue
Block a user