diff --git a/apps/server/src/modules/media-source/index.ts b/apps/server/src/modules/media-source/index.ts index 0e839ea30e..30d292a82c 100644 --- a/apps/server/src/modules/media-source/index.ts +++ b/apps/server/src/modules/media-source/index.ts @@ -1,3 +1,2 @@ export { MediaSource } from './domain'; export { MediaSourceService } from './service'; -export { mediaSourceFactory } from './testing'; diff --git a/apps/server/src/modules/media-source/testing/index.ts b/apps/server/src/modules/media-source/testing/index.ts index 6308d817ce..4cd1dc41c7 100644 --- a/apps/server/src/modules/media-source/testing/index.ts +++ b/apps/server/src/modules/media-source/testing/index.ts @@ -1 +1,4 @@ export { mediaSourceFactory } from './media-source.factory'; +export { mediaSourceEntityFactory } from './media-source-entity.factory'; +export { mediaSourceBasicConfigEmbeddableFactory } from './media-source-basic-auth-config.embeddable.factory'; +export { mediaSourceOAuthConfigEmbeddableFactory } from './media-source-oauth-config.embeddable.factory'; diff --git a/apps/server/src/modules/user-license/repo/media-user-license.repo.spec.ts b/apps/server/src/modules/user-license/repo/media-user-license.repo.spec.ts index 3c943ac3f2..6f898476ce 100644 --- a/apps/server/src/modules/user-license/repo/media-user-license.repo.spec.ts +++ b/apps/server/src/modules/user-license/repo/media-user-license.repo.spec.ts @@ -3,16 +3,19 @@ import { EntityManager } from '@mikro-orm/mongodb'; import { Test, TestingModule } from '@nestjs/testing'; import { User as UserEntity } from '@shared/domain/entity'; import { cleanupCollections, userFactory } from '@shared/testing'; -import { mediaSourceOAuthConfigEmbeddableFactory } from '@src/modules/media-source/testing/media-source-oauth-config.embeddable.factory'; -import { mediaSourceEntityFactory } from '@src/modules/media-source/testing/media-source-entity.factory'; -import { mediaSourceFactory } from '@src/modules/media-source/testing/media-source.factory'; -import { MediaSourceConfigMapper } from '@src/modules/media-source/repo'; -import { MediaSourceEntity, MediaSourceOauthConfigEmbeddable } from '@src/modules/media-source/entity'; +import { MediaSource } from '@modules/media-source'; +import { MediaSourceEntity } from '@modules/media-source/entity'; +import { MediaSourceConfigMapper } from '@modules/media-source/repo'; +import { + mediaSourceFactory, + mediaSourceEntityFactory, + mediaSourceBasicConfigEmbeddableFactory, + mediaSourceOAuthConfigEmbeddableFactory, +} from '@modules/media-source/testing'; import { MediaUserLicense } from '../domain'; import { MediaUserLicenseEntity } from '../entity'; import { mediaUserLicenseEntityFactory, mediaUserLicenseFactory } from '../testing'; import { MediaUserLicenseRepo } from './media-user-license.repo'; -import { MediaSource } from '@src/modules/media-source/domain'; describe(MediaUserLicenseRepo.name, () => { let module: TestingModule; @@ -41,8 +44,9 @@ describe(MediaUserLicenseRepo.name, () => { describe('when searching for a users media licences', () => { const setup = async () => { const user: UserEntity = userFactory.build(); - const config: MediaSourceOauthConfigEmbeddable = mediaSourceOAuthConfigEmbeddableFactory.build(); - const mediaSource: MediaSourceEntity = mediaSourceEntityFactory.build({ oauthConfig: config }); + const basicAuthConfig = mediaSourceBasicConfigEmbeddableFactory.build(); + const oauthConfig = mediaSourceOAuthConfigEmbeddableFactory.build(); + const mediaSource: MediaSourceEntity = mediaSourceEntityFactory.build({ basicAuthConfig, oauthConfig }); const mediaUserLicense: MediaUserLicenseEntity = mediaUserLicenseEntityFactory.build({ user, mediaSource }); const otherMediaUserLicense: MediaUserLicenseEntity = mediaUserLicenseEntityFactory.build(); @@ -54,12 +58,13 @@ describe(MediaUserLicenseRepo.name, () => { user, mediaUserLicense, mediaSource, - config, + basicAuthConfig, + oauthConfig, }; }; it('should return user licenses for user', async () => { - const { user, mediaUserLicense, mediaSource, config } = await setup(); + const { user, mediaUserLicense, mediaSource, basicAuthConfig, oauthConfig } = await setup(); const result: MediaUserLicense[] = await repo.findMediaUserLicensesForUser(user.id); @@ -74,7 +79,8 @@ describe(MediaUserLicenseRepo.name, () => { name: mediaSource.name, sourceId: mediaSource.sourceId, format: mediaSource.format, - oauthConfig: MediaSourceConfigMapper.mapOauthConfigToDo(config), + oauthConfig: MediaSourceConfigMapper.mapOauthConfigToDo(oauthConfig), + basicAuthConfig: MediaSourceConfigMapper.mapBasicConfigToDo(basicAuthConfig), }), }), ]); diff --git a/apps/server/src/modules/user-license/repo/media-user-license.repo.ts b/apps/server/src/modules/user-license/repo/media-user-license.repo.ts index 37d64fd1e5..a6fae9df2f 100644 --- a/apps/server/src/modules/user-license/repo/media-user-license.repo.ts +++ b/apps/server/src/modules/user-license/repo/media-user-license.repo.ts @@ -27,6 +27,9 @@ export class MediaUserLicenseRepo extends BaseDomainObjectRepo