From 67688168cac015e405689d99ebf074e0014bca83 Mon Sep 17 00:00:00 2001 From: mamutmk5 <3045922+mamutmk5@users.noreply.github.com> Date: Fri, 17 Jan 2025 17:28:15 +0100 Subject: [PATCH] Revert "BC-8440 Remove devDependencies from docker image (#5419)" (#5444) This reverts commit 16b9c2c7b5803d32a22b1da0829b6dc7cdfbab1f. --- Dockerfile | 56 ++---- .../media-available-line.uc.spec.ts | 3 +- .../seed-data/factory/base.factory.ts | 164 ------------------ .../factory/county.embeddable.factory.ts | 17 -- .../factory/federal-state.factory.ts | 18 -- .../seed-data/factory/role.factory.ts | 9 - .../factory/school.entity.factory.ts | 12 -- .../seed-data/factory/schoolyear.factory.ts | 32 ---- .../factory/system.entity.factory.ts | 99 ----------- .../management/seed-data/federalstates.ts | 2 +- .../src/modules/management/seed-data/roles.ts | 2 +- .../modules/management/seed-data/schools.ts | 4 +- .../management/seed-data/schoolyears.ts | 2 +- .../modules/management/seed-data/systems.ts | 2 +- ...ool-external-tool-created.loggable.spec.ts | 2 +- ...onnex-license-provisioning.service.spec.ts | 8 +- ...ulconnex-tool-provisioning.service.spec.ts | 3 +- .../modules/rocketchat-user/domain/index.ts | 1 + apps/server/src/modules/room/index.ts | 1 + .../modules/synchronization/domain/index.ts | 1 + .../tool-configuration-status.service.spec.ts | 3 +- apps/server/src/modules/user-license/index.ts | 1 + apps/server/tsconfig.app.json | 5 +- esbuild/esmodules-bundler.js | 2 +- package-lock.json | 4 +- package.json | 6 +- sonar-project.properties | 2 +- 27 files changed, 48 insertions(+), 413 deletions(-) delete mode 100644 apps/server/src/modules/management/seed-data/factory/base.factory.ts delete mode 100644 apps/server/src/modules/management/seed-data/factory/county.embeddable.factory.ts delete mode 100644 apps/server/src/modules/management/seed-data/factory/federal-state.factory.ts delete mode 100644 apps/server/src/modules/management/seed-data/factory/role.factory.ts delete mode 100644 apps/server/src/modules/management/seed-data/factory/school.entity.factory.ts delete mode 100644 apps/server/src/modules/management/seed-data/factory/schoolyear.factory.ts delete mode 100644 apps/server/src/modules/management/seed-data/factory/system.entity.factory.ts diff --git a/Dockerfile b/Dockerfile index ff33f053c21..98a1f7fb8f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,47 +1,27 @@ -FROM docker.io/node:22-alpine AS builder +FROM docker.io/node:22 AS git +RUN mkdir /app && chown -R node:node /app WORKDIR /app -RUN apk add --no-cache git -COPY .git ./.git - -RUN git config --global --add safe.directory /app \ - && echo "{\"sha\": \"$(git rev-parse HEAD)\", \"version\": \"$(git describe --tags --abbrev=0)\", \"commitDate\": \"$(git log -1 --format=%cd --date=format:'%Y-%m-%dT%H:%M:%SZ')\", \"birthdate\": \"$(date +%Y-%m-%dT%H:%M:%SZ)\"}" > /app/serverversion - -COPY package.json package-lock.json tsconfig.json tsconfig.build.json nest-cli.json ./ -COPY apps apps -COPY config config -COPY esbuild esbuild -COPY src src - -RUN npm ci && npm run build - +COPY .git . +RUN git config --global --add safe.directory /app && echo "{\"sha\": \"$(git rev-parse HEAD)\", \"version\": \"$(git describe --tags --abbrev=0)\", \"commitDate\": \"$(git log -1 --format=%cd --date=format:'%Y-%m-%dT%H:%M:%SZ')\", \"birthdate\": \"$(date +%Y-%m-%dT%H:%M:%SZ)\"}" > /app/serverversion FROM docker.io/node:22-alpine - ENV TZ=Europe/Berlin -RUN apk add --no-cache git make python3 curl - +RUN apk add --no-cache git make python3 +# to run ldap sync as script curl is needed +RUN apk add --no-cache curl WORKDIR /schulcloud-server - -COPY package.json package-lock.json ./ -COPY backup backup -COPY config config -COPY scripts/ldapSync.sh scripts/ -COPY src src - -COPY --from=builder /app/dist dist -COPY --from=builder /app/serverversion dist/apps/server/static-assets/serverversion - -# The postinstall script must be disabled, because esbuild is a dev dependency and not installed here. -RUN npm pkg delete scripts.postinstall \ - && npm ci --omit=dev \ - && npm cache clean --force - -# The modules transpiled by esbuild need to be copied manually from the build stage. -COPY --from=builder /app/node_modules/@keycloak/keycloak-admin-client-cjs node_modules/@keycloak/keycloak-admin-client-cjs -COPY --from=builder /app/node_modules/file-type-cjs node_modules/file-type-cjs +COPY tsconfig.json tsconfig.build.json package.json package-lock.json .eslintrc.js .eslintignore nest-cli.json ./ +COPY esbuild ./esbuild +RUN npm ci && npm cache clean --force +COPY config /schulcloud-server/config +COPY backup /schulcloud-server/backup +COPY src /schulcloud-server/src +COPY apps /schulcloud-server/apps +COPY --from=git /app/serverversion /schulcloud-server/apps/server/static-assets +COPY scripts/ldapSync.sh /schulcloud-server/scripts/ +RUN npm run build ENV NODE_ENV=production ENV NO_COLOR="true" - -CMD npm start +CMD npm run start diff --git a/apps/server/src/modules/board/uc/media-board/media-available-line.uc.spec.ts b/apps/server/src/modules/board/uc/media-board/media-available-line.uc.spec.ts index 81fecfebd29..6e7da60a8d5 100644 --- a/apps/server/src/modules/board/uc/media-board/media-available-line.uc.spec.ts +++ b/apps/server/src/modules/board/uc/media-board/media-available-line.uc.spec.ts @@ -5,8 +5,7 @@ import { ExternalTool } from '@modules/tool/external-tool/domain'; import { externalToolFactory } from '@modules/tool/external-tool/testing'; import { SchoolExternalTool } from '@modules/tool/school-external-tool/domain'; import { schoolExternalToolFactory } from '@modules/tool/school-external-tool/testing'; -import { MediaUserLicense, MediaUserLicenseService } from '@modules/user-license'; -import { mediaUserLicenseFactory } from '@modules/user-license/testing'; +import { MediaUserLicense, mediaUserLicenseFactory, MediaUserLicenseService } from '@modules/user-license'; import { ConfigService } from '@nestjs/config'; import { Test, TestingModule } from '@nestjs/testing'; import { FeatureDisabledLoggableException } from '@shared/common/loggable-exception'; diff --git a/apps/server/src/modules/management/seed-data/factory/base.factory.ts b/apps/server/src/modules/management/seed-data/factory/base.factory.ts deleted file mode 100644 index 5db3cd71d5a..00000000000 --- a/apps/server/src/modules/management/seed-data/factory/base.factory.ts +++ /dev/null @@ -1,164 +0,0 @@ -import { ObjectId } from '@mikro-orm/mongodb'; -import type { EntityId } from '@shared/domain/types'; -import { BuildOptions, DeepPartial, Factory, GeneratorFn, HookFn } from 'fishery'; - -/** - * Entity factory based on thoughtbot/fishery - * https://github.com/thoughtbot/fishery - * - * @template T The entity to be built - * @template U The properties interface of the entity - * @template I The transient parameters that your factory supports - * @template C The class of the factory object being created. - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export class BaseFactory { - protected readonly propsFactory: Factory; - - constructor(private readonly EntityClass: { new (props: U): T }, propsFactory: Factory) { - this.propsFactory = propsFactory; - } - - /** - * Define a factory - * @template T The entity to be built - * @template U The properties interface of the entity - * @template I The transient parameters that your factory supports - * @template C The class of the factory object being created. - * @param EntityClass The constructor of the entity to be built. - * @param generator Your factory function - see `Factory.define()` in thoughtbot/fishery - * @returns - */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any - static define>( - this: new (EntityClass: { new (props: U): T }, propsFactory: Factory) => F, - EntityClass: { new (props: U): T }, - generator: GeneratorFn - ): F { - const propsFactory = Factory.define(generator); - const factory = new this(EntityClass, propsFactory); - return factory; - } - - /** - * Build an entity using your factory - * @param params - * @returns an entity - */ - build(params?: DeepPartial, options: BuildOptions = {}): T { - const props = this.propsFactory.build(params, options); - const entity = new this.EntityClass(props); - - return entity; - } - - /** - * Build an entity using your factory and generate a id for it. - * @param params - * @param id - * @returns an entity - */ - buildWithId(params?: DeepPartial, id?: string, options: BuildOptions = {}): T { - const entity = this.build(params, options) as { _id: ObjectId; id: EntityId }; - const generatedId = new ObjectId(id); - const entityWithId = Object.assign(entity, { _id: generatedId, id: generatedId.toHexString() }); - - return entityWithId as T; - } - - /** - * Build a list of entities using your factory - * @param number - * @param params - * @returns a list of entities - */ - buildList(number: number, params?: DeepPartial, options: BuildOptions = {}): T[] { - const list: T[] = []; - for (let i = 0; i < number; i += 1) { - list.push(this.build(params, options)); - } - - return list; - } - - buildListWithId(number: number, params?: DeepPartial, options: BuildOptions = {}): T[] { - const list: T[] = []; - for (let i = 0; i < number; i += 1) { - list.push(this.buildWithId(params, undefined, options)); - } - - return list; - } - - /** - * Extend the factory by adding a function to be called after an object is built. - * @param afterBuildFn - the function to call. It accepts your object of type T. The value this function returns gets returned from "build" - * @returns a new factory - */ - afterBuild(afterBuildFn: HookFn): this { - const newPropsFactory = this.propsFactory.afterBuild(afterBuildFn); - const newFactory = this.clone(newPropsFactory); - - return newFactory; - } - - /** - * Extend the factory by adding default associations to be passed to the factory when "build" is called - * @param associations - * @returns a new factory - */ - associations(associations: Partial): this { - const newPropsFactory = this.propsFactory.associations(associations); - const newFactory = this.clone(newPropsFactory); - - return newFactory; - } - - /** - * Extend the factory by adding default parameters to be passed to the factory when "build" is called - * @param params - * @returns a new factory - */ - params(params: DeepPartial): this { - const newPropsFactory = this.propsFactory.params(params); - const newFactory = this.clone(newPropsFactory); - - return newFactory; - } - - /** - * Extend the factory by adding default transient parameters to be passed to the factory when "build" is called - * @param transient - transient params - * @returns a new factory - */ - transient(transient: Partial): this { - const newPropsFactory = this.propsFactory.transient(transient); - const newFactory = this.clone(newPropsFactory); - - return newFactory; - } - - /** - * Set sequence back to its default value - */ - rewindSequence(): void { - this.propsFactory.rewindSequence(); - } - - protected clone>(this: F, propsFactory: Factory): F { - const copy = new (this.constructor as { - new (EntityClass: { new (props: U): T }, propsOfFactory: Factory): F; - })(this.EntityClass, propsFactory); - - return copy; - } - - /** - * Get the next sequence value - * @returns the next sequence value - */ - protected sequence(): number { - // eslint-disable-next-line @typescript-eslint/dot-notation - return this.propsFactory['sequence'](); - } -} diff --git a/apps/server/src/modules/management/seed-data/factory/county.embeddable.factory.ts b/apps/server/src/modules/management/seed-data/factory/county.embeddable.factory.ts deleted file mode 100644 index 58842c7f61b..00000000000 --- a/apps/server/src/modules/management/seed-data/factory/county.embeddable.factory.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { CountyEmbeddable } from '@shared/domain/entity'; -import { ObjectId } from '@mikro-orm/mongodb'; -import { BaseFactory } from './base.factory'; - -export const countyEmbeddableFactory = BaseFactory.define( - CountyEmbeddable, - ({ sequence }) => { - const county = { - _id: new ObjectId(), - name: `County ${sequence}`, - countyId: sequence, - antaresKey: `antaresKey ${sequence}`, - }; - - return county; - } -); diff --git a/apps/server/src/modules/management/seed-data/factory/federal-state.factory.ts b/apps/server/src/modules/management/seed-data/factory/federal-state.factory.ts deleted file mode 100644 index cb09d7cfa81..00000000000 --- a/apps/server/src/modules/management/seed-data/factory/federal-state.factory.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { FederalStateEntity, FederalStateProperties } from '@shared/domain/entity'; -import { BaseFactory } from './base.factory'; -import { countyEmbeddableFactory } from './county.embeddable.factory'; - -export const federalStateFactory = BaseFactory.define( - FederalStateEntity, - () => { - return { - name: 'Hamburg', - abbreviation: 'HH', - logoUrl: - 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/Coat_of_arms_of_Hamburg.svg/1200px-Coat_of_arms_of_Hamburg.svg.png', - counties: countyEmbeddableFactory.buildList(2), - createdAt: new Date(2020, 1), - updatedAt: new Date(2020, 1), - }; - } -); diff --git a/apps/server/src/modules/management/seed-data/factory/role.factory.ts b/apps/server/src/modules/management/seed-data/factory/role.factory.ts deleted file mode 100644 index ea982edf1e5..00000000000 --- a/apps/server/src/modules/management/seed-data/factory/role.factory.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Role, RoleProperties } from '@shared/domain/entity'; -import { RoleName } from '@shared/domain/interface'; -import { BaseFactory } from './base.factory'; - -export const roleFactory = BaseFactory.define(Role, ({ sequence }) => { - return { - name: `role${sequence}` as unknown as RoleName, - }; -}); diff --git a/apps/server/src/modules/management/seed-data/factory/school.entity.factory.ts b/apps/server/src/modules/management/seed-data/factory/school.entity.factory.ts deleted file mode 100644 index d8fe77a84f4..00000000000 --- a/apps/server/src/modules/management/seed-data/factory/school.entity.factory.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { SchoolEntity, SchoolProperties } from '@shared/domain/entity'; -import { BaseFactory } from './base.factory'; -import { federalStateFactory } from './federal-state.factory'; -import { schoolYearFactory } from './schoolyear.factory'; - -export const schoolEntityFactory = BaseFactory.define(SchoolEntity, ({ sequence }) => { - return { - name: `school #${sequence}`, - currentYear: schoolYearFactory.build(), - federalState: federalStateFactory.build(), - }; -}); diff --git a/apps/server/src/modules/management/seed-data/factory/schoolyear.factory.ts b/apps/server/src/modules/management/seed-data/factory/schoolyear.factory.ts deleted file mode 100644 index 3c5e77d986a..00000000000 --- a/apps/server/src/modules/management/seed-data/factory/schoolyear.factory.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { SchoolYearEntity, SchoolYearProperties } from '@shared/domain/entity/schoolyear.entity'; -import { BaseFactory } from './base.factory'; - -type SchoolYearTransientParams = { - startYear: number; -}; - -class SchoolYearFactory extends BaseFactory { - public withStartYear(startYear: number): this { - this.rewindSequence(); - return this.transient({ startYear }); - } -} - -export const schoolYearFactory = SchoolYearFactory.define(SchoolYearEntity, ({ transientParams, sequence }) => { - const now = new Date(); - const startYearWithoutSequence = transientParams?.startYear ?? now.getFullYear(); - const sequenceStartingWithZero = sequence - 1; - let correction = 0; - - if (now.getMonth() < 7 && !transientParams?.startYear) { - correction = 1; - } - - const startYear = startYearWithoutSequence + sequenceStartingWithZero - correction; - - const name = `${startYear}/${(startYear + 1).toString().slice(-2)}`; - const startDate = new Date(`${startYear}-08-01`); - const endDate = new Date(`${startYear + 1}-07-31`); - - return { name, startDate, endDate }; -}); diff --git a/apps/server/src/modules/management/seed-data/factory/system.entity.factory.ts b/apps/server/src/modules/management/seed-data/factory/system.entity.factory.ts deleted file mode 100644 index 88e1e9a6b05..00000000000 --- a/apps/server/src/modules/management/seed-data/factory/system.entity.factory.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { - LdapConfigEntity, - OauthConfigEntity, - OidcConfigEntity, - SystemEntity, - SystemEntityProps, -} from '@modules/system/entity'; -import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; -import { SystemTypeEnum } from '@shared/domain/types'; -import { DeepPartial } from 'fishery'; -import { BaseFactory } from './base.factory'; - -export const systemOauthConfigEntityFactory = BaseFactory.define( - OauthConfigEntity, - () => { - return { - clientId: '12345', - clientSecret: 'mocksecret', - idpHint: 'mock-oauth-idpHint', - tokenEndpoint: 'https://mock.de/mock/auth/public/mockToken', - grantType: 'authorization_code', - redirectUri: 'https://mockhost:3030/api/v3/sso/oauth/', - scope: 'openid uuid', - responseType: 'code', - authEndpoint: 'https://mock.de/auth', - provider: 'mock_type', - logoutEndpoint: 'https://mock.de/logout', - issuer: 'mock_issuer', - jwksEndpoint: 'https://mock.de/jwks', - endSessionEndpoint: 'https://mock.de/logout', - }; - } -); - -export const systemLdapConfigEntityFactory = BaseFactory.define( - LdapConfigEntity, - () => { - return { - url: 'ldaps:mock.de:389', - active: true, - }; - } -); - -export const systemOidcConfigEntityFactory = BaseFactory.define( - OidcConfigEntity, - () => { - return { - clientId: 'mock-client-id', - clientSecret: 'mock-client-secret', - idpHint: 'mock-oidc-idpHint', - defaultScopes: 'openid email userinfo', - authorizationUrl: 'https://mock.tld/auth', - tokenUrl: 'https://mock.tld/token', - userinfoUrl: 'https://mock.tld/userinfo', - logoutUrl: 'https://mock.tld/logout', - }; - } -); - -export class SystemEntityFactory extends BaseFactory { - withOauthConfig(otherParams?: DeepPartial): this { - const params: DeepPartial = { - type: SystemTypeEnum.OAUTH, - oauthConfig: systemOauthConfigEntityFactory.build(otherParams), - }; - - return this.params(params); - } - - withLdapConfig(otherParams?: DeepPartial): this { - const params: DeepPartial = { - type: SystemTypeEnum.LDAP, - ldapConfig: systemLdapConfigEntityFactory.build(otherParams), - }; - - return this.params(params); - } - - withOidcConfig(otherParams?: DeepPartial): this { - const params = { - type: SystemTypeEnum.OIDC, - oidcConfig: systemOidcConfigEntityFactory.build(otherParams), - }; - - return this.params(params); - } -} - -export const systemEntityFactory = SystemEntityFactory.define(SystemEntity, ({ sequence }) => { - return { - type: 'oauth', - url: 'https://mock.de', - alias: `system #${sequence}`, - displayName: `system #${sequence}DisplayName`, - provisioningStrategy: SystemProvisioningStrategy.OIDC, - provisioningUrl: 'https://provisioningurl.de/', - }; -}); diff --git a/apps/server/src/modules/management/seed-data/federalstates.ts b/apps/server/src/modules/management/seed-data/federalstates.ts index ef59e6cf309..c9e69566e6c 100644 --- a/apps/server/src/modules/management/seed-data/federalstates.ts +++ b/apps/server/src/modules/management/seed-data/federalstates.ts @@ -1,7 +1,7 @@ import { ObjectId } from '@mikro-orm/mongodb'; import { CountyEmbeddable, FederalStateProperties } from '@shared/domain/entity/federal-state.entity'; +import { federalStateFactory } from '@testing/factory/federal-state.factory'; import { DeepPartial } from 'fishery'; -import { federalStateFactory } from './factory/federal-state.factory'; type SeedFederalStateProperties = Omit & { id: string; diff --git a/apps/server/src/modules/management/seed-data/roles.ts b/apps/server/src/modules/management/seed-data/roles.ts index a563fc61f39..200fc609451 100644 --- a/apps/server/src/modules/management/seed-data/roles.ts +++ b/apps/server/src/modules/management/seed-data/roles.ts @@ -2,8 +2,8 @@ import { Role, RoleProperties } from '@shared/domain/entity'; import { Permission, RoleName } from '@shared/domain/interface'; +import { roleFactory } from '@testing/factory/role.factory'; import { DeepPartial } from 'fishery'; -import { roleFactory } from './factory/role.factory'; type SeedRoleProperties = Omit & { id: string; diff --git a/apps/server/src/modules/management/seed-data/schools.ts b/apps/server/src/modules/management/seed-data/schools.ts index ca2ccacbcf4..105255bedd9 100644 --- a/apps/server/src/modules/management/seed-data/schools.ts +++ b/apps/server/src/modules/management/seed-data/schools.ts @@ -5,9 +5,9 @@ import { FederalStateEntity, SchoolProperties, SchoolRoles, SchoolYearEntity } f import { LanguageType } from '@shared/domain/interface'; import { SchoolFeature, SchoolPurpose } from '@shared/domain/types'; import { FileStorageType } from '@src/modules/school/domain/type/file-storage-type.enum'; +import { federalStateFactory } from '@testing/factory/federal-state.factory'; +import { schoolEntityFactory } from '@testing/factory/school-entity.factory'; import { DeepPartial } from 'fishery'; -import { federalStateFactory } from './factory/federal-state.factory'; -import { schoolEntityFactory } from './factory/school.entity.factory'; import { EFederalState } from './federalstates'; import { SeedSchoolYearEnum } from './schoolyears'; diff --git a/apps/server/src/modules/management/seed-data/schoolyears.ts b/apps/server/src/modules/management/seed-data/schoolyears.ts index 3561bcc5157..228bccf60c8 100644 --- a/apps/server/src/modules/management/seed-data/schoolyears.ts +++ b/apps/server/src/modules/management/seed-data/schoolyears.ts @@ -1,6 +1,6 @@ import { SchoolYearProperties } from '@shared/domain/entity'; +import { schoolYearFactory } from '@testing/factory/schoolyear.factory'; import { DeepPartial } from 'fishery'; -import { schoolYearFactory } from './factory/schoolyear.factory'; type SeedSchoolYearProperties = Pick & { id: string; diff --git a/apps/server/src/modules/management/seed-data/systems.ts b/apps/server/src/modules/management/seed-data/systems.ts index f50ff4d0837..01744f7ed0e 100644 --- a/apps/server/src/modules/management/seed-data/systems.ts +++ b/apps/server/src/modules/management/seed-data/systems.ts @@ -1,8 +1,8 @@ /* eslint-disable no-template-curly-in-string */ import { SystemEntityProps } from '@modules/system/entity'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; +import { systemEntityFactory } from '@testing/factory/systemEntityFactory'; import { DeepPartial } from 'fishery'; -import { systemEntityFactory } from './factory/system.entity.factory'; type SystemPartial = DeepPartial & { id?: string; diff --git a/apps/server/src/modules/provisioning/loggable/school-external-tool-created.loggable.spec.ts b/apps/server/src/modules/provisioning/loggable/school-external-tool-created.loggable.spec.ts index 843b6cdfe52..8cfbe2a5677 100644 --- a/apps/server/src/modules/provisioning/loggable/school-external-tool-created.loggable.spec.ts +++ b/apps/server/src/modules/provisioning/loggable/school-external-tool-created.loggable.spec.ts @@ -1,5 +1,5 @@ import { schoolExternalToolFactory } from '@modules/tool/school-external-tool/testing'; -import { mediaUserLicenseFactory } from '@modules/user-license/testing'; +import { mediaUserLicenseFactory } from '@modules/user-license'; import { SchoolExternalToolCreatedLoggable } from './school-external-tool-created.loggable'; describe('SchoolExternalToolCreatedLoggable', () => { diff --git a/apps/server/src/modules/provisioning/strategy/schulconnex/service/schulconnex-license-provisioning.service.spec.ts b/apps/server/src/modules/provisioning/strategy/schulconnex/service/schulconnex-license-provisioning.service.spec.ts index d97c238446d..c2d34c0dfd1 100644 --- a/apps/server/src/modules/provisioning/strategy/schulconnex/service/schulconnex-license-provisioning.service.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/schulconnex/service/schulconnex-license-provisioning.service.spec.ts @@ -1,8 +1,12 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { MediaSource, MediaSourceService } from '@modules/media-source'; import { mediaSourceFactory } from '@modules/media-source/testing'; -import { MediaUserLicense, MediaUserLicenseService, UserLicenseType } from '@modules/user-license'; -import { mediaUserLicenseFactory } from '@modules/user-license/testing'; +import { + MediaUserLicense, + mediaUserLicenseFactory, + MediaUserLicenseService, + UserLicenseType, +} from '@modules/user-license'; import { Test, TestingModule } from '@nestjs/testing'; import { User as UserEntity } from '@shared/domain/entity'; import { userFactory } from '@testing/factory/user.factory'; diff --git a/apps/server/src/modules/provisioning/strategy/schulconnex/service/schulconnex-tool-provisioning.service.spec.ts b/apps/server/src/modules/provisioning/strategy/schulconnex/service/schulconnex-tool-provisioning.service.spec.ts index 4e3e53b63aa..0d592366702 100644 --- a/apps/server/src/modules/provisioning/strategy/schulconnex/service/schulconnex-tool-provisioning.service.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/schulconnex/service/schulconnex-tool-provisioning.service.spec.ts @@ -7,8 +7,7 @@ import { customParameterFactory, externalToolFactory } from '@modules/tool/exter import { SchoolExternalToolService } from '@modules/tool/school-external-tool'; import { SchoolExternalTool } from '@modules/tool/school-external-tool/domain'; import { schoolExternalToolFactory } from '@modules/tool/school-external-tool/testing'; -import { MediaUserLicense, MediaUserLicenseService } from '@modules/user-license'; -import { mediaUserLicenseFactory } from '@modules/user-license/testing'; +import { MediaUserLicense, mediaUserLicenseFactory, MediaUserLicenseService } from '@modules/user-license'; import { Test, TestingModule } from '@nestjs/testing'; import { Logger } from '@src/core/logger'; import { schoolSystemOptionsFactory } from '@testing/factory/domainobject'; diff --git a/apps/server/src/modules/rocketchat-user/domain/index.ts b/apps/server/src/modules/rocketchat-user/domain/index.ts index 0246dd0f0f9..441baa69c52 100644 --- a/apps/server/src/modules/rocketchat-user/domain/index.ts +++ b/apps/server/src/modules/rocketchat-user/domain/index.ts @@ -1 +1,2 @@ export * from './rocket-chat-user.do'; +export * from './testing'; diff --git a/apps/server/src/modules/room/index.ts b/apps/server/src/modules/room/index.ts index 7be3bdc7474..31c66bccfac 100644 --- a/apps/server/src/modules/room/index.ts +++ b/apps/server/src/modules/room/index.ts @@ -2,3 +2,4 @@ export * from './domain'; export { RoomConfig } from './room.config'; export * from './room.module'; export * from './repo/entity'; +export { roomFactory } from './testing'; diff --git a/apps/server/src/modules/synchronization/domain/index.ts b/apps/server/src/modules/synchronization/domain/index.ts index 2285cbd6829..ea6c26e614e 100644 --- a/apps/server/src/modules/synchronization/domain/index.ts +++ b/apps/server/src/modules/synchronization/domain/index.ts @@ -1,3 +1,4 @@ export * from './do'; export * from './service'; export * from './types'; +export * from './testing'; diff --git a/apps/server/src/modules/tool/context-external-tool/service/tool-configuration-status.service.spec.ts b/apps/server/src/modules/tool/context-external-tool/service/tool-configuration-status.service.spec.ts index c618eb9ad05..587d9731b6f 100644 --- a/apps/server/src/modules/tool/context-external-tool/service/tool-configuration-status.service.spec.ts +++ b/apps/server/src/modules/tool/context-external-tool/service/tool-configuration-status.service.spec.ts @@ -1,8 +1,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { ObjectId } from '@mikro-orm/mongodb'; import { MediaBoardConfig } from '@modules/board/media-board.config'; -import { MediaUserLicense, MediaUserLicenseService } from '@modules/user-license'; -import { mediaUserLicenseFactory } from '@modules/user-license/testing'; +import { MediaUserLicense, mediaUserLicenseFactory, MediaUserLicenseService } from '@modules/user-license'; import { ConfigService } from '@nestjs/config'; import { Test, TestingModule } from '@nestjs/testing'; import { ValidationError } from '@shared/common'; diff --git a/apps/server/src/modules/user-license/index.ts b/apps/server/src/modules/user-license/index.ts index efa3fb6d7d3..0bff3f1b0c2 100644 --- a/apps/server/src/modules/user-license/index.ts +++ b/apps/server/src/modules/user-license/index.ts @@ -1,4 +1,5 @@ export { AnyUserLicense, MediaUserLicense, MediaUserLicenseProps } from './domain'; export { UserLicenseType } from './enum/user-license-type'; export { MediaUserLicenseService } from './service'; +export { mediaUserLicenseEntityFactory, mediaUserLicenseFactory } from './testing'; export { UserLicenseModule } from './user-license.module'; diff --git a/apps/server/tsconfig.app.json b/apps/server/tsconfig.app.json index 735c8530c91..14752374a7c 100644 --- a/apps/server/tsconfig.app.json +++ b/apps/server/tsconfig.app.json @@ -11,7 +11,6 @@ "node_modules", "dist", "test", - "**/*spec.ts", - "**/testing" + "**/*spec.ts" ] -} +} \ No newline at end of file diff --git a/esbuild/esmodules-bundler.js b/esbuild/esmodules-bundler.js index e73aab0df47..5774ae47391 100644 --- a/esbuild/esmodules-bundler.js +++ b/esbuild/esmodules-bundler.js @@ -3,7 +3,7 @@ const { dtsPlugin } = require('esbuild-plugin-d.ts'); const { build } = require('esbuild'); const fs = require('fs'); const { resolve } = require('path'); -// add files to be transformed from ESModules to CommonJS in the following list +// add files to be transformed from CommonJs to EsModules in the following list const options = [ { name: 'keycloak-admin-client-lib', diff --git a/package-lock.json b/package-lock.json index b1a0b511893..2cfe57c1701 100644 --- a/package-lock.json +++ b/package-lock.json @@ -79,7 +79,6 @@ "feathers-hooks-common": "^8.1.1", "feathers-swagger": "^3.0.0", "file-type": "^18.5.0", - "fishery": "^2.2.2", "gm": "^1.25.0", "html-entities": "^2.3.2", "i18next": "^23.3.0", @@ -189,6 +188,7 @@ "eslint-plugin-no-only-tests": "^3.3.0", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-promise": "^7.1.0", + "fishery": "^2.2.2", "freeport": "^1.0.5", "jest": "^29.2.2", "jwt-decode": "^3.1.2", @@ -14506,6 +14506,7 @@ }, "node_modules/fishery": { "version": "2.2.2", + "dev": true, "license": "MIT", "dependencies": { "lodash.mergewith": "^4.6.2" @@ -18992,6 +18993,7 @@ }, "node_modules/lodash.mergewith": { "version": "4.6.2", + "dev": true, "license": "MIT" }, "node_modules/lodash.once": { diff --git a/package.json b/package.json index bd4cd82bfe2..df8c267b310 100644 --- a/package.json +++ b/package.json @@ -196,7 +196,6 @@ "feathers-hooks-common": "^8.1.1", "feathers-swagger": "^3.0.0", "file-type": "^18.5.0", - "fishery": "^2.2.2", "gm": "^1.25.0", "html-entities": "^2.3.2", "i18next": "^23.3.0", @@ -255,6 +254,8 @@ "yaml": "^2.5.0" }, "devDependencies": { + "cross-env": "^7.0.0", + "freeport": "^1.0.5", "@aws-sdk/client-s3": "^3.617.0", "@faker-js/faker": "^8.0.2", "@feathersjs/adapter-tests": "^5.0.29", @@ -291,7 +292,6 @@ "chai": "^4.2.0", "chai-as-promised": "^7.1.1", "chai-http": "^4.2.0", - "cross-env": "^7.0.0", "esbuild": "^0.17.10", "esbuild-plugin-d.ts": "^1.3.0", "eslint": "^8.57.0", @@ -306,7 +306,7 @@ "eslint-plugin-no-only-tests": "^3.3.0", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-promise": "^7.1.0", - "freeport": "^1.0.5", + "fishery": "^2.2.2", "jest": "^29.2.2", "jwt-decode": "^3.1.2", "mocha": "^9.1.3", diff --git a/sonar-project.properties b/sonar-project.properties index 317500cae17..9a61e473c22 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -3,7 +3,7 @@ sonar.projectKey=hpi-schul-cloud_schulcloud-server sonar.sources=. sonar.tests=. sonar.test.inclusions=**/*.spec.ts -sonar.exclusions=**/*.js,jest.config.ts,globalSetup.ts,globalTeardown.ts,**/*.app.ts,**/seed-data/**/*.ts,**/migrations/mikro-orm/*.ts,**/etherpad-api-client/**/*.ts,**/authorization-api-client/**/*.ts,**/board-api-client/**/*.ts,**/generated/**/*.ts,**/room-api-client/**/*.ts,**/cards-api-client/**/*.ts,**/lessons-api-client/**/*.ts +sonar.exclusions=**/*.js,jest.config.ts,globalSetup.ts,globalTeardown.ts,**/*.app.ts,**/seed-data/*.ts,**/migrations/mikro-orm/*.ts,**/etherpad-api-client/**/*.ts,**/authorization-api-client/**/*.ts,**/board-api-client/**/*.ts,**/generated/**/*.ts,**/room-api-client/**/*.ts,**/cards-api-client/**/*.ts,**/lessons-api-client/**/*.ts sonar.coverage.exclusions=**/board-management.uc.ts,**/*.module.ts,**/*.factory.ts,**/testing/**/*.ts,**/migrations/mikro-orm/*.ts,**/globalSetup.ts,**/globalTeardown.ts,**/etherpad-api-client/**/*.ts,**/authorization-api-client/**/*.ts,**/board-api-client/**/*.ts,**/generated/**/*.ts,**/room-api-client/**/*.ts,apps/server/src/console/console.ts sonar.cpd.exclusions=**/controller/dto/**/*.ts,**/api/dto/**/*.ts,**/testing/factory/*.factory.ts sonar.javascript.lcov.reportPaths=merged-lcov.info