Skip to content

Commit 9b7f539

Browse files
committed
Should work
1 parent 1dc6abf commit 9b7f539

File tree

5 files changed

+28
-0
lines changed

5 files changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { MigrationInterface, QueryRunner } from "typeorm";
2+
3+
export class BlogpostRenderedHtml1739824559290 implements MigrationInterface {
4+
name = "BlogpostRenderedHtml1739824559290";
5+
6+
public async up(queryRunner: QueryRunner): Promise<void> {
7+
await queryRunner.query(
8+
`ALTER TABLE "blogpost_entity" ADD "rendered_content_html" text NOT NULL DEFAULT ''`,
9+
);
10+
}
11+
12+
public async down(queryRunner: QueryRunner): Promise<void> {
13+
await queryRunner.query(
14+
`ALTER TABLE "blogpost_entity" DROP COLUMN "rendered_content_html"`,
15+
);
16+
}
17+
}

src/entity/blogpost.entity.ts

+7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ export class BlogpostEntity {
3131
})
3232
content: string;
3333

34+
@Column({
35+
type: "text",
36+
name: "rendered_content_html",
37+
default: "",
38+
})
39+
renderedContentHtml: string;
40+
3441
@Column()
3542
author: string;
3643

src/rest/blogpost/blogpost.controller.ts

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export class BlogpostController {
5757
blogpost.imageKey = `upload/dotaold.jpg`; // Very bad hack but wcyd
5858
}
5959
blogpost.content = dto.content;
60+
blogpost.renderedContentHtml = dto.renderedContentHtml;
6061
if (dto.imageKey) {
6162
blogpost.imageKey = dto.imageKey;
6263
}

src/rest/blogpost/blogpost.dto.ts

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export class UpdateBlogpostDraftDto {
66
id?: number;
77

88
content: string;
9+
renderedContentHtml: string;
910
title: string;
1011
shortDescription: string;
1112
imageKey?: string;
@@ -14,6 +15,7 @@ export class UpdateBlogpostDraftDto {
1415
export class BlogpostDto {
1516
id: number;
1617
content: string;
18+
renderedContentHtml: string;
1719
title: string;
1820
shortDescription: string;
1921
image: UploadedImageDto;

src/rest/blogpost/blogpost.mapper.ts

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export class BlogpostMapper {
1616
public mapPost = async (post: BlogpostEntity): Promise<BlogpostDto> => ({
1717
id: post.id,
1818
content: post.content,
19+
renderedContentHtml: post.renderedContentHtml,
1920
title: post.title,
2021
shortDescription: post.shortDescription,
2122
image: this.storageMapper.mapS3Item(post.imageKey),

0 commit comments

Comments
 (0)