fix: replace Equals constructor

TypeORMs Equals constructor is still broken, so this commit removes all remaining usages.

See https://github.com/hedgedoc/hedgedoc/issues/2467

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2023-03-25 12:00:00 +01:00
parent 088f2905a5
commit 382e70bf7b

View file

@ -6,7 +6,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { createPatch } from 'diff'; import { createPatch } from 'diff';
import { Equal, Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { NotInDBError } from '../errors/errors'; import { NotInDBError } from '../errors/errors';
import { ConsoleLoggerService } from '../logger/console-logger.service'; import { ConsoleLoggerService } from '../logger/console-logger.service';
@ -49,7 +49,7 @@ export class RevisionsService {
async purgeRevisions(note: Note): Promise<Revision[]> { async purgeRevisions(note: Note): Promise<Revision[]> {
const revisions = await this.revisionRepository.find({ const revisions = await this.revisionRepository.find({
where: { where: {
note: Equal(note), note: { id: note.id },
}, },
}); });
const latestRevision = await this.getLatestRevision(note); const latestRevision = await this.getLatestRevision(note);
@ -65,7 +65,7 @@ export class RevisionsService {
const revision = await this.revisionRepository.findOne({ const revision = await this.revisionRepository.findOne({
where: { where: {
id: revisionId, id: revisionId,
note: Equal(note), note: { id: note.id },
}, },
}); });
if (revision === null) { if (revision === null) {
@ -79,7 +79,7 @@ export class RevisionsService {
async getLatestRevision(note: Note): Promise<Revision> { async getLatestRevision(note: Note): Promise<Revision> {
const revision = await this.revisionRepository.findOne({ const revision = await this.revisionRepository.findOne({
where: { where: {
note: Equal(note), note: { id: note.id },
}, },
order: { order: {
createdAt: 'DESC', createdAt: 'DESC',