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.
@@ -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 = "you-forgot-to-set-a-base-url";
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 filters Restrictors to filter the set of models
219
- * @returns
216
+ * @param params Query parameters
217
+ * @return Observable<any>
220
218
  */
221
- index(filters) {
222
- return this.http.get(`api/${this.baseUrl}`, { params: { ...filters } }).toPromise();
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
- * @returns
226
+ * @param params Query parameters
227
+ * @return Observable<any>
229
228
  */
230
- store(model) {
231
- return this.http.post(`api/${this.baseUrl}`, model).toPromise();
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
- * @returns
236
+ * @param params Query parameters
237
+ * @return Observable<any>
238
238
  */
239
- show(modelId) {
240
- return this.http.get(`api/${this.baseUrl}/${modelId}`).toPromise();
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
- * @returns
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).toPromise();
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
- * @returns
256
+ * @return Observable<any>
256
257
  */
257
258
  delete(model) {
258
- return this.http.delete(`api/${this.baseUrl}/${model.id}`).toPromise();
259
+ return this.http.delete(`api/${this.baseUrl}/${model.id}`);
259
260
  }
260
261
  }
261
262