openxiangda-cli 2.0.0-alpha.61 → 2.0.0-alpha.62

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.
Files changed (38) hide show
  1. package/dist/create-workspace.d.ts.map +1 -1
  2. package/dist/create-workspace.js +1 -0
  3. package/dist/create-workspace.js.map +1 -1
  4. package/package.json +4 -4
  5. package/template/AGENTS.md +1 -1
  6. package/template/README.md +7 -7
  7. package/template/apps/server/package.json +1 -1
  8. package/template/apps/server/src/app.module.ts +1 -3
  9. package/template/apps/server/test/smoke.test.ts +6 -23
  10. package/template/apps/web/e2e/resources.spec.ts +20 -0
  11. package/template/apps/web/index.html +1 -1
  12. package/template/apps/web/package.json +1 -1
  13. package/template/apps/web/src/AuthoritativeSelector.tsx +38 -29
  14. package/template/apps/web/src/Shell.tsx +39 -211
  15. package/template/apps/web/src/components/platform-fields/AttachmentFileList.tsx +1 -1
  16. package/template/apps/web/src/components/resource/GeneratedResourceCrud.tsx +26 -5
  17. package/template/apps/web/src/components/resource/SurfaceFields.tsx +32 -1
  18. package/template/apps/web/src/data-provider.ts +23 -102
  19. package/template/apps/web/src/main.tsx +22 -82
  20. package/template/apps/web/src/platform-client.ts +71 -415
  21. package/template/apps/web/src/runtime-meta.ts +1 -1
  22. package/template/apps/web/src/styles.css +3 -3
  23. package/template/apps/web/test/contracts.test.ts +31 -769
  24. package/template/openxiangda.config.ts +14 -81
  25. package/template/package.json +3 -3
  26. package/template/packages/contracts/src/generated.ts +7 -804
  27. package/template/apps/server/src/instrument-context.controller.ts +0 -25
  28. package/template/apps/web/e2e/instruments.spec.ts +0 -1338
  29. package/template/apps/web/src/CollegePage.tsx +0 -181
  30. package/template/apps/web/src/InstrumentDetailPage.tsx +0 -176
  31. package/template/apps/web/src/InstrumentForm.tsx +0 -380
  32. package/template/apps/web/src/InstrumentFormPage.tsx +0 -82
  33. package/template/apps/web/src/InstrumentListPage.tsx +0 -457
  34. package/template/apps/web/src/fields.ts +0 -18
  35. package/template/apps/web/src/instrument.ts +0 -56
  36. package/template/platform/data/colleges.ts +0 -21
  37. package/template/platform/data/instrument-surface.ts +0 -125
  38. package/template/platform/data/instruments.ts +0 -83
@@ -1,83 +0,0 @@
1
- import { SCHEMA_VERSIONS, type DataResource } from 'openxiangda-contracts';
2
- import { instrumentSurface } from './instrument-surface.js';
3
-
4
- export const protectedFieldCapabilities = {
5
- instrumentCode: {
6
- create: 'app:instrument-center:instrument:field:instrument-code:create',
7
- update: 'app:instrument-center:instrument:field:instrument-code:update',
8
- },
9
- assetCode: {
10
- create: 'app:instrument-center:instrument:field:asset-code:create',
11
- update: 'app:instrument-center:instrument:field:asset-code:update',
12
- },
13
- assetValue: {
14
- create: 'app:instrument-center:instrument:field:asset-value:create',
15
- update: 'app:instrument-center:instrument:field:asset-value:update',
16
- },
17
- collegeId: {
18
- create: 'app:instrument-center:instrument:field:college-id:create',
19
- update: 'app:instrument-center:instrument:field:college-id:update',
20
- },
21
- instrumentAdminIds: {
22
- create:
23
- 'app:instrument-center:instrument:field:instrument-admin-ids:create',
24
- update:
25
- 'app:instrument-center:instrument:field:instrument-admin-ids:update',
26
- },
27
- } as const;
28
-
29
- export const instruments: DataResource = {
30
- schemaVersion: SCHEMA_VERSIONS.dataResource,
31
- appCode: 'instrument-center',
32
- code: 'instruments',
33
- name: '仪器资源',
34
- schema: {
35
- fields: [
36
- { code: 'instrumentCode', type: 'string', nullable: false, indexed: true },
37
- { code: 'chineseName', type: 'string', nullable: false, indexed: true },
38
- { code: 'englishName', type: 'string' },
39
- { code: 'aliasName', type: 'string' },
40
- { code: 'image', type: 'file', file: { maxCount: 1, maxSizeMb: 10, accept: ['image/*'] } },
41
- { code: 'specModel', type: 'string', nullable: false },
42
- { code: 'categoryId', type: 'string', nullable: false, indexed: true },
43
- { code: 'instrumentSource', type: 'string' },
44
- { code: 'manufacturer', type: 'string' },
45
- { code: 'assetCode', type: 'string', nullable: false, indexed: true },
46
- { code: 'assetValue', type: 'decimal' },
47
- { code: 'enabledDate', type: 'date', nullable: false },
48
- { code: 'usageStatus', type: 'string', nullable: false },
49
- { code: 'instrumentStatus', type: 'string', nullable: false, indexed: true },
50
- { code: 'openToOutside', type: 'boolean', nullable: false },
51
- { code: 'subjectAreas', type: 'json' },
52
- { code: 'platformProperty', type: 'string' },
53
- { code: 'collegeId', type: 'uuid', nullable: false, indexed: true },
54
- { code: 'manageDepartmentId', type: 'string', nullable: false },
55
- { code: 'useDepartmentId', type: 'string', nullable: false },
56
- { code: 'instrumentAdminIds', type: 'json', nullable: false, indexed: true },
57
- { code: 'contactUserIds', type: 'json', nullable: false },
58
- { code: 'contactPhone', type: 'string', nullable: false },
59
- { code: 'contactEmail', type: 'string' },
60
- { code: 'locationId', type: 'string' },
61
- { code: 'address', type: 'text' },
62
- { code: 'serviceContent', type: 'text' },
63
- { code: 'attachments', type: 'file', file: { multiple: true, maxCount: 8, maxSizeMb: 50 } },
64
- ],
65
- },
66
- surface: instrumentSurface,
67
- capabilities: {
68
- read: 'app:instrument-center:data:instruments:read',
69
- create: 'app:instrument-center:data:instruments:create',
70
- update: 'app:instrument-center:data:instruments:update',
71
- delete: 'app:instrument-center:data:instruments:delete',
72
- },
73
- dataPolicyCode: 'instrument-access',
74
- fieldPolicies: Object.fromEntries(
75
- Object.entries(protectedFieldCapabilities).map(([code, capabilities]) => [
76
- code,
77
- {
78
- create: [capabilities.create],
79
- update: [capabilities.update],
80
- },
81
- ])
82
- ),
83
- };