Skip to content

Commit

Permalink
CopyFileDomainObjectProps, FileDomainObjectProps, CopyFilesRequestInf…
Browse files Browse the repository at this point in the history
…o, FileRequestInfo
  • Loading branch information
wolfganggreschus committed Nov 2, 2023
1 parent 3e830fd commit bc2271f
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EntityId } from '@shared/domain';
import { ICopyFileDomainObjectProps } from '../interfaces';
import { CopyFileDomainObjectProps } from '../interfaces';

export class CopyFileDto {
id?: EntityId | undefined;
Expand All @@ -8,7 +8,7 @@ export class CopyFileDto {

name: string;

constructor(data: ICopyFileDomainObjectProps) {
constructor(data: CopyFileDomainObjectProps) {
this.id = data.id;
this.sourceId = data.sourceId;
this.name = data.name;
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/modules/files-storage-client/dto/file.dto.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EntityId } from '@shared/domain';
import { FileRecordParentType } from '@shared/infra/rabbitmq';
import { IFileDomainObjectProps } from '../interfaces';
import { FileDomainObjectProps } from '../interfaces';

export class FileDto {
id: EntityId;
Expand All @@ -11,7 +11,7 @@ export class FileDto {

parentId: EntityId;

constructor(props: IFileDomainObjectProps) {
constructor(props: FileDomainObjectProps) {
this.id = props.id;
this.name = props.name;
this.parentType = props.parentType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EntityId } from '@shared/domain';

export interface ICopyFileDomainObjectProps {
export interface CopyFileDomainObjectProps {
id?: EntityId | undefined;
sourceId: EntityId;
name: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { EntityId } from '@shared/domain';
import { IFileRequestInfo } from './file-request-info';
import { FileRequestInfo } from './file-request-info';

export interface ICopyFilesRequestInfo {
export interface CopyFilesRequestInfo {
userId: EntityId;
source: IFileRequestInfo;
target: IFileRequestInfo;
source: FileRequestInfo;
target: FileRequestInfo;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EntityId } from '@shared/domain';
import { FileRecordParentType } from '@shared/infra/rabbitmq';

export interface IFileDomainObjectProps {
export interface FileDomainObjectProps {
id: EntityId;
name: string;
parentType: FileRecordParentType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EntityId } from '@shared/domain';
import { FileRecordParentType } from '@shared/infra/rabbitmq';

export interface IFileRequestInfo {
export interface FileRequestInfo {
schoolId: EntityId;
parentType: FileRecordParentType;
parentId: EntityId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { EntityId } from '@shared/domain';
import { IFileRequestInfo } from '../interfaces';
import { ICopyFilesRequestInfo } from '../interfaces/copy-file-request-info';
import { FileRequestInfo } from '../interfaces';
import { CopyFilesRequestInfo } from '../interfaces/copy-file-request-info';

export class CopyFilesOfParentParamBuilder {
static build(userId: EntityId, source: IFileRequestInfo, target: IFileRequestInfo): ICopyFilesRequestInfo {
static build(userId: EntityId, source: FileRequestInfo, target: FileRequestInfo): CopyFilesRequestInfo {
const fileRequestInfo = {
userId,
source,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { LessonEntity, Submission, Task } from '@shared/domain';
import { FileRecordParentType } from '@shared/infra/rabbitmq';
import { CopyFileDto, FileDto } from '../dto';
import { EntitiesWithFiles, ICopyFileDomainObjectProps, IFileDomainObjectProps } from '../interfaces';
import { CopyFileDomainObjectProps, EntitiesWithFiles, FileDomainObjectProps } from '../interfaces';

export class FilesStorageClientMapper {
static mapfileRecordListResponseToDomainFilesDto(fileRecordListResponse: IFileDomainObjectProps[]): FileDto[] {
const filesDto = fileRecordListResponse.map((record: IFileDomainObjectProps) => {
static mapfileRecordListResponseToDomainFilesDto(fileRecordListResponse: FileDomainObjectProps[]): FileDto[] {
const filesDto = fileRecordListResponse.map((record: FileDomainObjectProps) => {
const fileDto = FilesStorageClientMapper.mapFileRecordResponseToFileDto(record);

return fileDto;
Expand All @@ -14,7 +14,7 @@ export class FilesStorageClientMapper {
return filesDto;
}

static mapCopyFileListResponseToCopyFilesDto(copyFileListResponse: ICopyFileDomainObjectProps[]): CopyFileDto[] {
static mapCopyFileListResponseToCopyFilesDto(copyFileListResponse: CopyFileDomainObjectProps[]): CopyFileDto[] {
const filesDto = copyFileListResponse.map((response) => {
const fileDto = FilesStorageClientMapper.mapCopyFileResponseToCopyFileDto(response);

Expand All @@ -24,7 +24,7 @@ export class FilesStorageClientMapper {
return filesDto;
}

static mapFileRecordResponseToFileDto(fileRecordResponse: IFileDomainObjectProps) {
static mapFileRecordResponseToFileDto(fileRecordResponse: FileDomainObjectProps) {
const parentType = FilesStorageClientMapper.mapStringToParentType(fileRecordResponse.parentType);
const fileDto = new FileDto({
id: fileRecordResponse.id,
Expand All @@ -36,7 +36,7 @@ export class FilesStorageClientMapper {
return fileDto;
}

static mapCopyFileResponseToCopyFileDto(response: ICopyFileDomainObjectProps) {
static mapCopyFileResponseToCopyFileDto(response: CopyFileDomainObjectProps) {
const dto = new CopyFileDto({
id: response.id,
sourceId: response.sourceId,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { EntityId } from '@shared/domain';
import { EntitiesWithFiles, IFileRequestInfo } from '../interfaces';
import { EntitiesWithFiles, FileRequestInfo } from '../interfaces';
import { FilesStorageClientMapper } from './files-storage-client.mapper';

export class FileParamBuilder {
static build(schoolId: EntityId, parent: EntitiesWithFiles): IFileRequestInfo {
static build(schoolId: EntityId, parent: EntitiesWithFiles): FileRequestInfo {
const parentType = FilesStorageClientMapper.mapEntityToParentType(parent);
const fileRequestInfo = {
parentType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Injectable } from '@nestjs/common';
import { EntityId } from '@shared/domain';
import { LegacyLogger } from '@src/core/logger';
import { CopyFileDto, FileDto } from '../dto';
import { IFileRequestInfo } from '../interfaces';
import { ICopyFilesRequestInfo } from '../interfaces/copy-file-request-info';
import { FileRequestInfo } from '../interfaces';
import { CopyFilesRequestInfo } from '../interfaces/copy-file-request-info';
import { FilesStorageClientMapper } from '../mapper';
import { FilesStorageProducer } from './files-storage.producer';

Expand All @@ -13,14 +13,14 @@ export class FilesStorageClientAdapterService {
this.logger.setContext(FilesStorageClientAdapterService.name);
}

async copyFilesOfParent(param: ICopyFilesRequestInfo): Promise<CopyFileDto[]> {
async copyFilesOfParent(param: CopyFilesRequestInfo): Promise<CopyFileDto[]> {
const response = await this.fileStorageMQProducer.copyFilesOfParent(param);
const fileInfos = FilesStorageClientMapper.mapCopyFileListResponseToCopyFilesDto(response);

return fileInfos;
}

async listFilesOfParent(param: IFileRequestInfo): Promise<FileDto[]> {
async listFilesOfParent(param: FileRequestInfo): Promise<FileDto[]> {
const response = await this.fileStorageMQProducer.listFilesOfParent(param);

const fileInfos = FilesStorageClientMapper.mapfileRecordListResponseToDomainFilesDto(response);
Expand Down

0 comments on commit bc2271f

Please sign in to comment.