mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 09:45:37 -04:00
ESLint fixes in models
Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
parent
64b88e8488
commit
e641681483
6 changed files with 80 additions and 57 deletions
|
@ -1,31 +1,41 @@
|
|||
import { AutoIncrement, Table, Column, DataType, PrimaryKey, Model, BelongsTo, createIndexDecorator, ForeignKey } from 'sequelize-typescript'
|
||||
import { Note, User } from './index';
|
||||
import {
|
||||
AutoIncrement,
|
||||
BelongsTo,
|
||||
Column,
|
||||
createIndexDecorator,
|
||||
DataType,
|
||||
ForeignKey,
|
||||
Model,
|
||||
PrimaryKey,
|
||||
Table
|
||||
} from 'sequelize-typescript'
|
||||
import { Note, User } from './index'
|
||||
|
||||
const NoteUserIndex = createIndexDecorator({unique: true});
|
||||
const NoteUserIndex = createIndexDecorator({ unique: true })
|
||||
|
||||
@Table
|
||||
export class Author extends Model<Author> {
|
||||
@PrimaryKey
|
||||
@AutoIncrement
|
||||
@Column(DataType.INTEGER)
|
||||
id: number;
|
||||
id: number
|
||||
|
||||
@Column(DataType.STRING)
|
||||
color: string;
|
||||
color: string
|
||||
|
||||
@ForeignKey(() => Note)
|
||||
@NoteUserIndex
|
||||
@Column(DataType.UUID)
|
||||
noteId: string;
|
||||
noteId: string
|
||||
|
||||
@BelongsTo(() => Note, { foreignKey: 'noteId', onDelete: 'CASCADE', constraints: false, hooks: true })
|
||||
note: Note;
|
||||
note: Note
|
||||
|
||||
@ForeignKey(() => User)
|
||||
@NoteUserIndex
|
||||
@Column(DataType.UUID)
|
||||
userId: string;
|
||||
userId: string
|
||||
|
||||
@BelongsTo(() => User, { foreignKey: 'userId', onDelete: 'CASCADE', constraints: false, hooks: true })
|
||||
user: User;
|
||||
user: User
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue