mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import { AbstractServiceOptions, Item, PrimaryKey } from '../types';
|
|
import { register } from '../webhooks';
|
|
import { ItemsService, MutationOptions } from './items';
|
|
|
|
export class WebhooksService extends ItemsService {
|
|
constructor(options: AbstractServiceOptions) {
|
|
super('directus_webhooks', options);
|
|
}
|
|
|
|
async createOne(data: Partial<Item>, opts?: MutationOptions): Promise<PrimaryKey> {
|
|
const result = await super.createOne(data, opts);
|
|
await register();
|
|
return result;
|
|
}
|
|
|
|
async createMany(data: Partial<Item>[], opts?: MutationOptions): Promise<PrimaryKey[]> {
|
|
const result = await super.createMany(data, opts);
|
|
await register();
|
|
return result;
|
|
}
|
|
|
|
async updateOne(key: PrimaryKey, data: Partial<Item>, opts?: MutationOptions): Promise<PrimaryKey> {
|
|
const result = await super.updateOne(key, data, opts);
|
|
await register();
|
|
return result;
|
|
}
|
|
|
|
async updateMany(keys: PrimaryKey[], data: Partial<Item>, opts?: MutationOptions): Promise<PrimaryKey[]> {
|
|
const result = await super.updateMany(keys, data, opts);
|
|
await register();
|
|
return result;
|
|
}
|
|
|
|
async deleteOne(key: PrimaryKey, opts?: MutationOptions): Promise<PrimaryKey> {
|
|
const result = await super.deleteOne(key, opts);
|
|
await register();
|
|
return result;
|
|
}
|
|
|
|
async deleteMany(keys: PrimaryKey[], opts?: MutationOptions): Promise<PrimaryKey[]> {
|
|
const result = await super.deleteMany(keys, opts);
|
|
await register();
|
|
return result;
|
|
}
|
|
}
|