Merge pull request #684 from hedgedoc/renovate/prettier-2.x

Update dependency prettier to v2
This commit is contained in:
David Mehren 2021-01-06 23:52:38 +01:00 committed by GitHub
commit 060eeff44e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 41 additions and 99 deletions

View file

@ -57,7 +57,7 @@
"eslint-config-prettier": "7.1.0", "eslint-config-prettier": "7.1.0",
"eslint-plugin-import": "2.22.1", "eslint-plugin-import": "2.22.1",
"jest": "26.6.3", "jest": "26.6.3",
"prettier": "1.19.1", "prettier": "2.2.1",
"supertest": "6.0.1", "supertest": "6.0.1",
"ts-jest": "26.1.0", "ts-jest": "26.1.0",
"ts-loader": "8.0.14", "ts-loader": "8.0.14",

View file

@ -23,10 +23,10 @@ export class MediaUpload {
@PrimaryColumn() @PrimaryColumn()
id: string; id: string;
@ManyToOne(_ => Note, { nullable: false }) @ManyToOne((_) => Note, { nullable: false })
note: Note; note: Note;
@ManyToOne(_ => User, { nullable: false }) @ManyToOne((_) => User, { nullable: false })
user: User; user: User;
@Column({ @Column({

View file

@ -25,7 +25,7 @@ async function getServerVersionFromPackageJson() {
const packageInfo: { version: string } = JSON.parse(rawFileContent); const packageInfo: { version: string } = JSON.parse(rawFileContent);
const versionParts: number[] = packageInfo.version const versionParts: number[] = packageInfo.version
.split('.') .split('.')
.map(x => parseInt(x, 10)); .map((x) => parseInt(x, 10));
versionCache = { versionCache = {
major: versionParts[0], major: versionParts[0],
minor: versionParts[1], minor: versionParts[1],

View file

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

View file

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

View file

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

View file

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

View file

@ -10,14 +10,10 @@ import { Note } from '../notes/note.entity';
@Entity() @Entity()
export class NoteGroupPermission { export class NoteGroupPermission {
@ManyToOne(_ => Group, { primary: true }) @ManyToOne((_) => Group, { primary: true })
group: Group; group: Group;
@ManyToOne( @ManyToOne((_) => Note, (note) => note.groupPermissions, { primary: true })
_ => Note,
note => note.groupPermissions,
{ primary: true },
)
note: Note; note: Note;
@Column() @Column()

View file

@ -10,14 +10,10 @@ import { User } from '../users/user.entity';
@Entity() @Entity()
export class NoteUserPermission { export class NoteUserPermission {
@ManyToOne(_ => User, { primary: true }) @ManyToOne((_) => User, { primary: true })
user: User; user: User;
@ManyToOne( @ManyToOne((_) => Note, (note) => note.userPermissions, { primary: true })
_ => Note,
note => note.userPermissions,
{ primary: true },
)
note: Note; note: Note;
@Column() @Column()

View file

@ -27,16 +27,13 @@ export class Authorship {
/** /**
* Revisions this authorship appears in * Revisions this authorship appears in
*/ */
@ManyToMany( @ManyToMany((_) => Revision, (revision) => revision.authorships)
_ => Revision,
revision => revision.authorships,
)
revisions: Revision[]; revisions: Revision[];
/** /**
* User this authorship represents * User this authorship represents
*/ */
@ManyToOne(_ => User) @ManyToOne((_) => User)
user: User; user: User;
@Column() @Column()

View file

@ -56,19 +56,12 @@ export class Revision {
/** /**
* Note this revision belongs to. * Note this revision belongs to.
*/ */
@ManyToOne( @ManyToOne((_) => Note, (note) => note.revisions, { onDelete: 'CASCADE' })
_ => Note,
note => note.revisions,
{ onDelete: 'CASCADE' },
)
note: Note; note: Note;
/** /**
* All authorship objects which are used in the revision. * All authorship objects which are used in the revision.
*/ */
@ManyToMany( @ManyToMany((_) => Authorship, (authorship) => authorship.revisions)
_ => Authorship,
authorship => authorship.revisions,
)
@JoinTable() @JoinTable()
authorships: Authorship[]; authorships: Authorship[];

View file

@ -33,7 +33,7 @@ export class RevisionsService {
note: note.id, note: note.id,
}, },
}); });
return revisions.map(revision => this.toMetadataDto(revision)); return revisions.map((revision) => this.toMetadataDto(revision));
} }
async getNoteRevision( async getNoteRevision(

View file

@ -17,10 +17,7 @@ export class AuthToken {
@PrimaryGeneratedColumn() @PrimaryGeneratedColumn()
id: number; id: number;
@ManyToOne( @ManyToOne((_) => User, (user) => user.authToken)
_ => User,
user => user.authToken,
)
user: User; user: User;
@Column() @Column()

View file

@ -19,10 +19,7 @@ export class Identity {
@PrimaryGeneratedColumn() @PrimaryGeneratedColumn()
id: number; id: number;
@ManyToOne( @ManyToOne((_) => User, (user) => user.identities)
_ => User,
user => user.identities,
)
user: User; user: User;
@Column() @Column()

View file

@ -42,22 +42,13 @@ export class User {
}) })
email?: string; email?: string;
@OneToMany( @OneToMany((_) => Note, (note) => note.owner)
_ => Note,
note => note.owner,
)
ownedNotes: Note[]; ownedNotes: Note[];
@OneToMany( @OneToMany((_) => AuthToken, (authToken) => authToken.user)
_ => AuthToken,
authToken => authToken.user,
)
authToken: AuthToken[]; authToken: AuthToken[];
@OneToMany( @OneToMany((_) => Identity, (identity) => identity.user)
_ => Identity,
identity => identity.user,
)
identities: Identity[]; identities: Identity[];
// eslint-disable-next-line @typescript-eslint/no-empty-function // eslint-disable-next-line @typescript-eslint/no-empty-function

View file

@ -84,9 +84,7 @@ describe('Notes', () => {
it(`DELETE /notes/{note}`, async () => { it(`DELETE /notes/{note}`, async () => {
await notesService.createNote('This is a test note.', 'test3'); await notesService.createNote('This is a test note.', 'test3');
await request(app.getHttpServer()) await request(app.getHttpServer()).delete('/notes/test3').expect(200);
.delete('/notes/test3')
.expect(200);
return expect(notesService.getNoteByIdOrAlias('test3')).rejects.toEqual( return expect(notesService.getNoteByIdOrAlias('test3')).rejects.toEqual(
new NotInDBError("Note with id/alias 'test3' not found."), new NotInDBError("Note with id/alias 'test3' not found."),
); );

View file

@ -5530,10 +5530,10 @@ prelude-ls@~1.1.2:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=
prettier@1.19.1: prettier@2.2.1:
version "1.19.1" version "2.2.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==
pretty-format@^25.2.1, pretty-format@^25.5.0: pretty-format@^25.2.1, pretty-format@^25.5.0:
version "25.5.0" version "25.5.0"