upsertPathSteps method
- String pathId,
- List<
LearningPathStepModel> steps
Implementation
Future<void> upsertPathSteps(
String pathId,
List<LearningPathStepModel> steps,
) async {
// Delete existing steps then batch insert — simpler than individual upserts
// when positions may have changed.
await _client.from('learning_path_steps').delete().eq('path_id', pathId);
if (steps.isNotEmpty) {
await _client
.from('learning_path_steps')
.insert(steps.map((s) => s.toInsertJson()).toList());
}
}