mirror of
https://github.com/outline/outline.git
synced 2026-11-22 22:02:35 +03:00
52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
import { InferAttributes, InferCreationAttributes } from "sequelize";
|
|
import {
|
|
BelongsTo,
|
|
ForeignKey,
|
|
Column,
|
|
Table,
|
|
DataType,
|
|
} from "sequelize-typescript";
|
|
import DataAttribute from "./DataAttribute";
|
|
import Document from "./Document";
|
|
import User from "./User";
|
|
import IdModel from "./base/IdModel";
|
|
import Fix from "./decorators/Fix";
|
|
|
|
@Table({
|
|
tableName: "document_data_attributes",
|
|
modelName: "document_data_attribute",
|
|
})
|
|
@Fix
|
|
class DocumentDataAttribute extends IdModel<
|
|
InferAttributes<DocumentDataAttribute>,
|
|
Partial<InferCreationAttributes<DocumentDataAttribute>>
|
|
> {
|
|
@Column
|
|
value: string;
|
|
|
|
// associations
|
|
|
|
@BelongsTo(() => DataAttribute, "dataAttributeId")
|
|
dataAttribute: DataAttribute;
|
|
|
|
@ForeignKey(() => DataAttribute)
|
|
@Column(DataType.UUID)
|
|
dataAttributeId: string;
|
|
|
|
@BelongsTo(() => Document, "documentId")
|
|
document: Document;
|
|
|
|
@ForeignKey(() => Document)
|
|
@Column(DataType.UUID)
|
|
documentId: string;
|
|
|
|
@BelongsTo(() => User, "userId")
|
|
user: User;
|
|
|
|
@ForeignKey(() => User)
|
|
@Column(DataType.UUID)
|
|
userId: string;
|
|
}
|
|
|
|
export default DocumentDataAttribute;
|