Format with Prettier 2

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-01-06 23:48:53 +01:00
parent 25e74f4ae7
commit f81e67a3a1
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
15 changed files with 36 additions and 94 deletions

View file

@ -10,16 +10,12 @@ import { Note } from './note.entity';
@Entity()
export class AuthorColor {
@ManyToOne(
_ => Note,
note => note.authorColors,
{
primary: true,
},
)
@ManyToOne((_) => Note, (note) => note.authorColors, {
primary: true,
})
note: Note;
@ManyToOne(_ => User, {
@ManyToOne((_) => User, {
primary: true,
})
user: User;

View file

@ -36,36 +36,22 @@ export class Note {
})
alias?: string;
@OneToMany(
_ => NoteGroupPermission,
groupPermission => groupPermission.note,
(_) => NoteGroupPermission,
(groupPermission) => groupPermission.note,
)
groupPermissions: NoteGroupPermission[];
@OneToMany(
_ => NoteUserPermission,
userPermission => userPermission.note,
)
@OneToMany((_) => NoteUserPermission, (userPermission) => userPermission.note)
userPermissions: NoteUserPermission[];
@Column({
nullable: false,
default: 0,
})
viewcount: number;
@ManyToOne(
_ => User,
user => user.ownedNotes,
{ onDelete: 'CASCADE' },
)
@ManyToOne((_) => User, (user) => user.ownedNotes, { onDelete: 'CASCADE' })
owner: User;
@OneToMany(
_ => Revision,
revision => revision.note,
{ cascade: true },
)
@OneToMany((_) => Revision, (revision) => revision.note, { cascade: true })
revisions: Promise<Revision[]>;
@OneToMany(
_ => AuthorColor,
authorColor => authorColor.note,
)
@OneToMany((_) => AuthorColor, (authorColor) => authorColor.note)
authorColors: AuthorColor[];
@Column({
@ -77,11 +63,7 @@ export class Note {
})
title?: string;
@ManyToMany(
_ => Tag,
tag => tag.notes,
{ eager: true, cascade: true },
)
@ManyToMany((_) => Tag, (tag) => tag.notes, { eager: true, cascade: true })
@JoinTable()
tags: Tag[];

View file

@ -113,20 +113,22 @@ export class NotesService {
// TODO: Get actual createTime
createTime: new Date(),
description: note.description,
editedBy: note.authorColors.map(authorColor => authorColor.user.userName),
editedBy: note.authorColors.map(
(authorColor) => authorColor.user.userName,
),
// TODO: Extract into method
permissions: {
owner: this.usersService.toUserDto(note.owner),
sharedToUsers: note.userPermissions.map(noteUserPermission => ({
sharedToUsers: note.userPermissions.map((noteUserPermission) => ({
user: this.usersService.toUserDto(noteUserPermission.user),
canEdit: noteUserPermission.canEdit,
})),
sharedToGroups: note.groupPermissions.map(noteGroupPermission => ({
sharedToGroups: note.groupPermissions.map((noteGroupPermission) => ({
group: noteGroupPermission.group,
canEdit: noteGroupPermission.canEdit,
})),
},
tags: note.tags.map(tag => tag.name),
tags: note.tags.map((tag) => tag.name),
updateTime: (await this.getLastRevision(note)).createdAt,
// TODO: Get actual updateUser
updateUser: {

View file

@ -17,9 +17,6 @@ export class Tag {
})
name: string;
@ManyToMany(
_ => Note,
note => note.tags,
)
@ManyToMany((_) => Note, (note) => note.tags)
notes: Note[];
}