Skip to content

Commit

Permalink
FilesStorageClientConfig, FilesStorageClientConfig, CopyFileDomainObj…
Browse files Browse the repository at this point in the history
…ectProps, FileDomainObjectProps, CommonCartridgeElement, CommonCartridgeElement

tests adjusted
  • Loading branch information
wolfganggreschus committed Nov 2, 2023
1 parent bc2271f commit 48b3328
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion apps/server/src/modules/files-storage-client/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export { FileDto } from './dto';
export * from './files-storage-client.module';
export { IFilesStorageClientConfig } from './interfaces';
export { FilesStorageClientConfig } from './interfaces';
export { FileParamBuilder } from './mapper/files-storage-param.builder';
export { CopyFilesService } from './service/copy-files.service';
export { FilesStorageClientAdapterService } from './service/files-storage-client.service';
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export interface IFilesStorageClientConfig {
export interface FilesStorageClientConfig {
INCOMING_REQUEST_TIMEOUT_COPY_API: number;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FileRecordParentType } from '@shared/infra/rabbitmq';
import { ICopyFileDomainObjectProps, IFileDomainObjectProps } from '../interfaces';
import { CopyFileDomainObjectProps, FileDomainObjectProps } from '../interfaces';
import { FilesStorageClientMapper } from './files-storage-client.mapper';

describe('FilesStorageClientMapper', () => {
Expand All @@ -15,7 +15,7 @@ describe('FilesStorageClientMapper', () => {
parentType: FileRecordParentType.Task,
};

const response: IFileDomainObjectProps[] = [record];
const response: FileDomainObjectProps[] = [record];

describe('mapfileRecordListResponseToDomainFilesDto', () => {
it('Should map to valid file Dtos.', () => {
Expand Down Expand Up @@ -83,13 +83,13 @@ describe('FilesStorageClientMapper', () => {
});

describe('copyFileDto mapper', () => {
const copyFileResponse: ICopyFileDomainObjectProps = {
const copyFileResponse: CopyFileDomainObjectProps = {
id: 'id123',
sourceId: 'sourceId123',
name: 'name',
};

const list: ICopyFileDomainObjectProps[] = [copyFileResponse];
const list: CopyFileDomainObjectProps[] = [copyFileResponse];

describe('mapCopyFileListResponseToCopyFilesDto', () => {
it('Should map to valid file Dtos.', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import {
IFileRecordParams,
RpcMessageProducer,
} from '@src/shared/infra/rabbitmq';
import { IFilesStorageClientConfig } from '../interfaces';
import { FilesStorageClientConfig } from '../interfaces';

@Injectable()
export class FilesStorageProducer extends RpcMessageProducer {
constructor(
protected readonly amqpConnection: AmqpConnection,
private readonly logger: LegacyLogger,
protected readonly configService: ConfigService<IFilesStorageClientConfig, true>
protected readonly configService: ConfigService<FilesStorageClientConfig, true>
) {
super(amqpConnection, FilesStorageExchange, configService.get('INCOMING_REQUEST_TIMEOUT_COPY_API'));
this.logger.setContext(FilesStorageProducer.name);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export interface ICommonCartridgeElement {
export interface CommonCartridgeElement {
transform(): Record<string, unknown>;
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import AdmZip from 'adm-zip';
import { Builder } from 'xml2js';
import { CommonCartridgeElement } from './common-cartridge-element.interface';
import { CommonCartridgeVersion } from './common-cartridge-enums';
import { ICommonCartridgeElement } from './common-cartridge-element.interface';
import { CommonCartridgeManifestElement } from './common-cartridge-manifest-element';
import {
CommonCartridgeResourceItemElement,
ICommonCartridgeResourceProps,
} from './common-cartridge-resource-item-element';
import {
CommonCartridgeOrganizationItemElement,
ICommonCartridgeOrganizationProps,
} from './common-cartridge-organization-item-element';
import {
CommonCartridgeResourceItemElement,
ICommonCartridgeResourceProps,
} from './common-cartridge-resource-item-element';

export type ICommonCartridgeFileBuilderOptions = {
identifier: string;
Expand Down Expand Up @@ -39,11 +39,11 @@ class CommonCartridgeOrganizationBuilder implements ICommonCartridgeOrganization
private readonly zipBuilder: AdmZip
) {}

get organization(): ICommonCartridgeElement {
get organization(): CommonCartridgeElement {
return new CommonCartridgeOrganizationItemElement(this.props);
}

get resources(): ICommonCartridgeElement[] {
get resources(): CommonCartridgeElement[] {
return this.props.resources.map(
(resourceProps) => new CommonCartridgeResourceItemElement(resourceProps, this.xmlBuilder)
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Builder } from 'xml2js';
import { ICommonCartridgeElement } from './common-cartridge-element.interface';
import { ICommonCartridgeFile } from './common-cartridge-file.interface';
import { CommonCartridgeElement } from './common-cartridge-element.interface';
import { CommonCartridgeResourceType, CommonCartridgeVersion } from './common-cartridge-enums';
import { ICommonCartridgeFile } from './common-cartridge-file.interface';

export type ICommonCartridgeLtiResourceProps = {
type: CommonCartridgeResourceType.LTI;
Expand All @@ -13,7 +13,7 @@ export type ICommonCartridgeLtiResourceProps = {
url: string;
};

export class CommonCartridgeLtiResource implements ICommonCartridgeElement, ICommonCartridgeFile {
export class CommonCartridgeLtiResource implements CommonCartridgeElement, ICommonCartridgeFile {
constructor(private readonly props: ICommonCartridgeLtiResourceProps, private readonly xmlBuilder: Builder) {}

canInline(): boolean {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { ICommonCartridgeElement } from './common-cartridge-element.interface';
import { CommonCartridgeElement } from './common-cartridge-element.interface';
import { CommonCartridgeVersion } from './common-cartridge-enums';
import { CommonCartridgeMetadataElement, ICommonCartridgeMetadataProps } from './common-cartridge-metadata-element';
import { CommonCartridgeOrganizationWrapperElement } from './common-cartridge-organization-wrapper-element';
import { CommonCartridgeResourceWrapperElement } from './common-cartridge-resource-wrapper-element';
import { CommonCartridgeVersion } from './common-cartridge-enums';

export type ICommonCartridgeManifestProps = {
identifier: string;
};

export class CommonCartridgeManifestElement implements ICommonCartridgeElement {
export class CommonCartridgeManifestElement implements CommonCartridgeElement {
constructor(
private readonly props: ICommonCartridgeManifestProps,
private readonly metadataProps: ICommonCartridgeMetadataProps,
private readonly organizations: ICommonCartridgeElement[],
private readonly resources: ICommonCartridgeElement[]
private readonly organizations: CommonCartridgeElement[],
private readonly resources: CommonCartridgeElement[]
) {}

transform(): Record<string, unknown> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ICommonCartridgeElement } from './common-cartridge-element.interface';
import { CommonCartridgeElement } from './common-cartridge-element.interface';
import { CommonCartridgeVersion } from './common-cartridge-enums';

export type ICommonCartridgeMetadataProps = {
Expand All @@ -8,7 +8,7 @@ export type ICommonCartridgeMetadataProps = {
version: CommonCartridgeVersion;
};

export class CommonCartridgeMetadataElement implements ICommonCartridgeElement {
export class CommonCartridgeMetadataElement implements CommonCartridgeElement {
constructor(private readonly props: ICommonCartridgeMetadataProps) {}

transform(): Record<string, unknown> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ICommonCartridgeElement } from './common-cartridge-element.interface';
import { CommonCartridgeElement } from './common-cartridge-element.interface';
import { ICommonCartridgeResourceProps } from './common-cartridge-resource-item-element';
import { createIdentifier } from './utils';

Expand All @@ -9,7 +9,7 @@ export type ICommonCartridgeOrganizationProps = {
resources: ICommonCartridgeResourceProps[];
};

export class CommonCartridgeOrganizationItemElement implements ICommonCartridgeElement {
export class CommonCartridgeOrganizationItemElement implements CommonCartridgeElement {
constructor(private readonly props: ICommonCartridgeOrganizationProps) {}

transform(): Record<string, unknown> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ICommonCartridgeElement } from './common-cartridge-element.interface';
import { CommonCartridgeElement } from './common-cartridge-element.interface';

export class CommonCartridgeOrganizationWrapperElement implements ICommonCartridgeElement {
constructor(private readonly organizationElements: ICommonCartridgeElement[]) {}
export class CommonCartridgeOrganizationWrapperElement implements CommonCartridgeElement {
constructor(private readonly organizationElements: CommonCartridgeElement[]) {}

transform(): Record<string, unknown> {
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { Builder } from 'xml2js';
import { CommonCartridgeElement } from './common-cartridge-element.interface';
import { CommonCartridgeResourceType } from './common-cartridge-enums';
import { ICommonCartridgeFile } from './common-cartridge-file.interface';
import { CommonCartridgeLtiResource, ICommonCartridgeLtiResourceProps } from './common-cartridge-lti-resource';
import {
CommonCartridgeWebContentResource,
Expand All @@ -8,17 +11,14 @@ import {
CommonCartridgeWebLinkResourceElement,
ICommonCartridgeWebLinkResourceProps,
} from './common-cartridge-web-link-resource';
import { ICommonCartridgeElement } from './common-cartridge-element.interface';
import { ICommonCartridgeFile } from './common-cartridge-file.interface';
import { CommonCartridgeResourceType } from './common-cartridge-enums';

export type ICommonCartridgeResourceProps =
| ICommonCartridgeLtiResourceProps
| ICommonCartridgeWebContentResourceProps
| ICommonCartridgeWebLinkResourceProps;

export class CommonCartridgeResourceItemElement implements ICommonCartridgeElement, ICommonCartridgeFile {
private readonly inner: ICommonCartridgeElement & ICommonCartridgeFile;
export class CommonCartridgeResourceItemElement implements CommonCartridgeElement, ICommonCartridgeFile {
private readonly inner: CommonCartridgeElement & ICommonCartridgeFile;

constructor(props: ICommonCartridgeResourceProps, xmlBuilder: Builder) {
if (props.type === CommonCartridgeResourceType.LTI) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ICommonCartridgeElement } from './common-cartridge-element.interface';
import { CommonCartridgeElement } from './common-cartridge-element.interface';

export class CommonCartridgeResourceWrapperElement implements ICommonCartridgeElement {
constructor(private readonly resourceElements: ICommonCartridgeElement[]) {}
export class CommonCartridgeResourceWrapperElement implements CommonCartridgeElement {
constructor(private readonly resourceElements: CommonCartridgeElement[]) {}

transform(): Record<string, unknown> {
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ICommonCartridgeElement } from './common-cartridge-element.interface';
import { ICommonCartridgeFile } from './common-cartridge-file.interface';
import { CommonCartridgeElement } from './common-cartridge-element.interface';
import {
CommonCartridgeIntendedUseType,
CommonCartridgeResourceType,
CommonCartridgeVersion,
} from './common-cartridge-enums';
import { ICommonCartridgeFile } from './common-cartridge-file.interface';

export type ICommonCartridgeWebContentResourceProps = {
type: CommonCartridgeResourceType.WEB_CONTENT;
Expand All @@ -16,7 +16,7 @@ export type ICommonCartridgeWebContentResourceProps = {
intendedUse?: CommonCartridgeIntendedUseType;
};

export class CommonCartridgeWebContentResource implements ICommonCartridgeElement, ICommonCartridgeFile {
export class CommonCartridgeWebContentResource implements CommonCartridgeElement, ICommonCartridgeFile {
constructor(private readonly props: ICommonCartridgeWebContentResourceProps) {}

canInline(): boolean {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Builder } from 'xml2js';
import { ICommonCartridgeElement } from './common-cartridge-element.interface';
import { ICommonCartridgeFile } from './common-cartridge-file.interface';
import { CommonCartridgeElement } from './common-cartridge-element.interface';
import { CommonCartridgeResourceType, CommonCartridgeVersion } from './common-cartridge-enums';
import { ICommonCartridgeFile } from './common-cartridge-file.interface';

export type ICommonCartridgeWebLinkResourceProps = {
type: CommonCartridgeResourceType.WEB_LINK_V1 | CommonCartridgeResourceType.WEB_LINK_V3;
Expand All @@ -12,7 +12,7 @@ export type ICommonCartridgeWebLinkResourceProps = {
url: string;
};

export class CommonCartridgeWebLinkResourceElement implements ICommonCartridgeElement, ICommonCartridgeFile {
export class CommonCartridgeWebLinkResourceElement implements CommonCartridgeElement, ICommonCartridgeFile {
constructor(private readonly props: ICommonCartridgeWebLinkResourceProps, private readonly xmlBuilder: Builder) {}

canInline(): boolean {
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/modules/server/server.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Configuration } from '@hpi-schul-cloud/commons';
import type { AccountConfig } from '@modules/account';
import type { IFilesStorageClientConfig } from '@modules/files-storage-client';
import type { FilesStorageClientConfig } from '@modules/files-storage-client';
import type { ICommonCartridgeConfig } from '@modules/learnroom/common-cartridge';
import type { IUserConfig } from '@modules/user';
import type { IIdentityManagementConfig } from '@shared/infra/identity-management';
Expand All @@ -16,7 +16,7 @@ export enum NodeEnvType {
export interface IServerConfig
extends CoreModuleConfig,
IUserConfig,
IFilesStorageClientConfig,
FilesStorageClientConfig,
AccountConfig,
IIdentityManagementConfig,
ICommonCartridgeConfig {
Expand Down

0 comments on commit 48b3328

Please sign in to comment.