@statezero/core 0.1.60 → 0.1.61
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.
|
@@ -54,14 +54,7 @@ export class Manager {
|
|
|
54
54
|
* @returns {Promise<Model>} A promise that resolves to the model instance.
|
|
55
55
|
*/
|
|
56
56
|
async get(filters, serializerOptions) {
|
|
57
|
-
|
|
58
|
-
if (filters) {
|
|
59
|
-
querySet = querySet.filter(filters);
|
|
60
|
-
}
|
|
61
|
-
if (serializerOptions) {
|
|
62
|
-
querySet.setSerializerOptions(serializerOptions);
|
|
63
|
-
}
|
|
64
|
-
return await QueryExecutor.execute(querySet, 'get');
|
|
57
|
+
return this.newQuerySet().get(filters, serializerOptions);
|
|
65
58
|
}
|
|
66
59
|
/**
|
|
67
60
|
* Filters the QuerySet based on the provided conditions.
|
|
@@ -168,7 +161,7 @@ export class Manager {
|
|
|
168
161
|
* @returns {Promise<*>} A promise that resolves to the newly created model instance.
|
|
169
162
|
*/
|
|
170
163
|
async create(data) {
|
|
171
|
-
return
|
|
164
|
+
return this.newQuerySet().create(data);
|
|
172
165
|
}
|
|
173
166
|
/**
|
|
174
167
|
* Fetches all records using the current QuerySet.
|
|
@@ -177,11 +170,7 @@ export class Manager {
|
|
|
177
170
|
* @returns {Promise<Array<*>>} A promise that resolves to an array of model instances.
|
|
178
171
|
*/
|
|
179
172
|
async fetch(serializerOptions) {
|
|
180
|
-
|
|
181
|
-
if (serializerOptions) {
|
|
182
|
-
querySet.setSerializerOptions(serializerOptions);
|
|
183
|
-
}
|
|
184
|
-
return await QueryExecutor.execute(querySet, 'list');
|
|
173
|
+
return this.newQuerySet().fetch(serializerOptions);
|
|
185
174
|
}
|
|
186
175
|
/**
|
|
187
176
|
* Retrieves or creates a model instance based on lookup fields and defaults.
|
|
@@ -194,7 +183,7 @@ export class Manager {
|
|
|
194
183
|
*/
|
|
195
184
|
async getOrCreate(lookupFields, options = {}) {
|
|
196
185
|
const { defaults = {} } = options;
|
|
197
|
-
return
|
|
186
|
+
return this.newQuerySet().getOrCreate(lookupFields, defaults);
|
|
198
187
|
}
|
|
199
188
|
/**
|
|
200
189
|
* Updates or creates a model instance based on lookup fields and defaults.
|
|
@@ -207,7 +196,7 @@ export class Manager {
|
|
|
207
196
|
*/
|
|
208
197
|
async updateOrCreate(lookupFields, options = {}) {
|
|
209
198
|
const { defaults = {} } = options;
|
|
210
|
-
return
|
|
199
|
+
return this.newQuerySet().updateOrCreate(lookupFields, defaults);
|
|
211
200
|
}
|
|
212
201
|
/**
|
|
213
202
|
* Applies a search to the QuerySet using the specified search query and fields.
|
package/package.json
CHANGED