From 9242a25dea3cc090cb34eae66906343a4e7fbfd5 Mon Sep 17 00:00:00 2001 From: CodeDoctorDE Date: Mon, 11 Nov 2024 09:31:11 +0100 Subject: [PATCH] Fix ci, upgrade dependencies --- api/lib/converters/ical.dart | 4 +- api/lib/helpers/converter.dart | 15 - api/lib/models/event/database.dart | 28 +- api/lib/models/event/item/database.dart | 36 +- api/lib/models/event/item/model.dart | 29 +- api/lib/models/event/item/model.freezed.dart | 552 +++++++++---------- api/lib/models/event/item/model.g.dart | 104 ++-- api/lib/models/event/item/service.dart | 12 +- api/lib/models/event/model.dart | 10 +- api/lib/models/event/model.freezed.dart | 96 ++-- api/lib/models/event/model.g.dart | 32 +- api/lib/models/event/service.dart | 10 +- api/lib/models/group/database.dart | 14 +- api/lib/models/group/model.dart | 6 +- api/lib/models/group/model.freezed.dart | 48 +- api/lib/models/group/model.g.dart | 16 +- api/lib/models/group/service.dart | 6 +- api/lib/models/label/database.dart | 14 +- api/lib/models/label/model.dart | 4 +- api/lib/models/label/model.freezed.dart | 24 +- api/lib/models/label/model.g.dart | 8 +- api/lib/models/label/service.dart | 6 +- api/lib/models/model.dart | 10 +- api/lib/models/note/database.dart | 70 ++- api/lib/models/note/label.dart | 24 +- api/lib/models/note/model.dart | 10 +- api/lib/models/note/model.freezed.dart | 96 ++-- api/lib/models/note/model.g.dart | 32 +- api/lib/models/note/service.dart | 26 +- api/lib/models/place/database.dart | 14 +- api/lib/models/place/model.dart | 4 +- api/lib/models/place/model.freezed.dart | 24 +- api/lib/models/place/model.g.dart | 8 +- api/lib/models/place/service.dart | 6 +- api/lib/models/user/database.dart | 16 +- api/lib/models/user/model.dart | 5 +- api/lib/models/user/model.freezed.dart | 48 +- api/lib/models/user/model.g.dart | 16 +- api/lib/models/user/service.dart | 6 +- api/lib/services/database.dart | 19 +- api/pubspec.lock | 70 +-- api/pubspec.yaml | 4 +- app/android/Gemfile.lock | 12 +- app/lib/api/storage/remote/caldav.dart | 10 +- app/lib/api/storage/remote/ical.dart | 2 +- app/lib/main.dart | 9 +- app/lib/pages/calendar/day.dart | 4 +- app/lib/pages/calendar/filter.dart | 12 +- app/lib/pages/calendar/filter.freezed.dart | 48 +- app/lib/pages/calendar/month.dart | 4 +- app/lib/pages/calendar/page.dart | 6 +- app/lib/pages/events/filter.dart | 6 +- app/lib/pages/events/filter.freezed.dart | 28 +- app/lib/pages/events/select.dart | 8 +- app/lib/pages/groups/select.dart | 8 +- app/lib/pages/notes/filter.dart | 6 +- app/lib/pages/notes/filter.freezed.dart | 32 +- app/lib/pages/notes/navigator/drawer.dart | 4 +- app/lib/pages/notes/navigator/notebooks.dart | 6 +- app/lib/pages/notes/page.dart | 12 +- app/lib/pages/notes/select.dart | 8 +- app/lib/pages/notes/tile.dart | 4 +- app/lib/pages/places/select.dart | 8 +- app/lib/pages/users/filter.dart | 4 +- app/lib/pages/users/filter.freezed.dart | 16 +- app/lib/widgets/select.dart | 14 +- app/pubspec.lock | 64 +-- app/pubspec.yaml | 1 - docs/package.json | 2 +- docs/pnpm-lock.yaml | 388 ++++++------- docs/src/content/docs/ar/index.mdx | 2 +- docs/src/content/docs/cs/index.mdx | 2 +- docs/src/content/docs/da/index.mdx | 2 +- docs/src/content/docs/de/index.mdx | 2 +- docs/src/content/docs/el/index.mdx | 2 +- docs/src/content/docs/es/index.mdx | 2 +- docs/src/content/docs/fi/index.mdx | 2 +- docs/src/content/docs/it/index.mdx | 2 +- docs/src/content/docs/ja/index.mdx | 2 +- docs/src/content/docs/no/index.mdx | 2 +- docs/src/content/docs/pl/index.mdx | 2 +- docs/src/content/docs/pt-br/index.mdx | 2 +- docs/src/content/docs/pt/index.mdx | 2 +- docs/src/content/docs/ru/index.mdx | 2 +- docs/src/content/docs/sv/index.mdx | 2 +- docs/src/content/docs/tr/index.mdx | 2 +- docs/src/content/docs/uk/index.mdx | 2 +- docs/src/content/docs/vi/index.mdx | 2 +- docs/src/content/docs/zh-hant/index.mdx | 2 +- docs/src/content/docs/zh/index.mdx | 2 +- 90 files changed, 1138 insertions(+), 1210 deletions(-) diff --git a/api/lib/converters/ical.dart b/api/lib/converters/ical.dart index 48df23dd5f2..7d55df04033 100644 --- a/api/lib/converters/ical.dart +++ b/api/lib/converters/ical.dart @@ -18,8 +18,8 @@ class ICalConverter { CalendarItem? currentItem; Note? currentNote; final items = List.from(data?.items ?? []); - var currentEvent = event ?? Event(id: createUniqueMultihash()); - var currentNotebook = notebook ?? Notebook(id: createUniqueMultihash()); + var currentEvent = event ?? Event(id: createUniqueUint8List()); + var currentNotebook = notebook ?? Notebook(id: createUniqueUint8List()); final notes = List.from(data?.notes ?? []); for (int i = offset; i < lines.length; i++) { final line = lines[i]; diff --git a/api/lib/helpers/converter.dart b/api/lib/helpers/converter.dart index f64cb3b5d44..ddcd8fd1490 100644 --- a/api/lib/helpers/converter.dart +++ b/api/lib/helpers/converter.dart @@ -2,7 +2,6 @@ import 'dart:typed_data'; import 'package:dart_leap/dart_leap.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:lib5/lib5.dart'; class DateTimeConverter extends JsonConverter { const DateTimeConverter(); @@ -32,17 +31,3 @@ class Uint8ListConverter extends JsonConverter> { return object.toList(); } } - -class MultihashConverter extends JsonConverter> { - const MultihashConverter(); - - @override - Multihash fromJson(List json) { - return Multihash(Uint8List.fromList(json)); - } - - @override - List toJson(Multihash object) { - return object.fullBytes; - } -} diff --git a/api/lib/models/event/database.dart b/api/lib/models/event/database.dart index f75d6b15637..54557d12f21 100644 --- a/api/lib/models/event/database.dart +++ b/api/lib/models/event/database.dart @@ -1,7 +1,7 @@ import 'dart:async'; +import 'dart:typed_data'; import 'package:collection/collection.dart'; -import 'package:lib5/lib5.dart'; import 'package:flow_api/services/database.dart'; import 'package:sqflite_common/sqlite_api.dart'; @@ -36,7 +36,7 @@ class EventDatabaseService extends EventService with TableService { @override Future createEvent(Event event) async { - final id = event.id ?? createUniqueMultihash(); + final id = event.id ?? createUniqueUint8List(); event = event.copyWith(id: id); final row = await db?.insert('events', event.toDatabase()); if (row == null) return null; @@ -44,26 +44,24 @@ class EventDatabaseService extends EventService with TableService { } @override - Future deleteEvent(Multihash id) async { - return await db - ?.delete('events', where: 'id = ?', whereArgs: [id.fullBytes]) == - 1; + Future deleteEvent(Uint8List id) async { + return await db?.delete('events', where: 'id = ?', whereArgs: [id]) == 1; } @override - Future getEvent(Multihash id) async { + Future getEvent(Uint8List id) async { final result = await db?.query( 'events', where: 'id = ?', - whereArgs: [id.fullBytes], + whereArgs: [id], ); return result?.map(Event.fromDatabase).firstOrNull; } @override Future> getEvents( - {Multihash? groupId, - Multihash? placeId, + {Uint8List? groupId, + Uint8List? placeId, int offset = 0, int limit = 50, String search = ''}) async { @@ -75,15 +73,11 @@ class EventDatabaseService extends EventService with TableService { } if (groupId != null) { where = where == null ? 'groupId = ?' : '$where AND groupId = ?'; - whereArgs = whereArgs == null - ? [groupId.fullBytes] - : [...whereArgs, groupId.fullBytes]; + whereArgs = whereArgs == null ? [groupId] : [...whereArgs, groupId]; } if (placeId != null) { where = where == null ? 'placeId = ?' : '$where AND placeId = ?'; - whereArgs = whereArgs == null - ? [placeId.fullBytes] - : [...whereArgs, placeId.fullBytes]; + whereArgs = whereArgs == null ? [placeId] : [...whereArgs, placeId]; } final result = await db?.query( 'events', @@ -105,7 +99,7 @@ class EventDatabaseService extends EventService with TableService { 'events', event.toDatabase()..remove('id'), where: 'id = ?', - whereArgs: [event.id?.fullBytes], + whereArgs: [event.id], ) == 1; } diff --git a/api/lib/models/event/item/database.dart b/api/lib/models/event/item/database.dart index d87d47e15f7..85ace7671ea 100644 --- a/api/lib/models/event/item/database.dart +++ b/api/lib/models/event/item/database.dart @@ -1,6 +1,6 @@ import 'dart:async'; +import 'dart:typed_data'; -import 'package:lib5/lib5.dart'; import 'package:dart_leap/dart_leap.dart'; import 'package:sqflite_common/sqlite_api.dart'; @@ -56,9 +56,9 @@ class CalendarItemDatabaseService extends CalendarItemService @override Future>> getCalendarItems( {List? status, - Multihash? eventId, - Multihash? groupId, - Multihash? placeId, + Uint8List? eventId, + Uint8List? groupId, + Uint8List? placeId, bool pending = false, int offset = 0, int limit = 50, @@ -111,16 +111,16 @@ class CalendarItemDatabaseService extends CalendarItemService if (groupId != null) { final statement = "(groupId = ? OR events.groupId = ?)"; where = where == null ? statement : '$where AND $statement'; - whereArgs = [...?whereArgs, groupId.fullBytes, groupId.fullBytes]; + whereArgs = [...?whereArgs, groupId, groupId]; } if (placeId != null) { final statement = "(placeId = ? OR events.placeId = ?)"; where = where == null ? statement : '$where AND $statement'; - whereArgs = [...?whereArgs, placeId.fullBytes, placeId.fullBytes]; + whereArgs = [...?whereArgs, placeId, placeId]; } if (eventId != null) { where = where == null ? 'eventId = ?' : '$where AND eventId = ?'; - whereArgs = [...?whereArgs, eventId.fullBytes]; + whereArgs = [...?whereArgs, eventId]; } const eventPrefix = "event_"; final result = await db?.query( @@ -156,7 +156,7 @@ class CalendarItemDatabaseService extends CalendarItemService @override Future createCalendarItem(CalendarItem item) async { - final id = item.id ?? createUniqueMultihash(); + final id = item.id ?? createUniqueUint8List(); item = item.copyWith(id: id); final row = await db?.insert('calendarItems', item.toDatabase()); if (row == null) return null; @@ -169,27 +169,27 @@ class CalendarItemDatabaseService extends CalendarItemService 'calendarItems', item.toDatabase(), where: 'id = ?', - whereArgs: [item.id?.fullBytes], + whereArgs: [item.id], ) == 1; } @override - Future deleteCalendarItem(Multihash id) async { + Future deleteCalendarItem(Uint8List id) async { return await db?.delete( 'calendarItems', where: 'id = ?', - whereArgs: [id.fullBytes], + whereArgs: [id], ) == 1; } @override - FutureOr getCalendarItem(Multihash id) async { + FutureOr getCalendarItem(Uint8List id) async { final result = await db?.query( 'calendarItems', where: 'id = ?', - whereArgs: [id.fullBytes], + whereArgs: [id], ); return result?.map(CalendarItem.fromDatabase).first; } @@ -207,15 +207,15 @@ abstract class CalendarItemDatabaseServiceLinker extends CalendarItemService CalendarItemDatabaseServiceLinker(this.service); @override - FutureOr getCalendarItem(Multihash id) => + FutureOr getCalendarItem(Uint8List id) => service.getCalendarItem(id); @override FutureOr>> getCalendarItems({ List? status, - Multihash? eventId, - Multihash? groupId, - Multihash? placeId, + Uint8List? eventId, + Uint8List? groupId, + Uint8List? placeId, bool pending = false, int offset = 0, int limit = 50, @@ -247,7 +247,7 @@ abstract class CalendarItemDatabaseServiceLinker extends CalendarItemService service.updateCalendarItem(item); @override - FutureOr deleteCalendarItem(Multihash id) => + FutureOr deleteCalendarItem(Uint8List id) => service.deleteCalendarItem(id); @override diff --git a/api/lib/models/event/item/model.dart b/api/lib/models/event/item/model.dart index 6e9f2341739..7a788160f11 100644 --- a/api/lib/models/event/item/model.dart +++ b/api/lib/models/event/item/model.dart @@ -1,5 +1,6 @@ +import 'dart:typed_data'; + import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:lib5/lib5.dart'; import '../../../helpers/converter.dart'; import '../../model.dart'; @@ -16,26 +17,26 @@ class CalendarItem const CalendarItem._(); const factory CalendarItem.fixed({ - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, @Default('') String name, @Default('') String description, @Default('') String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, @Default(EventStatus.confirmed) EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, }) = FixedCalendarItem; const factory CalendarItem.repeating({ - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, @Default('') String name, @Default('') String description, @Default('') String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, @Default(EventStatus.confirmed) EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, @@ -48,17 +49,17 @@ class CalendarItem }) = RepeatingCalendarItem; const factory CalendarItem.auto({ - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, @Default('') String name, @Default('') String description, @Default('') String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, @Default(EventStatus.confirmed) EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, - @MultihashConverter() Multihash? autoGroupId, + @Uint8ListConverter() Uint8List? autoGroupId, @DateTimeConverter() DateTime? searchStart, @Default(60) int autoDuration, }) = AutoCalendarItem; diff --git a/api/lib/models/event/item/model.freezed.dart b/api/lib/models/event/item/model.freezed.dart index feb9626d352..679dfb89273 100644 --- a/api/lib/models/event/item/model.freezed.dart +++ b/api/lib/models/event/item/model.freezed.dart @@ -31,17 +31,17 @@ CalendarItem _$CalendarItemFromJson(Map json) { /// @nodoc mixin _$CalendarItem { - @MultihashConverter() - Multihash? get id => throw _privateConstructorUsedError; + @Uint8ListConverter() + Uint8List? get id => throw _privateConstructorUsedError; String get name => throw _privateConstructorUsedError; 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; + @Uint8ListConverter() + Uint8List? get groupId => throw _privateConstructorUsedError; + @Uint8ListConverter() + Uint8List? get placeId => throw _privateConstructorUsedError; + @Uint8ListConverter() + Uint8List? get eventId => throw _privateConstructorUsedError; EventStatus get status => throw _privateConstructorUsedError; @DateTimeConverter() DateTime? get start => throw _privateConstructorUsedError; @@ -50,25 +50,25 @@ mixin _$CalendarItem { @optionalTypeArgs TResult when({ required TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end) fixed, required TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, @@ -80,17 +80,17 @@ mixin _$CalendarItem { List exceptions) repeating, required TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, - @MultihashConverter() Multihash? autoGroupId, + @Uint8ListConverter() Uint8List? autoGroupId, @DateTimeConverter() DateTime? searchStart, int autoDuration) auto, @@ -99,25 +99,25 @@ mixin _$CalendarItem { @optionalTypeArgs TResult? whenOrNull({ TResult? Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end)? fixed, TResult? Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, @@ -129,17 +129,17 @@ mixin _$CalendarItem { List exceptions)? repeating, TResult? Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, - @MultihashConverter() Multihash? autoGroupId, + @Uint8ListConverter() Uint8List? autoGroupId, @DateTimeConverter() DateTime? searchStart, int autoDuration)? auto, @@ -148,25 +148,25 @@ mixin _$CalendarItem { @optionalTypeArgs TResult maybeWhen({ TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end)? fixed, TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, @@ -178,17 +178,17 @@ mixin _$CalendarItem { List exceptions)? repeating, TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, - @MultihashConverter() Multihash? autoGroupId, + @Uint8ListConverter() Uint8List? autoGroupId, @DateTimeConverter() DateTime? searchStart, int autoDuration)? auto, @@ -235,13 +235,13 @@ abstract class $CalendarItemCopyWith<$Res> { _$CalendarItemCopyWithImpl<$Res, CalendarItem>; @useResult $Res call( - {@MultihashConverter() Multihash? id, + {@Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end}); @@ -277,7 +277,7 @@ class _$CalendarItemCopyWithImpl<$Res, $Val extends CalendarItem> id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, name: null == name ? _value.name : name // ignore: cast_nullable_to_non_nullable @@ -293,15 +293,15 @@ class _$CalendarItemCopyWithImpl<$Res, $Val extends CalendarItem> groupId: freezed == groupId ? _value.groupId : groupId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, placeId: freezed == placeId ? _value.placeId : placeId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, eventId: freezed == eventId ? _value.eventId : eventId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, status: null == status ? _value.status : status // ignore: cast_nullable_to_non_nullable @@ -327,13 +327,13 @@ abstract class _$$FixedCalendarItemImplCopyWith<$Res> @override @useResult $Res call( - {@MultihashConverter() Multihash? id, + {@Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end}); @@ -367,7 +367,7 @@ class __$$FixedCalendarItemImplCopyWithImpl<$Res> id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, name: null == name ? _value.name : name // ignore: cast_nullable_to_non_nullable @@ -383,15 +383,15 @@ class __$$FixedCalendarItemImplCopyWithImpl<$Res> groupId: freezed == groupId ? _value.groupId : groupId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, placeId: freezed == placeId ? _value.placeId : placeId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, eventId: freezed == eventId ? _value.eventId : eventId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, status: null == status ? _value.status : status // ignore: cast_nullable_to_non_nullable @@ -412,13 +412,13 @@ class __$$FixedCalendarItemImplCopyWithImpl<$Res> @JsonSerializable() class _$FixedCalendarItemImpl extends FixedCalendarItem { const _$FixedCalendarItemImpl( - {@MultihashConverter() this.id, + {@Uint8ListConverter() this.id, this.name = '', this.description = '', this.location = '', - @MultihashConverter() this.groupId, - @MultihashConverter() this.placeId, - @MultihashConverter() this.eventId, + @Uint8ListConverter() this.groupId, + @Uint8ListConverter() this.placeId, + @Uint8ListConverter() this.eventId, this.status = EventStatus.confirmed, @DateTimeConverter() this.start, @DateTimeConverter() this.end, @@ -430,8 +430,8 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { _$$FixedCalendarItemImplFromJson(json); @override - @MultihashConverter() - final Multihash? id; + @Uint8ListConverter() + final Uint8List? id; @override @JsonKey() final String name; @@ -442,14 +442,14 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { @JsonKey() final String location; @override - @MultihashConverter() - final Multihash? groupId; + @Uint8ListConverter() + final Uint8List? groupId; @override - @MultihashConverter() - final Multihash? placeId; + @Uint8ListConverter() + final Uint8List? placeId; @override - @MultihashConverter() - final Multihash? eventId; + @Uint8ListConverter() + final Uint8List? eventId; @override @JsonKey() final EventStatus status; @@ -505,25 +505,25 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { @optionalTypeArgs TResult when({ required TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end) fixed, required TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, @@ -535,17 +535,17 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { List exceptions) repeating, required TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, - @MultihashConverter() Multihash? autoGroupId, + @Uint8ListConverter() Uint8List? autoGroupId, @DateTimeConverter() DateTime? searchStart, int autoDuration) auto, @@ -558,25 +558,25 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { @optionalTypeArgs TResult? whenOrNull({ TResult? Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end)? fixed, TResult? Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, @@ -588,17 +588,17 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { List exceptions)? repeating, TResult? Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, - @MultihashConverter() Multihash? autoGroupId, + @Uint8ListConverter() Uint8List? autoGroupId, @DateTimeConverter() DateTime? searchStart, int autoDuration)? auto, @@ -611,25 +611,25 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { @optionalTypeArgs TResult maybeWhen({ TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end)? fixed, TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, @@ -641,17 +641,17 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { List exceptions)? repeating, TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, - @MultihashConverter() Multihash? autoGroupId, + @Uint8ListConverter() Uint8List? autoGroupId, @DateTimeConverter() DateTime? searchStart, int autoDuration)? auto, @@ -708,13 +708,13 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { abstract class FixedCalendarItem extends CalendarItem { const factory FixedCalendarItem( - {@MultihashConverter() final Multihash? id, + {@Uint8ListConverter() final Uint8List? id, final String name, final String description, final String location, - @MultihashConverter() final Multihash? groupId, - @MultihashConverter() final Multihash? placeId, - @MultihashConverter() final Multihash? eventId, + @Uint8ListConverter() final Uint8List? groupId, + @Uint8ListConverter() final Uint8List? placeId, + @Uint8ListConverter() final Uint8List? eventId, final EventStatus status, @DateTimeConverter() final DateTime? start, @DateTimeConverter() final DateTime? end}) = _$FixedCalendarItemImpl; @@ -724,8 +724,8 @@ abstract class FixedCalendarItem extends CalendarItem { _$FixedCalendarItemImpl.fromJson; @override - @MultihashConverter() - Multihash? get id; + @Uint8ListConverter() + Uint8List? get id; @override String get name; @override @@ -733,14 +733,14 @@ abstract class FixedCalendarItem extends CalendarItem { @override String get location; @override - @MultihashConverter() - Multihash? get groupId; + @Uint8ListConverter() + Uint8List? get groupId; @override - @MultihashConverter() - Multihash? get placeId; + @Uint8ListConverter() + Uint8List? get placeId; @override - @MultihashConverter() - Multihash? get eventId; + @Uint8ListConverter() + Uint8List? get eventId; @override EventStatus get status; @override @@ -768,13 +768,13 @@ abstract class _$$RepeatingCalendarItemImplCopyWith<$Res> @override @useResult $Res call( - {@MultihashConverter() Multihash? id, + {@Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, @@ -820,7 +820,7 @@ class __$$RepeatingCalendarItemImplCopyWithImpl<$Res> id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, name: null == name ? _value.name : name // ignore: cast_nullable_to_non_nullable @@ -836,15 +836,15 @@ class __$$RepeatingCalendarItemImplCopyWithImpl<$Res> groupId: freezed == groupId ? _value.groupId : groupId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, placeId: freezed == placeId ? _value.placeId : placeId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, eventId: freezed == eventId ? _value.eventId : eventId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, status: null == status ? _value.status : status // ignore: cast_nullable_to_non_nullable @@ -889,13 +889,13 @@ class __$$RepeatingCalendarItemImplCopyWithImpl<$Res> @JsonSerializable() class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { const _$RepeatingCalendarItemImpl( - {@MultihashConverter() this.id, + {@Uint8ListConverter() this.id, this.name = '', this.description = '', this.location = '', - @MultihashConverter() this.groupId, - @MultihashConverter() this.placeId, - @MultihashConverter() this.eventId, + @Uint8ListConverter() this.groupId, + @Uint8ListConverter() this.placeId, + @Uint8ListConverter() this.eventId, this.status = EventStatus.confirmed, @DateTimeConverter() this.start, @DateTimeConverter() this.end, @@ -914,8 +914,8 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { _$$RepeatingCalendarItemImplFromJson(json); @override - @MultihashConverter() - final Multihash? id; + @Uint8ListConverter() + final Uint8List? id; @override @JsonKey() final String name; @@ -926,14 +926,14 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { @JsonKey() final String location; @override - @MultihashConverter() - final Multihash? groupId; + @Uint8ListConverter() + final Uint8List? groupId; @override - @MultihashConverter() - final Multihash? placeId; + @Uint8ListConverter() + final Uint8List? placeId; @override - @MultihashConverter() - final Multihash? eventId; + @Uint8ListConverter() + final Uint8List? eventId; @override @JsonKey() final EventStatus status; @@ -1038,25 +1038,25 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { @optionalTypeArgs TResult when({ required TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end) fixed, required TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, @@ -1068,17 +1068,17 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { List exceptions) repeating, required TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, - @MultihashConverter() Multihash? autoGroupId, + @Uint8ListConverter() Uint8List? autoGroupId, @DateTimeConverter() DateTime? searchStart, int autoDuration) auto, @@ -1106,25 +1106,25 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { @optionalTypeArgs TResult? whenOrNull({ TResult? Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end)? fixed, TResult? Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, @@ -1136,17 +1136,17 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { List exceptions)? repeating, TResult? Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, - @MultihashConverter() Multihash? autoGroupId, + @Uint8ListConverter() Uint8List? autoGroupId, @DateTimeConverter() DateTime? searchStart, int autoDuration)? auto, @@ -1174,25 +1174,25 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { @optionalTypeArgs TResult maybeWhen({ TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end)? fixed, TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, @@ -1204,17 +1204,17 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { List exceptions)? repeating, TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, - @MultihashConverter() Multihash? autoGroupId, + @Uint8ListConverter() Uint8List? autoGroupId, @DateTimeConverter() DateTime? searchStart, int autoDuration)? auto, @@ -1286,13 +1286,13 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { abstract class RepeatingCalendarItem extends CalendarItem { const factory RepeatingCalendarItem( - {@MultihashConverter() final Multihash? id, + {@Uint8ListConverter() final Uint8List? id, final String name, final String description, final String location, - @MultihashConverter() final Multihash? groupId, - @MultihashConverter() final Multihash? placeId, - @MultihashConverter() final Multihash? eventId, + @Uint8ListConverter() final Uint8List? groupId, + @Uint8ListConverter() final Uint8List? placeId, + @Uint8ListConverter() final Uint8List? eventId, final EventStatus status, @DateTimeConverter() final DateTime? start, @DateTimeConverter() final DateTime? end, @@ -1308,8 +1308,8 @@ abstract class RepeatingCalendarItem extends CalendarItem { _$RepeatingCalendarItemImpl.fromJson; @override - @MultihashConverter() - Multihash? get id; + @Uint8ListConverter() + Uint8List? get id; @override String get name; @override @@ -1317,14 +1317,14 @@ abstract class RepeatingCalendarItem extends CalendarItem { @override String get location; @override - @MultihashConverter() - Multihash? get groupId; + @Uint8ListConverter() + Uint8List? get groupId; @override - @MultihashConverter() - Multihash? get placeId; + @Uint8ListConverter() + Uint8List? get placeId; @override - @MultihashConverter() - Multihash? get eventId; + @Uint8ListConverter() + Uint8List? get eventId; @override EventStatus get status; @override @@ -1358,17 +1358,17 @@ abstract class _$$AutoCalendarItemImplCopyWith<$Res> @override @useResult $Res call( - {@MultihashConverter() Multihash? id, + {@Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, - @MultihashConverter() Multihash? autoGroupId, + @Uint8ListConverter() Uint8List? autoGroupId, @DateTimeConverter() DateTime? searchStart, int autoDuration}); } @@ -1404,7 +1404,7 @@ class __$$AutoCalendarItemImplCopyWithImpl<$Res> id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, name: null == name ? _value.name : name // ignore: cast_nullable_to_non_nullable @@ -1420,15 +1420,15 @@ class __$$AutoCalendarItemImplCopyWithImpl<$Res> groupId: freezed == groupId ? _value.groupId : groupId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, placeId: freezed == placeId ? _value.placeId : placeId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, eventId: freezed == eventId ? _value.eventId : eventId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, status: null == status ? _value.status : status // ignore: cast_nullable_to_non_nullable @@ -1444,7 +1444,7 @@ class __$$AutoCalendarItemImplCopyWithImpl<$Res> autoGroupId: freezed == autoGroupId ? _value.autoGroupId : autoGroupId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, searchStart: freezed == searchStart ? _value.searchStart : searchStart // ignore: cast_nullable_to_non_nullable @@ -1461,17 +1461,17 @@ class __$$AutoCalendarItemImplCopyWithImpl<$Res> @JsonSerializable() class _$AutoCalendarItemImpl extends AutoCalendarItem { const _$AutoCalendarItemImpl( - {@MultihashConverter() this.id, + {@Uint8ListConverter() this.id, this.name = '', this.description = '', this.location = '', - @MultihashConverter() this.groupId, - @MultihashConverter() this.placeId, - @MultihashConverter() this.eventId, + @Uint8ListConverter() this.groupId, + @Uint8ListConverter() this.placeId, + @Uint8ListConverter() this.eventId, this.status = EventStatus.confirmed, @DateTimeConverter() this.start, @DateTimeConverter() this.end, - @MultihashConverter() this.autoGroupId, + @Uint8ListConverter() this.autoGroupId, @DateTimeConverter() this.searchStart, this.autoDuration = 60, final String? $type}) @@ -1482,8 +1482,8 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { _$$AutoCalendarItemImplFromJson(json); @override - @MultihashConverter() - final Multihash? id; + @Uint8ListConverter() + final Uint8List? id; @override @JsonKey() final String name; @@ -1494,14 +1494,14 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { @JsonKey() final String location; @override - @MultihashConverter() - final Multihash? groupId; + @Uint8ListConverter() + final Uint8List? groupId; @override - @MultihashConverter() - final Multihash? placeId; + @Uint8ListConverter() + final Uint8List? placeId; @override - @MultihashConverter() - final Multihash? eventId; + @Uint8ListConverter() + final Uint8List? eventId; @override @JsonKey() final EventStatus status; @@ -1512,8 +1512,8 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { @DateTimeConverter() final DateTime? end; @override - @MultihashConverter() - final Multihash? autoGroupId; + @Uint8ListConverter() + final Uint8List? autoGroupId; @override @DateTimeConverter() final DateTime? searchStart; @@ -1585,25 +1585,25 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { @optionalTypeArgs TResult when({ required TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end) fixed, required TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, @@ -1615,17 +1615,17 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { List exceptions) repeating, required TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, - @MultihashConverter() Multihash? autoGroupId, + @Uint8ListConverter() Uint8List? autoGroupId, @DateTimeConverter() DateTime? searchStart, int autoDuration) auto, @@ -1638,25 +1638,25 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { @optionalTypeArgs TResult? whenOrNull({ TResult? Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end)? fixed, TResult? Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, @@ -1668,17 +1668,17 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { List exceptions)? repeating, TResult? Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, - @MultihashConverter() Multihash? autoGroupId, + @Uint8ListConverter() Uint8List? autoGroupId, @DateTimeConverter() DateTime? searchStart, int autoDuration)? auto, @@ -1691,25 +1691,25 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { @optionalTypeArgs TResult maybeWhen({ TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end)? fixed, TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, @@ -1721,17 +1721,17 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { List exceptions)? repeating, TResult Function( - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, String name, String description, String location, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, - @MultihashConverter() Multihash? eventId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, + @Uint8ListConverter() Uint8List? eventId, EventStatus status, @DateTimeConverter() DateTime? start, @DateTimeConverter() DateTime? end, - @MultihashConverter() Multihash? autoGroupId, + @Uint8ListConverter() Uint8List? autoGroupId, @DateTimeConverter() DateTime? searchStart, int autoDuration)? auto, @@ -1788,17 +1788,17 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { abstract class AutoCalendarItem extends CalendarItem { const factory AutoCalendarItem( - {@MultihashConverter() final Multihash? id, + {@Uint8ListConverter() final Uint8List? id, final String name, final String description, final String location, - @MultihashConverter() final Multihash? groupId, - @MultihashConverter() final Multihash? placeId, - @MultihashConverter() final Multihash? eventId, + @Uint8ListConverter() final Uint8List? groupId, + @Uint8ListConverter() final Uint8List? placeId, + @Uint8ListConverter() final Uint8List? eventId, final EventStatus status, @DateTimeConverter() final DateTime? start, @DateTimeConverter() final DateTime? end, - @MultihashConverter() final Multihash? autoGroupId, + @Uint8ListConverter() final Uint8List? autoGroupId, @DateTimeConverter() final DateTime? searchStart, final int autoDuration}) = _$AutoCalendarItemImpl; const AutoCalendarItem._() : super._(); @@ -1807,8 +1807,8 @@ abstract class AutoCalendarItem extends CalendarItem { _$AutoCalendarItemImpl.fromJson; @override - @MultihashConverter() - Multihash? get id; + @Uint8ListConverter() + Uint8List? get id; @override String get name; @override @@ -1816,14 +1816,14 @@ abstract class AutoCalendarItem extends CalendarItem { @override String get location; @override - @MultihashConverter() - Multihash? get groupId; + @Uint8ListConverter() + Uint8List? get groupId; @override - @MultihashConverter() - Multihash? get placeId; + @Uint8ListConverter() + Uint8List? get placeId; @override - @MultihashConverter() - Multihash? get eventId; + @Uint8ListConverter() + Uint8List? get eventId; @override EventStatus get status; @override @@ -1832,8 +1832,8 @@ abstract class AutoCalendarItem extends CalendarItem { @override @DateTimeConverter() DateTime? get end; - @MultihashConverter() - Multihash? get autoGroupId; + @Uint8ListConverter() + Uint8List? get autoGroupId; @DateTimeConverter() DateTime? get searchStart; int get autoDuration; diff --git a/api/lib/models/event/item/model.g.dart b/api/lib/models/event/item/model.g.dart index 74096a16a9f..2c05b1e0384 100644 --- a/api/lib/models/event/item/model.g.dart +++ b/api/lib/models/event/item/model.g.dart @@ -9,17 +9,17 @@ part of 'model.dart'; _$FixedCalendarItemImpl _$$FixedCalendarItemImplFromJson( Map json) => _$FixedCalendarItemImpl( - id: _$JsonConverterFromJson, Multihash>( - json['id'], const MultihashConverter().fromJson), + id: _$JsonConverterFromJson, Uint8List>( + json['id'], const Uint8ListConverter().fromJson), 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>( - json['eventId'], const MultihashConverter().fromJson), + groupId: _$JsonConverterFromJson, Uint8List>( + json['groupId'], const Uint8ListConverter().fromJson), + placeId: _$JsonConverterFromJson, Uint8List>( + json['placeId'], const Uint8ListConverter().fromJson), + eventId: _$JsonConverterFromJson, Uint8List>( + json['eventId'], const Uint8ListConverter().fromJson), status: $enumDecodeNullable(_$EventStatusEnumMap, json['status']) ?? EventStatus.confirmed, start: @@ -31,17 +31,17 @@ _$FixedCalendarItemImpl _$$FixedCalendarItemImplFromJson( Map _$$FixedCalendarItemImplToJson( _$FixedCalendarItemImpl instance) => { - 'id': _$JsonConverterToJson, Multihash>( - instance.id, const MultihashConverter().toJson), + 'id': _$JsonConverterToJson, Uint8List>( + instance.id, const Uint8ListConverter().toJson), '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>( - instance.eventId, const MultihashConverter().toJson), + 'groupId': _$JsonConverterToJson, Uint8List>( + instance.groupId, const Uint8ListConverter().toJson), + 'placeId': _$JsonConverterToJson, Uint8List>( + instance.placeId, const Uint8ListConverter().toJson), + 'eventId': _$JsonConverterToJson, Uint8List>( + instance.eventId, const Uint8ListConverter().toJson), 'status': _$EventStatusEnumMap[instance.status]!, 'start': const DateTimeConverter().toJson(instance.start), 'end': const DateTimeConverter().toJson(instance.end), @@ -69,17 +69,17 @@ Json? _$JsonConverterToJson( _$RepeatingCalendarItemImpl _$$RepeatingCalendarItemImplFromJson( Map json) => _$RepeatingCalendarItemImpl( - id: _$JsonConverterFromJson, Multihash>( - json['id'], const MultihashConverter().fromJson), + id: _$JsonConverterFromJson, Uint8List>( + json['id'], const Uint8ListConverter().fromJson), 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>( - json['eventId'], const MultihashConverter().fromJson), + groupId: _$JsonConverterFromJson, Uint8List>( + json['groupId'], const Uint8ListConverter().fromJson), + placeId: _$JsonConverterFromJson, Uint8List>( + json['placeId'], const Uint8ListConverter().fromJson), + eventId: _$JsonConverterFromJson, Uint8List>( + json['eventId'], const Uint8ListConverter().fromJson), status: $enumDecodeNullable(_$EventStatusEnumMap, json['status']) ?? EventStatus.confirmed, start: @@ -103,17 +103,17 @@ _$RepeatingCalendarItemImpl _$$RepeatingCalendarItemImplFromJson( Map _$$RepeatingCalendarItemImplToJson( _$RepeatingCalendarItemImpl instance) => { - 'id': _$JsonConverterToJson, Multihash>( - instance.id, const MultihashConverter().toJson), + 'id': _$JsonConverterToJson, Uint8List>( + instance.id, const Uint8ListConverter().toJson), '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>( - instance.eventId, const MultihashConverter().toJson), + 'groupId': _$JsonConverterToJson, Uint8List>( + instance.groupId, const Uint8ListConverter().toJson), + 'placeId': _$JsonConverterToJson, Uint8List>( + instance.placeId, const Uint8ListConverter().toJson), + 'eventId': _$JsonConverterToJson, Uint8List>( + instance.eventId, const Uint8ListConverter().toJson), 'status': _$EventStatusEnumMap[instance.status]!, 'start': const DateTimeConverter().toJson(instance.start), 'end': const DateTimeConverter().toJson(instance.end), @@ -136,24 +136,24 @@ const _$RepeatTypeEnumMap = { _$AutoCalendarItemImpl _$$AutoCalendarItemImplFromJson( Map json) => _$AutoCalendarItemImpl( - id: _$JsonConverterFromJson, Multihash>( - json['id'], const MultihashConverter().fromJson), + id: _$JsonConverterFromJson, Uint8List>( + json['id'], const Uint8ListConverter().fromJson), 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>( - json['eventId'], const MultihashConverter().fromJson), + groupId: _$JsonConverterFromJson, Uint8List>( + json['groupId'], const Uint8ListConverter().fromJson), + placeId: _$JsonConverterFromJson, Uint8List>( + json['placeId'], const Uint8ListConverter().fromJson), + eventId: _$JsonConverterFromJson, Uint8List>( + json['eventId'], const Uint8ListConverter().fromJson), status: $enumDecodeNullable(_$EventStatusEnumMap, json['status']) ?? EventStatus.confirmed, start: const DateTimeConverter().fromJson((json['start'] as num?)?.toInt()), end: const DateTimeConverter().fromJson((json['end'] as num?)?.toInt()), - autoGroupId: _$JsonConverterFromJson, Multihash>( - json['autoGroupId'], const MultihashConverter().fromJson), + autoGroupId: _$JsonConverterFromJson, Uint8List>( + json['autoGroupId'], const Uint8ListConverter().fromJson), searchStart: const DateTimeConverter() .fromJson((json['searchStart'] as num?)?.toInt()), autoDuration: (json['autoDuration'] as num?)?.toInt() ?? 60, @@ -163,22 +163,22 @@ _$AutoCalendarItemImpl _$$AutoCalendarItemImplFromJson( Map _$$AutoCalendarItemImplToJson( _$AutoCalendarItemImpl instance) => { - 'id': _$JsonConverterToJson, Multihash>( - instance.id, const MultihashConverter().toJson), + 'id': _$JsonConverterToJson, Uint8List>( + instance.id, const Uint8ListConverter().toJson), '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>( - instance.eventId, const MultihashConverter().toJson), + 'groupId': _$JsonConverterToJson, Uint8List>( + instance.groupId, const Uint8ListConverter().toJson), + 'placeId': _$JsonConverterToJson, Uint8List>( + instance.placeId, const Uint8ListConverter().toJson), + 'eventId': _$JsonConverterToJson, Uint8List>( + instance.eventId, const Uint8ListConverter().toJson), 'status': _$EventStatusEnumMap[instance.status]!, 'start': const DateTimeConverter().toJson(instance.start), 'end': const DateTimeConverter().toJson(instance.end), - 'autoGroupId': _$JsonConverterToJson, Multihash>( - instance.autoGroupId, const MultihashConverter().toJson), + 'autoGroupId': _$JsonConverterToJson, Uint8List>( + instance.autoGroupId, const Uint8ListConverter().toJson), 'searchStart': const DateTimeConverter().toJson(instance.searchStart), 'autoDuration': instance.autoDuration, 'runtimeType': instance.$type, diff --git a/api/lib/models/event/item/service.dart b/api/lib/models/event/item/service.dart index 324e522c024..4f28260b874 100644 --- a/api/lib/models/event/item/service.dart +++ b/api/lib/models/event/item/service.dart @@ -1,6 +1,6 @@ import 'dart:async'; +import 'dart:typed_data'; -import 'package:lib5/lib5.dart'; import '../../../services/source.dart'; import '../../model.dart'; @@ -8,12 +8,12 @@ import '../model.dart'; import 'model.dart'; abstract class CalendarItemService extends ModelService { - FutureOr getCalendarItem(Multihash id); + FutureOr getCalendarItem(Uint8List id); FutureOr>> getCalendarItems({ List? status, - Multihash? eventId, - Multihash? groupId, - Multihash? placeId, + Uint8List? eventId, + Uint8List? groupId, + Uint8List? placeId, bool pending = false, int offset = 0, int limit = 50, @@ -27,5 +27,5 @@ abstract class CalendarItemService extends ModelService { FutureOr updateCalendarItem(CalendarItem item); - FutureOr deleteCalendarItem(Multihash id); + FutureOr deleteCalendarItem(Uint8List id); } diff --git a/api/lib/models/event/model.dart b/api/lib/models/event/model.dart index 90a44bc26bc..90f77b3bce3 100644 --- a/api/lib/models/event/model.dart +++ b/api/lib/models/event/model.dart @@ -1,7 +1,7 @@ import 'dart:convert'; +import 'dart:typed_data'; import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:lib5/lib5.dart'; import 'package:flow_api/models/extra.dart'; import '../../helpers/converter.dart'; @@ -16,10 +16,10 @@ class Event with _$Event, IdentifiedModel, NamedModel, DescriptiveModel { @Implements() const factory Event({ - @MultihashConverter() Multihash? id, - @MultihashConverter() Multihash? parentId, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, + @Uint8ListConverter() Uint8List? id, + @Uint8ListConverter() Uint8List? parentId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, @Default(true) bool blocked, @Default('') String name, @Default('') String description, diff --git a/api/lib/models/event/model.freezed.dart b/api/lib/models/event/model.freezed.dart index 5b409df28d8..bcacd7236a8 100644 --- a/api/lib/models/event/model.freezed.dart +++ b/api/lib/models/event/model.freezed.dart @@ -20,14 +20,14 @@ Event _$EventFromJson(Map json) { /// @nodoc mixin _$Event { - @MultihashConverter() - Multihash? get id => throw _privateConstructorUsedError; - @MultihashConverter() - Multihash? get parentId => throw _privateConstructorUsedError; - @MultihashConverter() - Multihash? get groupId => throw _privateConstructorUsedError; - @MultihashConverter() - Multihash? get placeId => throw _privateConstructorUsedError; + @Uint8ListConverter() + Uint8List? get id => throw _privateConstructorUsedError; + @Uint8ListConverter() + Uint8List? get parentId => throw _privateConstructorUsedError; + @Uint8ListConverter() + Uint8List? get groupId => throw _privateConstructorUsedError; + @Uint8ListConverter() + Uint8List? get placeId => throw _privateConstructorUsedError; bool get blocked => throw _privateConstructorUsedError; String get name => throw _privateConstructorUsedError; String get description => throw _privateConstructorUsedError; @@ -49,10 +49,10 @@ abstract class $EventCopyWith<$Res> { _$EventCopyWithImpl<$Res, Event>; @useResult $Res call( - {@MultihashConverter() Multihash? id, - @MultihashConverter() Multihash? parentId, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, + {@Uint8ListConverter() Uint8List? id, + @Uint8ListConverter() Uint8List? parentId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, bool blocked, String name, String description, @@ -89,19 +89,19 @@ class _$EventCopyWithImpl<$Res, $Val extends Event> id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, parentId: freezed == parentId ? _value.parentId : parentId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, groupId: freezed == groupId ? _value.groupId : groupId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, placeId: freezed == placeId ? _value.placeId : placeId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, blocked: null == blocked ? _value.blocked : blocked // ignore: cast_nullable_to_non_nullable @@ -134,10 +134,10 @@ abstract class _$$EventImplCopyWith<$Res> implements $EventCopyWith<$Res> { @override @useResult $Res call( - {@MultihashConverter() Multihash? id, - @MultihashConverter() Multihash? parentId, - @MultihashConverter() Multihash? groupId, - @MultihashConverter() Multihash? placeId, + {@Uint8ListConverter() Uint8List? id, + @Uint8ListConverter() Uint8List? parentId, + @Uint8ListConverter() Uint8List? groupId, + @Uint8ListConverter() Uint8List? placeId, bool blocked, String name, String description, @@ -172,19 +172,19 @@ class __$$EventImplCopyWithImpl<$Res> id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, parentId: freezed == parentId ? _value.parentId : parentId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, groupId: freezed == groupId ? _value.groupId : groupId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, placeId: freezed == placeId ? _value.placeId : placeId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, blocked: null == blocked ? _value.blocked : blocked // ignore: cast_nullable_to_non_nullable @@ -213,10 +213,10 @@ class __$$EventImplCopyWithImpl<$Res> @JsonSerializable() class _$EventImpl extends _Event { const _$EventImpl( - {@MultihashConverter() this.id, - @MultihashConverter() this.parentId, - @MultihashConverter() this.groupId, - @MultihashConverter() this.placeId, + {@Uint8ListConverter() this.id, + @Uint8ListConverter() this.parentId, + @Uint8ListConverter() this.groupId, + @Uint8ListConverter() this.placeId, this.blocked = true, this.name = '', this.description = '', @@ -228,17 +228,17 @@ class _$EventImpl extends _Event { _$$EventImplFromJson(json); @override - @MultihashConverter() - final Multihash? id; + @Uint8ListConverter() + final Uint8List? id; @override - @MultihashConverter() - final Multihash? parentId; + @Uint8ListConverter() + final Uint8List? parentId; @override - @MultihashConverter() - final Multihash? groupId; + @Uint8ListConverter() + final Uint8List? groupId; @override - @MultihashConverter() - final Multihash? placeId; + @Uint8ListConverter() + final Uint8List? placeId; @override @JsonKey() final bool blocked; @@ -301,10 +301,10 @@ class _$EventImpl extends _Event { abstract class _Event extends Event implements DescriptiveModel { const factory _Event( - {@MultihashConverter() final Multihash? id, - @MultihashConverter() final Multihash? parentId, - @MultihashConverter() final Multihash? groupId, - @MultihashConverter() final Multihash? placeId, + {@Uint8ListConverter() final Uint8List? id, + @Uint8ListConverter() final Uint8List? parentId, + @Uint8ListConverter() final Uint8List? groupId, + @Uint8ListConverter() final Uint8List? placeId, final bool blocked, final String name, final String description, @@ -315,17 +315,17 @@ abstract class _Event extends Event implements DescriptiveModel { factory _Event.fromJson(Map json) = _$EventImpl.fromJson; @override - @MultihashConverter() - Multihash? get id; + @Uint8ListConverter() + Uint8List? get id; @override - @MultihashConverter() - Multihash? get parentId; + @Uint8ListConverter() + Uint8List? get parentId; @override - @MultihashConverter() - Multihash? get groupId; + @Uint8ListConverter() + Uint8List? get groupId; @override - @MultihashConverter() - Multihash? get placeId; + @Uint8ListConverter() + Uint8List? get placeId; @override bool get blocked; @override diff --git a/api/lib/models/event/model.g.dart b/api/lib/models/event/model.g.dart index ab0b7218828..b6a798eee3c 100644 --- a/api/lib/models/event/model.g.dart +++ b/api/lib/models/event/model.g.dart @@ -7,14 +7,14 @@ part of 'model.dart'; // ************************************************************************** _$EventImpl _$$EventImplFromJson(Map json) => _$EventImpl( - id: _$JsonConverterFromJson, Multihash>( - json['id'], const MultihashConverter().fromJson), - parentId: _$JsonConverterFromJson, Multihash>( - json['parentId'], const MultihashConverter().fromJson), - groupId: _$JsonConverterFromJson, Multihash>( - json['groupId'], const MultihashConverter().fromJson), - placeId: _$JsonConverterFromJson, Multihash>( - json['placeId'], const MultihashConverter().fromJson), + id: _$JsonConverterFromJson, Uint8List>( + json['id'], const Uint8ListConverter().fromJson), + parentId: _$JsonConverterFromJson, Uint8List>( + json['parentId'], const Uint8ListConverter().fromJson), + groupId: _$JsonConverterFromJson, Uint8List>( + json['groupId'], const Uint8ListConverter().fromJson), + placeId: _$JsonConverterFromJson, Uint8List>( + json['placeId'], const Uint8ListConverter().fromJson), blocked: json['blocked'] as bool? ?? true, name: json['name'] as String? ?? '', description: json['description'] as String? ?? '', @@ -24,14 +24,14 @@ _$EventImpl _$$EventImplFromJson(Map json) => _$EventImpl( Map _$$EventImplToJson(_$EventImpl instance) => { - 'id': _$JsonConverterToJson, Multihash>( - instance.id, const MultihashConverter().toJson), - 'parentId': _$JsonConverterToJson, Multihash>( - instance.parentId, const MultihashConverter().toJson), - 'groupId': _$JsonConverterToJson, Multihash>( - instance.groupId, const MultihashConverter().toJson), - 'placeId': _$JsonConverterToJson, Multihash>( - instance.placeId, const MultihashConverter().toJson), + 'id': _$JsonConverterToJson, Uint8List>( + instance.id, const Uint8ListConverter().toJson), + 'parentId': _$JsonConverterToJson, Uint8List>( + instance.parentId, const Uint8ListConverter().toJson), + 'groupId': _$JsonConverterToJson, Uint8List>( + instance.groupId, const Uint8ListConverter().toJson), + 'placeId': _$JsonConverterToJson, Uint8List>( + instance.placeId, const Uint8ListConverter().toJson), 'blocked': instance.blocked, 'name': instance.name, 'description': instance.description, diff --git a/api/lib/models/event/service.dart b/api/lib/models/event/service.dart index b43223ba772..6efc7bb78cb 100644 --- a/api/lib/models/event/service.dart +++ b/api/lib/models/event/service.dart @@ -1,19 +1,19 @@ import 'dart:async'; +import 'dart:typed_data'; -import 'package:lib5/lib5.dart'; import 'package:flow_api/services/source.dart'; import 'item/model.dart'; import 'model.dart'; abstract class EventService extends ModelService { - FutureOr getEvent(Multihash id); + FutureOr getEvent(Uint8List id); FutureOr getEventByItem(CalendarItem item) => item.eventId == null ? null : getEvent(item.eventId!); FutureOr> getEvents({ - Multihash? groupId, - Multihash? placeId, + Uint8List? groupId, + Uint8List? placeId, int offset = 0, int limit = 50, String search = '', @@ -23,5 +23,5 @@ abstract class EventService extends ModelService { FutureOr updateEvent(Event event); - FutureOr deleteEvent(Multihash id); + FutureOr deleteEvent(Uint8List id); } diff --git a/api/lib/models/group/database.dart b/api/lib/models/group/database.dart index 9ac3b4776d7..1b573b2c81b 100644 --- a/api/lib/models/group/database.dart +++ b/api/lib/models/group/database.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'package:collection/collection.dart'; -import 'package:lib5/lib5.dart'; +import 'dart:typed_data'; import 'package:flow_api/services/database.dart'; import 'package:sqflite_common/sqlite_api.dart'; @@ -26,7 +26,7 @@ class GroupDatabaseService extends GroupService with TableService { @override Future createGroup(Group group) async { - final id = group.id ?? createUniqueMultihash(); + final id = group.id ?? createUniqueUint8List(); group = group.copyWith(id: id); final row = await db?.insert('groups', group.toDatabase()); if (row == null) return null; @@ -34,11 +34,11 @@ class GroupDatabaseService extends GroupService with TableService { } @override - Future deleteGroup(Multihash id) async { + Future deleteGroup(Uint8List id) async { return await db?.delete( 'groups', where: 'id = ?', - whereArgs: [id.fullBytes], + whereArgs: [id], ) == 1; } @@ -60,11 +60,11 @@ class GroupDatabaseService extends GroupService with TableService { } @override - Future getGroup(Multihash id) async { + Future getGroup(Uint8List id) async { final result = await db?.query( 'groups', where: 'id = ?', - whereArgs: [id.fullBytes], + whereArgs: [id], ); return result?.map(Group.fromDatabase).firstOrNull; } @@ -75,7 +75,7 @@ class GroupDatabaseService extends GroupService with TableService { 'groups', group.toDatabase()..remove('id'), where: 'id = ?', - whereArgs: [group.id?.fullBytes], + whereArgs: [group.id], ) == 1; } diff --git a/api/lib/models/group/model.dart b/api/lib/models/group/model.dart index fce88782455..94b0aefee18 100644 --- a/api/lib/models/group/model.dart +++ b/api/lib/models/group/model.dart @@ -1,5 +1,5 @@ import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:lib5/lib5.dart'; +import 'dart:typed_data'; import '../../helpers/converter.dart'; import '../model.dart'; @@ -13,10 +13,10 @@ class Group with _$Group, IdentifiedModel, NamedModel, DescriptiveModel { @Implements() const factory Group({ - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, @Default('') String name, @Default('') String description, - @MultihashConverter() Multihash? parentId, + @Uint8ListConverter() Uint8List? parentId, }) = _Group; factory Group.fromJson(Map json) => _$GroupFromJson(json); diff --git a/api/lib/models/group/model.freezed.dart b/api/lib/models/group/model.freezed.dart index 8562f375060..1f3bb3a1815 100644 --- a/api/lib/models/group/model.freezed.dart +++ b/api/lib/models/group/model.freezed.dart @@ -20,12 +20,12 @@ Group _$GroupFromJson(Map json) { /// @nodoc mixin _$Group { - @MultihashConverter() - Multihash? get id => throw _privateConstructorUsedError; + @Uint8ListConverter() + Uint8List? get id => throw _privateConstructorUsedError; String get name => throw _privateConstructorUsedError; String get description => throw _privateConstructorUsedError; - @MultihashConverter() - Multihash? get parentId => throw _privateConstructorUsedError; + @Uint8ListConverter() + Uint8List? get parentId => throw _privateConstructorUsedError; /// Serializes this Group to a JSON map. Map toJson() => throw _privateConstructorUsedError; @@ -42,10 +42,10 @@ abstract class $GroupCopyWith<$Res> { _$GroupCopyWithImpl<$Res, Group>; @useResult $Res call( - {@MultihashConverter() Multihash? id, + {@Uint8ListConverter() Uint8List? id, String name, String description, - @MultihashConverter() Multihash? parentId}); + @Uint8ListConverter() Uint8List? parentId}); } /// @nodoc @@ -72,7 +72,7 @@ class _$GroupCopyWithImpl<$Res, $Val extends Group> id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, name: null == name ? _value.name : name // ignore: cast_nullable_to_non_nullable @@ -84,7 +84,7 @@ class _$GroupCopyWithImpl<$Res, $Val extends Group> parentId: freezed == parentId ? _value.parentId : parentId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, ) as $Val); } } @@ -97,10 +97,10 @@ abstract class _$$GroupImplCopyWith<$Res> implements $GroupCopyWith<$Res> { @override @useResult $Res call( - {@MultihashConverter() Multihash? id, + {@Uint8ListConverter() Uint8List? id, String name, String description, - @MultihashConverter() Multihash? parentId}); + @Uint8ListConverter() Uint8List? parentId}); } /// @nodoc @@ -125,7 +125,7 @@ class __$$GroupImplCopyWithImpl<$Res> id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, name: null == name ? _value.name : name // ignore: cast_nullable_to_non_nullable @@ -137,7 +137,7 @@ class __$$GroupImplCopyWithImpl<$Res> parentId: freezed == parentId ? _value.parentId : parentId // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, )); } } @@ -146,18 +146,18 @@ class __$$GroupImplCopyWithImpl<$Res> @JsonSerializable() class _$GroupImpl extends _Group { const _$GroupImpl( - {@MultihashConverter() this.id, + {@Uint8ListConverter() this.id, this.name = '', this.description = '', - @MultihashConverter() this.parentId}) + @Uint8ListConverter() this.parentId}) : super._(); factory _$GroupImpl.fromJson(Map json) => _$$GroupImplFromJson(json); @override - @MultihashConverter() - final Multihash? id; + @Uint8ListConverter() + final Uint8List? id; @override @JsonKey() final String name; @@ -165,8 +165,8 @@ class _$GroupImpl extends _Group { @JsonKey() final String description; @override - @MultihashConverter() - final Multihash? parentId; + @Uint8ListConverter() + final Uint8List? parentId; @override String toString() { @@ -208,24 +208,24 @@ class _$GroupImpl extends _Group { abstract class _Group extends Group implements DescriptiveModel { const factory _Group( - {@MultihashConverter() final Multihash? id, + {@Uint8ListConverter() final Uint8List? id, final String name, final String description, - @MultihashConverter() final Multihash? parentId}) = _$GroupImpl; + @Uint8ListConverter() final Uint8List? parentId}) = _$GroupImpl; const _Group._() : super._(); factory _Group.fromJson(Map json) = _$GroupImpl.fromJson; @override - @MultihashConverter() - Multihash? get id; + @Uint8ListConverter() + Uint8List? get id; @override String get name; @override String get description; @override - @MultihashConverter() - Multihash? get parentId; + @Uint8ListConverter() + Uint8List? get parentId; /// Create a copy of Group /// with the given fields replaced by the non-null parameter values. diff --git a/api/lib/models/group/model.g.dart b/api/lib/models/group/model.g.dart index 5c3f130d936..2c0258bf668 100644 --- a/api/lib/models/group/model.g.dart +++ b/api/lib/models/group/model.g.dart @@ -7,22 +7,22 @@ part of 'model.dart'; // ************************************************************************** _$GroupImpl _$$GroupImplFromJson(Map json) => _$GroupImpl( - id: _$JsonConverterFromJson, Multihash>( - json['id'], const MultihashConverter().fromJson), + id: _$JsonConverterFromJson, Uint8List>( + json['id'], const Uint8ListConverter().fromJson), name: json['name'] as String? ?? '', description: json['description'] as String? ?? '', - parentId: _$JsonConverterFromJson, Multihash>( - json['parentId'], const MultihashConverter().fromJson), + parentId: _$JsonConverterFromJson, Uint8List>( + json['parentId'], const Uint8ListConverter().fromJson), ); Map _$$GroupImplToJson(_$GroupImpl instance) => { - 'id': _$JsonConverterToJson, Multihash>( - instance.id, const MultihashConverter().toJson), + 'id': _$JsonConverterToJson, Uint8List>( + instance.id, const Uint8ListConverter().toJson), 'name': instance.name, 'description': instance.description, - 'parentId': _$JsonConverterToJson, Multihash>( - instance.parentId, const MultihashConverter().toJson), + 'parentId': _$JsonConverterToJson, Uint8List>( + instance.parentId, const Uint8ListConverter().toJson), }; Value? _$JsonConverterFromJson( diff --git a/api/lib/models/group/service.dart b/api/lib/models/group/service.dart index 626078b2e73..cee8a4a9a56 100644 --- a/api/lib/models/group/service.dart +++ b/api/lib/models/group/service.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'package:lib5/lib5.dart'; +import 'dart:typed_data'; import 'package:flow_api/services/source.dart'; import 'model.dart'; @@ -12,11 +12,11 @@ abstract class GroupService extends ModelService { String search = '', }); - FutureOr getGroup(Multihash id); + FutureOr getGroup(Uint8List id); FutureOr createGroup(Group group); FutureOr updateGroup(Group group); - FutureOr deleteGroup(Multihash id); + FutureOr deleteGroup(Uint8List id); } diff --git a/api/lib/models/label/database.dart b/api/lib/models/label/database.dart index 375d9ce3ab2..1d123b485eb 100644 --- a/api/lib/models/label/database.dart +++ b/api/lib/models/label/database.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'package:lib5/lib5.dart'; +import 'dart:typed_data'; import 'package:flow_api/models/label/model.dart'; import 'package:flow_api/models/label/service.dart'; import 'package:flow_api/services/database.dart'; @@ -30,7 +30,7 @@ class LabelDatabaseService extends LabelService with TableService { @override Future createLabel(Label label) async { - final id = label.id ?? createUniqueMultihash(); + final id = label.id ?? createUniqueUint8List(); label = label.copyWith(id: id); final row = await db?.insert('labels', label.toDatabase()); if (row == null) return null; @@ -38,22 +38,22 @@ class LabelDatabaseService extends LabelService with TableService { } @override - Future getLabel(Multihash id) async { + Future getLabel(Uint8List id) async { final result = await db?.query( 'labels', where: 'id = ?', - whereArgs: [id.fullBytes], + whereArgs: [id], ); if (result == null || result.isEmpty) return null; return Label.fromDatabase(result.first); } @override - Future deleteLabel(Multihash id) async { + Future deleteLabel(Uint8List id) async { return await db?.delete( 'labels', where: 'id = ?', - whereArgs: [id.fullBytes], + whereArgs: [id], ) == 1; } @@ -87,7 +87,7 @@ class LabelDatabaseService extends LabelService with TableService { 'labels', label.toDatabase()..remove('id'), where: 'id = ?', - whereArgs: [label.id?.fullBytes], + whereArgs: [label.id], ) == 1; } diff --git a/api/lib/models/label/model.dart b/api/lib/models/label/model.dart index dd35156f511..e7b47045c6b 100644 --- a/api/lib/models/label/model.dart +++ b/api/lib/models/label/model.dart @@ -1,5 +1,5 @@ import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:lib5/lib5.dart'; +import 'dart:typed_data'; import 'package:flow_api/helpers/converter.dart'; import 'package:flow_api/models/model.dart'; @@ -12,7 +12,7 @@ class Label with _$Label, IdentifiedModel, NamedModel, DescriptiveModel { @Implements() const factory Label({ - @MultihashConverter() Multihash? id, + @Uint8ListConverter() Uint8List? id, @Default('') String name, @Default('') String description, @Default(kColorBlack) int color, diff --git a/api/lib/models/label/model.freezed.dart b/api/lib/models/label/model.freezed.dart index e6454572d82..55edce39abf 100644 --- a/api/lib/models/label/model.freezed.dart +++ b/api/lib/models/label/model.freezed.dart @@ -20,8 +20,8 @@ Label _$LabelFromJson(Map json) { /// @nodoc mixin _$Label { - @MultihashConverter() - Multihash? get id => throw _privateConstructorUsedError; + @Uint8ListConverter() + Uint8List? get id => throw _privateConstructorUsedError; String get name => throw _privateConstructorUsedError; String get description => throw _privateConstructorUsedError; int get color => throw _privateConstructorUsedError; @@ -41,7 +41,7 @@ abstract class $LabelCopyWith<$Res> { _$LabelCopyWithImpl<$Res, Label>; @useResult $Res call( - {@MultihashConverter() Multihash? id, + {@Uint8ListConverter() Uint8List? id, String name, String description, int color}); @@ -71,7 +71,7 @@ class _$LabelCopyWithImpl<$Res, $Val extends Label> id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, name: null == name ? _value.name : name // ignore: cast_nullable_to_non_nullable @@ -96,7 +96,7 @@ abstract class _$$LabelImplCopyWith<$Res> implements $LabelCopyWith<$Res> { @override @useResult $Res call( - {@MultihashConverter() Multihash? id, + {@Uint8ListConverter() Uint8List? id, String name, String description, int color}); @@ -124,7 +124,7 @@ class __$$LabelImplCopyWithImpl<$Res> id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable - as Multihash?, + as Uint8List?, name: null == name ? _value.name : name // ignore: cast_nullable_to_non_nullable @@ -145,7 +145,7 @@ class __$$LabelImplCopyWithImpl<$Res> @JsonSerializable() class _$LabelImpl extends _Label { const _$LabelImpl( - {@MultihashConverter() this.id, + {@Uint8ListConverter() this.id, this.name = '', this.description = '', this.color = kColorBlack}) @@ -155,8 +155,8 @@ class _$LabelImpl extends _Label { _$$LabelImplFromJson(json); @override - @MultihashConverter() - final Multihash? id; + @Uint8ListConverter() + final Uint8List? id; @override @JsonKey() final String name; @@ -206,7 +206,7 @@ class _$LabelImpl extends _Label { abstract class _Label extends Label implements DescriptiveModel { const factory _Label( - {@MultihashConverter() final Multihash? id, + {@Uint8ListConverter() final Uint8List? id, final String name, final String description, final int color}) = _$LabelImpl; @@ -215,8 +215,8 @@ abstract class _Label extends Label implements DescriptiveModel { factory _Label.fromJson(Map json) = _$LabelImpl.fromJson; @override - @MultihashConverter() - Multihash? get id; + @Uint8ListConverter() + Uint8List? get id; @override String get name; @override diff --git a/api/lib/models/label/model.g.dart b/api/lib/models/label/model.g.dart index 1797e31225b..49390ee45da 100644 --- a/api/lib/models/label/model.g.dart +++ b/api/lib/models/label/model.g.dart @@ -7,8 +7,8 @@ part of 'model.dart'; // ************************************************************************** _$LabelImpl _$$LabelImplFromJson(Map json) => _$LabelImpl( - id: _$JsonConverterFromJson, Multihash>( - json['id'], const MultihashConverter().fromJson), + id: _$JsonConverterFromJson, Uint8List>( + json['id'], const Uint8ListConverter().fromJson), name: json['name'] as String? ?? '', description: json['description'] as String? ?? '', color: (json['color'] as num?)?.toInt() ?? kColorBlack, @@ -16,8 +16,8 @@ _$LabelImpl _$$LabelImplFromJson(Map json) => _$LabelImpl( Map _$$LabelImplToJson(_$LabelImpl instance) => { - 'id': _$JsonConverterToJson, Multihash>( - instance.id, const MultihashConverter().toJson), + 'id': _$JsonConverterToJson, Uint8List>( + instance.id, const Uint8ListConverter().toJson), 'name': instance.name, 'description': instance.description, 'color': instance.color, diff --git a/api/lib/models/label/service.dart b/api/lib/models/label/service.dart index b3e688e4c22..16197bfd73c 100644 --- a/api/lib/models/label/service.dart +++ b/api/lib/models/label/service.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'package:lib5/lib5.dart'; +import 'dart:typed_data'; import 'package:flow_api/services/source.dart'; import 'model.dart'; @@ -12,11 +12,11 @@ abstract class LabelService extends ModelService { String search = '', }); - FutureOr getLabel(Multihash id); + FutureOr getLabel(Uint8List id); FutureOr createLabel(Label label); FutureOr updateLabel(Label label); - FutureOr deleteLabel(Multihash id); + FutureOr deleteLabel(Uint8List id); } diff --git a/api/lib/models/model.dart b/api/lib/models/model.dart index 1674868d5ce..1d3fe91b8d2 100644 --- a/api/lib/models/model.dart +++ b/api/lib/models/model.dart @@ -1,15 +1,17 @@ +import 'dart:convert'; + import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:lib5/lib5.dart'; +import 'dart:typed_data'; part 'model.freezed.dart'; const kColorBlack = 0xFF000000; mixin IdentifiedModel { - Multihash? get id; + Uint8List? get id; String toDisplayString() { - return id?.toBase64Url() ?? ''; + return base64Encode(id ?? []); } } @@ -65,7 +67,7 @@ extension SourcedConnectedModelNullableExtension extension ConnectedModelIdentifier on ConnectedModel { - ConnectedModel? toIdentifierModel() { + ConnectedModel? toIdentifierModel() { final id = model?.id; if (id == null) return null; return ConnectedModel(source, id); diff --git a/api/lib/models/note/database.dart b/api/lib/models/note/database.dart index 885463d43a7..33a3e6cbe00 100644 --- a/api/lib/models/note/database.dart +++ b/api/lib/models/note/database.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'package:collection/collection.dart'; -import 'package:lib5/lib5.dart'; +import 'dart:typed_data'; import 'package:flow_api/models/note/service.dart'; import 'package:flow_api/services/database.dart'; import 'package:sqflite_common/sqlite_api.dart'; @@ -30,30 +30,30 @@ abstract class NoteDatabaseConnector extends NoteConnector } @override - Future connect(Multihash connectId, Multihash noteId) async { + Future connect(Uint8List connectId, Uint8List noteId) async { if (await isNoteConnected(connectId, noteId)) return; await db?.insert(tableName, { - 'noteId': noteId.fullBytes, - connectedIdName: connectId.fullBytes, + 'noteId': noteId, + connectedIdName: connectId, }); } @override - Future disconnect(Multihash connectId, Multihash noteId) async { + Future disconnect(Uint8List connectId, Uint8List noteId) async { await db?.delete( tableName, where: 'noteId = ? AND $connectedIdName = ?', - whereArgs: [noteId.fullBytes, connectId.fullBytes], + whereArgs: [noteId, connectId], ); } @override - Future> getNotes(Multihash connectId, + Future> getNotes(Uint8List connectId, {int offset = 0, int limit = 50}) async { final result = await db?.query( '$tableName JOIN notes ON notes.id = noteId', where: '$connectedIdName = ?', - whereArgs: [connectId.fullBytes], + whereArgs: [connectId], columns: [ 'notes.id AS noteid', 'notes.name AS notename', @@ -76,12 +76,12 @@ abstract class NoteDatabaseConnector extends NoteConnector } @override - Future> getConnected(Multihash noteId, + Future> getConnected(Uint8List noteId, {int offset = 0, int limit = 50}) async { final result = await db?.query( '$tableName JOIN $connectedTableName ON $connectedTableName.id = $connectedIdName', where: 'noteId = ?', - whereArgs: [noteId.fullBytes], + whereArgs: [noteId], offset: offset, limit: limit, ); @@ -89,24 +89,24 @@ abstract class NoteDatabaseConnector extends NoteConnector } @override - Future isNoteConnected(Multihash connectId, Multihash noteId) async { + Future isNoteConnected(Uint8List connectId, Uint8List noteId) async { final result = await db?.query( tableName, where: 'noteId = ? AND $connectedIdName = ?', - whereArgs: [noteId.fullBytes, connectId.fullBytes], + whereArgs: [noteId, connectId], ); return result?.isNotEmpty == true; } @override - Future notesDone(Multihash connectId) async { + Future notesDone(Uint8List connectId) async { final result = await db?.rawQuery( 'SELECT COUNT(*) AS count FROM notes WHERE $connectedIdName = ? AND status = ?', - [connectId.fullBytes, NoteStatus.done.name]); + [connectId, NoteStatus.done.name]); final resultCount = result?.first['count'] as int? ?? 0; final all = await db?.rawQuery( 'SELECT COUNT(*) AS count FROM notes WHERE $connectedIdName = ?', - [connectId.fullBytes]); + [connectId]); final allCount = all?.first['count'] as int? ?? 0; if (resultCount == allCount && allCount > 0) { return true; @@ -155,7 +155,7 @@ class NoteDatabaseService extends NoteService with TableService { @override Future createNote(Note note) async { - final id = note.id ?? createUniqueMultihash(); + final id = note.id ?? createUniqueUint8List(); note = note.copyWith(id: id); final row = await db?.insert('notes', note.toDatabase()); if (row == null) return null; @@ -163,11 +163,11 @@ class NoteDatabaseService extends NoteService with TableService { } @override - Future deleteNote(Multihash id) async { + Future deleteNote(Uint8List id) async { return await db?.delete( 'notes', where: 'id = ?', - whereArgs: [id.fullBytes], + whereArgs: [id], ) == 1; } @@ -176,9 +176,9 @@ class NoteDatabaseService extends NoteService with TableService { Future> getNotes({ int offset = 0, int limit = 50, - Multihash? parent, - Multihash? notebook, - Set labels = const {}, + Uint8List? parent, + Uint8List? notebook, + Set labels = const {}, Set statuses = const { NoteStatus.todo, NoteStatus.inProgress, @@ -194,11 +194,9 @@ class NoteDatabaseService extends NoteService with TableService { whereArgs = ['%$search%', '%$search%']; } if (parent != null) { - if (parent.fullBytes.isNotEmpty) { + if (parent.isNotEmpty) { where = where == null ? 'parentId = ?' : '$where AND parentId = ?'; - whereArgs = whereArgs == null - ? [parent.fullBytes] - : [...whereArgs, parent.fullBytes]; + whereArgs = whereArgs == null ? [parent] : [...whereArgs, parent]; } else { where = where == null ? 'parentId IS NULL' : '$where AND parentId IS NULL'; @@ -206,7 +204,7 @@ class NoteDatabaseService extends NoteService with TableService { } if (notebook != null) { where = where == null ? 'notebookId = ?' : '$where AND notebookId = ?'; - whereArgs = [...?whereArgs, notebook.fullBytes]; + whereArgs = [...?whereArgs, notebook]; } var statusStatement = "status IN (${statuses.nonNulls.map((e) => "'${e.name}'").join(',')})"; @@ -232,7 +230,7 @@ class NoteDatabaseService extends NoteService with TableService { 'notes', note.toDatabase()..remove('id'), where: 'id = ?', - whereArgs: [note.id?.fullBytes], + whereArgs: [note.id], ) == 1; } @@ -243,26 +241,26 @@ class NoteDatabaseService extends NoteService with TableService { } @override - Future getNote(Multihash id, {bool fallback = false}) async { + Future getNote(Uint8List id, {bool fallback = false}) async { final result = fallback ? await db?.rawQuery( """SELECT * FROM notes WHERE slug = ? OR slug = (SELECT MIN(slug) FROM notes) ORDER BY slug DESC LIMIT 1;""", - [id.fullBytes], + [id], ) : await db?.query( 'notes', where: 'id = ?', - whereArgs: [id.fullBytes], + whereArgs: [id], ); return result?.map(Note.fromDatabase).firstOrNull; } @override Future createNotebook(Notebook notebook) async { - final id = notebook.id ?? createUniqueMultihash(); + final id = notebook.id ?? createUniqueUint8List(); notebook = notebook.copyWith(id: id); final row = await db?.insert('notebooks', notebook.toDatabase()); if (row == null) return null; @@ -270,21 +268,21 @@ LIMIT 1;""", } @override - Future deleteNotebook(Multihash id) async { + Future deleteNotebook(Uint8List id) async { return await db?.delete( 'notebooks', where: 'id = ?', - whereArgs: [id.fullBytes], + whereArgs: [id], ) == 1; } @override - Future getNotebook(Multihash id) async { + Future getNotebook(Uint8List id) async { final result = await db?.query( 'notebooks', where: 'id = ?', - whereArgs: [id.fullBytes], + whereArgs: [id], ); return result?.map(Notebook.fromDatabase).firstOrNull; } @@ -308,7 +306,7 @@ LIMIT 1;""", 'notebooks', notebook.toDatabase()..remove('id'), where: 'id = ?', - whereArgs: [notebook.id?.fullBytes], + whereArgs: [notebook.id], ) == 1; } diff --git a/api/lib/models/note/label.dart b/api/lib/models/note/label.dart index 9d3a8c597c3..73523f081dc 100644 --- a/api/lib/models/note/label.dart +++ b/api/lib/models/note/label.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'package:lib5/lib5.dart'; +import 'dart:typed_data'; import 'package:flow_api/models/label/model.dart'; import 'package:flow_api/models/note/database.dart'; @@ -12,11 +12,11 @@ import 'service.dart'; abstract class LabelNoteConnector extends NoteConnector