chore: Docs, define additional client-side relations

This commit is contained in:
Tom Moor
2023-10-05 22:32:58 -04:00
parent 773c35ebc3
commit ea4de0dfb5
6 changed files with 67 additions and 18 deletions

View File

@@ -1,22 +1,28 @@
import { observable } from "mobx";
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.
* A subscription represents a request for a user to receive notifications for a document.
*/
class Subscription extends Model {
@Field
@observable
id: string;
/** The user subscribing */
/** The user ID subscribing */
userId: string;
/** The document being subscribed to */
/** 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 event being subscribed to */
@Field
@observable