Skip to content

Commit

Permalink
removing url property from VC element
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSchuhmacher committed Dec 11, 2024
1 parent dc7c768 commit 66b7a98
Show file tree
Hide file tree
Showing 15 changed files with 4 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ export class VideoConferenceContentBody {
@IsString()
@ApiProperty()
title!: string;

@IsString()
@ApiProperty()
url!: string;
}

export class VideoConferenceElementContentBody extends ElementContentBody {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@ import { ContentElementType } from '../../../domain';
import { TimestampsResponse } from '../timestamps.response';

export class VideoConferenceElementContent {
constructor({ title, url }: VideoConferenceElementContent) {
constructor({ title }: VideoConferenceElementContent) {
this.title = title;
this.url = url;
}

@ApiProperty()
title: string;

@ApiProperty()
url: string;
}

export class VideoConferenceElementResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class VideoConferenceElementResponseMapper implements BaseResponseMapper
id: element.id,
timestamps: new TimestampsResponse({ lastUpdatedAt: element.updatedAt, createdAt: element.createdAt }),
type: ContentElementType.VIDEO_CONFERENCE,
content: new VideoConferenceElementContent({ title: element.title, url: element.url }),
content: new VideoConferenceElementContent({ title: element.title }),
});

return result;
Expand Down
1 change: 0 additions & 1 deletion apps/server/src/modules/board/domain/board-node.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export class BoardNodeFactory {
element = new VideoConferenceElement({
...this.getBaseProps(),
title: '',
url: '',
});
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export interface SubmissionItemProps extends BoardNodeProps {

export interface VideoConferenceElementProps extends BoardNodeProps {
title: string;
url: string;
}

export interface DeletedElementProps extends BoardNodeProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('VideoConferenceElement', () => {
beforeEach(() => {
videoConferenceElement = new VideoConferenceElement({
...boardNodeProps,
url: 'https://example.com',
title: 'Example',
});
});
Expand All @@ -30,15 +29,6 @@ describe('VideoConferenceElement', () => {
expect(isVideoConferenceElement({})).toBe(false);
});

it('should return url', () => {
expect(videoConferenceElement.url).toBe('https://example.com');
});

it('should set url', () => {
videoConferenceElement.url = 'https://newurl.com';
expect(videoConferenceElement.url).toBe('https://newurl.com');
});

it('should return title', () => {
expect(videoConferenceElement.title).toBe('Example');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ import { BoardNode } from './board-node.do';
import type { VideoConferenceElementProps } from './types';

export class VideoConferenceElement extends BoardNode<VideoConferenceElementProps> {
get url(): string {
return this.props.url ?? '';
}

set url(value: string) {
this.props.url = value;
}

get title(): string {
return this.props.title ?? '';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,10 @@ describe('ContentElementUpdateService', () => {
it('should update VideoConferenceElement', async () => {
const element = videoConferenceElementFactory.build();
const content = new VideoConferenceContentBody();
content.url = 'http://example-vc.com/';
content.title = 'vc title';

await service.updateContent(element, content);

expect(element.url).toBe('http://example-vc.com/');
expect(element.title).toBe('vc title');
expect(repo.save).toHaveBeenCalledWith(element);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,5 @@ export class ContentElementUpdateService {

updateVideoConferenceElement(element: VideoConferenceElement, content: VideoConferenceContentBody): void {
element.title = content.title;
element.url = new URL(content.url).toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const videoConferenceElementEntityFactory = BoardNodeEntityFactory.define
title: `video conference element #${sequence}`,
position: 0,
children: [],
url: `https://example.org/#${sequence}`,
createdAt: new Date(),
updatedAt: new Date(),
type: BoardNodeType.VIDEO_CONFERENCE_ELEMENT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const videoConferenceElementFactory = BaseFactory.define<VideoConferenceE
createdAt: new Date(),
updatedAt: new Date(),
title: `video conference element #${sequence}`,
url: `url #${sequence}`,
};
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,4 @@ export interface VideoConferenceElementContent {
* @memberof VideoConferenceElementContent
*/
title: string;
/**
*
* @type {string}
* @memberof VideoConferenceElementContent
*/
url: string;
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
export class VideoConferenceElementContentDto {
title: string;

url: string;

constructor(title: string, url: string) {
constructor(title: string) {
this.title = title;
this.url = url;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ describe('CardResponseMapper', () => {
}) as RichTextElementResponse,

createMockElement(faker.string.uuid(), ContentElementType.VIDEO_CONFERENCE, {
url: faker.internet.url(),
title: faker.lorem.word(),
}) as VideoConferenceElementResponse,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class CardResponseMapper {
new VideoConferenceElementResponseDto(
element.id,
ContentElementType.VIDEO_CONFERENCE,
new VideoConferenceElementContentDto(content.title, content.url),
new VideoConferenceElementContentDto(content.title),
this.mapToTimestampDto(element.timestamps)
)
);
Expand Down

0 comments on commit 66b7a98

Please sign in to comment.