mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
6a1f2399db
* feat: Collection subscription * refactor to use latest impl * load subscriptions only once * tests, type rename, migration index * all users in publish flow * tsc * remove SubscriptionType.Collection enum * review
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
import { observable } from "mobx";
|
|
import Collection from "./Collection";
|
|
import Document from "./Document";
|
|
import User from "./User";
|
|
import Model from "./base/Model";
|
|
import Field from "./decorators/Field";
|
|
import Relation from "./decorators/Relation";
|
|
|
|
/**
|
|
* A subscription represents a request for a user to receive notifications for a document.
|
|
*/
|
|
class Subscription extends Model {
|
|
static modelName = "Subscription";
|
|
|
|
/** The user ID subscribing */
|
|
userId: string;
|
|
|
|
/** The user subscribing */
|
|
@Relation(() => User, { onDelete: "cascade" })
|
|
user?: User;
|
|
|
|
/** The document ID being subscribed to */
|
|
documentId: string;
|
|
|
|
/** The document being subscribed to */
|
|
@Relation(() => Document, { onDelete: "cascade" })
|
|
document?: Document;
|
|
|
|
/** The collection ID being subscribed to */
|
|
collectionId: string;
|
|
|
|
/** The collection being subscribed to */
|
|
@Relation(() => Collection, { onDelete: "cascade" })
|
|
collection?: Collection;
|
|
|
|
/** The event being subscribed to */
|
|
@Field
|
|
@observable
|
|
event: string;
|
|
}
|
|
|
|
export default Subscription;
|