setTopicMastery method
Advance a topic's mastery through the server-side authorization RPC
(set_topic_mastery, migration 071). Direct writes to the mastery
column are blocked by a DB trigger, so mastery must never be written via
updateProgress. The RPC re-derives the allowed transition from
source — one of 'awareness', 'session', 'validation', or
'override' — and throws (PostgrestException) if the transition is not
permitted. sessionId is required for the 'session' and 'validation'
sources.
Implementation
Future<void> setTopicMastery({
required String topicId,
required String target,
required String source,
String? sessionId,
}) async {
await _client.rpc(
'set_topic_mastery',
params: {
'p_topic_id': topicId,
'p_target': target,
'p_source': source,
'p_session_id': sessionId,
},
);
}