diff --git a/lib/app.ts b/lib/app.ts index 6540f49d4..aeded1288 100644 --- a/lib/app.ts +++ b/lib/app.ts @@ -1,6 +1,6 @@ 'use strict' -import { Revision } from "./models/revision" +import { Revision } from "./models" import { sequelize } from './models' // app diff --git a/lib/models/author.ts b/lib/models/author.ts index e58e72411..40b047b75 100644 --- a/lib/models/author.ts +++ b/lib/models/author.ts @@ -1,6 +1,5 @@ import { AutoIncrement, Table, Column, DataType, PrimaryKey, Model, BelongsTo, createIndexDecorator, ForeignKey } from 'sequelize-typescript' -import { Note } from './note'; -import { User } from './user'; +import { Note, User } from './index'; const NoteUserIndex = createIndexDecorator({unique: true}); @@ -18,7 +17,7 @@ export class Author extends Model { @NoteUserIndex @Column(DataType.UUID) noteId: string; - + @BelongsTo(() => Note, { foreignKey: 'noteId', onDelete: 'CASCADE', constraints: false, hooks: true }) note: Note; diff --git a/lib/models/note.ts b/lib/models/note.ts index 603b86362..ac4492009 100644 --- a/lib/models/note.ts +++ b/lib/models/note.ts @@ -14,9 +14,7 @@ import { Unique } from "sequelize-typescript"; import {generate as shortIdGenerate, isValid as shortIdIsValid} from "shortid"; -import {Author} from "./author"; -import {User} from './user'; -import {Revision} from './revision'; +import {Author, Revision, User} from "./index"; import {Utils} from "../utils"; import Sequelize from "sequelize"; diff --git a/lib/realtime.ts b/lib/realtime.ts index a718e7b34..90cbf5c38 100644 --- a/lib/realtime.ts +++ b/lib/realtime.ts @@ -1,10 +1,7 @@ 'use strict' // realtime // external modules -import {User} from "./models/user"; -import {Author} from "./models/author"; -import {Note} from "./models/note"; -import {Revision} from "./models/revision"; +import { Author, Note, Revision, User } from "./models"; var cookie = require('cookie') var cookieParser = require('cookie-parser')