Merge pull request #277 from Hexastack/276-bug-unable-to-submit-attachment-block-edit-form

fix(api): schema support attachment_id nullable value
This commit is contained in:
Med Marrouchi 2024-10-30 08:55:53 +01:00 committed by GitHub
commit 807af97aaf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 1 deletions

View File

@ -53,6 +53,7 @@ export class BlockRepository extends BaseRepository<
if ( if (
block.message && block.message &&
'attachment' in block.message && 'attachment' in block.message &&
block.message.attachment.payload &&
'url' in block.message.attachment.payload 'url' in block.message.attachment.payload
) { ) {
this.logger.error( this.logger.error(

View File

@ -409,6 +409,7 @@ export class BlockService extends BaseService<Block, BlockPopulate, BlockFull> {
if ( if (
block.message && block.message &&
'attachment' in block.message && 'attachment' in block.message &&
block.message.attachment.payload &&
'url' in block.message.attachment.payload 'url' in block.message.attachment.payload
) { ) {
this.logger.error( this.logger.error(

View File

@ -71,7 +71,7 @@ export function isValidMessage(msg: any) {
.required(), .required(),
payload: Joi.object().keys({ payload: Joi.object().keys({
url: Joi.string().uri(), url: Joi.string().uri(),
attachment_id: Joi.string(), attachment_id: Joi.string().allow(null),
}), }),
}), }),
elements: Joi.boolean(), elements: Joi.boolean(),