ngx-techlify-core 14.2.1 → 14.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/base-model/techlify-service.class.mjs +20 -19
- package/fesm2015/ngx-techlify-core.mjs +19 -18
- package/fesm2015/ngx-techlify-core.mjs.map +1 -1
- package/fesm2020/ngx-techlify-core.mjs +19 -18
- package/fesm2020/ngx-techlify-core.mjs.map +1 -1
- package/lib/base-model/techlify-service.class.d.ts +16 -14
- package/lib/base-model/techlify-service.class.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -198,8 +198,6 @@ class TechlifyListingControllerInterface {
|
|
|
198
198
|
/**
|
|
199
199
|
* Interface used to ensure we have a consistent structure across our listing pages
|
|
200
200
|
*
|
|
201
|
-
* @todo This should be moved to ngx-techlify-core
|
|
202
|
-
*
|
|
203
201
|
* Advantages of this abstract class
|
|
204
202
|
* - Less code, less maintenance, less bugs
|
|
205
203
|
* - more consistent code
|
|
@@ -209,53 +207,56 @@ class TechlifyListingControllerInterface {
|
|
|
209
207
|
class TechlifyServiceBaseClass {
|
|
210
208
|
constructor(http, baseUrl) {
|
|
211
209
|
this.http = http;
|
|
212
|
-
this.baseUrl =
|
|
210
|
+
this.baseUrl = 'you-forgot-to-set-a-base-url';
|
|
213
211
|
this.baseUrl = baseUrl;
|
|
214
212
|
}
|
|
215
213
|
/**
|
|
216
214
|
* Loads a set of the model this service is for
|
|
217
215
|
*
|
|
218
|
-
* @param
|
|
219
|
-
* @
|
|
216
|
+
* @param params Query parameters
|
|
217
|
+
* @return Observable<any>
|
|
220
218
|
*/
|
|
221
|
-
index(
|
|
222
|
-
return this.http.get(`api/${this.baseUrl}`, { params
|
|
219
|
+
index(params) {
|
|
220
|
+
return this.http.get(`api/${this.baseUrl}`, { params });
|
|
223
221
|
}
|
|
224
222
|
/**
|
|
225
223
|
* Add a new record to the database
|
|
226
224
|
*
|
|
227
225
|
* @param model The data of the model to add
|
|
228
|
-
* @
|
|
226
|
+
* @param params Query parameters
|
|
227
|
+
* @return Observable<any>
|
|
229
228
|
*/
|
|
230
|
-
store(model) {
|
|
231
|
-
return this.http.post(`api/${this.baseUrl}`, model)
|
|
229
|
+
store(model, params) {
|
|
230
|
+
return this.http.post(`api/${this.baseUrl}`, model, { params });
|
|
232
231
|
}
|
|
233
232
|
/**
|
|
234
233
|
* Load a single model record, often with all relations and related data
|
|
235
234
|
*
|
|
236
235
|
* @param modelId ID of the model to load
|
|
237
|
-
* @
|
|
236
|
+
* @param params Query parameters
|
|
237
|
+
* @return Observable<any>
|
|
238
238
|
*/
|
|
239
|
-
show(modelId) {
|
|
240
|
-
return this.http.get(`api/${this.baseUrl}/${modelId}
|
|
239
|
+
show(modelId, params) {
|
|
240
|
+
return this.http.get(`api/${this.baseUrl}/${modelId}`, { params });
|
|
241
241
|
}
|
|
242
242
|
/**
|
|
243
243
|
* Update fields of a single existing model
|
|
244
244
|
*
|
|
245
245
|
* @param model Model to update
|
|
246
|
-
* @
|
|
246
|
+
* @param params Query parameters
|
|
247
|
+
* @return Observable<any>
|
|
247
248
|
*/
|
|
248
|
-
update(model) {
|
|
249
|
-
return this.http.put(`api/${this.baseUrl}/${model.id}`, model)
|
|
249
|
+
update(model, params) {
|
|
250
|
+
return this.http.put(`api/${this.baseUrl}/${model.id}`, model, { params });
|
|
250
251
|
}
|
|
251
252
|
/**
|
|
252
253
|
* Delete a single model
|
|
253
254
|
*
|
|
254
255
|
* @param model Model to delete
|
|
255
|
-
* @
|
|
256
|
+
* @return Observable<any>
|
|
256
257
|
*/
|
|
257
258
|
delete(model) {
|
|
258
|
-
return this.http.delete(`api/${this.baseUrl}/${model.id}`)
|
|
259
|
+
return this.http.delete(`api/${this.baseUrl}/${model.id}`);
|
|
259
260
|
}
|
|
260
261
|
}
|
|
261
262
|
|