@stonyx/orm 0.2.5-alpha.0 → 0.2.7-alpha.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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "stonyx-async",
5
5
  "stonyx-module"
6
6
  ],
7
- "version": "0.2.5-alpha.0",
7
+ "version": "0.2.7-alpha.0",
8
8
  "description": "",
9
9
  "main": "src/main.js",
10
10
  "type": "module",
@@ -215,15 +215,15 @@ export default class OrmRequest extends Request {
215
215
  },
216
216
 
217
217
  post: {
218
- [`/${pluralizedModel}`]: (request) => {
219
- const { attributes } = request.body?.data || {};
218
+ [`/${pluralizedModel}`]: ({ body, query }) => {
219
+ const { type, attributes } = body?.data || {};
220
220
 
221
- if (!attributes) return 400; // Bad request
221
+ if (!type) return 400; // Bad request
222
222
 
223
- const fieldsMap = parseFields(request.query);
223
+ const fieldsMap = parseFields(query);
224
224
  const modelFields = fieldsMap.get(pluralizedModel) || fieldsMap.get(model);
225
225
  // Check for duplicate ID
226
- if (attributes.id !== undefined && store.get(model, attributes.id)) return 409; // Conflict
226
+ if (attributes?.id !== undefined && store.get(model, attributes.id)) return 409; // Conflict
227
227
 
228
228
  const record = createRecord(model, attributes, { serialize: false });
229
229