Lewati ke isi

T3-W02 Import Contract

Supported path

  • Sync: POST /api/v1/admin/import/students-with-parents
  • Async job: …/job + …/job/status
  • Capability: students.manage
  • FE: UploadSiswa.vue, TambahSiswa.vue (single/multi row via same API)

Columns (core)

Student: full_name (required), nickname, nsn, nid, sic, gender, birth_date, mobile, email, street, city, zip, religion, blood_group, place_of_birth

Parent (optional per row): parent_name, parent_mobile, parent_email, relationship, family_group_id

Enrollment: - per-row batch_id (alias classroom) — preferred for manual TambahSiswa; - and/or global options.assign_to_batch_id (applies when row has no batch).

Options

Option Default (BE) Meaning
dry_run false validate only
strict_mode true pre-validation errors abort entire import
create_accounts false skip auto user creation (scola_skip_student_user_creation)
assign_to_batch_id none enroll all successful students into batch (company-checked)
idempotency_key job path dedupe enqueue

Transaction policy (Product freeze for W02)

Declared Core policy: ROW_ATOMIC for persistence + explicit result

  1. Pre-validation: when strict_mode=true, any validation error → no writes (ALL_OR_NOTHING at gate).
  2. Persistence: family/student savepoints — valid groups/rows commit; failed rows roll back their savepoint; response reports success_count / error_count / per-row errors.
  3. FE Core surfaces (TambahSiswa, UploadSiswa) currently pass strict_mode: false → rely on row-atomic persistence. W02 certification will:
  4. document this as Product ROW_ATOMIC;
  5. align FE messaging to never claim full success when error_count > 0;
  6. keep BE strict_mode=true available for callers that want pre-gate abort.

Invalid row

Must leave no partial partner/student/parent/user/enrollment for that row/family savepoint.

Duplicates

Company-unique nsn/nid/sic reject duplicate creates. Repeated file must not silently create second canonical students.

Cross-tenant relations

Foreign assign_to_batch_id / scoped parents must fail closed without leaking foreign existence beyond generic validation errors.

Accounts

Default off. Enabling create_accounts must follow DEC-014; failed row must not leave orphan login (savepoint rollback).