upsertRoleSkillExpectations method
Implementation
Future<void> upsertRoleSkillExpectations(
String roleProfileId,
List<({String skillId, int expectedMastery})> expectations,
) async {
// Delete existing, then insert new set
await _client
.from('role_skill_expectations')
.delete()
.eq('role_profile_id', roleProfileId);
if (expectations.isEmpty) return;
final rows = expectations
.map(
(e) => {
'role_profile_id': roleProfileId,
'skill_id': e.skillId,
'expected_mastery': e.expectedMastery,
},
)
.toList();
await _client.from('role_skill_expectations').insert(rows);
}