Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
include: package:very_good_analysis/analysis_options.7.0.0.yaml
analyzer:
errors:
cast_nullable_to_non_nullable: ignore
document_ignores: ignore
lines_longer_than_80_chars: ignore
no_runtimetype_tostring: ignore
overridden_fields: ignore
prefer_initializing_formals: ignore
require_trailing_commas: ignore
unnecessary_null_checks: ignore
unused_element: ignore
use_super_parameters: ignore
10 changes: 9 additions & 1 deletion lib/src/models/auth/permission.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:meta/meta.dart';

part 'permission.g.dart';

Expand All @@ -8,7 +9,14 @@ part 'permission.g.dart';
///
/// Permissions follow the format `resource.action`.
/// {@endtemplate}
@JsonSerializable()

@immutable
@JsonSerializable(
fieldRename: FieldRename.snake,
explicitToJson: true,
includeIfNull: false,
checked: true,
)
class Permission extends Equatable {
/// {@macro permission}
const Permission({required this.name});
Expand Down
13 changes: 11 additions & 2 deletions lib/src/models/auth/permission.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion lib/src/models/auth/user.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import 'package:equatable/equatable.dart';
import 'package:ht_shared/src/models/auth/user_role.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:meta/meta.dart';

part 'user.g.dart';

/// Represents a user within the system.
///
/// This model holds basic information about the user, including their
/// unique identifier, email (if available), and their assigned [role].
@JsonSerializable()

@immutable
@JsonSerializable(
fieldRename: FieldRename.snake,
explicitToJson: true,
includeIfNull: false,
checked: true,
)
class User extends Equatable {
/// Creates a new [User] instance.
///
Expand All @@ -34,6 +42,7 @@ class User extends Equatable {
final String? email;

/// The role of the user.

final UserRole role;

/// The date and time the user account was created.
Expand Down
25 changes: 18 additions & 7 deletions lib/src/models/auth/user.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 33 additions & 5 deletions lib/src/models/core/feed_item_action.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import 'package:equatable/equatable.dart';
import 'package:ht_shared/ht_shared.dart' show FeedItem;
import 'package:ht_shared/src/models/core/content_type.dart';
import 'package:ht_shared/src/models/core/core.dart' show FeedItem;
import 'package:ht_shared/src/models/core/feed_item.dart' show FeedItem;
import 'package:ht_shared/src/models/models.dart' show FeedItem;
// Removed redundant FeedItem imports
import 'package:json_annotation/json_annotation.dart';
import 'package:meta/meta.dart';

part 'feed_item_action.g.dart';

Expand All @@ -15,7 +16,14 @@ part 'feed_item_action.g.dart';
/// and defined within this library. This allows for exhaustive pattern
/// matching in the UI layer.
/// {@endtemplate}
@JsonSerializable(createFactory: false)
@immutable
@JsonSerializable(
createFactory: false,
fieldRename: FieldRename.snake,
explicitToJson: true,
includeIfNull: false,
checked: true,
)
sealed class FeedItemAction extends Equatable {
/// {@macro feed_item_action}
const FeedItemAction({required this.type});
Expand Down Expand Up @@ -66,7 +74,13 @@ Map<String, dynamic> feedItemActionToJson(FeedItemAction action) {
/// {@template open_internal_content}
/// An action to open content that resides within the application.
/// {@endtemplate}
@JsonSerializable()
@immutable
@JsonSerializable(
fieldRename: FieldRename.snake,
explicitToJson: true,
includeIfNull: false,
checked: true,
)
class OpenInternalContent extends FeedItemAction {
/// {@macro open_internal_content}
const OpenInternalContent({
Expand All @@ -82,6 +96,7 @@ class OpenInternalContent extends FeedItemAction {
final String contentId;

/// The type of the internal content (e.g., headline, category, source).

final ContentType contentType;

@override
Expand All @@ -99,7 +114,13 @@ class OpenInternalContent extends FeedItemAction {
/// {@template show_interstitial_then_open_internal_content}
/// An action to show an interstitial advertisement, then open internal content.
/// {@endtemplate}
@JsonSerializable()
@immutable
@JsonSerializable(
fieldRename: FieldRename.snake,
explicitToJson: true,
includeIfNull: false,
checked: true,
)
class ShowInterstitialThenOpenInternalContent extends FeedItemAction {
/// {@macro show_interstitial_then_open_internal_content}
const ShowInterstitialThenOpenInternalContent({
Expand All @@ -118,6 +139,7 @@ class ShowInterstitialThenOpenInternalContent extends FeedItemAction {
final String contentId;

/// The type of the internal content (e.g., headline, category, source).

final ContentType contentType;

@override
Expand All @@ -134,7 +156,13 @@ class ShowInterstitialThenOpenInternalContent extends FeedItemAction {
/// {@template open_external_url}
/// An action to open an external URL, typically in a web browser.
/// {@endtemplate}
@JsonSerializable()
@immutable
@JsonSerializable(
fieldRename: FieldRename.snake,
explicitToJson: true,
includeIfNull: false,
checked: true,
)
class OpenExternalUrl extends FeedItemAction {
/// {@macro open_external_url}
const OpenExternalUrl({required this.url}) : super(type: 'open_external_url');
Expand Down
59 changes: 45 additions & 14 deletions lib/src/models/core/feed_item_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion lib/src/models/entities/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ part 'category.g.dart';
/// The [id] is automatically generated using UUID v4 if not provided.
/// {@endtemplate}
@immutable
@JsonSerializable(explicitToJson: true, includeIfNull: false)
@JsonSerializable(
fieldRename: FieldRename.snake,
explicitToJson: true,
includeIfNull: false,
checked: true,
)
class Category extends FeedItem {
/// {@macro category}
///
Expand Down
33 changes: 20 additions & 13 deletions lib/src/models/entities/category.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion lib/src/models/entities/country.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:ht_shared/src/models/core/feed_item.dart';
import 'package:ht_shared/src/models/core/feed_item_action.dart'
show FeedItemAction, feedItemActionFromJson, feedItemActionToJson;
import 'package:json_annotation/json_annotation.dart';
import 'package:meta/meta.dart';
import 'package:uuid/uuid.dart';

part 'country.g.dart';
Expand All @@ -12,7 +13,13 @@ part 'country.g.dart';
/// Used typically in contexts like selecting a country for news headlines
/// or user profile settings.
/// {@endtemplate}
@JsonSerializable()
@immutable
@JsonSerializable(
fieldRename: FieldRename.snake,
explicitToJson: true,
includeIfNull: false,
checked: true,
)
class Country extends FeedItem {
/// {@macro country}
Country({
Expand Down
Loading
Loading