Skip to content

[People · Phase 2] Soci register and admission #122

Description

@toto04

Goal

The Libro Soci in the backend: one record per admission, keyed on the Microsoft 365 account and the member number, with the data the association must keep. Admission moves here from azure.members.create. Phase 2: PoliNetworkOrg/admin#144, roadmap PoliNetworkOrg/admin#146. Design: docs/people/soci.md (PoliNetworkOrg/admin#154). Read it first; this issue only lists the backend's part.

Data (soci_ prefix, new src/soci/)

soci_members: never deleted. Fields:

  • number: unique, never reused.
  • entra_object_id: unique.
  • Snapshots of the mailbox and display name, kept after the account is deleted.
  • Legal first and last name; optional alias.
  • codice_fiscale: format, check digit and omocodia validated; at most one active record per code.
  • birth_date, birth_place.
  • Residence: street, postal code, city, province (Italy only), country.
  • admitted_on; ended_on, end_reason, end_note (set by the lapse issue).
  • Account state: active | pending_deletion | deleted.
  • Created / updated by and at.

soci_activity: append-only history.

Member numbers:

  • A number is free only if no record has ever held it and no Microsoft 365 user has it as employeeId.
  • Keep serializeMemberWrite and the pending-number cache for the Entra side.

The register starts empty: nothing is imported.

Procedures (soci.*)

Procedure Policy
members.list, members.get (record + activity), members.unregistered (Soci group members without a record, with their employeeId and createdDateTime) admin:access + soci:read
members.admit admin:access + soci:write
members.register (an account already in Soci; personal fields optional) admin:access + soci:write
members.update admin:access + soci:write
members.setNumber (Entra employeeId + record, optional email as today) admin:access + soci:write
  • members.admit runs today's create workflow: user with employeeId, licences, Soci group, cleanup on failure, welcome email to the typed address (not stored). Then it writes the record with every field required except the alias. If the record can't be written, it deletes the account.
  • members.list reports mismatches: an active record whose account isn't in Soci, or an ended one whose account still is.
  • Directory (Graph + mock):
    • Read createdDateTime.
    • Remove a user from Soci, add an existing user back, and delete a user, for the lapse issue.
  • Retire: once the dashboard has switched ([People · Phase 2] Soci › Register and Admit socio admin#155), remove azure.members.create and azure.members.setAssocNumber.
  • Export types: the npm package exports soci.*'s types.

Done when

  • Tables, migration, procedures and policies exist, and the contract types are exported.
  • Tests cover:
    • number reuse refused, including numbers from ended records and Entra-only numbers;
    • codice fiscale validation, and two active records with one code refused;
    • a failed record write deleting the new account;
    • register for an existing Soci account;
    • mismatches.

Activity

  1. added
    peoplePeople: Group Admins, Capo Admins, Teams, Soci and census (see the People roadmap)
    on Nov 9, 2026
  2. added theissue type on Nov 9, 2026
  3. coderabbitai commented on Nov 9, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #95 - feat(people): mirror PoliNetwork Auth roles and Microsoft 365 members [open]
    #104 - refactor(people)!: remove Soci, fees, receipts, census and record matching [closed]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    peoplePeople: Group Admins, Capo Admins, Teams, Soci and census (see the People roadmap)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions