@@ -110,51 +110,51 @@ module.exports = class Service1 extends cds.ApplicationService {
110110 /* ========== 4. Service1 running query on Service2 using `Service2.run` and friends ========== */
111111 this . on ( "send41" , async ( req ) => {
112112 const { id } = req . data ;
113- const { Service2 } = await cds . connect . to ( "Service2" ) ;
113+ const Service2 = await cds . connect . to ( "Service2" ) ;
114114 const query = SELECT . from `Service1Entity` . where ( "ID=" + id ) ;
115115 Service2 . run ( query ) ;
116116 } ) ;
117117
118118 this . on ( "send42" , async ( req ) => {
119119 const { id } = req . data ;
120- const { Service2 } = await cds . connect . to ( "Service2" ) ;
120+ const Service2 = await cds . connect . to ( "Service2" ) ;
121121 Service2 . read ( `Service2Entity` ) . where ( "ID =" + id ) ;
122122 } ) ;
123123
124124 this . on ( "send43" , async ( req ) => {
125125 const { id } = req . data ;
126- const { Service2 } = await cds . connect . to ( "Service2" ) ;
126+ const Service2 = await cds . connect . to ( "Service2" ) ;
127127 Service2 . create ( `Service2Entity` ) . entries ( { id : "" + id } ) ;
128128 } ) ;
129129
130130 this . on ( "send44" , async ( req ) => {
131131 const { id, amount } = req . data ;
132- const { Service2 } = await cds . connect . to ( "Service2" ) ;
132+ const Service2 = await cds . connect . to ( "Service2" ) ;
133133 Service2 . update ( `Service2Entity` ) . set ( "col1 = col1" + amount ) . where ( "col1 = " + id ) ;
134134 } ) ;
135135
136136 this . on ( "send45" , async ( req ) => {
137137 const { id } = req . data ;
138- const { Service2 } = await cds . connect . to ( "Service2" ) ;
138+ const Service2 = await cds . connect . to ( "Service2" ) ;
139139 Service2 . insert ( `Service2Entity` ) . entries ( { id : "" + id } ) ;
140140 } ) ;
141141
142142 this . on ( "send46" , async ( req ) => {
143143 const { id } = req . data ;
144- const { Service2 } = await cds . connect . to ( "Service2" ) ;
144+ const Service2 = await cds . connect . to ( "Service2" ) ;
145145 Service2 . upsert ( `Service2Entity` ) . entries ( { id : "" + id } ) ;
146146 } ) ;
147147
148148 this . on ( "send47" , async ( req ) => {
149149 const { id } = req . data ;
150- const { Service2 } = await cds . connect . to ( "Service2" ) ;
150+ const Service2 = await cds . connect . to ( "Service2" ) ;
151151 Service2 . delete ( `Service2Entity` ) . where ( "ID =" + id ) ;
152152 } ) ;
153153
154154 /* ========== 5. Service1 running query on Service2 using CQN parsed with `cds.ql` ========== */
155155 this . on ( "send5" , async ( req ) => {
156156 const { id } = req . data ;
157- const { Service2 } = await cds . connect . to ( "Service2" ) ;
157+ const Service2 = await cds . connect . to ( "Service2" ) ;
158158 const query = cds . ql ( "SELECT * from Service1Entity where ID =" + id ) ;
159159 Service2 . run ( query ) ;
160160 } ) ;
@@ -176,22 +176,22 @@ module.exports = class Service1 extends cds.ApplicationService {
176176 /* ========== 8. Service1 running query on Service2 using an unparsed CDL string (only valid in old versions of CAP) ========== */
177177 this . on ( "send71" , async ( req ) => {
178178 const { id } = req . data ;
179- const { Service2 } = await cds . connect . to ( "Service2" ) ;
179+ const Service2 = await cds . connect . to ( "Service2" ) ;
180180 const query = "SELECT * from Entity1 where ID =" + id ;
181181 Service2 . run ( query ) ;
182182 } ) ;
183183
184184 this . on ( "send72" , async ( req ) => {
185185 const { id } = req . data ;
186- const { Service2 } = await cds . connect . to ( "Service2" ) ;
186+ const Service2 = await cds . connect . to ( "Service2" ) ;
187187 const query = `SELECT * from Entity1 where ID =` + id ;
188188 Service2 . run ( query ) ;
189189 } ) ;
190190
191191 /* ========== 9. Service1 running query on Service2 using `Service2.tx( tx => tx.run(...) )` and friends ========== */
192192 this . on ( "send91" , async ( req ) => {
193193 const { id } = req . data ;
194- const { Service2 } = await cds . connect . to ( "Service2" ) ;
194+ const Service2 = await cds . connect . to ( "Service2" ) ;
195195 const query = SELECT . from `Service2Entity` . where ( "ID=" + id ) ;
196196 Service2 . tx ( async ( tx ) => {
197197 tx . run ( query ) ;
@@ -200,47 +200,47 @@ module.exports = class Service1 extends cds.ApplicationService {
200200
201201 this . on ( "send92" , async ( req ) => {
202202 const { id } = req . data ;
203- const { Service2 } = await cds . connect . to ( "Service2" ) ;
203+ const Service2 = await cds . connect . to ( "Service2" ) ;
204204 Service2 . tx ( async ( tx ) => {
205205 tx . read ( `Service2Entity` ) . where ( "ID =" + id ) ;
206206 } ) ;
207207 } ) ;
208208
209209 this . on ( "send93" , async ( req ) => {
210210 const { id } = req . data ;
211- const { Service2 } = await cds . connect . to ( "Service2" ) ;
211+ const Service2 = await cds . connect . to ( "Service2" ) ;
212212 Service2 . tx ( async ( tx ) => {
213213 tx . create ( `Service2Entity` ) . entries ( { id : "" + id } ) ;
214214 } ) ;
215215 } ) ;
216216
217217 this . on ( "send94" , async ( req ) => {
218218 const { id, amount } = req . data ;
219- const { Service2 } = await cds . connect . to ( "Service2" ) ;
219+ const Service2 = await cds . connect . to ( "Service2" ) ;
220220 Service2 . tx ( async ( tx ) => {
221221 tx . update ( `Service2Entity` ) . set ( "col1 = col1" + amount ) . where ( "col1 = " + id ) ;
222222 } ) ;
223223 } ) ;
224224
225225 this . on ( "send95" , async ( req ) => {
226226 const { id } = req . data ;
227- const { Service2 } = await cds . connect . to ( "Service2" ) ;
227+ const Service2 = await cds . connect . to ( "Service2" ) ;
228228 Service2 . tx ( async ( tx ) => {
229229 tx . insert ( `Service2Entity` ) . entries ( { id : "" + id } ) ;
230230 } ) ;
231231 } ) ;
232232
233233 this . on ( "send96" , async ( req ) => {
234234 const { id } = req . data ;
235- const { Service2 } = await cds . connect . to ( "Service2" ) ;
235+ const Service2 = await cds . connect . to ( "Service2" ) ;
236236 Service2 . tx ( async ( tx ) => {
237237 tx . upsert ( `Service2Entity` ) . entries ( { id : "" + id } ) ;
238238 } ) ;
239239 } ) ;
240240
241241 this . on ( "send97" , async ( req ) => {
242242 const { id } = req . data ;
243- const { Service2 } = await cds . connect . to ( "Service2" ) ;
243+ const Service2 = await cds . connect . to ( "Service2" ) ;
244244 Service2 . tx ( async ( tx ) => {
245245 tx . delete ( `Service2Entity` ) . where ( "ID =" + id ) ;
246246 } ) ;
0 commit comments