Introduce webhook v2 (#17456)

Migrate webhook to v2 entity
This commit is contained in:
Charles Bochet
2026-01-27 16:32:33 +01:00
committed by GitHub
parent 27e5b9797b
commit bc7791871f
83 changed files with 1574 additions and 975 deletions
@@ -0,0 +1,38 @@
import { Field, InputType } from '@nestjs/graphql';
import {
IsArray,
IsNotEmpty,
IsOptional,
IsString,
IsUUID,
} from 'class-validator';
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
@InputType()
export class CreateWebhookInput {
@IsUUID()
@IsOptional()
@Field(() => UUIDScalarType, { nullable: true })
id?: string;
@IsString()
@IsNotEmpty()
@Field()
targetUrl: string;
@IsArray()
@Field(() => [String])
operations: string[];
@IsString()
@IsOptional()
@Field({ nullable: true })
description?: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
secret?: string;
}
@@ -0,0 +1,53 @@
import { Field, InputType } from '@nestjs/graphql';
import { Type } from 'class-transformer';
import {
IsArray,
IsNotEmpty,
IsOptional,
IsString,
IsUUID,
ValidateNested,
} from 'class-validator';
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
@InputType()
export class UpdateWebhookInputUpdates {
@IsOptional()
@IsString()
@Field({ nullable: true })
targetUrl?: string;
@IsOptional()
@IsArray()
@Field(() => [String], { nullable: true })
operations?: string[];
@IsOptional()
@IsString()
@Field({ nullable: true })
description?: string;
@IsOptional()
@IsString()
@Field({ nullable: true })
secret?: string;
}
@InputType()
export class UpdateWebhookInput {
@IsUUID()
@IsNotEmpty()
@Field(() => UUIDScalarType, {
description: 'The id of the webhook to update',
})
id: string;
@Type(() => UpdateWebhookInputUpdates)
@ValidateNested()
@Field(() => UpdateWebhookInputUpdates, {
description: 'The webhook fields to update',
})
update: UpdateWebhookInputUpdates;
}
@@ -0,0 +1,58 @@
import { Field, HideField, ObjectType } from '@nestjs/graphql';
import {
IsArray,
IsDateString,
IsNotEmpty,
IsOptional,
IsString,
IsUUID,
} from 'class-validator';
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
@ObjectType('Webhook')
export class WebhookDTO {
@IsUUID()
@IsNotEmpty()
@Field(() => UUIDScalarType)
id: string;
@IsString()
@IsNotEmpty()
@Field()
targetUrl: string;
@IsArray()
@Field(() => [String])
operations: string[];
@IsString()
@IsOptional()
@Field(() => String, { nullable: true })
description: string | null;
@IsString()
@IsNotEmpty()
@Field()
secret: string;
@HideField()
workspaceId: string;
@Field(() => UUIDScalarType)
applicationId: string;
@IsDateString()
@Field()
createdAt: Date;
@IsDateString()
@Field()
updatedAt: Date;
@IsDateString()
@IsOptional()
@Field(() => Date, { nullable: true })
deletedAt: Date | null;
}