ESLint fixes in models

Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
David Mehren 2020-04-12 13:52:50 +02:00
parent 64b88e8488
commit e641681483
No known key found for this signature in database
GPG key ID: 6017AF117F9756CB
6 changed files with 80 additions and 57 deletions

View file

@ -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
}