toulouse-maelis: rename person schemas (#71646)
This commit is contained in:
parent
2fbdbf19d7
commit
5e06fb43a2
|
@ -845,7 +845,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
||||||
parameters={
|
parameters={
|
||||||
'NameID': {'description': 'Publik NameID'},
|
'NameID': {'description': 'Publik NameID'},
|
||||||
},
|
},
|
||||||
post={'request_body': {'schema': {'application/json': schemas.FAMILYPERSON_SCHEMA}}},
|
post={'request_body': {'schema': {'application/json': schemas.EMERGENCY_PERSON_SCHEMA}}},
|
||||||
)
|
)
|
||||||
def create_person(self, request, NameID, post_data):
|
def create_person(self, request, NameID, post_data):
|
||||||
family_id = self.get_link(NameID).family_id
|
family_id = self.get_link(NameID).family_id
|
||||||
|
@ -876,7 +876,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
||||||
'NameID': {'description': 'Publik NameID'},
|
'NameID': {'description': 'Publik NameID'},
|
||||||
'person_id': {'description': 'Numéro de la personne'},
|
'person_id': {'description': 'Numéro de la personne'},
|
||||||
},
|
},
|
||||||
post={'request_body': {'schema': {'application/json': schemas.FAMILYPERSON_SCHEMA}}},
|
post={'request_body': {'schema': {'application/json': schemas.EMERGENCY_PERSON_SCHEMA}}},
|
||||||
)
|
)
|
||||||
def update_person(self, request, NameID, person_id, post_data):
|
def update_person(self, request, NameID, person_id, post_data):
|
||||||
family_id = self.get_link(NameID).family_id
|
family_id = self.get_link(NameID).family_id
|
||||||
|
@ -952,7 +952,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
||||||
'NameID': {'description': 'Publik NameID'},
|
'NameID': {'description': 'Publik NameID'},
|
||||||
'child_id': {'description': "Numéro de l'enfant"},
|
'child_id': {'description': "Numéro de l'enfant"},
|
||||||
},
|
},
|
||||||
post={'request_body': {'schema': {'application/json': schemas.CHILDPERSON2_SCHEMA}}},
|
post={'request_body': {'schema': {'application/json': schemas.AUTHORIZED_PERSON_SCHEMA}}},
|
||||||
)
|
)
|
||||||
def create_child_person(self, request, NameID, child_id, post_data):
|
def create_child_person(self, request, NameID, child_id, post_data):
|
||||||
family_id = self.get_link(NameID).family_id
|
family_id = self.get_link(NameID).family_id
|
||||||
|
@ -981,7 +981,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
||||||
'child_id': {'description': "Numéro de l'enfant"},
|
'child_id': {'description': "Numéro de l'enfant"},
|
||||||
'person_id': {'description': 'Numéro de la personne'},
|
'person_id': {'description': 'Numéro de la personne'},
|
||||||
},
|
},
|
||||||
post={'request_body': {'schema': {'application/json': schemas.CHILDPERSON2_SCHEMA}}},
|
post={'request_body': {'schema': {'application/json': schemas.AUTHORIZED_PERSON_SCHEMA}}},
|
||||||
)
|
)
|
||||||
def update_child_person(self, request, NameID, child_id, person_id, post_data):
|
def update_child_person(self, request, NameID, child_id, person_id, post_data):
|
||||||
family_id = self.get_link(NameID).family_id
|
family_id = self.get_link(NameID).family_id
|
||||||
|
|
|
@ -66,6 +66,110 @@ ISEXISTS_SCHEMA = {
|
||||||
'additionalProperties': False,
|
'additionalProperties': False,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CONTACTLIGHT_SCHEMA = {
|
||||||
|
'$schema': 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title': 'Contact light',
|
||||||
|
'description': "Informations de contact pour les personnes autorisées à récupérer les enfants ou à prévenir en cas d'urgence",
|
||||||
|
'type': 'object',
|
||||||
|
'properties': {
|
||||||
|
'phone': {
|
||||||
|
'description': 'Téléphone',
|
||||||
|
'oneOf': [{'type': 'string'}, {'type': 'null'}],
|
||||||
|
},
|
||||||
|
'mobile': {
|
||||||
|
'description': 'Portable',
|
||||||
|
'oneOf': [{'type': 'string'}, {'type': 'null'}],
|
||||||
|
},
|
||||||
|
'mail': {
|
||||||
|
'description': 'Mail',
|
||||||
|
'oneOf': [{'type': 'string'}, {'type': 'null'}],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PERSON_PROPERTIES = {
|
||||||
|
'civility': {
|
||||||
|
'description': 'civilité (depuis référentiel)',
|
||||||
|
'oneOf': [{'type': 'string'}, {'type': 'null'}],
|
||||||
|
},
|
||||||
|
'sexe': {
|
||||||
|
'description': 'Sexe (depuis référentiel)',
|
||||||
|
'oneOf': [{'type': 'string'}, {'type': 'null'}],
|
||||||
|
},
|
||||||
|
'contact': {'oneOf': [CONTACTLIGHT_SCHEMA, {'type': 'null'}]},
|
||||||
|
}
|
||||||
|
PERSON_PROPERTIES.update(BASIC_ID_PROPERTIES)
|
||||||
|
|
||||||
|
|
||||||
|
EMERGENCY_PERSON_SCHEMA = {
|
||||||
|
'$schema': 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title': 'Emergency person',
|
||||||
|
'description': "Personnes à prévenir en cas d'urgence",
|
||||||
|
'type': 'object',
|
||||||
|
'required': ['firstname', 'lastname', 'dateBirth', 'quality'],
|
||||||
|
'properties': {
|
||||||
|
'quality': {
|
||||||
|
'description': 'Qualité',
|
||||||
|
'type': 'string',
|
||||||
|
'pattern': '.+',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'unflatten': True,
|
||||||
|
'additionalProperties': False,
|
||||||
|
}
|
||||||
|
EMERGENCY_PERSON_SCHEMA['properties'].update(PERSON_PROPERTIES)
|
||||||
|
|
||||||
|
|
||||||
|
EMERGENCY_PERSON_LIST_SCHEMA = {
|
||||||
|
'$schema': 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title': 'Family persons',
|
||||||
|
'description': "Liste des personnes à prévenir en cas d'urgence",
|
||||||
|
'type': 'object',
|
||||||
|
'properties': {
|
||||||
|
'personList': {
|
||||||
|
'oneOf': [
|
||||||
|
{
|
||||||
|
'type': 'array',
|
||||||
|
'items': EMERGENCY_PERSON_SCHEMA,
|
||||||
|
},
|
||||||
|
{'type': 'null'},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
AUTHORIZED_PERSON_SCHEMA = {
|
||||||
|
'$schema': 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title': 'Family persons',
|
||||||
|
'description': "Personnes autorisées à venir chercher l'enfant",
|
||||||
|
'type': 'object',
|
||||||
|
'required': ['personInfo', 'personQuality'],
|
||||||
|
'properties': {
|
||||||
|
'personInfo': {
|
||||||
|
'type': 'object',
|
||||||
|
'required': ['firstname', 'lastname', 'dateBirth'],
|
||||||
|
'properties': PERSON_PROPERTIES,
|
||||||
|
},
|
||||||
|
'personQuality': {
|
||||||
|
'type': 'object',
|
||||||
|
'required': ['code'],
|
||||||
|
'properties': {
|
||||||
|
'code': {
|
||||||
|
'description': 'Le code (depuis référentiel)',
|
||||||
|
'type': 'string',
|
||||||
|
'pattern': '.+',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'additionalProperties': False,
|
||||||
|
'unflatten': True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BIRTH_SCHEMA = {
|
BIRTH_SCHEMA = {
|
||||||
'$schema': 'http://json-schema.org/draft-04/schema#',
|
'$schema': 'http://json-schema.org/draft-04/schema#',
|
||||||
'title': 'Birth info',
|
'title': 'Birth info',
|
||||||
|
@ -453,72 +557,6 @@ CHILD_SCHEMA = {
|
||||||
}
|
}
|
||||||
CHILD_SCHEMA['properties'].update(ID_PROPERTIES)
|
CHILD_SCHEMA['properties'].update(ID_PROPERTIES)
|
||||||
|
|
||||||
CONTACTLIGHT_SCHEMA = {
|
|
||||||
'$schema': 'http://json-schema.org/draft-04/schema#',
|
|
||||||
'title': 'Contact light',
|
|
||||||
'description': "Informations de contact pour les personnes autorisées à récupérer les enfants ou à prévenir en cas d'urgence",
|
|
||||||
'type': 'object',
|
|
||||||
'properties': {
|
|
||||||
'phone': {
|
|
||||||
'description': 'Téléphone',
|
|
||||||
'oneOf': [{'type': 'string'}, {'type': 'null'}],
|
|
||||||
},
|
|
||||||
'mobile': {
|
|
||||||
'description': 'Portable',
|
|
||||||
'oneOf': [{'type': 'string'}, {'type': 'null'}],
|
|
||||||
},
|
|
||||||
'mail': {
|
|
||||||
'description': 'Mail',
|
|
||||||
'oneOf': [{'type': 'string'}, {'type': 'null'}],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
FAMILYPERSON_SCHEMA = {
|
|
||||||
'$schema': 'http://json-schema.org/draft-04/schema#',
|
|
||||||
'title': 'Family person',
|
|
||||||
'description': "Informations sur les personnes autorisées à venir chercher les enfants ou à prévenir en cas d'urgence",
|
|
||||||
'type': 'object',
|
|
||||||
'required': ['firstname', 'lastname', 'dateBirth', 'quality'],
|
|
||||||
'properties': {
|
|
||||||
'civility': {
|
|
||||||
'description': 'civilité (depuis référentiel)',
|
|
||||||
'oneOf': [{'type': 'string'}, {'type': 'null'}],
|
|
||||||
},
|
|
||||||
'quality': {
|
|
||||||
'description': 'Qualité',
|
|
||||||
'type': 'string',
|
|
||||||
'pattern': '.+',
|
|
||||||
},
|
|
||||||
'sexe': {
|
|
||||||
'description': 'Sexe (depuis référentiel)',
|
|
||||||
'oneOf': [{'type': 'string'}, {'type': 'null'}],
|
|
||||||
},
|
|
||||||
'contact': {'oneOf': [CONTACTLIGHT_SCHEMA, {'type': 'null'}]},
|
|
||||||
},
|
|
||||||
'unflatten': True,
|
|
||||||
'additionalProperties': False,
|
|
||||||
}
|
|
||||||
FAMILYPERSON_SCHEMA['properties'].update(BASIC_ID_PROPERTIES)
|
|
||||||
|
|
||||||
AUTHORIZEDPERSON_SCHEMA = {
|
|
||||||
'$schema': 'http://json-schema.org/draft-04/schema#',
|
|
||||||
'title': 'Family persons',
|
|
||||||
'description': "Informations sur les personnes autorisées à venir chercher les enfants ou à prévenir en cas d'urgence",
|
|
||||||
'type': 'object',
|
|
||||||
'properties': {
|
|
||||||
'personList': {
|
|
||||||
'oneOf': [
|
|
||||||
{
|
|
||||||
'type': 'array',
|
|
||||||
'items': FAMILYPERSON_SCHEMA,
|
|
||||||
},
|
|
||||||
{'type': 'null'},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
UPDATE_FAMILY_SCHEMA = {
|
UPDATE_FAMILY_SCHEMA = {
|
||||||
'$schema': 'http://json-schema.org/draft-04/schema#',
|
'$schema': 'http://json-schema.org/draft-04/schema#',
|
||||||
'title': 'Family',
|
'title': 'Family',
|
||||||
|
@ -558,7 +596,7 @@ UPDATE_FAMILY_SCHEMA = {
|
||||||
'oneOf': [
|
'oneOf': [
|
||||||
{
|
{
|
||||||
'type': 'array',
|
'type': 'array',
|
||||||
'items': AUTHORIZEDPERSON_SCHEMA,
|
'items': EMERGENCY_PERSON_LIST_SCHEMA,
|
||||||
},
|
},
|
||||||
{'type': 'null'},
|
{'type': 'null'},
|
||||||
],
|
],
|
||||||
|
@ -626,35 +664,3 @@ UPDATE_COORDINATE_SCHEMA = {
|
||||||
'unflatten': True,
|
'unflatten': True,
|
||||||
'additionalProperties': False,
|
'additionalProperties': False,
|
||||||
}
|
}
|
||||||
|
|
||||||
CHILDPERSON_SCHEMA = copy.deepcopy(FAMILYPERSON_SCHEMA)
|
|
||||||
CHILDPERSON_SCHEMA['required'] = ['firstname', 'lastname', 'dateBirth']
|
|
||||||
del CHILDPERSON_SCHEMA['properties']['quality']
|
|
||||||
|
|
||||||
PERSONQUALITY_SCHEMA = {
|
|
||||||
'$schema': 'http://json-schema.org/draft-04/schema#',
|
|
||||||
'title': 'Child person quality',
|
|
||||||
'description': "Informations sur la qualité des personnes autorisées à venir chercher l'enfant",
|
|
||||||
'type': 'object',
|
|
||||||
'required': ['code'],
|
|
||||||
'properties': {
|
|
||||||
'code': {
|
|
||||||
'description': 'Le code (depuis référentiel)',
|
|
||||||
'type': 'string',
|
|
||||||
'pattern': '.+',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
CHILDPERSON2_SCHEMA = {
|
|
||||||
'$schema': 'http://json-schema.org/draft-04/schema#',
|
|
||||||
'title': 'Family persons',
|
|
||||||
'description': "Informations sur les personnes autorisées à venir chercher l'enfant avec leur qualité",
|
|
||||||
'type': 'object',
|
|
||||||
'required': ['personInfo', 'personQuality'],
|
|
||||||
'properties': {
|
|
||||||
'personInfo': CHILDPERSON_SCHEMA,
|
|
||||||
'personQuality': PERSONQUALITY_SCHEMA,
|
|
||||||
},
|
|
||||||
'unflatten': True,
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue