@@ -78,31 +78,31 @@ async def appointment_webhook_mass(request):
7878 del data ['_request_time' ]
7979 for apt_id , apt in data .items ():
8080 if apt ['ss_method' ] == 'POST' :
81- appointment : AppointmentModel = apt
81+ appointment = AppointmentModel ( ** apt )
8282
83- v = await conn .execute (select ([ser_c .company ]).where (ser_c .id == appointment [ ' service_id' ] ))
83+ v = await conn .execute (select ([ser_c .company ]).where (ser_c .id == appointment . service_id ))
8484 r = await v .first ()
8585 if r and r .company != request ['company' ].id :
8686 raise HTTPConflictJson (
8787 status = 'service conflict' ,
88- details = f'service { appointment [ " service_id" ] } already exists'
88+ details = f'service { appointment . service_id } already exists'
8989 ' and is associated with another company' ,
9090 )
9191
9292 service_insert_update = dict (
93- name = appointment [ ' service_name' ] ,
94- colour = appointment [ ' colour' ] ,
93+ name = appointment . service_name ,
94+ colour = appointment . colour ,
9595 extra_attributes = [
9696 ea .dict (exclude = {'sort_index' })
97- for ea in sorted (appointment [ ' extra_attributes' ] , key = attrgetter ('sort_index' ))
97+ for ea in sorted (appointment . extra_attributes , key = attrgetter ('sort_index' ))
9898 ],
9999 )
100100
101101 await conn .execute (
102102 pg_insert (sa_services )
103- .values (id = appointment [ ' service_id' ] , company = request ['company' ].id , ** service_insert_update )
103+ .values (id = appointment . service_id , company = request ['company' ].id , ** service_insert_update )
104104 .on_conflict_do_update (
105- index_elements = [ser_c .id ], where = ser_c .id == appointment [ ' service_id' ] , set_ = service_insert_update ,
105+ index_elements = [ser_c .id ], where = ser_c .id == appointment . service_id , set_ = service_insert_update ,
106106 )
107107 )
108108 apt_insert_keys = [
@@ -116,11 +116,11 @@ async def appointment_webhook_mass(request):
116116 ]
117117
118118 apt_insert_update = {key : value for key , value in apt .items () if key in apt_insert_keys }
119- apt_insert_update ['topic' ] = appointment [ ' appointment_topic' ]
119+ apt_insert_update ['topic' ] = appointment . appointment_topic
120120
121121 await conn .execute (
122122 pg_insert (sa_appointments )
123- .values (id = apt_id , service = appointment [ ' service_id' ] , ** apt_insert_update )
123+ .values (id = apt_id , service = appointment . service_id , ** apt_insert_update )
124124 .on_conflict_do_update (index_elements = [apt_c .id ], where = apt_c .id == apt_id , set_ = apt_insert_update ,)
125125 )
126126 elif apt ['ss_method' ] == 'DELETE' :
0 commit comments