feat(import): allow org editors to import DEAs with org assignment#112
Open
feat(import): allow org editors to import DEAs with org assignment#112
Conversation
Organization editors (can_edit=true) can now use the CSV import at /admin/imports. Imported DEAs are automatically associated with the importing organization via AedOrganizationAssignment, and the assignment type (OWNERSHIP, MAINTENANCE, VERIFICATION) is configurable during import. Backend: - Extend canImportAeds permission to include org editors - Add requireImportPermission() auth helper - GET /api/import filters by org for non-admins - POST /api/import accepts organizationId + assignmentType - PrismaStateStore persists organization_id on BatchJob - aedRecordProcessor creates AedOrganizationAssignment in transaction - Resume/cancel routes verify org membership Frontend: - Admin imports page accessible to org editors with badge - ImportWizard: org selector + assignment type dropdown No DB migration needed — BatchJob.organization_id already exists. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Add test users with working passwords (123456) and org memberships: - editor@deamap.es → SAMUR - Protección Civil (can_edit) - verificador@deamap.es → SAMUR - Protección Civil (can_edit + can_verify) These users allow testing the org editor import flow on branch DBs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Assignment type is now auto-derived from the organization's type (e.g., CIVIL_PROTECTION org → CIVIL_PROTECTION assignment). Only global admins can override this via a dropdown selector. - Add "Importar" link to main navigation (visible when canImportAeds) - Add "Importar DEAs" quick action to org dashboard for editors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
can_edit=true) ahora pueden usar la importación CSV en/admin/importsAedOrganizationAssignmentCambios
Backend (6 archivos)
auth.ts: Nueva funciónrequireImportPermission()— valida admin o miembro de org concan_edit/api/auth/me:canImportAedsahora incluye editores de org/api/importGET: Filtra por organización para no-admins/api/importPOST: AceptaorganizationId+assignmentTypePrismaStateStore: Persisteorganization_iden el BatchJobBulkImportService: Propaga contexto organizacional al state store y processoraedRecordProcessor: CreaAedOrganizationAssignmenten la misma transacción que el AEDFrontend (2 archivos)
admin/imports/page.tsx: Accesible para editores de org, muestra badge de organizaciónImportWizard.tsx: Selector de organización (auto-seleccionado si solo tiene una) + dropdown de tipo de asignaciónSin migración DB
BatchJob.organization_idya existe en el schema.Test plan
can_edit: importar → org auto-seleccionada → seleccionar assignmentType → importar → verificar assignment🤖 Generated with Claude Code