Skip to content

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

fix(pinterest): validate board as a numeric id and map the board-name rejection

Gilad Resisicd899eaad671
diff --git a/libraries/nestjs-libraries/src/chat/tools/integration.schedule.post.ts b/libraries/nestjs-libraries/src/chat/tools/integration.schedule.post.ts
index 39d11cbd7..d7b670b2c 100644
--- a/libraries/nestjs-libraries/src/chat/tools/integration.schedule.post.ts
+++ b/libraries/nestjs-libraries/src/chat/tools/integration.schedule.post.ts
@@ -110,7 +110,7 @@ If validation fails, the result contains output.errors describing what to fix; t
value: z
.any()
.describe(
- 'Value of the key, always prefer the id then label if possible'
+ 'Value of the key, always prefer the id then label if possible. When the settings schema says a field is an id, pass the id returned by the channel tools, never the display label'
),
})
)
diff --git a/libraries/nestjs-libraries/src/chat/tools/post.settings.tool.ts b/libraries/nestjs-libraries/src/chat/tools/post.settings.tool.ts
index e3812b220..99a95d3cb 100644
--- a/libraries/nestjs-libraries/src/chat/tools/post.settings.tool.ts
+++ b/libraries/nestjs-libraries/src/chat/tools/post.settings.tool.ts
@@ -41,7 +41,7 @@ If validation fails, the result contains output.errors describing what to fix; t
value: z
.any()
.describe(
- 'New value of the key, always prefer the id then label if possible'
+ 'New value of the key, always prefer the id then label if possible. When the settings schema says a field is an id, pass the id returned by the channel tools, never the display label'
),
})
)
diff --git a/libraries/nestjs-libraries/src/dtos/posts/providers-settings/pinterest.dto.ts b/libraries/nestjs-libraries/src/dtos/posts/providers-settings/pinterest.dto.ts
index aed79c805..81779dfec 100644
--- a/libraries/nestjs-libraries/src/dtos/posts/providers-settings/pinterest.dto.ts
+++ b/libraries/nestjs-libraries/src/dtos/posts/providers-settings/pinterest.dto.ts
@@ -1,5 +1,12 @@
import {
- IsDefined, IsOptional, IsString, IsUrl, MaxLength, MinLength, ValidateIf
+ IsDefined,
+ IsOptional,
+ IsString,
+ IsUrl,
+ Matches,
+ MaxLength,
+ MinLength,
+ ValidateIf,
} from 'class-validator';
import { JSONSchema } from 'class-validator-jsonschema';
@@ -27,8 +34,13 @@ export class PinterestSettingsDto {
@MinLength(1, {
message: 'Board is required',
})
- @JSONSchema({
- description: 'board must be an id',
+ @Matches(/^\d+$/, {
+ message:
+ 'Board must be the numeric board id (use the boards list of the channel to find it), not the board name',
+ })
+ @JSONSchema({
+ description:
+ 'The numeric id of the board (from the boards list of the channel), not the board name',
})
board: string;
}