Skip to content

Commit

Permalink
ew-1009: added all required DTOs for uc usage
Browse files Browse the repository at this point in the history
  • Loading branch information
HKayed committed Oct 18, 2024
1 parent b37a85f commit fb0bafa
Show file tree
Hide file tree
Showing 25 changed files with 1,334 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { CollaborativeTextEditorElementResponseDto } from './collaborative-text-editor-element-response.dto';
import { DeletedElementResponseDto } from './deleted-element-response.dto';
import { DrawingElementResponseDto } from './drawing-element-response.dto';
import { ExternalToolElementResponseDto } from './external-tool-element-response.dto';
import { FileElementResponseDto } from './file-element-response.dto';
import { LinkElementResponseDto } from './link-element-response.dto';
import { RichTextElementResponseDto } from './rich-text-element-response.dto';
import { SubmissionContainerElementResponseDto } from './submission-container-element-response.dto';

export type CardResponseElementsInnerDto =
| CollaborativeTextEditorElementResponseDto
| DeletedElementResponseDto
| DrawingElementResponseDto
| ExternalToolElementResponseDto
| FileElementResponseDto
| LinkElementResponseDto
| RichTextElementResponseDto
| SubmissionContainerElementResponseDto;
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { CardResponseElementsInnerDto } from './card-response-elements-inner.dto';
import { TimestampResponseDto } from './timestamp-response.dto';
import { VisibilitySettingsResponseDto } from './visibility-settings-response.dto';

export class CardResponseDto {
id: string;

title?: string;

height: number;

elements: Array<CardResponseElementsInnerDto>;

visibilitySettings: VisibilitySettingsResponseDto;

timeStamps: TimestampResponseDto;

constructor(
id: string,
title: string,
height: number,
elements: Array<CardResponseElementsInnerDto>,
visibilitySettings: VisibilitySettingsResponseDto,
timeStamps: TimestampResponseDto
) {
this.id = id;
this.title = title;
this.height = height;
this.elements = elements;
this.visibilitySettings = visibilitySettings;
this.timeStamps = timeStamps;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ContentElementType } from '../cards-api-client';
import { TimestampResponseDto } from './timestamp-response.dto';

export class CollaborativeTextEditorElementResponseDto {
id: string;

type: ContentElementType;

timestamps: TimestampResponseDto;

content: object;

constructor(id: string, type: ContentElementType, timestamps: TimestampResponseDto, content: object) {
this.id = id;
this.type = type;
this.timestamps = timestamps;
this.content = content;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ContentElementType } from '../enums/content-element-type.enum';

export class DeletedElementContentDto {
title: string;

deletedElementType: ContentElementType;

description: string;

constructor(title: string, deletedElementType: ContentElementType, description: string) {
this.title = title;
this.deletedElementType = deletedElementType;
this.description = description;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ContentElementType } from '../cards-api-client';
import { DeletedElementContentDto } from './deleted-element-content.dto';
import { TimestampResponseDto } from './timestamp-response.dto';

export class DeletedElementResponseDto {
id: string;

type: ContentElementType;

content: DeletedElementContentDto;

timestamps: TimestampResponseDto;

constructor(
id: string,
type: ContentElementType,
content: DeletedElementContentDto,
timestamps: TimestampResponseDto
) {
this.id = id;
this.type = type;
this.content = content;
this.timestamps = timestamps;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export class DrawingElementContentDto {
descritpion: string;

constructor(descritpion: string) {
this.descritpion = descritpion;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ContentElementType } from '../enums/content-element-type.enum';
import { DrawingElementContentDto } from './drawing-element-content.dto';
import { TimestampResponseDto } from './timestamp-response.dto';

export class DrawingElementResponseDto {
id: string;

type: ContentElementType;

timestamps: TimestampResponseDto;

content: DrawingElementContentDto;

constructor(
id: string,
type: ContentElementType,
timestamps: TimestampResponseDto,
content: DrawingElementContentDto
) {
this.id = id;
this.type = type;
this.timestamps = timestamps;
this.content = content;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export class ExternalToolElementContentDto {
contentExternalToolId: string | null;

constructor(contentExternalToolId: string | null) {
this.contentExternalToolId = contentExternalToolId;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ContentElementType } from '../enums/content-element-type.enum';
import { ExternalToolElementContentDto } from './external-tool-element-content.dto';
import { TimestampResponseDto } from './timestamp-response.dto';

export class ExternalToolElementResponseDto {
id: string;

type: ContentElementType;

content: ExternalToolElementContentDto;

timestamps: TimestampResponseDto;

constructor(
id: string,
type: ContentElementType,
content: ExternalToolElementContentDto,
timestamps: TimestampResponseDto
) {
this.id = id;
this.type = type;
this.content = content;
this.timestamps = timestamps;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export class FileElementContentDto {
caption: string;

alternativeText: string;

constructor(caption: string, alternativeText: string) {
this.caption = caption;
this.alternativeText = alternativeText;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ContentElementType } from '../enums/content-element-type.enum';
import { FileElementContentDto } from './file-element-content.dto';
import { TimestampResponseDto } from './timestamp-response.dto';

export class FileElementResponseDto {
id: string;

type: ContentElementType;

content: FileElementContentDto;

timestamps: TimestampResponseDto;

constructor(id: string, type: ContentElementType, content: FileElementContentDto, timestamps: TimestampResponseDto) {
this.id = id;
this.type = type;
this.content = content;
this.timestamps = timestamps;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export class LinkElementContentDto {
url: string;

title: string;

description?: string;

imageUrl?: string;

constructor(url: string, title: string, description: string, imageUrl: string) {
this.url = url;
this.title = title;
this.description = description;
this.imageUrl = imageUrl;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ContentElementType } from '../enums/content-element-type.enum';
import { LinkElementContentDto } from './link-element-content.dto';
import { TimestampResponseDto } from './timestamp-response.dto';

export class LinkElementResponseDto {
id: string;

type: ContentElementType;

content: LinkElementContentDto;

timestamps: TimestampResponseDto;

constructor(id: string, type: ContentElementType, content: LinkElementContentDto, timestamps: TimestampResponseDto) {
this.id = id;
this.type = type;
this.content = content;
this.timestamps = timestamps;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export class RichTextElementContentDto {
text: string;

inputFormat: string;

constructor(text: string, inputFormat: string) {
this.text = text;
this.inputFormat = inputFormat;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ContentElementType } from '../enums/content-element-type.enum';
import { RichTextElementContentDto } from './rich-text-element-content.dto';
import { TimestampResponseDto } from './timestamp-response.dto';

export class RichTextElementResponseDto {
id: string;

type: ContentElementType;

content: RichTextElementContentDto;

timestamps: TimestampResponseDto;

constructor(
id: string,
type: ContentElementType,
content: RichTextElementContentDto,
timestamps: TimestampResponseDto
) {
this.id = id;
this.type = type;
this.content = content;
this.timestamps = timestamps;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export class SubmissionContainerElementContentDto {
dueDate: string;

constructor(dueDate: string) {
this.dueDate = dueDate;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ContentElementType } from '../cards-api-client';
import { SubmissionContainerElementContentDto } from './submission-container-element-content.dto';
import { TimestampResponseDto } from './timestamp-response.dto';

export class SubmissionContainerElementResponseDto {
id: string;

type: ContentElementType;

content: SubmissionContainerElementContentDto;

timestamps: TimestampResponseDto;

constructor(
id: string,
type: ContentElementType,
content: SubmissionContainerElementContentDto,
timestamps: TimestampResponseDto
) {
this.id = id;
this.type = type;
this.content = content;
this.timestamps = timestamps;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export class TimestampResponseDto {
lastUpdatedAt: string;

createdAt: string;

deletedAt: string;

constructor(lastUpdatedAt: string, createdAt: string, deletedAt: string) {
this.lastUpdatedAt = lastUpdatedAt;
this.createdAt = createdAt;
this.deletedAt = deletedAt;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export class VisibilitySettingsResponseDto {
publishedAt: string;

constructor(publishedAt: string) {
this.publishedAt = publishedAt;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export enum ContentElementType {
FILE = 'file',
DRAWING = 'drawing',
LINK = 'link',
RICH_TEXT = 'richText',
SUBMISSION_CONTAINER = 'submissionContainer',
EXTERNAL_TOOL = 'externalTool',
COLLABORATIVE_TEXT_EDITOR = 'collaborativeTextEditor',
DELETED = 'deleted',
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { CardResponse } from '../cards-api-client';
import { CardResponseDto } from '../dto/card-response.dto';

export class CardResponseMapper {
public static mapToCardResponseDto(cardResponse: CardResponse) {
return new CardResponseDto(
cardResponse.id,
cardResponse.title!,
cardResponse.height,
cardResponse.elements,
cardResponse.visibilitySettings,
cardResponse.timestamps
);
}

private static mapTo
}
Loading

0 comments on commit fb0bafa

Please sign in to comment.