mirror of
https://github.com/zapstore/zapstore.git
synced 2026-10-05 20:48:24 +00:00
102 lines
3.3 KiB
Dart
102 lines
3.3 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
part of 'user.dart';
|
|
|
|
// **************************************************************************
|
|
// AdapterGenerator
|
|
// **************************************************************************
|
|
|
|
// ignore_for_file: non_constant_identifier_names, duplicate_ignore
|
|
|
|
mixin _$UserAdapter on Adapter<User> {
|
|
static final Map<String, RelationshipMeta> _kUserRelationshipMetas = {
|
|
'following': RelationshipMeta<User>(
|
|
name: 'following',
|
|
inverseName: 'followers',
|
|
type: 'users',
|
|
kind: 'HasMany',
|
|
instance: (_) => (_ as User).following,
|
|
),
|
|
'followers': RelationshipMeta<User>(
|
|
name: 'followers',
|
|
inverseName: 'following',
|
|
type: 'users',
|
|
kind: 'HasMany',
|
|
instance: (_) => (_ as User).followers,
|
|
)
|
|
};
|
|
|
|
@override
|
|
Map<String, RelationshipMeta> get relationshipMetas =>
|
|
_kUserRelationshipMetas;
|
|
|
|
@override
|
|
User deserializeLocal(map, {String? key}) {
|
|
map = transformDeserialize(map);
|
|
return internalWrapStopInit(() => _$UserFromJson(map), key: key);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> serializeLocal(model, {bool withRelationships = true}) {
|
|
final map = _$UserToJson(model);
|
|
return transformSerialize(map, withRelationships: withRelationships);
|
|
}
|
|
}
|
|
|
|
final _usersFinders = <String, dynamic>{};
|
|
|
|
class $UserAdapter = Adapter<User>
|
|
with _$UserAdapter, NostrAdapter<User>, UserAdapter;
|
|
|
|
final usersAdapterProvider = Provider<Adapter<User>>(
|
|
(ref) => $UserAdapter(ref, InternalHolder(_usersFinders)));
|
|
|
|
extension UserAdapterX on Adapter<User> {
|
|
NostrAdapter<User> get nostrAdapter => this as NostrAdapter<User>;
|
|
UserAdapter get userAdapter => this as UserAdapter;
|
|
}
|
|
|
|
extension UserRelationshipGraphNodeX on RelationshipGraphNode<User> {
|
|
RelationshipGraphNode<User> get following {
|
|
final meta = _$UserAdapter._kUserRelationshipMetas['following']
|
|
as RelationshipMeta<User>;
|
|
return meta.clone(
|
|
parent: this is RelationshipMeta ? this as RelationshipMeta : null);
|
|
}
|
|
|
|
RelationshipGraphNode<User> get followers {
|
|
final meta = _$UserAdapter._kUserRelationshipMetas['followers']
|
|
as RelationshipMeta<User>;
|
|
return meta.clone(
|
|
parent: this is RelationshipMeta ? this as RelationshipMeta : null);
|
|
}
|
|
}
|
|
|
|
// **************************************************************************
|
|
// JsonSerializableGenerator
|
|
// **************************************************************************
|
|
|
|
User _$UserFromJson(Map<String, dynamic> json) => User()
|
|
..id = json['id']
|
|
..pubkey = json['pubkey'] as String
|
|
..createdAt = DateTime.parse(json['createdAt'] as String)
|
|
..content = json['content'] as String
|
|
..kind = (json['kind'] as num).toInt()
|
|
..tags = (json['tags'] as List<dynamic>)
|
|
.map((e) => (e as List<dynamic>).map((e) => e as String).toList())
|
|
.toList()
|
|
..signature = json['signature'] as String?
|
|
..following =
|
|
HasMany<User>.fromJson(json['following'] as Map<String, dynamic>);
|
|
|
|
Map<String, dynamic> _$UserToJson(User instance) => <String, dynamic>{
|
|
'id': instance.id,
|
|
'pubkey': instance.pubkey,
|
|
'createdAt': instance.createdAt.toIso8601String(),
|
|
'content': instance.content,
|
|
'kind': instance.kind,
|
|
'tags': instance.tags,
|
|
'signature': instance.signature,
|
|
'following': instance.following,
|
|
};
|