video func implemented
This commit is contained in:
1 parent
3bc534489d
commit
89b8687431
13 files changed
+504
-9
No files matched your search
@@ -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, ImagePosition, ImageSize } from './entities';
|
||||
import { ArticleStatus, LiveBlogStatus, ImagePosition, ImageSize, VideoPosition } from './entities';
|
||||
|
||||
interface StrapiArticle {
|
||||
id: number;
|
||||
@@ -21,6 +21,9 @@ interface StrapiArticle {
|
||||
media?: any[];
|
||||
imagePosition?: string;
|
||||
imageSize?: string;
|
||||
videoUrl?: string;
|
||||
videoPosition?: string;
|
||||
videoCaption?: string;
|
||||
}
|
||||
|
||||
interface StrapiLiveBlog {
|
||||
@@ -37,6 +40,9 @@ interface StrapiLiveBlog {
|
||||
media?: any[];
|
||||
imagePosition?: string;
|
||||
imageSize?: string;
|
||||
videoUrl?: string;
|
||||
videoPosition?: string;
|
||||
videoCaption?: string;
|
||||
}
|
||||
|
||||
interface StrapiResponse<T> {
|
||||
@@ -162,6 +168,9 @@ export class StrapiService {
|
||||
featuredImage: imageUrl,
|
||||
imagePosition: (strapiArticle.imagePosition || 'top') as ImagePosition,
|
||||
imageSize: (strapiArticle.imageSize || 'medium') as ImageSize,
|
||||
videoUrl: strapiArticle.videoUrl || '',
|
||||
videoPosition: (strapiArticle.videoPosition || 'inline') as VideoPosition,
|
||||
videoCaption: strapiArticle.videoCaption || '',
|
||||
};
|
||||
|
||||
await this.articlesService.syncFromStrapi(
|
||||
@@ -223,6 +232,9 @@ export class StrapiService {
|
||||
featuredImage: imageUrl,
|
||||
imagePosition: (strapiArticle.imagePosition || 'top') as ImagePosition,
|
||||
imageSize: (strapiArticle.imageSize || 'medium') as ImageSize,
|
||||
videoUrl: strapiArticle.videoUrl || '',
|
||||
videoPosition: (strapiArticle.videoPosition || 'inline') as VideoPosition,
|
||||
videoCaption: strapiArticle.videoCaption || '',
|
||||
};
|
||||
|
||||
await this.articlesService.syncFromStrapi(
|
||||
@@ -287,6 +299,9 @@ export class StrapiService {
|
||||
featuredImage: imageUrl,
|
||||
imagePosition: (strapiLiveBlog.imagePosition || 'top') as ImagePosition,
|
||||
imageSize: (strapiLiveBlog.imageSize || 'medium') as ImageSize,
|
||||
videoUrl: strapiLiveBlog.videoUrl || '',
|
||||
videoPosition: (strapiLiveBlog.videoPosition || 'inline') as VideoPosition,
|
||||
videoCaption: strapiLiveBlog.videoCaption || '',
|
||||
};
|
||||
|
||||
await this.liveBlogService.syncFromStrapi(
|
||||
@@ -342,6 +357,9 @@ export class StrapiService {
|
||||
featuredImage: imageUrl,
|
||||
imagePosition: (strapiLiveBlog.imagePosition || 'top') as ImagePosition,
|
||||
imageSize: (strapiLiveBlog.imageSize || 'medium') as ImageSize,
|
||||
videoUrl: strapiLiveBlog.videoUrl || '',
|
||||
videoPosition: (strapiLiveBlog.videoPosition || 'inline') as VideoPosition,
|
||||
videoCaption: strapiLiveBlog.videoCaption || '',
|
||||
};
|
||||
|
||||
await this.liveBlogService.syncFromStrapi(
|
||||
@@ -403,7 +421,15 @@ export class StrapiService {
|
||||
);
|
||||
|
||||
if (event === 'entry.delete') {
|
||||
this.logger.log(`Handling delete for document: ${data.documentId}`);
|
||||
this.logger.log(`Handling delete for document: ${data.documentId}, model: ${data.model}`);
|
||||
|
||||
if (data.model === 'article') {
|
||||
await this.articlesService.removeByStrapiId(data.documentId);
|
||||
} else if (data.model === 'live-blog') {
|
||||
await this.liveBlogService.removeByStrapiId(data.documentId);
|
||||
} else {
|
||||
this.logger.warn(`Cannot delete: unknown model type: ${data.model}`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user