diff --git a/passerelle/contrib/toulouse_foederis/models.py b/passerelle/contrib/toulouse_foederis/models.py index 7bd00001..a7f45f51 100644 --- a/passerelle/contrib/toulouse_foederis/models.py +++ b/passerelle/contrib/toulouse_foederis/models.py @@ -240,25 +240,25 @@ APPLICATION_SCHEMA = { 'type': 'string', }, 'rgpd_agreement': boolean_field(_('RGPD agreement.')), - 'job_type': { - 'description': _("ID of an element of the data source 'type-emploi'."), - 'type': 'string', - 'pattern': '^[0-9]*$', + 'job_types': { + 'description': _("IDs of elements of the data source 'type-emploi'."), + 'type': 'array', + 'items': {'type': 'string', 'pattern': '^[0-9]*$'}, }, - 'job_realm': { - 'description': _("ID of an element of the data source 'domaine-emploi'."), - 'type': 'string', - 'pattern': '^[0-9]*$', + 'job_realms': { + 'description': _("IDs of elements of the data source 'domaine-emploi'."), + 'type': 'array', + 'items': {'type': 'string', 'pattern': '^[0-9]*$'}, }, - 'job_family': { - 'description': _("ID of an element of the data source 'sous-domaine-emploi'."), - 'type': 'string', - 'pattern': '^[0-9]*$', + 'job_families': { + 'description': _("IDs of elements of the data source 'sous-domaine-emploi'."), + 'type': 'array', + 'items': {'type': 'string', 'pattern': '^[0-9]*$'}, }, - 'job': { - 'description': _("ID of an element of the data source 'emploi'."), - 'type': 'string', - 'pattern': '^[0-9]*$', + 'jobs': { + 'description': _("IDs of elements of the data source 'emploi'."), + 'type': 'array', + 'items': {'type': 'string', 'pattern': '^[0-9]*$'}, }, 'desired_work_time': { 'description': _('TC / TNC.'), @@ -611,10 +611,12 @@ class Resource(BaseResource, HTTPResource): self.REFERENTIELS_FKEYS['origine_candidature']: _get_id('origin'), 'precision_origine_candidature': post_data.get('origin_precisions', None), 'accord_RGPD': get_bool(post_data.get('rgpd_agreement', False)), - self.REFERENTIELS_FKEYS['type_emploi']: _get_id('job_type'), - self.REFERENTIELS_FKEYS['domaine_emploi']: _get_id('job_realm'), - self.REFERENTIELS_FKEYS['sous_domaine_emploi']: _get_id('job_family'), - self.REFERENTIELS_FKEYS['emploi']: _get_id('job'), + self.REFERENTIELS_FKEYS['type_emploi']: [int(id) for id in post_data.get('job_types', [])], + self.REFERENTIELS_FKEYS['domaine_emploi']: [int(id) for id in post_data.get('job_realms', [])], + self.REFERENTIELS_FKEYS['sous_domaine_emploi']: [ + int(id) for id in post_data.get('job_families', []) + ], + self.REFERENTIELS_FKEYS['emploi']: [int(id) for id in post_data.get('jobs', [])], 'temps_de_travail_souhaite': post_data.get('desired_work_time', None), 'duree_du_contrat_de_stage_apprentissage': post_data.get('internship_duration', None), 'ecole_centre_de_formation_mission_loc': post_data.get('school_name', None), diff --git a/tests/test_toulouse_foederis.py b/tests/test_toulouse_foederis.py index dc458b7e..5469e327 100644 --- a/tests/test_toulouse_foederis.py +++ b/tests/test_toulouse_foederis.py @@ -442,9 +442,10 @@ class TestEndpoints: "complement_information_candidature": "I need money.", "R1261279": 1561049, "accord_RGPD": True, - "R1249707": 157193, - "R60845221": 5776395, - "R60845244": 5776394, + "R1249707": [157193, 157194], + "R60845221": [5776395, 5776396], + "R60845244": [5776394, 5776395], + "R15017962": [], "temps_de_travail_souhaite": "TC", "duree_du_contrat_de_stage_apprentissage": "2h", "ecole_centre_de_formation_mission_loc": "Ecole de la vie", @@ -490,9 +491,9 @@ class TestEndpoints: "first_name": "John", "gender": "H", "internship_duration": "2h", - "job_family": "5776394", - "job_realm": "5776395", - "job_type": "157193", + "job_families": ["5776394", "5776395"], + "job_realms": ["5776395", "5776396"], + "job_types": ["157193", "157194"], "last_course_taken": "Terminale", "last_name": "Doe", "last_obtained_diploma": "BAC",