chore: Docs, define additional client-side relations
This commit is contained in:
@@ -1,12 +1,26 @@
|
|||||||
import { observable } from "mobx";
|
import { observable } from "mobx";
|
||||||
|
import Collection from "./Collection";
|
||||||
|
import Document from "./Document";
|
||||||
import Model from "./base/Model";
|
import Model from "./base/Model";
|
||||||
import Field from "./decorators/Field";
|
import Field from "./decorators/Field";
|
||||||
|
import Relation from "./decorators/Relation";
|
||||||
|
|
||||||
class Pin extends Model {
|
class Pin extends Model {
|
||||||
id: string;
|
/** The collection ID that the document is pinned to. If empty the document is pinned to home. */
|
||||||
collectionId: string;
|
collectionId: string;
|
||||||
|
|
||||||
|
/** The collection that the document is pinned to. If empty the document is pinned to home. */
|
||||||
|
@Relation(() => Collection, { onDelete: "cascade" })
|
||||||
|
collection?: Collection;
|
||||||
|
|
||||||
|
/** The document ID that is pinned. */
|
||||||
documentId: string;
|
documentId: string;
|
||||||
|
|
||||||
|
/** The document that is pinned. */
|
||||||
|
@Relation(() => Document, { onDelete: "cascade" })
|
||||||
|
document: Document;
|
||||||
|
|
||||||
|
/** The sort order of the pin on screen. */
|
||||||
@observable
|
@observable
|
||||||
@Field
|
@Field
|
||||||
index: string;
|
index: string;
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
import { computed } from "mobx";
|
import { computed } from "mobx";
|
||||||
import { isRTL } from "@shared/utils/rtl";
|
import { isRTL } from "@shared/utils/rtl";
|
||||||
|
import Document from "./Document";
|
||||||
import User from "./User";
|
import User from "./User";
|
||||||
import Model from "./base/Model";
|
import Model from "./base/Model";
|
||||||
import Relation from "./decorators/Relation";
|
import Relation from "./decorators/Relation";
|
||||||
|
|
||||||
class Revision extends Model {
|
class Revision extends Model {
|
||||||
id: string;
|
/** The document ID that the revision is related to */
|
||||||
|
|
||||||
documentId: string;
|
documentId: string;
|
||||||
|
|
||||||
|
/** The document that the revision is related to */
|
||||||
|
@Relation(() => Document, { onDelete: "cascade" })
|
||||||
|
document: Document;
|
||||||
|
|
||||||
/** The document title when the revision was created */
|
/** The document title when the revision was created */
|
||||||
title: string;
|
title: string;
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
import { observable } from "mobx";
|
import { observable } from "mobx";
|
||||||
|
import Document from "./Document";
|
||||||
import User from "./User";
|
import User from "./User";
|
||||||
import Model from "./base/Model";
|
import Model from "./base/Model";
|
||||||
import Field from "./decorators/Field";
|
import Field from "./decorators/Field";
|
||||||
|
import Relation from "./decorators/Relation";
|
||||||
|
|
||||||
class Share extends Model {
|
class Share extends Model {
|
||||||
@Field
|
|
||||||
@observable
|
|
||||||
id: string;
|
|
||||||
|
|
||||||
@Field
|
@Field
|
||||||
@observable
|
@observable
|
||||||
published: boolean;
|
published: boolean;
|
||||||
@@ -16,10 +14,15 @@ class Share extends Model {
|
|||||||
@observable
|
@observable
|
||||||
includeChildDocuments: boolean;
|
includeChildDocuments: boolean;
|
||||||
|
|
||||||
|
/** The document ID that is shared. */
|
||||||
@Field
|
@Field
|
||||||
@observable
|
@observable
|
||||||
documentId: string;
|
documentId: string;
|
||||||
|
|
||||||
|
/** The document that is shared. */
|
||||||
|
@Relation(() => Document, { onDelete: "cascade" })
|
||||||
|
document: Document;
|
||||||
|
|
||||||
@Field
|
@Field
|
||||||
@observable
|
@observable
|
||||||
urlId: string;
|
urlId: string;
|
||||||
@@ -36,6 +39,8 @@ class Share extends Model {
|
|||||||
@observable
|
@observable
|
||||||
url: string;
|
url: string;
|
||||||
|
|
||||||
|
/** The user that shared the document. */
|
||||||
|
@Relation(() => User, { onDelete: "null" })
|
||||||
createdBy: User;
|
createdBy: User;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,44 @@
|
|||||||
import { observable } from "mobx";
|
import { observable } from "mobx";
|
||||||
import type StarsStore from "~/stores/StarsStore";
|
import type StarsStore from "~/stores/StarsStore";
|
||||||
|
import Collection from "./Collection";
|
||||||
|
import Document from "./Document";
|
||||||
import Model from "./base/Model";
|
import Model from "./base/Model";
|
||||||
import Field from "./decorators/Field";
|
import Field from "./decorators/Field";
|
||||||
|
import Relation from "./decorators/Relation";
|
||||||
|
|
||||||
class Star extends Model {
|
class Star extends Model {
|
||||||
id: string;
|
/** The sort order of the star */
|
||||||
|
|
||||||
@Field
|
@Field
|
||||||
@observable
|
@observable
|
||||||
index: string;
|
index: string;
|
||||||
|
|
||||||
documentId: string;
|
/** The document ID that is starred. */
|
||||||
|
documentId?: string;
|
||||||
|
|
||||||
|
/** The document that is starred. */
|
||||||
|
@Relation(() => Document, { onDelete: "cascade" })
|
||||||
|
document?: Document;
|
||||||
|
|
||||||
|
/** The collection ID that is starred. */
|
||||||
collectionId: string;
|
collectionId: string;
|
||||||
|
|
||||||
|
/** The collection that is starred. */
|
||||||
|
@Relation(() => Collection, { onDelete: "cascade" })
|
||||||
|
collection: Collection;
|
||||||
|
|
||||||
store: StarsStore;
|
store: StarsStore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the next star in the list, or undefined if this is the last star.
|
||||||
|
*/
|
||||||
next(): Star | undefined {
|
next(): Star | undefined {
|
||||||
const index = this.store.orderedData.indexOf(this);
|
const index = this.store.orderedData.indexOf(this);
|
||||||
return this.store.orderedData[index + 1];
|
return this.store.orderedData[index + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the previous star in the list, or undefined if this is the first star.
|
||||||
|
*/
|
||||||
previous(): Star | undefined {
|
previous(): Star | undefined {
|
||||||
const index = this.store.orderedData.indexOf(this);
|
const index = this.store.orderedData.indexOf(this);
|
||||||
return this.store.orderedData[index + 1];
|
return this.store.orderedData[index + 1];
|
||||||
|
|||||||
@@ -1,22 +1,28 @@
|
|||||||
import { observable } from "mobx";
|
import { observable } from "mobx";
|
||||||
|
import Document from "./Document";
|
||||||
|
import User from "./User";
|
||||||
import Model from "./base/Model";
|
import Model from "./base/Model";
|
||||||
import Field from "./decorators/Field";
|
import Field from "./decorators/Field";
|
||||||
|
import Relation from "./decorators/Relation";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A subscription represents a request for a user to receive notifications for
|
* A subscription represents a request for a user to receive notifications for a document.
|
||||||
* a document.
|
|
||||||
*/
|
*/
|
||||||
class Subscription extends Model {
|
class Subscription extends Model {
|
||||||
@Field
|
/** The user ID subscribing */
|
||||||
@observable
|
|
||||||
id: string;
|
|
||||||
|
|
||||||
/** The user subscribing */
|
|
||||||
userId: string;
|
userId: string;
|
||||||
|
|
||||||
/** The document being subscribed to */
|
/** The user subscribing */
|
||||||
|
@Relation(() => User, { onDelete: "cascade" })
|
||||||
|
user?: User;
|
||||||
|
|
||||||
|
/** The document ID being subscribed to */
|
||||||
documentId: string;
|
documentId: string;
|
||||||
|
|
||||||
|
/** The document being subscribed to */
|
||||||
|
@Relation(() => Document, { onDelete: "cascade" })
|
||||||
|
document?: Document;
|
||||||
|
|
||||||
/** The event being subscribed to */
|
/** The event being subscribed to */
|
||||||
@Field
|
@Field
|
||||||
@observable
|
@observable
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { action, observable } from "mobx";
|
import { action, observable } from "mobx";
|
||||||
import User from "./User";
|
import User from "./User";
|
||||||
import Model from "./base/Model";
|
import Model from "./base/Model";
|
||||||
|
import Relation from "./decorators/Relation";
|
||||||
|
|
||||||
class View extends Model {
|
class View extends Model {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -15,6 +16,7 @@ class View extends Model {
|
|||||||
@observable
|
@observable
|
||||||
count: number;
|
count: number;
|
||||||
|
|
||||||
|
@Relation(() => User)
|
||||||
user: User;
|
user: User;
|
||||||
|
|
||||||
@action
|
@action
|
||||||
|
|||||||
Reference in New Issue
Block a user