13/11/2023 - 12h30

master
cherif 2023-11-13 12:50:19 +01:00
parent 979c2e5f37
commit fa3f2163cf
4 changed files with 3285 additions and 12 deletions

View File

@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="11/11/2023 - 17h">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="11/11/2023 - 23h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/agenda.py" beforeDir="false" afterPath="$PROJECT_DIR$/agenda.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -72,13 +75,6 @@
<option name="presentableId" value="Default" />
<updated>1680804787304</updated>
</task>
<task id="LOCAL-00095" summary="05/09/23 - 14h30">
<created>1693917146195</created>
<option name="number" value="00095" />
<option name="presentableId" value="LOCAL-00095" />
<option name="project" value="LOCAL" />
<updated>1693917146195</updated>
</task>
<task id="LOCAL-00096" summary="05/09/23 - 20h30">
<created>1693939153001</created>
<option name="number" value="00096" />
@ -415,7 +411,14 @@
<option name="project" value="LOCAL" />
<updated>1699718029739</updated>
</task>
<option name="localTasksCounter" value="144" />
<task id="LOCAL-00144" summary="11/11/2023 - 23h">
<created>1699740510545</created>
<option name="number" value="00144" />
<option name="presentableId" value="LOCAL-00144" />
<option name="project" value="LOCAL" />
<updated>1699740510546</updated>
</task>
<option name="localTasksCounter" value="145" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -430,7 +433,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="30/09/2023 - 18h" />
<MESSAGE value="30/09/2023 - 19h" />
<MESSAGE value="01/10/2023 - 23h" />
<MESSAGE value="02/10/2023 - 11h" />
@ -455,6 +457,7 @@
<MESSAGE value="09/11/2023 - 23h" />
<MESSAGE value="sdds" />
<MESSAGE value="11/11/2023 - 17h" />
<option name="LAST_COMMIT_MESSAGE" value="11/11/2023 - 17h" />
<MESSAGE value="11/11/2023 - 23h" />
<option name="LAST_COMMIT_MESSAGE" value="11/11/2023 - 23h" />
</component>
</project>

File diff suppressed because it is too large Load Diff

View File

@ -158,7 +158,7 @@ def Add_Update_Agenda_Event(diction):
"""
Recuperation de la liste des agenda (draft)
Recuperation de la liste des agenda
"""
def get_Agenda_Event_List(diction):
try:
@ -293,3 +293,70 @@ def Delete_Agenda_Event(diction):
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible d'ajouter ou mettre à jour l'événement "
"""
Cette fonction prends un id (_id de object), le type de ressource (employé ou materiel)
et retourn les données de lobjet
"""
def get_Ressource_Info_Data(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'related_collection', 'related_collection_recid']
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list and val.startswith('my_') is False:
mycommon.myprint(str(
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
return False, " Les informations fournies sont incorrectes",
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'related_collection', 'related_collection_recid']
for val in field_list_obligatoire:
if val not in diction:
mycommon.myprint(
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
return False, " Les informations fournies sont incorrectes",
"""
Verification de l'identité et autorisation de l'entité qui
appelle cette API
"""
token = ""
if ("token" in diction.keys()):
if diction['token']:
token = diction['token']
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
if (local_status is not True):
return local_status, my_partner
RetObject = []
val_tmp = 1
qry = MYSY_GV.dbname[str(diction['related_collection'])].find({'_id':ObjectId(str(diction['related_collection_recid'])),
'partner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'})
for New_retVal in MYSY_GV.dbname[str(diction['related_collection'])].find({'_id':ObjectId(str(diction['related_collection_recid'])),
'partner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'}):
user = New_retVal
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de récupérer la liste des evenement "

14
main.py
View File

@ -5357,6 +5357,20 @@ def Delete_Agenda_Event():
status, retval = agenda.Delete_Agenda_Event(payload)
return jsonify(status=status, message=retval)
"""
API qui retourne les data d'une ressource (materielle ou humaine)
"""
@app.route('/myclass/api/get_Ressource_Info_Data/', methods=['POST','GET'])
@crossdomain(origin='*')
def get_Ressource_Info_Data():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### get_Ressource_Info_Data : payload = ",payload)
status, retval = agenda.get_Ressource_Info_Data(payload)
return jsonify(status=status, message=retval)
if __name__ == '__main__':