Move lib and test into src directory

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2020-05-20 15:52:03 +02:00 committed by David Mehren
parent 241c418ea7
commit fab2607e4d
No known key found for this signature in database
GPG key ID: 6017AF117F9756CB
98 changed files with 1 additions and 3 deletions

41
src/lib/models/author.ts Normal file
View file

@ -0,0 +1,41 @@
import {
AutoIncrement,
BelongsTo,
Column,
createIndexDecorator,
DataType,
ForeignKey,
Model,
PrimaryKey,
Table
} from 'sequelize-typescript'
import { Note, User } from './index'
const NoteUserIndex = createIndexDecorator({ unique: true })
@Table
export class Author extends Model<Author> {
@PrimaryKey
@AutoIncrement
@Column(DataType.INTEGER)
id: number
@Column(DataType.STRING)
color: string
@ForeignKey(() => Note)
@NoteUserIndex
@Column(DataType.UUID)
noteId: string
@BelongsTo(() => Note, { foreignKey: 'noteId', onDelete: 'CASCADE', constraints: false, hooks: true })
note: Note
@ForeignKey(() => User)
@NoteUserIndex
@Column(DataType.UUID)
userId: string
@BelongsTo(() => User, { foreignKey: 'userId', onDelete: 'CASCADE', constraints: false, hooks: true })
user: User
}