prepare for multiple apps
This commit is contained in:
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Copyright (c) 2024-2026 Fabian Freund.
|
||||
*
|
||||
* This file is part of WebLibre
|
||||
* (see https://weblibre.eu).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import 'package:copy_with_extension/copy_with_extension.dart';
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:fast_equatable/fast_equatable.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:weblibre/features/web_feed/data/database/definitions.drift.dart';
|
||||
import 'package:weblibre/features/web_feed/data/models/feed_author.dart';
|
||||
import 'package:weblibre/features/web_feed/data/models/feed_category.dart';
|
||||
import 'package:weblibre/features/web_feed/data/models/feed_link.dart';
|
||||
|
||||
part 'feed_article.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
@CopyWith()
|
||||
class FeedArticle with FastEquatable implements Insertable<FeedArticle> {
|
||||
final String id;
|
||||
final Uri feedId;
|
||||
final DateTime fetched;
|
||||
final DateTime? created;
|
||||
final DateTime? updated;
|
||||
final DateTime? lastRead;
|
||||
final String? title;
|
||||
final List<FeedAuthor>? authors;
|
||||
final List<FeedCategory>? tags;
|
||||
final List<FeedLink>? links;
|
||||
final String? summaryHtml;
|
||||
final String? summaryMarkdown;
|
||||
final String? summaryPlain;
|
||||
final String? contentHtml;
|
||||
final String? contentMarkdown;
|
||||
final String? contentPlain;
|
||||
|
||||
//Derived by view from feed table, should not get inserted
|
||||
final Uri? icon;
|
||||
final Uri? siteLink;
|
||||
|
||||
FeedArticle({
|
||||
required this.id,
|
||||
required this.feedId,
|
||||
required this.fetched,
|
||||
this.created,
|
||||
this.updated,
|
||||
this.lastRead,
|
||||
this.title,
|
||||
this.authors,
|
||||
this.tags,
|
||||
this.links,
|
||||
this.summaryHtml,
|
||||
this.summaryMarkdown,
|
||||
this.summaryPlain,
|
||||
this.contentHtml,
|
||||
this.contentMarkdown,
|
||||
this.contentPlain,
|
||||
this.icon,
|
||||
this.siteLink,
|
||||
});
|
||||
|
||||
factory FeedArticle.fromJson(Map<String, dynamic> json) =>
|
||||
_$FeedArticleFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$FeedArticleToJson(this);
|
||||
|
||||
@override
|
||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||
final map = <String, Expression>{};
|
||||
map['id'] = Variable<String>(id);
|
||||
{
|
||||
map['feed_id'] = Variable<String>(Article.$converterfeedId.toSql(feedId));
|
||||
}
|
||||
map['fetched'] = Variable<DateTime>(fetched);
|
||||
if (!nullToAbsent || created != null) {
|
||||
map['created'] = Variable<DateTime>(created);
|
||||
}
|
||||
if (!nullToAbsent || updated != null) {
|
||||
map['updated'] = Variable<DateTime>(updated);
|
||||
}
|
||||
if (!nullToAbsent || lastRead != null) {
|
||||
map['last_read'] = Variable<DateTime>(lastRead);
|
||||
}
|
||||
if (!nullToAbsent || title != null) {
|
||||
map['title'] = Variable<String>(title);
|
||||
}
|
||||
if (!nullToAbsent || authors != null) {
|
||||
map['authors'] = Variable<String>(
|
||||
Article.$converterauthorsn.toSql(authors),
|
||||
);
|
||||
}
|
||||
if (!nullToAbsent || tags != null) {
|
||||
map['tags'] = Variable<String>(Article.$convertertagsn.toSql(tags));
|
||||
}
|
||||
if (!nullToAbsent || links != null) {
|
||||
map['links'] = Variable<String>(Article.$converterlinksn.toSql(links));
|
||||
}
|
||||
if (!nullToAbsent || summaryHtml != null) {
|
||||
map['summaryHtml'] = Variable<String>(summaryHtml);
|
||||
}
|
||||
if (!nullToAbsent || summaryMarkdown != null) {
|
||||
map['summaryMarkdown'] = Variable<String>(summaryMarkdown);
|
||||
}
|
||||
if (!nullToAbsent || summaryPlain != null) {
|
||||
map['summaryPlain'] = Variable<String>(summaryPlain);
|
||||
}
|
||||
if (!nullToAbsent || contentHtml != null) {
|
||||
map['contentHtml'] = Variable<String>(contentHtml);
|
||||
}
|
||||
if (!nullToAbsent || contentMarkdown != null) {
|
||||
map['contentMarkdown'] = Variable<String>(contentMarkdown);
|
||||
}
|
||||
if (!nullToAbsent || contentPlain != null) {
|
||||
map['contentPlain'] = Variable<String>(contentPlain);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
id,
|
||||
feedId,
|
||||
fetched,
|
||||
created,
|
||||
updated,
|
||||
lastRead,
|
||||
title,
|
||||
authors,
|
||||
tags,
|
||||
links,
|
||||
summaryHtml,
|
||||
summaryMarkdown,
|
||||
summaryPlain,
|
||||
contentHtml,
|
||||
contentMarkdown,
|
||||
contentPlain,
|
||||
icon,
|
||||
siteLink,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,313 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'feed_article.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// CopyWithGenerator
|
||||
// **************************************************************************
|
||||
|
||||
abstract class _$FeedArticleCWProxy {
|
||||
FeedArticle id(String id);
|
||||
|
||||
FeedArticle feedId(Uri feedId);
|
||||
|
||||
FeedArticle fetched(DateTime fetched);
|
||||
|
||||
FeedArticle created(DateTime? created);
|
||||
|
||||
FeedArticle updated(DateTime? updated);
|
||||
|
||||
FeedArticle lastRead(DateTime? lastRead);
|
||||
|
||||
FeedArticle title(String? title);
|
||||
|
||||
FeedArticle authors(List<FeedAuthor>? authors);
|
||||
|
||||
FeedArticle tags(List<FeedCategory>? tags);
|
||||
|
||||
FeedArticle links(List<FeedLink>? links);
|
||||
|
||||
FeedArticle summaryHtml(String? summaryHtml);
|
||||
|
||||
FeedArticle summaryMarkdown(String? summaryMarkdown);
|
||||
|
||||
FeedArticle summaryPlain(String? summaryPlain);
|
||||
|
||||
FeedArticle contentHtml(String? contentHtml);
|
||||
|
||||
FeedArticle contentMarkdown(String? contentMarkdown);
|
||||
|
||||
FeedArticle contentPlain(String? contentPlain);
|
||||
|
||||
FeedArticle icon(Uri? icon);
|
||||
|
||||
FeedArticle siteLink(Uri? siteLink);
|
||||
|
||||
/// Creates a new instance with the provided field values.
|
||||
/// Passing `null` to a nullable field nullifies it, while `null` for a non-nullable field is ignored. To update a single field use `FeedArticle(...).copyWith.fieldName(value)`.
|
||||
///
|
||||
/// Example:
|
||||
/// ```dart
|
||||
/// FeedArticle(...).copyWith(id: 12, name: "My name")
|
||||
/// ```
|
||||
FeedArticle call({
|
||||
String id,
|
||||
Uri feedId,
|
||||
DateTime fetched,
|
||||
DateTime? created,
|
||||
DateTime? updated,
|
||||
DateTime? lastRead,
|
||||
String? title,
|
||||
List<FeedAuthor>? authors,
|
||||
List<FeedCategory>? tags,
|
||||
List<FeedLink>? links,
|
||||
String? summaryHtml,
|
||||
String? summaryMarkdown,
|
||||
String? summaryPlain,
|
||||
String? contentHtml,
|
||||
String? contentMarkdown,
|
||||
String? contentPlain,
|
||||
Uri? icon,
|
||||
Uri? siteLink,
|
||||
});
|
||||
}
|
||||
|
||||
/// Callable proxy for `copyWith` functionality.
|
||||
/// Use as `instanceOfFeedArticle.copyWith(...)` or call `instanceOfFeedArticle.copyWith.fieldName(value)` for a single field.
|
||||
class _$FeedArticleCWProxyImpl implements _$FeedArticleCWProxy {
|
||||
const _$FeedArticleCWProxyImpl(this._value);
|
||||
|
||||
final FeedArticle _value;
|
||||
|
||||
@override
|
||||
FeedArticle id(String id) => call(id: id);
|
||||
|
||||
@override
|
||||
FeedArticle feedId(Uri feedId) => call(feedId: feedId);
|
||||
|
||||
@override
|
||||
FeedArticle fetched(DateTime fetched) => call(fetched: fetched);
|
||||
|
||||
@override
|
||||
FeedArticle created(DateTime? created) => call(created: created);
|
||||
|
||||
@override
|
||||
FeedArticle updated(DateTime? updated) => call(updated: updated);
|
||||
|
||||
@override
|
||||
FeedArticle lastRead(DateTime? lastRead) => call(lastRead: lastRead);
|
||||
|
||||
@override
|
||||
FeedArticle title(String? title) => call(title: title);
|
||||
|
||||
@override
|
||||
FeedArticle authors(List<FeedAuthor>? authors) => call(authors: authors);
|
||||
|
||||
@override
|
||||
FeedArticle tags(List<FeedCategory>? tags) => call(tags: tags);
|
||||
|
||||
@override
|
||||
FeedArticle links(List<FeedLink>? links) => call(links: links);
|
||||
|
||||
@override
|
||||
FeedArticle summaryHtml(String? summaryHtml) =>
|
||||
call(summaryHtml: summaryHtml);
|
||||
|
||||
@override
|
||||
FeedArticle summaryMarkdown(String? summaryMarkdown) =>
|
||||
call(summaryMarkdown: summaryMarkdown);
|
||||
|
||||
@override
|
||||
FeedArticle summaryPlain(String? summaryPlain) =>
|
||||
call(summaryPlain: summaryPlain);
|
||||
|
||||
@override
|
||||
FeedArticle contentHtml(String? contentHtml) =>
|
||||
call(contentHtml: contentHtml);
|
||||
|
||||
@override
|
||||
FeedArticle contentMarkdown(String? contentMarkdown) =>
|
||||
call(contentMarkdown: contentMarkdown);
|
||||
|
||||
@override
|
||||
FeedArticle contentPlain(String? contentPlain) =>
|
||||
call(contentPlain: contentPlain);
|
||||
|
||||
@override
|
||||
FeedArticle icon(Uri? icon) => call(icon: icon);
|
||||
|
||||
@override
|
||||
FeedArticle siteLink(Uri? siteLink) => call(siteLink: siteLink);
|
||||
|
||||
@override
|
||||
/// Creates a new instance with the provided field values.
|
||||
/// Passing `null` to a nullable field nullifies it, while `null` for a non-nullable field is ignored. To update a single field use `FeedArticle(...).copyWith.fieldName(value)`.
|
||||
///
|
||||
/// Example:
|
||||
/// ```dart
|
||||
/// FeedArticle(...).copyWith(id: 12, name: "My name")
|
||||
/// ```
|
||||
FeedArticle call({
|
||||
Object? id = const $CopyWithPlaceholder(),
|
||||
Object? feedId = const $CopyWithPlaceholder(),
|
||||
Object? fetched = const $CopyWithPlaceholder(),
|
||||
Object? created = const $CopyWithPlaceholder(),
|
||||
Object? updated = const $CopyWithPlaceholder(),
|
||||
Object? lastRead = const $CopyWithPlaceholder(),
|
||||
Object? title = const $CopyWithPlaceholder(),
|
||||
Object? authors = const $CopyWithPlaceholder(),
|
||||
Object? tags = const $CopyWithPlaceholder(),
|
||||
Object? links = const $CopyWithPlaceholder(),
|
||||
Object? summaryHtml = const $CopyWithPlaceholder(),
|
||||
Object? summaryMarkdown = const $CopyWithPlaceholder(),
|
||||
Object? summaryPlain = const $CopyWithPlaceholder(),
|
||||
Object? contentHtml = const $CopyWithPlaceholder(),
|
||||
Object? contentMarkdown = const $CopyWithPlaceholder(),
|
||||
Object? contentPlain = const $CopyWithPlaceholder(),
|
||||
Object? icon = const $CopyWithPlaceholder(),
|
||||
Object? siteLink = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return FeedArticle(
|
||||
id: id == const $CopyWithPlaceholder() || id == null
|
||||
? _value.id
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: id as String,
|
||||
feedId: feedId == const $CopyWithPlaceholder() || feedId == null
|
||||
? _value.feedId
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: feedId as Uri,
|
||||
fetched: fetched == const $CopyWithPlaceholder() || fetched == null
|
||||
? _value.fetched
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: fetched as DateTime,
|
||||
created: created == const $CopyWithPlaceholder()
|
||||
? _value.created
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: created as DateTime?,
|
||||
updated: updated == const $CopyWithPlaceholder()
|
||||
? _value.updated
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: updated as DateTime?,
|
||||
lastRead: lastRead == const $CopyWithPlaceholder()
|
||||
? _value.lastRead
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: lastRead as DateTime?,
|
||||
title: title == const $CopyWithPlaceholder()
|
||||
? _value.title
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: title as String?,
|
||||
authors: authors == const $CopyWithPlaceholder()
|
||||
? _value.authors
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: authors as List<FeedAuthor>?,
|
||||
tags: tags == const $CopyWithPlaceholder()
|
||||
? _value.tags
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: tags as List<FeedCategory>?,
|
||||
links: links == const $CopyWithPlaceholder()
|
||||
? _value.links
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: links as List<FeedLink>?,
|
||||
summaryHtml: summaryHtml == const $CopyWithPlaceholder()
|
||||
? _value.summaryHtml
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: summaryHtml as String?,
|
||||
summaryMarkdown: summaryMarkdown == const $CopyWithPlaceholder()
|
||||
? _value.summaryMarkdown
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: summaryMarkdown as String?,
|
||||
summaryPlain: summaryPlain == const $CopyWithPlaceholder()
|
||||
? _value.summaryPlain
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: summaryPlain as String?,
|
||||
contentHtml: contentHtml == const $CopyWithPlaceholder()
|
||||
? _value.contentHtml
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: contentHtml as String?,
|
||||
contentMarkdown: contentMarkdown == const $CopyWithPlaceholder()
|
||||
? _value.contentMarkdown
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: contentMarkdown as String?,
|
||||
contentPlain: contentPlain == const $CopyWithPlaceholder()
|
||||
? _value.contentPlain
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: contentPlain as String?,
|
||||
icon: icon == const $CopyWithPlaceholder()
|
||||
? _value.icon
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: icon as Uri?,
|
||||
siteLink: siteLink == const $CopyWithPlaceholder()
|
||||
? _value.siteLink
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: siteLink as Uri?,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
extension $FeedArticleCopyWith on FeedArticle {
|
||||
/// Returns a callable class used to build a new instance with modified fields.
|
||||
/// Example: `instanceOfFeedArticle.copyWith(...)` or `instanceOfFeedArticle.copyWith.fieldName(...)`.
|
||||
// ignore: library_private_types_in_public_api
|
||||
_$FeedArticleCWProxy get copyWith => _$FeedArticleCWProxyImpl(this);
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
FeedArticle _$FeedArticleFromJson(Map<String, dynamic> json) => FeedArticle(
|
||||
id: json['id'] as String,
|
||||
feedId: Uri.parse(json['feedId'] as String),
|
||||
fetched: DateTime.parse(json['fetched'] as String),
|
||||
created: json['created'] == null
|
||||
? null
|
||||
: DateTime.parse(json['created'] as String),
|
||||
updated: json['updated'] == null
|
||||
? null
|
||||
: DateTime.parse(json['updated'] as String),
|
||||
lastRead: json['lastRead'] == null
|
||||
? null
|
||||
: DateTime.parse(json['lastRead'] as String),
|
||||
title: json['title'] as String?,
|
||||
authors: (json['authors'] as List<dynamic>?)
|
||||
?.map((e) => FeedAuthor.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
tags: (json['tags'] as List<dynamic>?)
|
||||
?.map((e) => FeedCategory.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
links: (json['links'] as List<dynamic>?)
|
||||
?.map((e) => FeedLink.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
summaryHtml: json['summaryHtml'] as String?,
|
||||
summaryMarkdown: json['summaryMarkdown'] as String?,
|
||||
summaryPlain: json['summaryPlain'] as String?,
|
||||
contentHtml: json['contentHtml'] as String?,
|
||||
contentMarkdown: json['contentMarkdown'] as String?,
|
||||
contentPlain: json['contentPlain'] as String?,
|
||||
icon: json['icon'] == null ? null : Uri.parse(json['icon'] as String),
|
||||
siteLink: json['siteLink'] == null
|
||||
? null
|
||||
: Uri.parse(json['siteLink'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$FeedArticleToJson(FeedArticle instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'feedId': instance.feedId.toString(),
|
||||
'fetched': instance.fetched.toIso8601String(),
|
||||
'created': instance.created?.toIso8601String(),
|
||||
'updated': instance.updated?.toIso8601String(),
|
||||
'lastRead': instance.lastRead?.toIso8601String(),
|
||||
'title': instance.title,
|
||||
'authors': instance.authors?.map((e) => e.toJson()).toList(),
|
||||
'tags': instance.tags?.map((e) => e.toJson()).toList(),
|
||||
'links': instance.links?.map((e) => e.toJson()).toList(),
|
||||
'summaryHtml': instance.summaryHtml,
|
||||
'summaryMarkdown': instance.summaryMarkdown,
|
||||
'summaryPlain': instance.summaryPlain,
|
||||
'contentHtml': instance.contentHtml,
|
||||
'contentMarkdown': instance.contentMarkdown,
|
||||
'contentPlain': instance.contentPlain,
|
||||
'icon': instance.icon?.toString(),
|
||||
'siteLink': instance.siteLink?.toString(),
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2024-2026 Fabian Freund.
|
||||
*
|
||||
* This file is part of WebLibre
|
||||
* (see https://weblibre.eu).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import 'package:weblibre/features/web_feed/data/models/feed_article.dart';
|
||||
|
||||
class FeedArticleQueryResult extends FeedArticle {
|
||||
final String? titleHighlight;
|
||||
final String? summarySnippet;
|
||||
final String? contentSnippet;
|
||||
|
||||
final double weightedRank;
|
||||
|
||||
FeedArticleQueryResult({
|
||||
required super.id,
|
||||
required super.feedId,
|
||||
required super.fetched,
|
||||
required this.weightedRank,
|
||||
required super.created,
|
||||
required super.updated,
|
||||
required super.lastRead,
|
||||
required super.title,
|
||||
required super.authors,
|
||||
required super.tags,
|
||||
required super.links,
|
||||
required super.summaryHtml,
|
||||
required super.summaryMarkdown,
|
||||
required super.summaryPlain,
|
||||
required super.contentHtml,
|
||||
required super.contentMarkdown,
|
||||
required super.contentPlain,
|
||||
required super.icon,
|
||||
this.titleHighlight,
|
||||
this.summarySnippet,
|
||||
this.contentSnippet,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
...super.hashParameters,
|
||||
weightedRank,
|
||||
summarySnippet,
|
||||
contentSnippet,
|
||||
titleHighlight,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2024-2026 Fabian Freund.
|
||||
*
|
||||
* This file is part of WebLibre
|
||||
* (see https://weblibre.eu).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import 'package:fast_equatable/fast_equatable.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'feed_author.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class FeedAuthor with FastEquatable {
|
||||
final String? name;
|
||||
final String? email;
|
||||
|
||||
FeedAuthor({this.name, this.email});
|
||||
|
||||
factory FeedAuthor.fromJson(Map<String, dynamic> json) =>
|
||||
_$FeedAuthorFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$FeedAuthorToJson(this);
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [name, email];
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'feed_author.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
FeedAuthor _$FeedAuthorFromJson(Map<String, dynamic> json) =>
|
||||
FeedAuthor(name: json['name'] as String?, email: json['email'] as String?);
|
||||
|
||||
Map<String, dynamic> _$FeedAuthorToJson(FeedAuthor instance) =>
|
||||
<String, dynamic>{'name': instance.name, 'email': instance.email};
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2024-2026 Fabian Freund.
|
||||
*
|
||||
* This file is part of WebLibre
|
||||
* (see https://weblibre.eu).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import 'package:fast_equatable/fast_equatable.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'feed_category.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class FeedCategory with FastEquatable {
|
||||
final String id;
|
||||
final String? title;
|
||||
|
||||
FeedCategory({required this.id, this.title});
|
||||
|
||||
factory FeedCategory.fromJson(Map<String, dynamic> json) =>
|
||||
_$FeedCategoryFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$FeedCategoryToJson(this);
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [id, title];
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'feed_category.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
FeedCategory _$FeedCategoryFromJson(Map<String, dynamic> json) =>
|
||||
FeedCategory(id: json['id'] as String, title: json['title'] as String?);
|
||||
|
||||
Map<String, dynamic> _$FeedCategoryToJson(FeedCategory instance) =>
|
||||
<String, dynamic>{'id': instance.id, 'title': instance.title};
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2024-2026 Fabian Freund.
|
||||
*
|
||||
* This file is part of WebLibre
|
||||
* (see https://weblibre.eu).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import 'package:fast_equatable/fast_equatable.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'feed_link.g.dart';
|
||||
|
||||
enum FeedLinkRelation {
|
||||
///an alternate representation of the entry or feed, for example a permalink to the html version of the entry, or the front page of the weblog.
|
||||
alternate,
|
||||
|
||||
///a related resource which is potentially large in size and might require special handling, for example an audio or video recording.
|
||||
enclosure,
|
||||
|
||||
///an document related to the entry or feed.
|
||||
related,
|
||||
|
||||
///the feed itself.
|
||||
self,
|
||||
|
||||
///the source of the information provided in the entry.
|
||||
via,
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class FeedLink with FastEquatable {
|
||||
final Uri uri;
|
||||
final FeedLinkRelation? relation;
|
||||
final String? title;
|
||||
|
||||
FeedLink({required this.uri, this.relation, this.title});
|
||||
|
||||
factory FeedLink.fromJson(Map<String, dynamic> json) =>
|
||||
_$FeedLinkFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$FeedLinkToJson(this);
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [uri, relation, title];
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'feed_link.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
FeedLink _$FeedLinkFromJson(Map<String, dynamic> json) => FeedLink(
|
||||
uri: Uri.parse(json['uri'] as String),
|
||||
relation: $enumDecodeNullable(_$FeedLinkRelationEnumMap, json['relation']),
|
||||
title: json['title'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$FeedLinkToJson(FeedLink instance) => <String, dynamic>{
|
||||
'uri': instance.uri.toString(),
|
||||
'relation': _$FeedLinkRelationEnumMap[instance.relation],
|
||||
'title': instance.title,
|
||||
};
|
||||
|
||||
const _$FeedLinkRelationEnumMap = {
|
||||
FeedLinkRelation.alternate: 'alternate',
|
||||
FeedLinkRelation.enclosure: 'enclosure',
|
||||
FeedLinkRelation.related: 'related',
|
||||
FeedLinkRelation.self: 'self',
|
||||
FeedLinkRelation.via: 'via',
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2024-2026 Fabian Freund.
|
||||
*
|
||||
* This file is part of WebLibre
|
||||
* (see https://weblibre.eu).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:weblibre/features/web_feed/data/database/converters/feed_data.dart';
|
||||
import 'package:weblibre/features/web_feed/data/database/definitions.drift.dart';
|
||||
import 'package:weblibre/features/web_feed/data/models/feed_article.dart';
|
||||
|
||||
part 'feed_parse_result.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class FeedParseResult {
|
||||
@FeedDataConverter()
|
||||
final FeedData feedData;
|
||||
final List<FeedArticle> articleData;
|
||||
|
||||
FeedParseResult({required this.feedData, required this.articleData});
|
||||
|
||||
factory FeedParseResult.fromJson(Map<String, dynamic> json) =>
|
||||
_$FeedParseResultFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$FeedParseResultToJson(this);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'feed_parse_result.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
FeedParseResult _$FeedParseResultFromJson(Map<String, dynamic> json) =>
|
||||
FeedParseResult(
|
||||
feedData: const FeedDataConverter().fromJson(
|
||||
json['feedData'] as Map<String, dynamic>,
|
||||
),
|
||||
articleData: (json['articleData'] as List<dynamic>)
|
||||
.map((e) => FeedArticle.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$FeedParseResultToJson(FeedParseResult instance) =>
|
||||
<String, dynamic>{
|
||||
'feedData': const FeedDataConverter().toJson(instance.feedData),
|
||||
'articleData': instance.articleData.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
Reference in New Issue
Block a user