@things-factory/dataset 5.0.11 → 5.0.12

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": "5.0.11",
3
+ "version": "5.0.12",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -43,5 +43,5 @@
43
43
  "cron-parser": "^4.3.0",
44
44
  "moment-timezone": "^0.5.34"
45
45
  },
46
- "gitHead": "37cd4feb62e062899cae7029588d86a5d4b4036a"
46
+ "gitHead": "fc92c5a8449721503a893d67aae8e65ce21a7890"
47
47
  }
@@ -38,7 +38,9 @@ export class DataSetMutation {
38
38
  const dataSetRepo = tx.getRepository(DataSet)
39
39
 
40
40
  const dataSet = await dataSetRepo.findOne({
41
- where: { domain, id }
41
+ where: { domain, id },
42
+ relations: ['domain', 'dataKeySet', 'entryRole', 'supervisoryRole', 'creator', 'updater']
43
+ /* history에 항상 반영될 수 있도록 relations가 있어야 함. */
42
44
  })
43
45
 
44
46
  const result = await dataSetRepo.save({
@@ -81,9 +83,7 @@ export class DataSetMutation {
81
83
  await this._createAttachment(context, newRecord.reportTemplate, { ref: result, cuFlag })
82
84
 
83
85
  results.push({
84
- ...(await dataSetRepo.findOne(result.id, {
85
- relations: ['domain', 'creator', 'updater', 'supervisoryRole', 'entryRole']
86
- })),
86
+ ...result,
87
87
  cuFlag
88
88
  })
89
89
  }
@@ -93,7 +93,10 @@ export class DataSetMutation {
93
93
  const cuFlag = 'M'
94
94
  for (let i = 0; i < _updateRecords.length; i++) {
95
95
  const newRecord = _updateRecords[i]
96
- const dataSet = await dataSetRepo.findOne(newRecord.id)
96
+ const dataSet = await dataSetRepo.findOne(newRecord.id, {
97
+ /* history에 항상 반영될 수 있도록 relations가 있어야 함. */
98
+ relations: ['domain', 'dataKeySet', 'entryRole', 'supervisoryRole', 'creator', 'updater']
99
+ })
97
100
 
98
101
  const result = await dataSetRepo.save({
99
102
  ...dataSet,
@@ -104,9 +107,7 @@ export class DataSetMutation {
104
107
  await this._createAttachment(context, newRecord.reportTemplate, { ref: result, cuFlag })
105
108
 
106
109
  results.push({
107
- ...(await dataSetRepo.findOne(result.id, {
108
- relations: ['domain', 'creator', 'updater', 'supervisoryRole', 'entryRole']
109
- })),
110
+ ...result,
110
111
  cuFlag
111
112
  })
112
113
  }
@@ -176,7 +177,7 @@ export class DataSetMutation {
176
177
  id: In(ids),
177
178
  domain
178
179
  },
179
- relations: ['domain', 'supervisoryRole', 'entryRole']
180
+ relations: ['domain', 'supervisoryRole', 'entryRole', 'dataKeySet']
180
181
  })
181
182
 
182
183
  if (originals.length == 0) {
@@ -191,9 +192,12 @@ export class DataSetMutation {
191
192
  id: dataSetId,
192
193
  name: dataSet.name + ' (' + dataSetId + ')',
193
194
  active: false,
195
+ version: 1,
194
196
  domain,
195
197
  creator: user,
196
- updater: user
198
+ updater: user,
199
+ updatedAt: undefined,
200
+ createdAt: undefined
197
201
  }
198
202
  })
199
203