mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-20 10:15:17 -04:00
refactor: adapt for typeorm 0.3
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
a07b5f54d1
commit
c4975e4783
21 changed files with 131 additions and 69 deletions
|
@ -45,7 +45,7 @@ export class AliasService {
|
|||
const foundAlias = await this.aliasRepository.findOne({
|
||||
where: { name: alias },
|
||||
});
|
||||
if (foundAlias !== undefined) {
|
||||
if (foundAlias !== null) {
|
||||
this.logger.debug(`The alias '${alias}' is already used.`, 'addAlias');
|
||||
throw new AlreadyInDBError(`The alias '${alias}' is already used.`);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ export class AliasService {
|
|||
const foundNote = await this.noteRepository.findOne({
|
||||
where: { publicId: alias },
|
||||
});
|
||||
if (foundNote !== undefined) {
|
||||
if (foundNote !== null) {
|
||||
this.logger.debug(
|
||||
`The alias '${alias}' is already a public id.`,
|
||||
'addAlias',
|
||||
|
@ -113,8 +113,12 @@ export class AliasService {
|
|||
throw new NotInDBError(`The alias '${alias}' is not used by this note.`);
|
||||
}
|
||||
|
||||
const oldPrimary = await this.aliasRepository.findOne(oldPrimaryId);
|
||||
const newPrimary = await this.aliasRepository.findOne(newPrimaryId);
|
||||
const oldPrimary = await this.aliasRepository.findOneBy({
|
||||
id: oldPrimaryId,
|
||||
});
|
||||
const newPrimary = await this.aliasRepository.findOneBy({
|
||||
id: newPrimaryId,
|
||||
});
|
||||
|
||||
if (!oldPrimary || !newPrimary) {
|
||||
throw new Error('This should not happen!');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue