diff --git a/api/lib/models/event/item/database.dart b/api/lib/models/event/item/database.dart index 221a9f4a3bd..9b1bbd98015 100644 --- a/api/lib/models/event/item/database.dart +++ b/api/lib/models/event/item/database.dart @@ -24,6 +24,8 @@ class CalendarItemDatabaseService extends CalendarItemService description TEXT NOT NULL DEFAULT '', location VARCHAR(100) NOT NULL DEFAULT '', eventId BLOB(16), + groupId BLOB(16), + placeId BLOB(16), start INTEGER, end INTEGER, status VARCHAR(20) NOT NULL DEFAULT 'confirmed', @@ -42,7 +44,14 @@ class CalendarItemDatabaseService extends CalendarItemService } @override - FutureOr migrate(Database db, int version) {} + Future migrate(Database db, int version) async { + if (version < 3) { + await db.transaction((txn) async { + await txn.execute("ALTER TABLE calendarItems ADD groupId BLOB(16)"); + await txn.execute("ALTER TABLE calendarItems ADD placeId BLOB(16)"); + }); + } + } @override Future>> getCalendarItems( diff --git a/api/lib/models/event/item/model.dart b/api/lib/models/event/item/model.dart index 7847f774859..9b262036e7c 100644 --- a/api/lib/models/event/item/model.dart +++ b/api/lib/models/event/item/model.dart @@ -19,6 +19,7 @@ class CalendarItem with _$CalendarItem implements DescriptiveModel { @Default('') String name, @Default('') String description, @Default('') String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, @Default(EventStatus.confirmed) EventStatus status, @@ -31,6 +32,7 @@ class CalendarItem with _$CalendarItem implements DescriptiveModel { @Default('') String name, @Default('') String description, @Default('') String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, @Default(EventStatus.confirmed) EventStatus status, @@ -49,6 +51,7 @@ class CalendarItem with _$CalendarItem implements DescriptiveModel { @Default('') String name, @Default('') String description, @Default('') String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, @Default(EventStatus.confirmed) EventStatus status, diff --git a/api/lib/models/event/item/model.freezed.dart b/api/lib/models/event/item/model.freezed.dart index 95d08462ff2..71f6f57c35f 100644 --- a/api/lib/models/event/item/model.freezed.dart +++ b/api/lib/models/event/item/model.freezed.dart @@ -37,6 +37,8 @@ mixin _$CalendarItem { String get description => throw _privateConstructorUsedError; String get location => throw _privateConstructorUsedError; @MultihashConverter() + Multihash? get groupId => throw _privateConstructorUsedError; + @MultihashConverter() Multihash? get placeId => throw _privateConstructorUsedError; @MultihashConverter() Multihash? get eventId => throw _privateConstructorUsedError; @@ -52,6 +54,7 @@ mixin _$CalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -63,6 +66,7 @@ mixin _$CalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -80,6 +84,7 @@ mixin _$CalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -98,6 +103,7 @@ mixin _$CalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -109,6 +115,7 @@ mixin _$CalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -126,6 +133,7 @@ mixin _$CalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -144,6 +152,7 @@ mixin _$CalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -155,6 +164,7 @@ mixin _$CalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -172,6 +182,7 @@ mixin _$CalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -223,6 +234,7 @@ abstract class $CalendarItemCopyWith<$Res> { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -247,6 +259,7 @@ class _$CalendarItemCopyWithImpl<$Res, $Val extends CalendarItem> Object? name = null, Object? description = null, Object? location = null, + Object? groupId = freezed, Object? placeId = freezed, Object? eventId = freezed, Object? status = null, @@ -270,6 +283,10 @@ class _$CalendarItemCopyWithImpl<$Res, $Val extends CalendarItem> ? _value.location : location // ignore: cast_nullable_to_non_nullable as String, + groupId: freezed == groupId + ? _value.groupId + : groupId // ignore: cast_nullable_to_non_nullable + as Multihash?, placeId: freezed == placeId ? _value.placeId : placeId // ignore: cast_nullable_to_non_nullable @@ -307,6 +324,7 @@ abstract class _$$FixedCalendarItemImplCopyWith<$Res> String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -329,6 +347,7 @@ class __$$FixedCalendarItemImplCopyWithImpl<$Res> Object? name = null, Object? description = null, Object? location = null, + Object? groupId = freezed, Object? placeId = freezed, Object? eventId = freezed, Object? status = null, @@ -352,6 +371,10 @@ class __$$FixedCalendarItemImplCopyWithImpl<$Res> ? _value.location : location // ignore: cast_nullable_to_non_nullable as String, + groupId: freezed == groupId + ? _value.groupId + : groupId // ignore: cast_nullable_to_non_nullable + as Multihash?, placeId: freezed == placeId ? _value.placeId : placeId // ignore: cast_nullable_to_non_nullable @@ -384,6 +407,7 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { this.name = '', this.description = '', this.location = '', + @MultihashConverter() this.groupId, @MultihashConverter() this.placeId, @MultihashConverter() this.eventId, this.status = EventStatus.confirmed, @@ -410,6 +434,9 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { final String location; @override @MultihashConverter() + final Multihash? groupId; + @override + @MultihashConverter() final Multihash? placeId; @override @MultihashConverter() @@ -429,7 +456,7 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { @override String toString() { - return 'CalendarItem.fixed(id: $id, name: $name, description: $description, location: $location, placeId: $placeId, eventId: $eventId, status: $status, start: $start, end: $end)'; + return 'CalendarItem.fixed(id: $id, name: $name, description: $description, location: $location, groupId: $groupId, placeId: $placeId, eventId: $eventId, status: $status, start: $start, end: $end)'; } @override @@ -443,6 +470,7 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { other.description == description) && (identical(other.location, location) || other.location == location) && + (identical(other.groupId, groupId) || other.groupId == groupId) && (identical(other.placeId, placeId) || other.placeId == placeId) && (identical(other.eventId, eventId) || other.eventId == eventId) && (identical(other.status, status) || other.status == status) && @@ -453,7 +481,7 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { @JsonKey(ignore: true) @override int get hashCode => Object.hash(runtimeType, id, name, description, location, - placeId, eventId, status, start, end); + groupId, placeId, eventId, status, start, end); @JsonKey(ignore: true) @override @@ -470,6 +498,7 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -481,6 +510,7 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -498,6 +528,7 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -508,8 +539,8 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { int autoDuration) auto, }) { - return fixed( - id, name, description, location, placeId, eventId, status, start, end); + return fixed(id, name, description, location, groupId, placeId, eventId, + status, start, end); } @override @@ -520,6 +551,7 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -531,6 +563,7 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -548,6 +581,7 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -558,8 +592,8 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { int autoDuration)? auto, }) { - return fixed?.call( - id, name, description, location, placeId, eventId, status, start, end); + return fixed?.call(id, name, description, location, groupId, placeId, + eventId, status, start, end); } @override @@ -570,6 +604,7 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -581,6 +616,7 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -598,6 +634,7 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -610,8 +647,8 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { required TResult orElse(), }) { if (fixed != null) { - return fixed(id, name, description, location, placeId, eventId, status, - start, end); + return fixed(id, name, description, location, groupId, placeId, eventId, + status, start, end); } return orElse(); } @@ -664,6 +701,7 @@ abstract class FixedCalendarItem extends CalendarItem { final String name, final String description, final String location, + @MultihashConverter() final Multihash? groupId, @MultihashConverter() final Multihash? placeId, @MultihashConverter() final Multihash? eventId, final EventStatus status, @@ -685,6 +723,9 @@ abstract class FixedCalendarItem extends CalendarItem { String get location; @override @MultihashConverter() + Multihash? get groupId; + @override + @MultihashConverter() Multihash? get placeId; @override @MultihashConverter() @@ -717,6 +758,7 @@ abstract class _$$RepeatingCalendarItemImplCopyWith<$Res> String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -745,6 +787,7 @@ class __$$RepeatingCalendarItemImplCopyWithImpl<$Res> Object? name = null, Object? description = null, Object? location = null, + Object? groupId = freezed, Object? placeId = freezed, Object? eventId = freezed, Object? status = null, @@ -774,6 +817,10 @@ class __$$RepeatingCalendarItemImplCopyWithImpl<$Res> ? _value.location : location // ignore: cast_nullable_to_non_nullable as String, + groupId: freezed == groupId + ? _value.groupId + : groupId // ignore: cast_nullable_to_non_nullable + as Multihash?, placeId: freezed == placeId ? _value.placeId : placeId // ignore: cast_nullable_to_non_nullable @@ -830,6 +877,7 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { this.name = '', this.description = '', this.location = '', + @MultihashConverter() this.groupId, @MultihashConverter() this.placeId, @MultihashConverter() this.eventId, this.status = EventStatus.confirmed, @@ -863,6 +911,9 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { final String location; @override @MultihashConverter() + final Multihash? groupId; + @override + @MultihashConverter() final Multihash? placeId; @override @MultihashConverter() @@ -905,7 +956,7 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { @override String toString() { - return 'CalendarItem.repeating(id: $id, name: $name, description: $description, location: $location, placeId: $placeId, eventId: $eventId, status: $status, start: $start, end: $end, repeatType: $repeatType, interval: $interval, variation: $variation, count: $count, until: $until, exceptions: $exceptions)'; + return 'CalendarItem.repeating(id: $id, name: $name, description: $description, location: $location, groupId: $groupId, placeId: $placeId, eventId: $eventId, status: $status, start: $start, end: $end, repeatType: $repeatType, interval: $interval, variation: $variation, count: $count, until: $until, exceptions: $exceptions)'; } @override @@ -919,6 +970,7 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { other.description == description) && (identical(other.location, location) || other.location == location) && + (identical(other.groupId, groupId) || other.groupId == groupId) && (identical(other.placeId, placeId) || other.placeId == placeId) && (identical(other.eventId, eventId) || other.eventId == eventId) && (identical(other.status, status) || other.status == status) && @@ -944,6 +996,7 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { name, description, location, + groupId, placeId, eventId, status, @@ -971,6 +1024,7 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -982,6 +1036,7 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -999,6 +1054,7 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1009,8 +1065,23 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { int autoDuration) auto, }) { - return repeating(id, name, description, location, placeId, eventId, status, - start, end, repeatType, interval, variation, count, until, exceptions); + return repeating( + id, + name, + description, + location, + groupId, + placeId, + eventId, + status, + start, + end, + repeatType, + interval, + variation, + count, + until, + exceptions); } @override @@ -1021,6 +1092,7 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1032,6 +1104,7 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1049,6 +1122,7 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1064,6 +1138,7 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { name, description, location, + groupId, placeId, eventId, status, @@ -1085,6 +1160,7 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1096,6 +1172,7 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1113,6 +1190,7 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1130,6 +1208,7 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { name, description, location, + groupId, placeId, eventId, status, @@ -1193,6 +1272,7 @@ abstract class RepeatingCalendarItem extends CalendarItem { final String name, final String description, final String location, + @MultihashConverter() final Multihash? groupId, @MultihashConverter() final Multihash? placeId, @MultihashConverter() final Multihash? eventId, final EventStatus status, @@ -1220,6 +1300,9 @@ abstract class RepeatingCalendarItem extends CalendarItem { String get location; @override @MultihashConverter() + Multihash? get groupId; + @override + @MultihashConverter() Multihash? get placeId; @override @MultihashConverter() @@ -1258,6 +1341,7 @@ abstract class _$$AutoCalendarItemImplCopyWith<$Res> String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1283,6 +1367,7 @@ class __$$AutoCalendarItemImplCopyWithImpl<$Res> Object? name = null, Object? description = null, Object? location = null, + Object? groupId = freezed, Object? placeId = freezed, Object? eventId = freezed, Object? status = null, @@ -1309,6 +1394,10 @@ class __$$AutoCalendarItemImplCopyWithImpl<$Res> ? _value.location : location // ignore: cast_nullable_to_non_nullable as String, + groupId: freezed == groupId + ? _value.groupId + : groupId // ignore: cast_nullable_to_non_nullable + as Multihash?, placeId: freezed == placeId ? _value.placeId : placeId // ignore: cast_nullable_to_non_nullable @@ -1353,6 +1442,7 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { this.name = '', this.description = '', this.location = '', + @MultihashConverter() this.groupId, @MultihashConverter() this.placeId, @MultihashConverter() this.eventId, this.status = EventStatus.confirmed, @@ -1382,6 +1472,9 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { final String location; @override @MultihashConverter() + final Multihash? groupId; + @override + @MultihashConverter() final Multihash? placeId; @override @MultihashConverter() @@ -1410,7 +1503,7 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { @override String toString() { - return 'CalendarItem.auto(id: $id, name: $name, description: $description, location: $location, placeId: $placeId, eventId: $eventId, status: $status, start: $start, end: $end, autoGroupId: $autoGroupId, searchStart: $searchStart, autoDuration: $autoDuration)'; + return 'CalendarItem.auto(id: $id, name: $name, description: $description, location: $location, groupId: $groupId, placeId: $placeId, eventId: $eventId, status: $status, start: $start, end: $end, autoGroupId: $autoGroupId, searchStart: $searchStart, autoDuration: $autoDuration)'; } @override @@ -1424,6 +1517,7 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { other.description == description) && (identical(other.location, location) || other.location == location) && + (identical(other.groupId, groupId) || other.groupId == groupId) && (identical(other.placeId, placeId) || other.placeId == placeId) && (identical(other.eventId, eventId) || other.eventId == eventId) && (identical(other.status, status) || other.status == status) && @@ -1445,6 +1539,7 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { name, description, location, + groupId, placeId, eventId, status, @@ -1469,6 +1564,7 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1480,6 +1576,7 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1497,6 +1594,7 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1507,8 +1605,8 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { int autoDuration) auto, }) { - return auto(id, name, description, location, placeId, eventId, status, - start, end, autoGroupId, searchStart, autoDuration); + return auto(id, name, description, location, groupId, placeId, eventId, + status, start, end, autoGroupId, searchStart, autoDuration); } @override @@ -1519,6 +1617,7 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1530,6 +1629,7 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1547,6 +1647,7 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1557,8 +1658,8 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { int autoDuration)? auto, }) { - return auto?.call(id, name, description, location, placeId, eventId, status, - start, end, autoGroupId, searchStart, autoDuration); + return auto?.call(id, name, description, location, groupId, placeId, + eventId, status, start, end, autoGroupId, searchStart, autoDuration); } @override @@ -1569,6 +1670,7 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1580,6 +1682,7 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1597,6 +1700,7 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { String name, String description, String location, + @MultihashConverter() Multihash? groupId, @MultihashConverter() Multihash? placeId, @MultihashConverter() Multihash? eventId, EventStatus status, @@ -1609,8 +1713,8 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { required TResult orElse(), }) { if (auto != null) { - return auto(id, name, description, location, placeId, eventId, status, - start, end, autoGroupId, searchStart, autoDuration); + return auto(id, name, description, location, groupId, placeId, eventId, + status, start, end, autoGroupId, searchStart, autoDuration); } return orElse(); } @@ -1663,6 +1767,7 @@ abstract class AutoCalendarItem extends CalendarItem { final String name, final String description, final String location, + @MultihashConverter() final Multihash? groupId, @MultihashConverter() final Multihash? placeId, @MultihashConverter() final Multihash? eventId, final EventStatus status, @@ -1687,6 +1792,9 @@ abstract class AutoCalendarItem extends CalendarItem { String get location; @override @MultihashConverter() + Multihash? get groupId; + @override + @MultihashConverter() Multihash? get placeId; @override @MultihashConverter() diff --git a/api/lib/models/event/item/model.g.dart b/api/lib/models/event/item/model.g.dart index 4fcc6225e42..74096a16a9f 100644 --- a/api/lib/models/event/item/model.g.dart +++ b/api/lib/models/event/item/model.g.dart @@ -14,6 +14,8 @@ _$FixedCalendarItemImpl _$$FixedCalendarItemImplFromJson( name: json['name'] as String? ?? '', description: json['description'] as String? ?? '', location: json['location'] as String? ?? '', + groupId: _$JsonConverterFromJson, Multihash>( + json['groupId'], const MultihashConverter().fromJson), placeId: _$JsonConverterFromJson, Multihash>( json['placeId'], const MultihashConverter().fromJson), eventId: _$JsonConverterFromJson, Multihash>( @@ -34,6 +36,8 @@ Map _$$FixedCalendarItemImplToJson( 'name': instance.name, 'description': instance.description, 'location': instance.location, + 'groupId': _$JsonConverterToJson, Multihash>( + instance.groupId, const MultihashConverter().toJson), 'placeId': _$JsonConverterToJson, Multihash>( instance.placeId, const MultihashConverter().toJson), 'eventId': _$JsonConverterToJson, Multihash>( @@ -70,6 +74,8 @@ _$RepeatingCalendarItemImpl _$$RepeatingCalendarItemImplFromJson( name: json['name'] as String? ?? '', description: json['description'] as String? ?? '', location: json['location'] as String? ?? '', + groupId: _$JsonConverterFromJson, Multihash>( + json['groupId'], const MultihashConverter().fromJson), placeId: _$JsonConverterFromJson, Multihash>( json['placeId'], const MultihashConverter().fromJson), eventId: _$JsonConverterFromJson, Multihash>( @@ -102,6 +108,8 @@ Map _$$RepeatingCalendarItemImplToJson( 'name': instance.name, 'description': instance.description, 'location': instance.location, + 'groupId': _$JsonConverterToJson, Multihash>( + instance.groupId, const MultihashConverter().toJson), 'placeId': _$JsonConverterToJson, Multihash>( instance.placeId, const MultihashConverter().toJson), 'eventId': _$JsonConverterToJson, Multihash>( @@ -133,6 +141,8 @@ _$AutoCalendarItemImpl _$$AutoCalendarItemImplFromJson( name: json['name'] as String? ?? '', description: json['description'] as String? ?? '', location: json['location'] as String? ?? '', + groupId: _$JsonConverterFromJson, Multihash>( + json['groupId'], const MultihashConverter().fromJson), placeId: _$JsonConverterFromJson, Multihash>( json['placeId'], const MultihashConverter().fromJson), eventId: _$JsonConverterFromJson, Multihash>( @@ -158,6 +168,8 @@ Map _$$AutoCalendarItemImplToJson( 'name': instance.name, 'description': instance.description, 'location': instance.location, + 'groupId': _$JsonConverterToJson, Multihash>( + instance.groupId, const MultihashConverter().toJson), 'placeId': _$JsonConverterToJson, Multihash>( instance.placeId, const MultihashConverter().toJson), 'eventId': _$JsonConverterToJson, Multihash>( diff --git a/api/lib/models/note/database.dart b/api/lib/models/note/database.dart index ca73118f441..8899b0c9fd1 100644 --- a/api/lib/models/note/database.dart +++ b/api/lib/models/note/database.dart @@ -128,11 +128,19 @@ class NoteDatabaseService extends NoteService with TableService { description TEXT, status VARCHAR(20), priority INTEGER NOT NULL DEFAULT 0, + notebookId BLOB(16), parentId BLOB(16) ) """); } + @override + Future migrate(Database db, int version) async { + if (version < 3) { + await db.execute("ALTER TABLE notes ADD notebookId BLOB(16)"); + } + } + @override Future createNote(Note note) async { final id = note.id ?? createUniqueMultihash(); @@ -201,9 +209,6 @@ class NoteDatabaseService extends NoteService with TableService { return result?.map((row) => Note.fromDatabase(row)).toList() ?? []; } - @override - FutureOr migrate(Database db, int version) {} - @override FutureOr updateNote(Note note) async { return await db?.update( diff --git a/api/lib/services/database.dart b/api/lib/services/database.dart index 47117cff45a..657bb68efd0 100644 --- a/api/lib/services/database.dart +++ b/api/lib/services/database.dart @@ -25,7 +25,7 @@ typedef DatabaseFactory = Future Function({ FutureOr Function(Database, int)? onCreate, }); -const databaseVersion = 2; +const databaseVersion = 3; class DatabaseService extends SourceService { late final Database db; diff --git a/app/lib/pages/calendar/item.dart b/app/lib/pages/calendar/item.dart index 55391cccd89..4d735ad2bc3 100644 --- a/app/lib/pages/calendar/item.dart +++ b/app/lib/pages/calendar/item.dart @@ -1,5 +1,6 @@ import 'package:flow/cubits/flow.dart'; import 'package:flow/helpers/event.dart'; +import 'package:flow/pages/groups/select.dart'; import 'package:flow/pages/places/select.dart'; import 'package:flow/widgets/markdown_field.dart'; import 'package:flutter/material.dart'; @@ -199,6 +200,8 @@ class _CalendarItemDialogState extends State { _source = connected?.source ?? ''; _item = _item.copyWith( eventId: null, + groupId: null, + placeId: null, ); _service = connected?.model; }, @@ -260,6 +263,13 @@ class _CalendarItemDialogState extends State { value: _item.description, ), const SizedBox(height: 16), + GroupSelectTile( + source: _source, + value: _item.groupId, + onChanged: (value) { + _item = _item.copyWith(groupId: value); + }, + ), PlaceSelectTile( source: _source, value: _item.placeId,