Repostable and replyable post

This commit is contained in:
2024-11-10 20:07:26 +08:00
parent 0a8c9fb208
commit c1e10916ee
7 changed files with 123 additions and 37 deletions

View File

@ -33,7 +33,7 @@ class SnPost with _$SnPost {
required DateTime? pinnedAt,
required DateTime? lockedAt,
required bool isDraft,
required DateTime publishedAt,
required DateTime? publishedAt,
required dynamic publishedUntil,
required int totalUpvote,
required int totalDownvote,

View File

@ -44,7 +44,7 @@ mixin _$SnPost {
DateTime? get pinnedAt => throw _privateConstructorUsedError;
DateTime? get lockedAt => throw _privateConstructorUsedError;
bool get isDraft => throw _privateConstructorUsedError;
DateTime get publishedAt => throw _privateConstructorUsedError;
DateTime? get publishedAt => throw _privateConstructorUsedError;
dynamic get publishedUntil => throw _privateConstructorUsedError;
int get totalUpvote => throw _privateConstructorUsedError;
int get totalDownvote => throw _privateConstructorUsedError;
@ -94,7 +94,7 @@ abstract class $SnPostCopyWith<$Res> {
DateTime? pinnedAt,
DateTime? lockedAt,
bool isDraft,
DateTime publishedAt,
DateTime? publishedAt,
dynamic publishedUntil,
int totalUpvote,
int totalDownvote,
@ -149,7 +149,7 @@ class _$SnPostCopyWithImpl<$Res, $Val extends SnPost>
Object? pinnedAt = freezed,
Object? lockedAt = freezed,
Object? isDraft = null,
Object? publishedAt = null,
Object? publishedAt = freezed,
Object? publishedUntil = freezed,
Object? totalUpvote = null,
Object? totalDownvote = null,
@ -257,10 +257,10 @@ class _$SnPostCopyWithImpl<$Res, $Val extends SnPost>
? _value.isDraft
: isDraft // ignore: cast_nullable_to_non_nullable
as bool,
publishedAt: null == publishedAt
publishedAt: freezed == publishedAt
? _value.publishedAt
: publishedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
as DateTime?,
publishedUntil: freezed == publishedUntil
? _value.publishedUntil
: publishedUntil // ignore: cast_nullable_to_non_nullable
@ -367,7 +367,7 @@ abstract class _$$SnPostImplCopyWith<$Res> implements $SnPostCopyWith<$Res> {
DateTime? pinnedAt,
DateTime? lockedAt,
bool isDraft,
DateTime publishedAt,
DateTime? publishedAt,
dynamic publishedUntil,
int totalUpvote,
int totalDownvote,
@ -423,7 +423,7 @@ class __$$SnPostImplCopyWithImpl<$Res>
Object? pinnedAt = freezed,
Object? lockedAt = freezed,
Object? isDraft = null,
Object? publishedAt = null,
Object? publishedAt = freezed,
Object? publishedUntil = freezed,
Object? totalUpvote = null,
Object? totalDownvote = null,
@ -531,10 +531,10 @@ class __$$SnPostImplCopyWithImpl<$Res>
? _value.isDraft
: isDraft // ignore: cast_nullable_to_non_nullable
as bool,
publishedAt: null == publishedAt
publishedAt: freezed == publishedAt
? _value.publishedAt
: publishedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
as DateTime?,
publishedUntil: freezed == publishedUntil
? _value.publishedUntil
: publishedUntil // ignore: cast_nullable_to_non_nullable
@ -688,7 +688,7 @@ class _$SnPostImpl extends _SnPost {
@override
final bool isDraft;
@override
final DateTime publishedAt;
final DateTime? publishedAt;
@override
final dynamic publishedUntil;
@override
@ -854,7 +854,7 @@ abstract class _SnPost extends SnPost {
required final DateTime? pinnedAt,
required final DateTime? lockedAt,
required final bool isDraft,
required final DateTime publishedAt,
required final DateTime? publishedAt,
required final dynamic publishedUntil,
required final int totalUpvote,
required final int totalDownvote,
@ -917,7 +917,7 @@ abstract class _SnPost extends SnPost {
@override
bool get isDraft;
@override
DateTime get publishedAt;
DateTime? get publishedAt;
@override
dynamic get publishedUntil;
@override

View File

@ -39,7 +39,9 @@ _$SnPostImpl _$$SnPostImplFromJson(Map<String, dynamic> json) => _$SnPostImpl(
? null
: DateTime.parse(json['locked_at'] as String),
isDraft: json['is_draft'] as bool,
publishedAt: DateTime.parse(json['published_at'] as String),
publishedAt: json['published_at'] == null
? null
: DateTime.parse(json['published_at'] as String),
publishedUntil: json['published_until'],
totalUpvote: (json['total_upvote'] as num).toInt(),
totalDownvote: (json['total_downvote'] as num).toInt(),
@ -80,7 +82,7 @@ Map<String, dynamic> _$$SnPostImplToJson(_$SnPostImpl instance) =>
'pinned_at': instance.pinnedAt?.toIso8601String(),
'locked_at': instance.lockedAt?.toIso8601String(),
'is_draft': instance.isDraft,
'published_at': instance.publishedAt.toIso8601String(),
'published_at': instance.publishedAt?.toIso8601String(),
'published_until': instance.publishedUntil,
'total_upvote': instance.totalUpvote,
'total_downvote': instance.totalDownvote,