@yunsoft/yuncms-api 0.1.1 → 0.1.2
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/README.md +6 -0
- package/package.json +2 -2
- package/src/routes/schema.js +40 -1
- package/studio-dist/assets/index-Db-PpxwL.js +9 -0
- package/studio-dist/assets/index-I8WeDHKd.css +1 -0
- package/studio-dist/index.html +2 -2
- package/studio-dist/assets/index-CeSr4SMH.js +0 -9
- package/studio-dist/assets/index-CozkIhar.css +0 -1
package/README.md
CHANGED
|
@@ -3,3 +3,9 @@
|
|
|
3
3
|
Express API runtime and bundled React Studio server for YunCMS.
|
|
4
4
|
|
|
5
5
|
The normal entry point is the `yuncms` executable provided by `@yunsoft/yuncms`. See the [project repository](https://github.com/Yunsoft-Software/yuncms) for configuration and deployment documentation.
|
|
6
|
+
|
|
7
|
+
## Project status
|
|
8
|
+
|
|
9
|
+
YunCMS is developed and maintained by [Yunsoft Software](https://yunsoft.com). It is under active development, so interfaces and behavior may change between releases. Test upgrades and keep verified backups before production use.
|
|
10
|
+
|
|
11
|
+
Use YunCMS at your own risk. This package is provided under the [MIT License](https://github.com/Yunsoft-Software/yuncms/blob/16-08-2026/LICENSE) without warranty.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yunsoft/yuncms-api",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Express API runtime and bundled Studio server for YunCMS.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"test": "node --test"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@yunsoft/yuncms-core": "0.1.
|
|
35
|
+
"@yunsoft/yuncms-core": "0.1.2",
|
|
36
36
|
"express": "5.2.1"
|
|
37
37
|
}
|
|
38
38
|
}
|
package/src/routes/schema.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
createO2ORelation,
|
|
4
|
+
deleteM2MJunction,
|
|
5
|
+
deleteO2ORelation,
|
|
6
|
+
} from '@yunsoft/yuncms-core';
|
|
3
7
|
|
|
4
8
|
import { serviceOptionsFromRequest } from '../service-options.js';
|
|
5
9
|
|
|
@@ -235,6 +239,41 @@ export function createSchemaRouter({ schemaCache = null } = {}) {
|
|
|
235
239
|
res.status(204).end();
|
|
236
240
|
});
|
|
237
241
|
|
|
242
|
+
router.post('/relations/o2o', async (req, res) => {
|
|
243
|
+
const data = await createO2ORelation({
|
|
244
|
+
database: req.context.database,
|
|
245
|
+
accountability: req.accountability,
|
|
246
|
+
input: req.body ?? {},
|
|
247
|
+
});
|
|
248
|
+
clearSchemaCache();
|
|
249
|
+
await auditSchema(req, {
|
|
250
|
+
action: 'schema.relation.o2o.create',
|
|
251
|
+
collection: data.many_collection,
|
|
252
|
+
itemKey: data.many_field,
|
|
253
|
+
payload: { after: data },
|
|
254
|
+
});
|
|
255
|
+
res.status(201).json({ data });
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
router.delete('/relations/o2o/:manyCollection/:manyField', async (req, res) => {
|
|
259
|
+
const relations = service(req, 'RelationsService');
|
|
260
|
+
const before = await relations.readOne(req.params.manyCollection, req.params.manyField);
|
|
261
|
+
await deleteO2ORelation({
|
|
262
|
+
database: req.context.database,
|
|
263
|
+
accountability: req.accountability,
|
|
264
|
+
manyCollection: req.params.manyCollection,
|
|
265
|
+
manyField: req.params.manyField,
|
|
266
|
+
});
|
|
267
|
+
clearSchemaCache();
|
|
268
|
+
await auditSchema(req, {
|
|
269
|
+
action: 'schema.relation.o2o.delete',
|
|
270
|
+
collection: req.params.manyCollection,
|
|
271
|
+
itemKey: req.params.manyField,
|
|
272
|
+
payload: { before },
|
|
273
|
+
});
|
|
274
|
+
res.status(204).end();
|
|
275
|
+
});
|
|
276
|
+
|
|
238
277
|
router.post('/relations/m2m', async (req, res) => {
|
|
239
278
|
const data = await service(req, 'RelationsService').createM2M(req.body ?? {});
|
|
240
279
|
clearSchemaCache();
|