@things-factory/board-service 8.0.72 → 8.0.73

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": "8.0.72",
3
+ "version": "8.0.73",
4
4
  "main": "dist-server/index.js",
5
5
  "things-factory": true,
6
6
  "author": "",
@@ -33,5 +33,5 @@
33
33
  "generic-pool": "^3.8.2",
34
34
  "puppeteer": "^23.0.0"
35
35
  },
36
- "gitHead": "73d07f864bdd3dc7968155fe187d08f596df019b"
36
+ "gitHead": "bda7f8e2ee7a18d153dc14c6b59882d441630fa7"
37
37
  }
@@ -310,6 +310,22 @@ standaloneBoardServiceRouter.get('/label-command/:id', async (context, next) =>
310
310
  context.body = await labelcommand({ id, data, orientation, mirror, upsideDown, context } as any)
311
311
  })
312
312
 
313
+ // for webpage scrap => zpl image print(grf format) command for released version board (POST)
314
+ standaloneBoardServiceRouter.post('/label-command/:id', async (context, next) => {
315
+ const { id } = context.params
316
+
317
+ const raw = context.request.body || context.query
318
+ const data = typeof raw === 'object' && raw != null ? { ...(raw as any) } : ({} as any)
319
+ delete data.access_token
320
+
321
+ const orientation = data && data.orientation
322
+ const mirror = data && data.mirror
323
+ const upsideDown = data && data.upsideDown
324
+
325
+ context.type = 'text/plain'
326
+ context.body = await labelcommand({ id, data, orientation, mirror, upsideDown, context } as any)
327
+ })
328
+
313
329
  // for webpage scrap => zpl image print(grf format) command for draft version board
314
330
  standaloneBoardServiceRouter.get('/label-command-draft/:id', async (context, next) => {
315
331
  const { id } = context.params
@@ -243,17 +243,8 @@ export class BoardMutation {
243
243
  @Directive('@privilege(category: "board", privilege: "mutation", domainOwnerGranted: true)')
244
244
  @Mutation(returns => Board, { description: 'To release a Board' })
245
245
  async releaseBoard(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Board> {
246
- const { domain, user, notify } = context.state
247
- /**
248
- * NOTE:
249
- * 특정 환경에서 @transaction scope의 tx(EntityManager)가 afterUpdate subscriber(@operato/typeorm-history)
250
- * 실행 시점에 이미 release된 상태로 전달되면서(QueryRunnerAlreadyReleasedError)
251
- * history insert가 실패하는 문제가 발생합니다.
252
- *
253
- * release는 단일 UPDATE이므로, 여기서는 tx를 강제 사용하지 않고 기본 repository로 처리하여
254
- * subscriber가 유효한 queryRunner로 동작하도록 합니다.
255
- */
256
- const repository = getRepository(Board)
246
+ const { domain, user, notify, tx } = context.state
247
+ const repository = getRepository(Board, tx)
257
248
 
258
249
  const board = await repository.findOne({
259
250
  where: { domain: { id: domain.id }, id },
@@ -56,13 +56,13 @@ export class BoardHistoryEntitySubscriber extends HistoryEntitySubscriber<Board,
56
56
 
57
57
  public async afterInsert(event: InsertEvent<Board>): Promise<void> {
58
58
  if (event.entity.state == 'released') {
59
- super.afterInsert(event)
59
+ await super.afterInsert(event)
60
60
  }
61
61
  }
62
62
 
63
63
  public async afterUpdate(event: UpdateEvent<Board>): Promise<void> {
64
64
  if (event.entity.state == 'released') {
65
- super.afterUpdate(event)
65
+ await super.afterUpdate(event)
66
66
  }
67
67
  }
68
68
  }