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:
Tizian 「ティツィアーン」 2026-10-19 22:20:27 +02:00
commit 4107cc3087
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -52,10 +52,6 @@ import 'package:halkyon_learn_server/src/generated/future_calls.dart'
as _iip9210p;
import 'package:halkyon_learn_server/src/generated/instance/instance_info.dart'
as _iof1vv19;
import 'package:halkyon_learn_server/src/generated/profile/profile.dart'
as _i1bgmvyh;
import 'package:halkyon_learn_server/src/generated/profile/profile_refusal.dart'
as _igp2arco;
import 'package:halkyon_learn_server/src/generated/publish/publication.dart'
as _ieaj397n;
import 'package:serverpod/serverpod.dart' as _is;
@ -215,10 +211,6 @@ class TestEndpoints {
late final _InstanceEndpoint instance;
late final _ProfileEndpoint profile;
late final _ProfilesEndpoint profiles;
late final _PublishEndpoint publish;
}
@ -269,14 +261,6 @@ class _InternalTestEndpoints extends TestEndpoints
endpoints,
serializationManager,
);
profile = _ProfileEndpoint(
endpoints,
serializationManager,
);
profiles = _ProfilesEndpoint(
endpoints,
serializationManager,
);
publish = _PublishEndpoint(
endpoints,
serializationManager,
@ -1861,278 +1845,6 @@ class _InstanceEndpoint {
}
}
class _ProfileEndpoint {
_ProfileEndpoint(
this._endpointDispatch,
this._serializationManager,
);
final _is.EndpointDispatch _endpointDispatch;
final _is.SerializationManager _serializationManager;
_ida.Future<_i1bgmvyh.Profile?> mine(
_ist.TestSessionBuilder sessionBuilder,
) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'profile',
method: 'mine',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'profile',
methodName: 'mine',
parameters: _ist.testObjectToJson({}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<_i1bgmvyh.Profile?>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
_ida.Future<_i1bgmvyh.Profile> save(
_ist.TestSessionBuilder sessionBuilder,
String handle,
String displayName,
String bio,
List<String> links,
) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'profile',
method: 'save',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'profile',
methodName: 'save',
parameters: _ist.testObjectToJson({
'handle': handle,
'displayName': displayName,
'bio': bio,
'links': links,
}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<_i1bgmvyh.Profile>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
_ida.Future<_i1bgmvyh.Profile> checkLinks(
_ist.TestSessionBuilder sessionBuilder,
) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'profile',
method: 'checkLinks',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'profile',
methodName: 'checkLinks',
parameters: _ist.testObjectToJson({}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<_i1bgmvyh.Profile>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
_ida.Future<_igp2arco.ProfileRefusal?> checkHandle(
_ist.TestSessionBuilder sessionBuilder,
String handle,
) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'profile',
method: 'checkHandle',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'profile',
methodName: 'checkHandle',
parameters: _ist.testObjectToJson({'handle': handle}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<_igp2arco.ProfileRefusal?>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
_ida.Future<_i1bgmvyh.Profile> setAvatar(
_ist.TestSessionBuilder sessionBuilder,
_idt.ByteData png,
) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'profile',
method: 'setAvatar',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'profile',
methodName: 'setAvatar',
parameters: _ist.testObjectToJson({'png': png}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<_i1bgmvyh.Profile>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
_ida.Future<_i1bgmvyh.Profile> removeAvatar(
_ist.TestSessionBuilder sessionBuilder,
) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'profile',
method: 'removeAvatar',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'profile',
methodName: 'removeAvatar',
parameters: _ist.testObjectToJson({}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<_i1bgmvyh.Profile>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
_ida.Future<void> remove(_ist.TestSessionBuilder sessionBuilder) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'profile',
method: 'remove',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'profile',
methodName: 'remove',
parameters: _ist.testObjectToJson({}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<void>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
}
class _ProfilesEndpoint {
_ProfilesEndpoint(
this._endpointDispatch,
this._serializationManager,
);
final _is.EndpointDispatch _endpointDispatch;
final _is.SerializationManager _serializationManager;
_ida.Future<_i1bgmvyh.Profile> byHandle(
_ist.TestSessionBuilder sessionBuilder,
String handle,
) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'profiles',
method: 'byHandle',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'profiles',
methodName: 'byHandle',
parameters: _ist.testObjectToJson({'handle': handle}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<_i1bgmvyh.Profile>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
}
class _PublishEndpoint {
_PublishEndpoint(
this._endpointDispatch,