refactor(profile): handles and profiles move into halkyon_base
People's public profiles are the instance's register's (ADR 0016), so the module now holds them: the public_profile table (unchanged, so Learn's migration records versions only; devices get the table empty, as they hold every module's tables), the profile and profiles endpoints under `base`, the handle rules, the link checks and the page at /@handle, whose foot names the app as the host's configuration says (profilePageNote). Deleting a person deletes their profile in the module's core. Hosts read profiles through the module (profileOf, profilesOf, personWithHandle, fixHandle; saveProfile for their tests), behind an AccountRegister that is this server's own database for now. Learn's feedback, discussions and publishing ask it; publishing fixes the handle just before it writes the release, outside its transaction. Explore still joins the table in its search, so Learn holds the register wherever it runs. Learn's app calls the module's endpoints; a profile not found is ProfileNotFoundException. Todo's database gets the table too (it was never deployed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
2033e5606f
commit
4107cc3087
10 changed files with 38851 additions and 1197 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,141 @@
|
|||
{
|
||||
"__className__": "serverpod.DatabaseMigration",
|
||||
"actions": [
|
||||
{
|
||||
"__className__": "serverpod.DatabaseMigrationAction",
|
||||
"type": "createTable",
|
||||
"createTable": {
|
||||
"__className__": "serverpod.TableDefinition",
|
||||
"name": "public_profile",
|
||||
"dartName": "PublicProfile",
|
||||
"module": "halkyon_base",
|
||||
"schema": "public",
|
||||
"columns": [
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "id",
|
||||
"fieldName": "id",
|
||||
"columnType": 6,
|
||||
"isNullable": false,
|
||||
"columnDefault": "serial",
|
||||
"dartType": "int?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "authUserId",
|
||||
"fieldName": "authUserId",
|
||||
"columnType": 7,
|
||||
"isNullable": false,
|
||||
"dartType": "UuidValue"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "handle",
|
||||
"fieldName": "handle",
|
||||
"columnType": 0,
|
||||
"isNullable": false,
|
||||
"dartType": "String"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "handleKey",
|
||||
"fieldName": "handleKey",
|
||||
"columnType": 0,
|
||||
"isNullable": false,
|
||||
"dartType": "String"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "displayName",
|
||||
"fieldName": "displayName",
|
||||
"columnType": 0,
|
||||
"isNullable": false,
|
||||
"dartType": "String"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "bio",
|
||||
"fieldName": "bio",
|
||||
"columnType": 0,
|
||||
"isNullable": false,
|
||||
"dartType": "String"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "links",
|
||||
"fieldName": "links",
|
||||
"columnType": 8,
|
||||
"isNullable": false,
|
||||
"dartType": "List<String>"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "verifiedLinks",
|
||||
"fieldName": "verifiedLinks",
|
||||
"columnType": 8,
|
||||
"isNullable": true,
|
||||
"dartType": "List<String>?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "avatarHash",
|
||||
"fieldName": "avatarHash",
|
||||
"columnType": 0,
|
||||
"isNullable": true,
|
||||
"dartType": "String?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "firstPublishedAt",
|
||||
"fieldName": "firstPublishedAt",
|
||||
"columnType": 4,
|
||||
"isNullable": true,
|
||||
"dartType": "DateTime?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "updatedAt",
|
||||
"fieldName": "updatedAt",
|
||||
"columnType": 4,
|
||||
"isNullable": false,
|
||||
"dartType": "DateTime"
|
||||
}
|
||||
],
|
||||
"foreignKeys": [],
|
||||
"indexes": [
|
||||
{
|
||||
"__className__": "serverpod.IndexDefinition",
|
||||
"indexName": "public_profile_person_idx",
|
||||
"elements": [
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "authUserId"
|
||||
}
|
||||
],
|
||||
"type": "btree",
|
||||
"isUnique": true,
|
||||
"isPrimary": false
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.IndexDefinition",
|
||||
"indexName": "public_profile_handle_idx",
|
||||
"elements": [
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "handleKey"
|
||||
}
|
||||
],
|
||||
"type": "btree",
|
||||
"isUnique": true,
|
||||
"isPrimary": false
|
||||
}
|
||||
],
|
||||
"managed": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"warnings": [],
|
||||
"migrationApiVersion": 1
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@ part '20261008165051407-pdf-position/migration.dart';
|
|||
part '20261009224606274-feedback/migration.dart';
|
||||
part '20261012162411835-studyset-deleted-at/migration.dart';
|
||||
part '20261019121406578-halkyon-base/migration.dart';
|
||||
part '20261019201023295-profiles-in-halkyon-base/migration.dart';
|
||||
|
||||
/// Migration registry for the client-side database.
|
||||
class MigrationRegistry {
|
||||
|
|
@ -34,6 +35,7 @@ class MigrationRegistry {
|
|||
_Migration20261009224606274_feedback(),
|
||||
_Migration20261012162411835_studyset_deleted_at(),
|
||||
_Migration20261019121406578_halkyon_base(),
|
||||
_Migration20261019201023295_profiles_in_halkyon_base(),
|
||||
];
|
||||
|
||||
/// List of all client-side database migration versions.
|
||||
|
|
|
|||
|
|
@ -49,10 +49,6 @@ import 'package:halkyon_learn_client/src/protocol/feedback/feedback_view.dart'
|
|||
as _idpwh21d;
|
||||
import 'package:halkyon_learn_client/src/protocol/instance/instance_info.dart'
|
||||
as _i26u8vl4;
|
||||
import 'package:halkyon_learn_client/src/protocol/profile/profile.dart'
|
||||
as _ihcmr71y;
|
||||
import 'package:halkyon_learn_client/src/protocol/profile/profile_refusal.dart'
|
||||
as _ibeo2wv6;
|
||||
import 'package:halkyon_learn_client/src/protocol/publish/publication.dart'
|
||||
as _ij0cqo11;
|
||||
import 'package:http/http.dart' as _i85jenna;
|
||||
|
|
@ -772,121 +768,6 @@ class EndpointInstance extends _isc.EndpointRef {
|
|||
);
|
||||
}
|
||||
|
||||
/// Your public profile (ADR 0005, rule 2): the handle others find you by,
|
||||
/// your display name, bio and links. Only for people with an identity: a
|
||||
/// profile is for others to see.
|
||||
///
|
||||
/// The person always comes from the session, never from the client: a
|
||||
/// profile is only ever the caller's own.
|
||||
/// {@category Endpoint}
|
||||
class EndpointProfile extends _isc.EndpointRef {
|
||||
EndpointProfile(_isc.EndpointCaller caller) : super(caller);
|
||||
|
||||
@override
|
||||
String get name => 'profile';
|
||||
|
||||
/// Your public profile; null while you have none.
|
||||
_ida.Future<_ihcmr71y.Profile?> mine() =>
|
||||
caller.callServerEndpoint<_ihcmr71y.Profile?>(
|
||||
'profile',
|
||||
'mine',
|
||||
{},
|
||||
);
|
||||
|
||||
/// Saves your public profile, making it if you have none. Throws
|
||||
/// [ProfileRefusedException] when it can't be saved (see
|
||||
/// [ProfileRefusal]): a handle someone else has, whatever its case, or a
|
||||
/// new handle once you have published.
|
||||
_ida.Future<_ihcmr71y.Profile> save(
|
||||
String handle,
|
||||
String displayName,
|
||||
String bio,
|
||||
List<String> links,
|
||||
) => caller.callServerEndpoint<_ihcmr71y.Profile>(
|
||||
'profile',
|
||||
'save',
|
||||
{
|
||||
'handle': handle,
|
||||
'displayName': displayName,
|
||||
'bio': bio,
|
||||
'links': links,
|
||||
},
|
||||
);
|
||||
|
||||
/// Checks which of your links' pages link back to your profile's page
|
||||
/// with `rel="me"` (ADR 0011), and keeps the answer: the app asks after a
|
||||
/// link is saved, and on Check again. At most 10 times an hour, as each
|
||||
/// check fetches every page linked ([ProfileRefusal.tooManyLinkChecks]).
|
||||
/// Throws [NotFoundException] while you have no profile.
|
||||
_ida.Future<_ihcmr71y.Profile> checkLinks() =>
|
||||
caller.callServerEndpoint<_ihcmr71y.Profile>(
|
||||
'profile',
|
||||
'checkLinks',
|
||||
{},
|
||||
);
|
||||
|
||||
/// Why [handle] couldn't be yours, as saving it would refuse it: not a
|
||||
/// handle, reserved for the instance, someone else's whatever its case,
|
||||
/// or a new one once you have published; null when it can, as your own
|
||||
/// can. For the app to say so while it is typed (decided 2026-10-12);
|
||||
/// saving checks again. Whose a handle is, anyone can find out already
|
||||
/// ([ProfilesEndpoint.byHandle]), so this tells nothing new.
|
||||
_ida.Future<_ibeo2wv6.ProfileRefusal?> checkHandle(String handle) =>
|
||||
caller.callServerEndpoint<_ibeo2wv6.ProfileRefusal?>(
|
||||
'profile',
|
||||
'checkHandle',
|
||||
{'handle': handle},
|
||||
);
|
||||
|
||||
/// Shows [png] as your avatar, in place of any before: a PNG of at most
|
||||
/// 1 MB, which the app draws from the picture chosen. Throws
|
||||
/// [ProfileRefusedException] for anything else, and [NotFoundException]
|
||||
/// while you have no profile.
|
||||
_ida.Future<_ihcmr71y.Profile> setAvatar(_idt.ByteData png) =>
|
||||
caller.callServerEndpoint<_ihcmr71y.Profile>(
|
||||
'profile',
|
||||
'setAvatar',
|
||||
{'png': png},
|
||||
);
|
||||
|
||||
/// Shows no avatar any more. Throws [NotFoundException] while you have no
|
||||
/// profile.
|
||||
_ida.Future<_ihcmr71y.Profile> removeAvatar() =>
|
||||
caller.callServerEndpoint<_ihcmr71y.Profile>(
|
||||
'profile',
|
||||
'removeAvatar',
|
||||
{},
|
||||
);
|
||||
|
||||
/// Removes your public profile, freeing its handle; nothing when you have
|
||||
/// none. Throws [ProfileRefusedException] once you have published: others
|
||||
/// refer to it.
|
||||
_ida.Future<void> remove() => caller.callServerEndpoint<void>(
|
||||
'profile',
|
||||
'remove',
|
||||
{},
|
||||
);
|
||||
}
|
||||
|
||||
/// The public profiles of others, found by their handles. Any signed-in
|
||||
/// person may read them: they are public.
|
||||
/// {@category Endpoint}
|
||||
class EndpointProfiles extends _isc.EndpointRef {
|
||||
EndpointProfiles(_isc.EndpointCaller caller) : super(caller);
|
||||
|
||||
@override
|
||||
String get name => 'profiles';
|
||||
|
||||
/// The public profile with [handle], whatever its case. Throws
|
||||
/// [NotFoundException] when there is none.
|
||||
_ida.Future<_ihcmr71y.Profile> byHandle(String handle) =>
|
||||
caller.callServerEndpoint<_ihcmr71y.Profile>(
|
||||
'profiles',
|
||||
'byHandle',
|
||||
{'handle': handle},
|
||||
);
|
||||
}
|
||||
|
||||
/// Publishing your studysets (ADR 0005, rule 3): each release a commit and
|
||||
/// a tag in a git repository of the studyset's own, which the server builds
|
||||
/// from your synced rows. Only for people with an identity and a public
|
||||
|
|
@ -1014,8 +895,6 @@ class Client extends _isc.ServerpodClientShared {
|
|||
feedback = EndpointFeedback(this);
|
||||
inbox = EndpointInbox(this);
|
||||
instance = EndpointInstance(this);
|
||||
profile = EndpointProfile(this);
|
||||
profiles = EndpointProfiles(this);
|
||||
publish = EndpointPublish(this);
|
||||
modules = Modules(this);
|
||||
}
|
||||
|
|
@ -1040,10 +919,6 @@ class Client extends _isc.ServerpodClientShared {
|
|||
|
||||
late final EndpointInstance instance;
|
||||
|
||||
late final EndpointProfile profile;
|
||||
|
||||
late final EndpointProfiles profiles;
|
||||
|
||||
late final EndpointPublish publish;
|
||||
|
||||
late final Modules modules;
|
||||
|
|
@ -1060,8 +935,6 @@ class Client extends _isc.ServerpodClientShared {
|
|||
'feedback': feedback,
|
||||
'inbox': inbox,
|
||||
'instance': instance,
|
||||
'profile': profile,
|
||||
'profiles': profiles,
|
||||
'publish': publish,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,203 +0,0 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:halkyon_learn_client/src/protocol/protocol.dart' as _itx5j3f5;
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
|
||||
/// A person's public profile as the app shows it (ADR 0005, rule 2): never
|
||||
/// whose it is, only who they say they are.
|
||||
abstract class Profile
|
||||
implements _isc.SerializableModel, _isc.ProtocolSerialization {
|
||||
Profile._({
|
||||
required this.handle,
|
||||
required this.address,
|
||||
required this.displayName,
|
||||
required this.bio,
|
||||
required this.links,
|
||||
this.verifiedLinks,
|
||||
this.pageUrl,
|
||||
this.avatarUrl,
|
||||
required this.handleFixed,
|
||||
});
|
||||
|
||||
factory Profile({
|
||||
required String handle,
|
||||
required String address,
|
||||
required String displayName,
|
||||
required String bio,
|
||||
required List<String> links,
|
||||
List<String>? verifiedLinks,
|
||||
String? pageUrl,
|
||||
String? avatarUrl,
|
||||
required bool handleFixed,
|
||||
}) = _ProfileImpl;
|
||||
|
||||
factory Profile.fromJson(Map<String, dynamic> jsonSerialization) {
|
||||
return Profile(
|
||||
handle: jsonSerialization['handle'] as String,
|
||||
address: jsonSerialization['address'] as String,
|
||||
displayName: jsonSerialization['displayName'] as String,
|
||||
bio: jsonSerialization['bio'] as String,
|
||||
links: _itx5j3f5.Protocol().deserialize<List<String>>(
|
||||
jsonSerialization['links'],
|
||||
),
|
||||
verifiedLinks: jsonSerialization['verifiedLinks'] == null
|
||||
? null
|
||||
: _itx5j3f5.Protocol().deserialize<List<String>>(
|
||||
jsonSerialization['verifiedLinks'],
|
||||
),
|
||||
pageUrl: jsonSerialization['pageUrl'] as String?,
|
||||
avatarUrl: jsonSerialization['avatarUrl'] as String?,
|
||||
handleFixed: _isc.BoolJsonExtension.fromJson(
|
||||
jsonSerialization['handleFixed'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// The handle as its person wrote it.
|
||||
String handle;
|
||||
|
||||
/// The handle with the account domain, as the fediverse knows it
|
||||
/// (`raisondetredev@halkyon.eu`).
|
||||
String address;
|
||||
|
||||
/// The name shown beside the handle; empty for none.
|
||||
String displayName;
|
||||
|
||||
/// A few words about the person; empty for none.
|
||||
String bio;
|
||||
|
||||
/// Pages about the person, in their order.
|
||||
List<String> links;
|
||||
|
||||
/// Those of [links] whose pages link back to [pageUrl] with `rel="me"`
|
||||
/// (ADR 0011). Null from servers that predate it: none.
|
||||
List<String>? verifiedLinks;
|
||||
|
||||
/// The profile's page on the web (`https://halkyon.eu/@raisondetredev`),
|
||||
/// which a person's other pages link back to. Null where the instance
|
||||
/// has none, and from servers that predate it.
|
||||
String? pageUrl;
|
||||
|
||||
/// Where their avatar is, a PNG; null for none.
|
||||
String? avatarUrl;
|
||||
|
||||
/// Whether the handle is fixed, as its person has published.
|
||||
bool handleFixed;
|
||||
|
||||
/// Returns a shallow copy of this [Profile]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
Profile copyWith({
|
||||
String? handle,
|
||||
String? address,
|
||||
String? displayName,
|
||||
String? bio,
|
||||
List<String>? links,
|
||||
List<String>? verifiedLinks,
|
||||
String? pageUrl,
|
||||
String? avatarUrl,
|
||||
bool? handleFixed,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'__className__': 'Profile',
|
||||
'handle': handle,
|
||||
'address': address,
|
||||
'displayName': displayName,
|
||||
'bio': bio,
|
||||
'links': links.toJson(),
|
||||
if (verifiedLinks != null) 'verifiedLinks': verifiedLinks?.toJson(),
|
||||
if (pageUrl != null) 'pageUrl': pageUrl,
|
||||
if (avatarUrl != null) 'avatarUrl': avatarUrl,
|
||||
'handleFixed': handleFixed,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJsonForProtocol() {
|
||||
return {
|
||||
'__className__': 'Profile',
|
||||
'handle': handle,
|
||||
'address': address,
|
||||
'displayName': displayName,
|
||||
'bio': bio,
|
||||
'links': links.toJson(),
|
||||
if (verifiedLinks != null) 'verifiedLinks': verifiedLinks?.toJson(),
|
||||
if (pageUrl != null) 'pageUrl': pageUrl,
|
||||
if (avatarUrl != null) 'avatarUrl': avatarUrl,
|
||||
'handleFixed': handleFixed,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _isc.SerializationManager.encode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class _Undefined {}
|
||||
|
||||
class _ProfileImpl extends Profile {
|
||||
_ProfileImpl({
|
||||
required String handle,
|
||||
required String address,
|
||||
required String displayName,
|
||||
required String bio,
|
||||
required List<String> links,
|
||||
List<String>? verifiedLinks,
|
||||
String? pageUrl,
|
||||
String? avatarUrl,
|
||||
required bool handleFixed,
|
||||
}) : super._(
|
||||
handle: handle,
|
||||
address: address,
|
||||
displayName: displayName,
|
||||
bio: bio,
|
||||
links: links,
|
||||
verifiedLinks: verifiedLinks,
|
||||
pageUrl: pageUrl,
|
||||
avatarUrl: avatarUrl,
|
||||
handleFixed: handleFixed,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [Profile]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
@override
|
||||
Profile copyWith({
|
||||
String? handle,
|
||||
String? address,
|
||||
String? displayName,
|
||||
String? bio,
|
||||
List<String>? links,
|
||||
Object? verifiedLinks = _Undefined,
|
||||
Object? pageUrl = _Undefined,
|
||||
Object? avatarUrl = _Undefined,
|
||||
bool? handleFixed,
|
||||
}) {
|
||||
return Profile(
|
||||
handle: handle ?? this.handle,
|
||||
address: address ?? this.address,
|
||||
displayName: displayName ?? this.displayName,
|
||||
bio: bio ?? this.bio,
|
||||
links: links ?? this.links.map((e0) => e0).toList(),
|
||||
verifiedLinks: verifiedLinks is List<String>?
|
||||
? verifiedLinks
|
||||
: this.verifiedLinks?.map((e0) => e0).toList(),
|
||||
pageUrl: pageUrl is String? ? pageUrl : this.pageUrl,
|
||||
avatarUrl: avatarUrl is String? ? avatarUrl : this.avatarUrl,
|
||||
handleFixed: handleFixed ?? this.handleFixed,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
|
||||
/// Why saving or removing a public profile was refused; nothing changed.
|
||||
enum ProfileRefusal implements _isc.SerializableModel {
|
||||
/// The handle isn't 1 to 30 letters (a to z), digits or underscores.
|
||||
handleInvalid,
|
||||
|
||||
/// The handle is kept for the instance (`admin`, `support`, …).
|
||||
handleReserved,
|
||||
|
||||
/// Someone else has the handle, whatever its case.
|
||||
handleTaken,
|
||||
|
||||
/// The person has published: their handle can't change, nor their profile
|
||||
/// go, any more.
|
||||
published,
|
||||
|
||||
/// The display name is longer than 30 characters.
|
||||
displayNameTooLong,
|
||||
|
||||
/// The bio is longer than 500 characters.
|
||||
bioTooLong,
|
||||
|
||||
/// More than 4 links.
|
||||
tooManyLinks,
|
||||
|
||||
/// A link isn't an absolute HTTP(S) URL of at most 2,000 characters.
|
||||
linkInvalid,
|
||||
|
||||
/// The avatar isn't a PNG of at most 1 MB.
|
||||
avatarInvalid,
|
||||
|
||||
/// The links were checked too often in the last hour.
|
||||
tooManyLinkChecks;
|
||||
|
||||
static ProfileRefusal fromJson(String name) {
|
||||
switch (name) {
|
||||
case 'handleInvalid':
|
||||
return ProfileRefusal.handleInvalid;
|
||||
case 'handleReserved':
|
||||
return ProfileRefusal.handleReserved;
|
||||
case 'handleTaken':
|
||||
return ProfileRefusal.handleTaken;
|
||||
case 'published':
|
||||
return ProfileRefusal.published;
|
||||
case 'displayNameTooLong':
|
||||
return ProfileRefusal.displayNameTooLong;
|
||||
case 'bioTooLong':
|
||||
return ProfileRefusal.bioTooLong;
|
||||
case 'tooManyLinks':
|
||||
return ProfileRefusal.tooManyLinks;
|
||||
case 'linkInvalid':
|
||||
return ProfileRefusal.linkInvalid;
|
||||
case 'avatarInvalid':
|
||||
return ProfileRefusal.avatarInvalid;
|
||||
case 'tooManyLinkChecks':
|
||||
return ProfileRefusal.tooManyLinkChecks;
|
||||
default:
|
||||
throw ArgumentError(
|
||||
'Value "$name" cannot be converted to "ProfileRefusal"',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String toJson() => name;
|
||||
|
||||
@override
|
||||
String toString() => name;
|
||||
}
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
import '../profile/profile_refusal.dart' as _i5pl5k19;
|
||||
|
||||
/// Saving or removing a public profile was refused; nothing changed.
|
||||
abstract class ProfileRefusedException
|
||||
implements
|
||||
_isc.SerializableException,
|
||||
_isc.SerializableModel,
|
||||
_isc.ProtocolSerialization {
|
||||
ProfileRefusedException._({required this.reason});
|
||||
|
||||
factory ProfileRefusedException({required _i5pl5k19.ProfileRefusal reason}) =
|
||||
_ProfileRefusedExceptionImpl;
|
||||
|
||||
factory ProfileRefusedException.fromJson(
|
||||
Map<String, dynamic> jsonSerialization,
|
||||
) {
|
||||
return ProfileRefusedException(
|
||||
reason: _i5pl5k19.ProfileRefusal.fromJson(
|
||||
(jsonSerialization['reason'] as String),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Why it was refused.
|
||||
_i5pl5k19.ProfileRefusal reason;
|
||||
|
||||
/// Returns a shallow copy of this [ProfileRefusedException]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
ProfileRefusedException copyWith({_i5pl5k19.ProfileRefusal? reason});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'__className__': 'ProfileRefusedException',
|
||||
'reason': reason.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJsonForProtocol() {
|
||||
return {
|
||||
'__className__': 'ProfileRefusedException',
|
||||
'reason': reason.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProfileRefusedException(reason: $reason)';
|
||||
}
|
||||
}
|
||||
|
||||
class _ProfileRefusedExceptionImpl extends ProfileRefusedException {
|
||||
_ProfileRefusedExceptionImpl({required _i5pl5k19.ProfileRefusal reason})
|
||||
: super._(reason: reason);
|
||||
|
||||
/// Returns a shallow copy of this [ProfileRefusedException]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
@override
|
||||
ProfileRefusedException copyWith({_i5pl5k19.ProfileRefusal? reason}) {
|
||||
return ProfileRefusedException(reason: reason ?? this.reason);
|
||||
}
|
||||
}
|
||||
|
|
@ -82,9 +82,6 @@ import 'note/note.dart' as _i9njjhyv;
|
|||
import 'note/note_revision.dart' as _i6j5dng4;
|
||||
import 'pdf_source/pdf_reading.dart' as _i4l20c7i;
|
||||
import 'pdf_source/pdf_source.dart' as _iz838ro9;
|
||||
import 'profile/profile.dart' as _ia5j8fch;
|
||||
import 'profile/profile_refusal.dart' as _i6j6efd1;
|
||||
import 'profile/profile_refused_exception.dart' as _idvc5e7p;
|
||||
import 'publish/publication.dart' as _i9o1kyhh;
|
||||
import 'publish/publish_refusal.dart' as _iofgvwaa;
|
||||
import 'publish/publish_refused_exception.dart' as _itdn8966;
|
||||
|
|
@ -140,9 +137,6 @@ export 'note/note.dart';
|
|||
export 'note/note_revision.dart';
|
||||
export 'pdf_source/pdf_reading.dart';
|
||||
export 'pdf_source/pdf_source.dart';
|
||||
export 'profile/profile.dart';
|
||||
export 'profile/profile_refusal.dart';
|
||||
export 'profile/profile_refused_exception.dart';
|
||||
export 'publish/publication.dart';
|
||||
export 'publish/publish_refusal.dart';
|
||||
export 'publish/publish_refused_exception.dart';
|
||||
|
|
@ -2438,15 +2432,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
if (t == _iz838ro9.PdfSource) {
|
||||
return _iz838ro9.PdfSource.fromJson(data) as T;
|
||||
}
|
||||
if (t == _ia5j8fch.Profile) {
|
||||
return _ia5j8fch.Profile.fromJson(data) as T;
|
||||
}
|
||||
if (t == _i6j6efd1.ProfileRefusal) {
|
||||
return _i6j6efd1.ProfileRefusal.fromJson(data) as T;
|
||||
}
|
||||
if (t == _idvc5e7p.ProfileRefusedException) {
|
||||
return _idvc5e7p.ProfileRefusedException.fromJson(data) as T;
|
||||
}
|
||||
if (t == _i9o1kyhh.Publication) {
|
||||
return _i9o1kyhh.Publication.fromJson(data) as T;
|
||||
}
|
||||
|
|
@ -2654,19 +2639,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
if (t == _isc.getType<_iz838ro9.PdfSource?>()) {
|
||||
return (data != null ? _iz838ro9.PdfSource.fromJson(data) : null) as T;
|
||||
}
|
||||
if (t == _isc.getType<_ia5j8fch.Profile?>()) {
|
||||
return (data != null ? _ia5j8fch.Profile.fromJson(data) : null) as T;
|
||||
}
|
||||
if (t == _isc.getType<_i6j6efd1.ProfileRefusal?>()) {
|
||||
return (data != null ? _i6j6efd1.ProfileRefusal.fromJson(data) : null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_idvc5e7p.ProfileRefusedException?>()) {
|
||||
return (data != null
|
||||
? _idvc5e7p.ProfileRefusedException.fromJson(data)
|
||||
: null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_i9o1kyhh.Publication?>()) {
|
||||
return (data != null ? _i9o1kyhh.Publication.fromJson(data) : null) as T;
|
||||
}
|
||||
|
|
@ -2737,12 +2709,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
.toList()
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<List<String>?>()) {
|
||||
return (data != null
|
||||
? (data as List).map((e) => deserialize<String>(e)).toList()
|
||||
: null)
|
||||
as T;
|
||||
}
|
||||
if (t == List<_i7kd0wkp.ReleaseInfo>) {
|
||||
return (data as List)
|
||||
.map((e) => deserialize<_i7kd0wkp.ReleaseInfo>(e))
|
||||
|
|
@ -2877,9 +2843,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
_i6j5dng4.NoteRevision => 'NoteRevision',
|
||||
_i4l20c7i.PdfReading => 'PdfReading',
|
||||
_iz838ro9.PdfSource => 'PdfSource',
|
||||
_ia5j8fch.Profile => 'Profile',
|
||||
_i6j6efd1.ProfileRefusal => 'ProfileRefusal',
|
||||
_idvc5e7p.ProfileRefusedException => 'ProfileRefusedException',
|
||||
_i9o1kyhh.Publication => 'Publication',
|
||||
_iofgvwaa.PublishRefusal => 'PublishRefusal',
|
||||
_itdn8966.PublishRefusedException => 'PublishRefusedException',
|
||||
|
|
@ -2996,12 +2959,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
return 'PdfReading';
|
||||
case _iz838ro9.PdfSource():
|
||||
return 'PdfSource';
|
||||
case _ia5j8fch.Profile():
|
||||
return 'Profile';
|
||||
case _i6j6efd1.ProfileRefusal():
|
||||
return 'ProfileRefusal';
|
||||
case _idvc5e7p.ProfileRefusedException():
|
||||
return 'ProfileRefusedException';
|
||||
case _i9o1kyhh.Publication():
|
||||
return 'Publication';
|
||||
case _iofgvwaa.PublishRefusal():
|
||||
|
|
@ -3188,15 +3145,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
if (dataClassName == 'PdfSource') {
|
||||
return deserialize<_iz838ro9.PdfSource>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'Profile') {
|
||||
return deserialize<_ia5j8fch.Profile>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'ProfileRefusal') {
|
||||
return deserialize<_i6j6efd1.ProfileRefusal>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'ProfileRefusedException') {
|
||||
return deserialize<_idvc5e7p.ProfileRefusedException>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'Publication') {
|
||||
return deserialize<_i9o1kyhh.Publication>(data['data']);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue