mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -04:00
Add AuthorColor entity
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
40034a4a84
commit
ba9d7a6572
2 changed files with 25 additions and 1 deletions
23
src/notes/author-color.entity.ts
Normal file
23
src/notes/author-color.entity.ts
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import { Column, Entity, ManyToOne } from 'typeorm/index';
|
||||||
|
import { User } from '../users/user.entity';
|
||||||
|
import { Note } from './note.entity';
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class AuthorColor {
|
||||||
|
@ManyToOne(
|
||||||
|
_ => Note,
|
||||||
|
note => note.authorColors,
|
||||||
|
{
|
||||||
|
primary: true,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
note: Note;
|
||||||
|
|
||||||
|
@ManyToOne(_ => User, {
|
||||||
|
primary: true,
|
||||||
|
})
|
||||||
|
user: User;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
color: string;
|
||||||
|
}
|
|
@ -1,10 +1,11 @@
|
||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
|
import { AuthorColor } from './author-color.entity';
|
||||||
import { Note } from './note.entity';
|
import { Note } from './note.entity';
|
||||||
import { NotesService } from './notes.service';
|
import { NotesService } from './notes.service';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [TypeOrmModule.forFeature([Note])],
|
imports: [TypeOrmModule.forFeature([Note, AuthorColor])],
|
||||||
controllers: [],
|
controllers: [],
|
||||||
providers: [NotesService],
|
providers: [NotesService],
|
||||||
exports: [NotesService],
|
exports: [NotesService],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue