From 8a73d1ed32a157d120a53dc0daa6768913f1f6d4 Mon Sep 17 00:00:00 2001 From: blazejpass Date: Wed, 8 Nov 2023 13:35:06 +0100 Subject: [PATCH] Lint fixes --- .../src/modules/board/controller/dto/element/index.ts | 1 + .../mapper/content-element-response.factory.spec.ts | 2 +- .../mapper/content-element-response.factory.ts | 2 +- .../board-do-copy-service/recursive-copy.visitor.ts | 6 +++--- .../board/service/content-element-update.visitor.spec.ts | 4 ++-- apps/server/src/modules/board/uc/card.uc.spec.ts | 1 + apps/server/src/modules/board/uc/element.uc.ts | 9 +++++---- .../domain/domainobject/board/content-element.factory.ts | 2 +- .../domain/entity/boardnode/types/board-do.builder.ts | 2 +- 9 files changed, 16 insertions(+), 13 deletions(-) diff --git a/apps/server/src/modules/board/controller/dto/element/index.ts b/apps/server/src/modules/board/controller/dto/element/index.ts index 6787c007c1b..3b85cb57f3f 100644 --- a/apps/server/src/modules/board/controller/dto/element/index.ts +++ b/apps/server/src/modules/board/controller/dto/element/index.ts @@ -1,5 +1,6 @@ export * from './any-content-element.response'; export * from './create-content-element.body.params'; +export * from './drawing-element.response'; export * from './external-tool-element.response'; export * from './file-element.response'; export * from './link-element.response'; diff --git a/apps/server/src/modules/board/controller/mapper/content-element-response.factory.spec.ts b/apps/server/src/modules/board/controller/mapper/content-element-response.factory.spec.ts index 53efd8cddc2..c4fb577f5c2 100644 --- a/apps/server/src/modules/board/controller/mapper/content-element-response.factory.spec.ts +++ b/apps/server/src/modules/board/controller/mapper/content-element-response.factory.spec.ts @@ -40,7 +40,7 @@ describe(ContentElementResponseFactory.name, () => { }); it('should return instance of DrawingElementResponse', () => { - const { drawingElement } = drawingElementFactory.build(); + const drawingElement = drawingElementFactory.build(); const result = ContentElementResponseFactory.mapToResponse(drawingElement); diff --git a/apps/server/src/modules/board/controller/mapper/content-element-response.factory.ts b/apps/server/src/modules/board/controller/mapper/content-element-response.factory.ts index 2c03e90cd7b..72311882bb8 100644 --- a/apps/server/src/modules/board/controller/mapper/content-element-response.factory.ts +++ b/apps/server/src/modules/board/controller/mapper/content-element-response.factory.ts @@ -8,7 +8,7 @@ import { isRichTextElementResponse, } from '../dto'; import { BaseResponseMapper } from './base-mapper.interface'; -import { DrawingElementResponseMapper } from '@src/modules/board/controller/mapper/drawing-element-response.mapper'; +import { DrawingElementResponseMapper } from './drawing-element-response.mapper'; import { ExternalToolElementResponseMapper } from './external-tool-element-response.mapper'; import { FileElementResponseMapper } from './file-element-response.mapper'; import { LinkElementResponseMapper } from './link-element-response.mapper'; diff --git a/apps/server/src/modules/board/service/board-do-copy-service/recursive-copy.visitor.ts b/apps/server/src/modules/board/service/board-do-copy-service/recursive-copy.visitor.ts index fb95f3c2c0a..3f1fd99224f 100644 --- a/apps/server/src/modules/board/service/board-do-copy-service/recursive-copy.visitor.ts +++ b/apps/server/src/modules/board/service/board-do-copy-service/recursive-copy.visitor.ts @@ -3,7 +3,8 @@ import { BoardCompositeVisitorAsync, Card, Column, - ColumnBoard, DrawingElement, + ColumnBoard, + DrawingElement, EntityId, ExternalToolElement, FileElement, @@ -123,7 +124,6 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync { this.copyMap.set(original.id, copy); } - async visitDrawingElementAsync(original: DrawingElement): Promise { const copy = new DrawingElement({ id: new ObjectId().toHexString(), @@ -131,7 +131,7 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync { drawingName: original.drawingName, children: [], createdAt: new Date(), - updatedAt: new Date() + updatedAt: new Date(), }); this.resultMap.set(original.id, { copyEntity: copy, diff --git a/apps/server/src/modules/board/service/content-element-update.visitor.spec.ts b/apps/server/src/modules/board/service/content-element-update.visitor.spec.ts index 30147d618e8..5dbd8bb6866 100644 --- a/apps/server/src/modules/board/service/content-element-update.visitor.spec.ts +++ b/apps/server/src/modules/board/service/content-element-update.visitor.spec.ts @@ -60,9 +60,9 @@ describe(ContentElementUpdateVisitor.name, () => { }); describe('when component is a drawing-item', () => { - it('should throw an error', () => { + it('should throw an error', async () => { const { drawingItem, updater } = setup(); - expect(() => updater.visitDrawingElement(drawingItem)).toThrow(); + await expect(() => updater.visitDrawingElementAsync(drawingItem)).rejects.toThrow(); }); }); }); diff --git a/apps/server/src/modules/board/uc/card.uc.spec.ts b/apps/server/src/modules/board/uc/card.uc.spec.ts index eccf302970d..b3a397d72ea 100644 --- a/apps/server/src/modules/board/uc/card.uc.spec.ts +++ b/apps/server/src/modules/board/uc/card.uc.spec.ts @@ -8,6 +8,7 @@ import { AuthorizationService } from '@modules/authorization'; import { ObjectId } from 'bson'; import { BoardDoAuthorizableService, ContentElementService, CardService } from '../service'; import { CardUc } from './card.uc'; +import { HttpService } from '@nestjs/axios'; describe(CardUc.name, () => { let module: TestingModule; diff --git a/apps/server/src/modules/board/uc/element.uc.ts b/apps/server/src/modules/board/uc/element.uc.ts index af3c69d0264..8e5306ca526 100644 --- a/apps/server/src/modules/board/uc/element.uc.ts +++ b/apps/server/src/modules/board/uc/element.uc.ts @@ -1,7 +1,8 @@ import { ForbiddenException, forwardRef, Inject, Injectable, UnprocessableEntityException } from '@nestjs/common'; import { AnyBoardDo, - AnyContentElementDo, DrawingElement, + AnyContentElementDo, + DrawingElement, EntityId, isSubmissionContainerElement, isSubmissionItem, @@ -14,9 +15,9 @@ import { AnyElementContentBody } from '../controller/dto'; import { BoardDoAuthorizableService, ContentElementService } from '../service'; import { SubmissionItemService } from '../service/submission-item.service'; import { BaseUc } from './base.uc'; -import {firstValueFrom} from "rxjs"; -import {HttpService} from "@nestjs/axios"; -import {Configuration} from "@hpi-schul-cloud/commons/lib"; +import { firstValueFrom } from 'rxjs'; +import { HttpService } from '@nestjs/axios'; +import { Configuration } from '@hpi-schul-cloud/commons/lib'; @Injectable() export class ElementUc extends BaseUc { diff --git a/apps/server/src/shared/domain/domainobject/board/content-element.factory.ts b/apps/server/src/shared/domain/domainobject/board/content-element.factory.ts index 0fa3443b6cf..7b6c2300240 100644 --- a/apps/server/src/shared/domain/domainobject/board/content-element.factory.ts +++ b/apps/server/src/shared/domain/domainobject/board/content-element.factory.ts @@ -2,7 +2,7 @@ import { Injectable, NotImplementedException } from '@nestjs/common'; import { InputFormat } from '@shared/domain/types'; import { ObjectId } from 'bson'; import { ExternalToolElement } from './external-tool-element.do'; -import { DrawingElement } from '@shared/domain/domainobject/board/drawing-element.do'; +import { DrawingElement } from './drawing-element.do'; import { FileElement } from './file-element.do'; import { LinkElement } from './link-element.do'; import { RichTextElement } from './rich-text-element.do'; diff --git a/apps/server/src/shared/domain/entity/boardnode/types/board-do.builder.ts b/apps/server/src/shared/domain/entity/boardnode/types/board-do.builder.ts index 00a60c6960d..9ca140bcc6b 100644 --- a/apps/server/src/shared/domain/entity/boardnode/types/board-do.builder.ts +++ b/apps/server/src/shared/domain/entity/boardnode/types/board-do.builder.ts @@ -13,7 +13,7 @@ import type { import type { CardNode } from '../card-node.entity'; import type { ColumnBoardNode } from '../column-board-node.entity'; import type { ColumnNode } from '../column-node.entity'; -import { DrawingElementNode } from '@shared/domain/entity/boardnode/drawing-element-node.entity'; +import { DrawingElementNode } from '../drawing-element-node.entity'; import type { ExternalToolElementNodeEntity } from '../external-tool-element-node.entity'; import type { FileElementNode } from '../file-element-node.entity'; import type { LinkElementNode } from '../link-element-node.entity';