mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 01:35:18 -04:00
Move lib and test into src directory
Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
241c418ea7
commit
fab2607e4d
98 changed files with 1 additions and 3 deletions
41
src/lib/models/author.ts
Normal file
41
src/lib/models/author.ts
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue