Skip to content

Commit

Permalink
feat: add dataset destination management in fieldmapping service + mi…
Browse files Browse the repository at this point in the history
…gration
  • Loading branch information
edelclaux committed Dec 17, 2024
1 parent d83e804 commit 64ef6d2
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
"""[monitorings] Adjust gn.imports bib_fields id_dataset and unique_id_dataset values
Revision ID: a43842db7ac1
Revises: 2b0b3bd0248c
Create Date: 2024-12-17 11:18:07.806852
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'a43842db7ac1'
down_revision = '2b0b3bd0248c'
branch_labels = None
depends_on = None

def upgrade():
op.execute(
"""
UPDATE gn_imports.bib_fields
SET display = TRUE,
mandatory = TRUE,
optional_conditions = '{"unique_dataset_id"}',
type_field = 'dataset',
type_field_params = '{"bind_value": "id_dataset"}'
WHERE name_field = 'id_dataset'
"""
)
op.execute(
"""
UPDATE gn_imports.bib_fields
SET display = TRUE,
mandatory = TRUE,
optional_conditions = '{"id_dataset"}',
type_field = 'dataset',
type_field_params = '{"bind_value": "unique_dataset_id"}'
WHERE name_field = 'unique_dataset_id'
"""
)


def downgrade():
op.execute(
"""
UPDATE gn_imports.bib_fields
SET display = FALSE,
mandatory = FALSE,
optional_conditions = NULL,
type_field = 'text',
type_field_params = NULL
WHERE name_field = 'id_dataset'
"""
)
op.execute(
"""
UPDATE gn_imports.bib_fields
SET display = FALSE,
mandatory = FALSE,
optional_conditions = NULL,
type_field = 'text',
type_field_params = NULL
WHERE name_field = 'unique_dataset_id'
"""
)
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,10 @@ export class FieldMappingService {
type_widget: 'textarea',
};
}
if(field.type_field == 'dataset'){
const module_code = this._importProcessService.getImportData().destination?.module.module_code;
def.creatable_in_module = module_code,
}

return {
...def,
Expand Down

0 comments on commit 64ef6d2

Please sign in to comment.