Files
outline/app/models/WebhookSubscription.ts
Tom Moor 57c110dbe5 chore: Upgrade MobX (#13554)
* Upgrade Mobx

* fix: Enforce MobX action boundaries

* fix: Wrap static observable updates in actions

* Remove iteration tests
2026-09-02 20:31:37 -04:00

55 lines
1.1 KiB
TypeScript

import { computed, observable } from "mobx";
import Model from "./base/Model";
import Field from "./decorators/Field";
import Relation from "./decorators/Relation";
import type { Searchable } from "./interfaces/Searchable";
import User from "./User";
class WebhookSubscription extends Model implements Searchable {
static modelName = "WebhookSubscription";
constructor(fields: Record<string, unknown>, store: Model["store"]) {
super(fields, store);
this.initialize(fields);
}
@Field
@observable
name: string;
@Field
@observable
url: string;
@Field
@observable
secret: string | null;
@Field
@observable
enabled: boolean;
@Field
@observable
events: string[];
/** The user who created this webhook subscription. */
@Relation(() => User)
createdBy?: User;
/** The user ID that created this webhook subscription. */
createdById: string;
@computed
get searchContent(): string[] {
return [this.name, this.url, ...(this.events ?? [])].filter(Boolean);
}
@computed
get searchSuppressed(): boolean {
return false;
}
}
export default WebhookSubscription;