@things-factory/dataset 7.0.0-alpha.24 → 7.0.0-alpha.26

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/dataset",
3
- "version": "7.0.0-alpha.24",
3
+ "version": "7.0.0-alpha.26",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -40,20 +40,20 @@
40
40
  "@operato/shell": "^2.0.0-alpha.0",
41
41
  "@operato/styles": "^2.0.0-alpha.0",
42
42
  "@operato/utils": "^2.0.0-alpha.0",
43
- "@things-factory/auth-base": "^7.0.0-alpha.24",
44
- "@things-factory/aws-base": "^7.0.0-alpha.24",
45
- "@things-factory/board-service": "^7.0.0-alpha.24",
43
+ "@things-factory/auth-base": "^7.0.0-alpha.25",
44
+ "@things-factory/aws-base": "^7.0.0-alpha.25",
45
+ "@things-factory/board-service": "^7.0.0-alpha.25",
46
46
  "@things-factory/env": "^7.0.0-alpha.24",
47
- "@things-factory/integration-base": "^7.0.0-alpha.24",
48
- "@things-factory/organization": "^7.0.0-alpha.24",
49
- "@things-factory/scheduler-client": "^7.0.0-alpha.24",
47
+ "@things-factory/integration-base": "^7.0.0-alpha.25",
48
+ "@things-factory/organization": "^7.0.0-alpha.25",
49
+ "@things-factory/scheduler-client": "^7.0.0-alpha.25",
50
50
  "@things-factory/shell": "^7.0.0-alpha.24",
51
- "@things-factory/work-shift": "^7.0.0-alpha.24",
52
- "@things-factory/worklist": "^7.0.0-alpha.24",
51
+ "@things-factory/work-shift": "^7.0.0-alpha.25",
52
+ "@things-factory/worklist": "^7.0.0-alpha.25",
53
53
  "cron-parser": "^4.3.0",
54
54
  "moment-timezone": "^0.5.40",
55
55
  "simple-statistics": "^7.8.3",
56
56
  "statistics": "^3.3.0"
57
57
  },
58
- "gitHead": "9fe76b02534c4ae7d17caea32e66f7ed7e9e87eb"
58
+ "gitHead": "3afa1781295ee26a972a23ec975df4eef5746dc6"
59
59
  }
@@ -10,7 +10,7 @@ import { createDataSample } from '../../controllers/create-data-sample'
10
10
  async function CreateDataSample(step: InputStep, context: Context) {
11
11
  const { logger, data, domain, user, lng } = context
12
12
  var {
13
- params: { dataset: dataSetId, source: sourceAccessor, rawData: rawDataAccessor, data: dataAccessor, timestamp }
13
+ params: { dataset: dataSetId, source: sourceAccessor, rawData: rawDataAccessor, data: dataAccessor, timestamp: timestampAccessor }
14
14
  } = step
15
15
 
16
16
  if (!dataSetId) {
@@ -28,6 +28,7 @@ async function CreateDataSample(step: InputStep, context: Context) {
28
28
  var source = await access(sourceAccessor, data)
29
29
  var extractedData = await access(dataAccessor, data)
30
30
  var extractedRawData = rawDataAccessor && (await access(rawDataAccessor, data))
31
+ var timestamp = timestampAccessor && (await access(timestampAccessor, data))
31
32
 
32
33
  const dataSample = await createDataSample(
33
34
  {
package/server/routes.ts CHANGED
@@ -47,20 +47,24 @@ process.on('bootstrap-module-global-public-route' as any, (app, globalPublicRout
47
47
  throw new Error(`Appliance of the sensor given deviceId(${deviceId}) is not set up`)
48
48
  }
49
49
 
50
- // if (!sensor.dataSet) {
51
- // throw new Error(`DataSet of the sensor given deviceId(${deviceId}) is not set up`)
52
- // }
53
-
54
50
  const domain = sensor.domain
55
51
  const dataSet = sensor.dataSet
56
- // const user: User = await tx.getRepository(User).findOne({
57
- // where: {
58
- // reference: sensor.appliance.id,
59
- // userType: 'appliance'
60
- // }
61
- // })
52
+
53
+ /*
54
+ 원칙적으로 user 인증정보를 가지고 요청해야 하지만, 인증정보를 보낼 수 없는 상황이라고 전제하여 처리한다.
55
+ 앞으로, 보완되어야 한다.
56
+ */
57
+ const user: User =
58
+ context.user ||
59
+ (await tx.getRepository(User).findOne({
60
+ where: {
61
+ reference: sensor.appliance.id,
62
+ userType: 'appliance'
63
+ }
64
+ }))
62
65
 
63
66
  context.state = {
67
+ user,
64
68
  ...context.state,
65
69
  domain,
66
70
  tx