@things-factory/board-service 6.4.5 → 6.4.6
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/board-service",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.6",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"@thiagoelg/node-printer": "0.6.2",
|
|
38
38
|
"puppeteer": "^20.7.3"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "ea532c05867c9003ef8b40726d0aec23668e2ee2"
|
|
41
41
|
}
|
|
@@ -245,6 +245,7 @@ export class BoardMutation {
|
|
|
245
245
|
async releaseBoard(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Board> {
|
|
246
246
|
const { domain, user, notify, tx } = context.state
|
|
247
247
|
const repository = tx.getRepository(Board)
|
|
248
|
+
const historyRepository = tx.getRepository(BoardHistory)
|
|
248
249
|
|
|
249
250
|
const board = await repository.findOne({
|
|
250
251
|
where: { domain: { id: domain.id }, id },
|
|
@@ -259,10 +260,19 @@ export class BoardMutation {
|
|
|
259
260
|
throw `Board given id(${id}) is already released`
|
|
260
261
|
}
|
|
261
262
|
|
|
263
|
+
// 히스토리에서 max version 가져오기
|
|
264
|
+
const maxHistory = await historyRepository
|
|
265
|
+
.createQueryBuilder('history')
|
|
266
|
+
.select('MAX(history.version)', 'max')
|
|
267
|
+
.where('history.originalId = :id', { id: board.id })
|
|
268
|
+
.getRawOne()
|
|
269
|
+
|
|
270
|
+
const nextVersion = maxHistory?.max ? Number(maxHistory.max) + 1 : 1
|
|
271
|
+
|
|
262
272
|
const updated = await repository.save({
|
|
263
273
|
domain,
|
|
264
274
|
...board,
|
|
265
|
-
version:
|
|
275
|
+
version: nextVersion,
|
|
266
276
|
state: 'released',
|
|
267
277
|
updater: user
|
|
268
278
|
})
|