Add blog post admin CRUD API.
Expose JWT-protected /blog-posts endpoints for draft creation, listing, update, and delete.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { Type } from 'class-transformer';
|
||||
import { IsInt, IsOptional, Max, Min } from 'class-validator';
|
||||
|
||||
export class ListBlogPostsQueryDto {
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
page?: number;
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Max(100)
|
||||
limit?: number;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { IsBoolean, IsNotEmpty, IsString, MaxLength } from 'class-validator';
|
||||
|
||||
import { getAppConfig } from '../../../config';
|
||||
|
||||
const {
|
||||
validation: { blogPostTitleMaxLength }
|
||||
} = getAppConfig();
|
||||
|
||||
export class UpdateBlogPostDto {
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
@MaxLength(blogPostTitleMaxLength)
|
||||
title: string;
|
||||
|
||||
@IsString()
|
||||
contentHtml: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
@IsBoolean()
|
||||
isDraft: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user