Skip to content

Commit

Permalink
Use ID Generator
Browse files Browse the repository at this point in the history
  • Loading branch information
bannzai committed Nov 28, 2022
1 parent a584b17 commit 65181d2
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 83 deletions.
5 changes: 4 additions & 1 deletion lib/entity/pill_sheet.codegen.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'package:pilll/entity/firestore_id_generator.dart';
import 'package:pilll/utils/datetime/date_range.dart';
import 'package:pilll/entity/firestore_timestamp_converter.dart';
import 'package:pilll/entity/pill_sheet_type.dart';
import 'package:pilll/utils/datetime/date_compare.dart';
import 'package:pilll/utils/datetime/day.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:uuid/uuid.dart';
part 'pill_sheet.codegen.g.dart';
part 'pill_sheet.codegen.freezed.dart';

Expand Down Expand Up @@ -63,7 +65,8 @@ class PillSheet with _$PillSheet {
@JsonSerializable(explicitToJson: true)
const factory PillSheet({
@JsonKey(includeIfNull: false)
required String? id,
@Default(IDDefault)
String id,
@JsonKey()
required PillSheetTypeInfo typeInfo,
@JsonKey(
Expand Down
26 changes: 13 additions & 13 deletions lib/entity/pill_sheet.codegen.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ PillSheet _$PillSheetFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$PillSheet {
@JsonKey(includeIfNull: false)
String? get id => throw _privateConstructorUsedError;
String get id => throw _privateConstructorUsedError;
@JsonKey()
PillSheetTypeInfo get typeInfo => throw _privateConstructorUsedError;
@JsonKey(
Expand Down Expand Up @@ -486,7 +486,7 @@ abstract class $PillSheetCopyWith<$Res> {
@useResult
$Res call(
{@JsonKey(includeIfNull: false)
String? id,
String id,
@JsonKey()
PillSheetTypeInfo typeInfo,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp)
Expand Down Expand Up @@ -516,7 +516,7 @@ class _$PillSheetCopyWithImpl<$Res, $Val extends PillSheet>
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? id = null,
Object? typeInfo = null,
Object? beginingDate = null,
Object? lastTakenDate = freezed,
Expand All @@ -526,10 +526,10 @@ class _$PillSheetCopyWithImpl<$Res, $Val extends PillSheet>
Object? restDurations = null,
}) {
return _then(_value.copyWith(
id: freezed == id
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
as String,
typeInfo: null == typeInfo
? _value.typeInfo
: typeInfo // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -579,7 +579,7 @@ abstract class _$$_PillSheetCopyWith<$Res> implements $PillSheetCopyWith<$Res> {
@useResult
$Res call(
{@JsonKey(includeIfNull: false)
String? id,
String id,
@JsonKey()
PillSheetTypeInfo typeInfo,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp)
Expand Down Expand Up @@ -608,7 +608,7 @@ class __$$_PillSheetCopyWithImpl<$Res>
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? id = null,
Object? typeInfo = null,
Object? beginingDate = null,
Object? lastTakenDate = freezed,
Expand All @@ -618,10 +618,10 @@ class __$$_PillSheetCopyWithImpl<$Res>
Object? restDurations = null,
}) {
return _then(_$_PillSheet(
id: freezed == id
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
as String,
typeInfo: null == typeInfo
? _value.typeInfo
: typeInfo // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -660,7 +660,7 @@ class __$$_PillSheetCopyWithImpl<$Res>
class _$_PillSheet extends _PillSheet {
const _$_PillSheet(
{@JsonKey(includeIfNull: false)
this.id,
this.id = IDDefault,
@JsonKey()
required this.typeInfo,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp)
Expand All @@ -681,7 +681,7 @@ class _$_PillSheet extends _PillSheet {

@override
@JsonKey(includeIfNull: false)
final String? id;
final String id;
@override
@JsonKey()
final PillSheetTypeInfo typeInfo;
Expand Down Expand Up @@ -773,7 +773,7 @@ class _$_PillSheet extends _PillSheet {
abstract class _PillSheet extends PillSheet {
const factory _PillSheet(
{@JsonKey(includeIfNull: false)
final String? id,
final String id,
@JsonKey()
required final PillSheetTypeInfo typeInfo,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp)
Expand All @@ -793,7 +793,7 @@ abstract class _PillSheet extends PillSheet {

@override
@JsonKey(includeIfNull: false)
String? get id;
String get id;
@override
@JsonKey()
PillSheetTypeInfo get typeInfo;
Expand Down
36 changes: 14 additions & 22 deletions lib/entity/pill_sheet.codegen.g.dart

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

84 changes: 37 additions & 47 deletions test/helper/mock.mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,43 +117,52 @@ class MockAnalytics extends _i1.Mock implements _i16.Analytics {
}

@override
dynamic logEvent({
void logEvent({
String? name,
Map<String, dynamic>? parameters,
}) =>
super.noSuchMethod(Invocation.method(
#logEvent,
[],
{
#name: name,
#parameters: parameters,
},
));
@override
dynamic setCurrentScreen({
super.noSuchMethod(
Invocation.method(
#logEvent,
[],
{
#name: name,
#parameters: parameters,
},
),
returnValueForMissingStub: null,
);
@override
void setCurrentScreen({
String? screenName,
String? screenClassOverride = r'Flutter',
}) =>
super.noSuchMethod(Invocation.method(
#setCurrentScreen,
[],
{
#screenName: screenName,
#screenClassOverride: screenClassOverride,
},
));
@override
dynamic setUserProperties(
super.noSuchMethod(
Invocation.method(
#setCurrentScreen,
[],
{
#screenName: screenName,
#screenClassOverride: screenClassOverride,
},
),
returnValueForMissingStub: null,
);
@override
void setUserProperties(
String? name,
dynamic value,
) =>
super.noSuchMethod(Invocation.method(
#setUserProperties,
[
name,
value,
],
));
super.noSuchMethod(
Invocation.method(
#setUserProperties,
[
name,
value,
],
),
returnValueForMissingStub: null,
);
}

/// A class which mocks [BatchFactory].
Expand Down Expand Up @@ -648,25 +657,6 @@ class MockDatabaseConnection extends _i1.Mock
returnValue: _FakeDocumentReference_8<_i23.DiarySetting>(),
) as _i3.DocumentReference<_i23.DiarySetting>);
@override
_i3.CollectionReference<_i19.PillSheet> pillSheetsReference() =>
(super.noSuchMethod(
Invocation.method(
#pillSheetsReference,
[],
),
returnValue: _FakeCollectionReference_9<_i19.PillSheet>(),
) as _i3.CollectionReference<_i19.PillSheet>);
@override
_i3.DocumentReference<_i19.PillSheet> pillSheetReference(
String? pillSheetID) =>
(super.noSuchMethod(
Invocation.method(
#pillSheetReference,
[pillSheetID],
),
returnValue: _FakeDocumentReference_8<_i19.PillSheet>(),
) as _i3.DocumentReference<_i19.PillSheet>);
@override
_i3.CollectionReference<_i24.Diary> diariesReference() => (super.noSuchMethod(
Invocation.method(
#diariesReference,
Expand Down

0 comments on commit 65181d2

Please sign in to comment.