Restructure agent chat messages with parts-based architecture (#14749)
Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { UseGuards } from '@nestjs/common';
|
||||
import { Args, Mutation, Query, Resolver } from '@nestjs/graphql';
|
||||
|
||||
import { type QueryDeepPartialEntity } from 'typeorm/query-builder/QueryPartialEntity';
|
||||
|
||||
import { CreateWebhookDTO } from 'src/engine/core-modules/webhook/dtos/create-webhook.dto';
|
||||
import { DeleteWebhookDTO } from 'src/engine/core-modules/webhook/dtos/delete-webhook.dto';
|
||||
import { GetWebhookDTO } from 'src/engine/core-modules/webhook/dtos/get-webhook.dto';
|
||||
@@ -56,7 +58,7 @@ export class WebhookResolver {
|
||||
@Args('input') input: UpdateWebhookDTO,
|
||||
): Promise<Webhook | null> {
|
||||
try {
|
||||
const updateData: Partial<Webhook> = {};
|
||||
const updateData: QueryDeepPartialEntity<Webhook> = {};
|
||||
|
||||
if (input.targetUrl !== undefined) updateData.targetUrl = input.targetUrl;
|
||||
if (input.operations !== undefined)
|
||||
|
||||
@@ -3,6 +3,7 @@ import { InjectRepository } from '@nestjs/typeorm';
|
||||
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { ArrayContains, IsNull, Repository } from 'typeorm';
|
||||
import { type QueryDeepPartialEntity } from 'typeorm/query-builder/QueryPartialEntity';
|
||||
|
||||
import { Webhook } from './webhook.entity';
|
||||
import { WebhookException, WebhookExceptionCode } from './webhook.exception';
|
||||
@@ -93,7 +94,7 @@ export class WebhookService {
|
||||
async update(
|
||||
id: string,
|
||||
workspaceId: string,
|
||||
updateData: Partial<Webhook>,
|
||||
updateData: QueryDeepPartialEntity<Webhook>,
|
||||
): Promise<Webhook | null> {
|
||||
const webhook = await this.findById(id, workspaceId);
|
||||
|
||||
@@ -102,7 +103,9 @@ export class WebhookService {
|
||||
}
|
||||
|
||||
if (isDefined(updateData.targetUrl)) {
|
||||
const normalizedTargetUrl = this.normalizeTargetUrl(updateData.targetUrl);
|
||||
const normalizedTargetUrl = this.normalizeTargetUrl(
|
||||
updateData.targetUrl as string,
|
||||
);
|
||||
|
||||
if (!this.validateTargetUrl(normalizedTargetUrl)) {
|
||||
throw new WebhookException(
|
||||
|
||||
Reference in New Issue
Block a user