markdown img insert work as intended
This commit is contained in:
1 parent
28609a6492
commit
6467e21019
9 files changed
+3138
-1263
No files matched your search
@@ -8,7 +8,7 @@ import {
|
||||
IsBoolean,
|
||||
IsDate,
|
||||
} from 'class-validator';
|
||||
import { ArticleStatus, LiveBlogStatus } from './entities';
|
||||
import { ArticleStatus, LiveBlogStatus, ImagePosition, ImageSize } from './entities';
|
||||
|
||||
export class CreateArticleDto {
|
||||
@IsString()
|
||||
@@ -49,6 +49,14 @@ export class CreateArticleDto {
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
categoryId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(ImagePosition)
|
||||
imagePosition?: ImagePosition;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(ImageSize)
|
||||
imageSize?: ImageSize;
|
||||
}
|
||||
|
||||
export class UpdateArticleDto {
|
||||
@@ -92,6 +100,14 @@ export class UpdateArticleDto {
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
categoryId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(ImagePosition)
|
||||
imagePosition?: ImagePosition;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(ImageSize)
|
||||
imageSize?: ImageSize;
|
||||
}
|
||||
|
||||
export class FindArticlesDto {
|
||||
@@ -157,6 +173,14 @@ export class CreateLiveBlogDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
featuredImage?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(ImagePosition)
|
||||
imagePosition?: ImagePosition;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(ImageSize)
|
||||
imageSize?: ImageSize;
|
||||
}
|
||||
|
||||
export class UpdateLiveBlogDto {
|
||||
@@ -195,6 +219,14 @@ export class UpdateLiveBlogDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
featuredImage?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(ImagePosition)
|
||||
imagePosition?: ImagePosition;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(ImageSize)
|
||||
imageSize?: ImageSize;
|
||||
}
|
||||
|
||||
export class CreateLiveBlogUpdateDto {
|
||||
|
||||
@@ -36,6 +36,19 @@ export enum LiveBlogStatus {
|
||||
ARCHIVED = 'archived',
|
||||
}
|
||||
|
||||
export enum ImagePosition {
|
||||
TOP = 'top',
|
||||
LEFT = 'left',
|
||||
RIGHT = 'right',
|
||||
NONE = 'none',
|
||||
}
|
||||
|
||||
export enum ImageSize {
|
||||
SMALL = 'small',
|
||||
MEDIUM = 'medium',
|
||||
LARGE = 'large',
|
||||
}
|
||||
|
||||
@Entity('authors')
|
||||
export class Author {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
@@ -114,6 +127,18 @@ export class Article {
|
||||
@Column({ default: '' })
|
||||
featuredImage: string;
|
||||
|
||||
@Column({
|
||||
type: 'text',
|
||||
default: 'top',
|
||||
})
|
||||
imagePosition: ImagePosition;
|
||||
|
||||
@Column({
|
||||
type: 'text',
|
||||
default: 'medium',
|
||||
})
|
||||
imageSize: ImageSize;
|
||||
|
||||
@Column({
|
||||
type: 'text',
|
||||
default: '[]',
|
||||
@@ -189,6 +214,18 @@ export class LiveBlog {
|
||||
@Column({ default: '' })
|
||||
featuredImage: string;
|
||||
|
||||
@Column({
|
||||
type: 'text',
|
||||
default: 'top',
|
||||
})
|
||||
imagePosition: ImagePosition;
|
||||
|
||||
@Column({
|
||||
type: 'text',
|
||||
default: 'medium',
|
||||
})
|
||||
imageSize: ImageSize;
|
||||
|
||||
@Column({ default: 0 })
|
||||
viewCount: number;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { lastValueFrom } from 'rxjs';
|
||||
import { ArticlesService } from './articles.service';
|
||||
import { LiveBlogService } from './live-blog.service';
|
||||
import { CreateArticleDto, CreateLiveBlogDto } from './articles.dto';
|
||||
import { ArticleStatus, LiveBlogStatus } from './entities';
|
||||
import { ArticleStatus, LiveBlogStatus, ImagePosition, ImageSize } from './entities';
|
||||
|
||||
interface StrapiArticle {
|
||||
id: number;
|
||||
@@ -19,6 +19,8 @@ interface StrapiArticle {
|
||||
updatedAt: string;
|
||||
img?: any;
|
||||
media?: any[];
|
||||
imagePosition?: string;
|
||||
imageSize?: string;
|
||||
}
|
||||
|
||||
interface StrapiLiveBlog {
|
||||
@@ -33,6 +35,8 @@ interface StrapiLiveBlog {
|
||||
updatedAt: string;
|
||||
img?: any;
|
||||
media?: any[];
|
||||
imagePosition?: string;
|
||||
imageSize?: string;
|
||||
}
|
||||
|
||||
interface StrapiResponse<T> {
|
||||
@@ -156,6 +160,8 @@ export class StrapiService {
|
||||
: ArticleStatus.DRAFT,
|
||||
tags: [],
|
||||
featuredImage: imageUrl,
|
||||
imagePosition: (strapiArticle.imagePosition || 'top') as ImagePosition,
|
||||
imageSize: (strapiArticle.imageSize || 'medium') as ImageSize,
|
||||
};
|
||||
|
||||
await this.articlesService.syncFromStrapi(
|
||||
@@ -215,6 +221,8 @@ export class StrapiService {
|
||||
status,
|
||||
tags: [],
|
||||
featuredImage: imageUrl,
|
||||
imagePosition: (strapiArticle.imagePosition || 'top') as ImagePosition,
|
||||
imageSize: (strapiArticle.imageSize || 'medium') as ImageSize,
|
||||
};
|
||||
|
||||
await this.articlesService.syncFromStrapi(
|
||||
@@ -277,6 +285,8 @@ export class StrapiService {
|
||||
slug: strapiLiveBlog.slug,
|
||||
status: this.mapStrapiStatusToLiveBlogStatus(strapiLiveBlog.status),
|
||||
featuredImage: imageUrl,
|
||||
imagePosition: (strapiLiveBlog.imagePosition || 'top') as ImagePosition,
|
||||
imageSize: (strapiLiveBlog.imageSize || 'medium') as ImageSize,
|
||||
};
|
||||
|
||||
await this.liveBlogService.syncFromStrapi(
|
||||
@@ -330,6 +340,8 @@ export class StrapiService {
|
||||
slug: strapiLiveBlog.slug,
|
||||
status,
|
||||
featuredImage: imageUrl,
|
||||
imagePosition: (strapiLiveBlog.imagePosition || 'top') as ImagePosition,
|
||||
imageSize: (strapiLiveBlog.imageSize || 'medium') as ImageSize,
|
||||
};
|
||||
|
||||
await this.liveBlogService.syncFromStrapi(
|
||||
|
||||
Reference in new issue
Block a user