forked from StellarSplit/StellarSplit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-webhook.dto.ts
More file actions
40 lines (36 loc) · 1.04 KB
/
Copy pathcreate-webhook.dto.ts
File metadata and controls
40 lines (36 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { IsString, IsUrl, IsArray, IsNotEmpty, ArrayNotEmpty, IsOptional } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
import { WebhookEventType } from '../webhook.entity';
export class CreateWebhookDto {
@ApiProperty({
description: 'User ID who owns this webhook (automatically assigned from auth context)',
example: 'user-123',
required: false,
})
@IsString()
@IsOptional()
userId?: string;
@ApiProperty({
description: 'Webhook endpoint URL',
example: 'https://example.com/webhooks',
})
@IsUrl({ require_protocol: true })
@IsNotEmpty()
url!: string;
@ApiProperty({
description: 'Array of event types to subscribe to',
enum: WebhookEventType,
isArray: true,
example: [WebhookEventType.SPLIT_CREATED, WebhookEventType.PAYMENT_RECEIVED],
})
@IsArray()
@ArrayNotEmpty()
events!: WebhookEventType[];
@ApiProperty({
description: 'Secret key for HMAC signature verification',
example: 'your-secret-key-here',
})
@IsString()
@IsNotEmpty()
secret!: string;
}