Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

feat: better validation

Nevo David790922827138
diff --git a/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts b/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts
index 866b48975..a002876a4 100644
--- a/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts
+++ b/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts
@@ -180,6 +180,7 @@ export class PostsService {
}
return {
+ type: replaceDraft ? 'schedule' : body.type,
...post,
settings: {
...(post.settings || ({} as any)),
diff --git a/libraries/nestjs-libraries/src/dtos/posts/create.post.dto.ts b/libraries/nestjs-libraries/src/dtos/posts/create.post.dto.ts
index 391fd56a5..2e5ce3ea2 100644
--- a/libraries/nestjs-libraries/src/dtos/posts/create.post.dto.ts
+++ b/libraries/nestjs-libraries/src/dtos/posts/create.post.dto.ts
@@ -49,6 +49,8 @@ export class PostContent {
}
export class Post {
+ type?: string;
+
@IsDefined()
@Type(() => Integration)
@ValidateNested()
@@ -65,6 +67,7 @@ export class Post {
@IsString()
group: string;
+ @ValidateIf((o) => o.type !== 'draft')
@ValidateNested()
@Type(() => EmptySettings, {
keepDiscriminatorProperty: true,
@@ -112,7 +115,6 @@ export class CreatePostDto {
@ValidateNested({ each: true })
tags: Tags[];
- @ValidateIf((o) => o.type !== 'draft')
@IsDefined()
@Type(() => Post)
@IsArray()