Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/server/controllers/asset.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ app.put(

await tManager.save(Asset, asset);
const result = await tManager.query(
getReplaceChildrenQuery('asset', 'npath', originalNPath, npath)
getReplaceChildrenQuery(tManager.getRepository(Asset).metadata.tableName, 'npath', originalNPath, npath)
);

// if not at least one entry (the very object we're renaming) was updated, then the query or the data is wrong
Expand Down
11 changes: 6 additions & 5 deletions src/server/controllers/post.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,9 @@ app.put(

await postRepository.save(post);
}

const qb = postRepository.createQueryBuilder('post').update(Post);

const alias = postRepository.metadata.tableName;
const qb = postRepository.createQueryBuilder(alias).update(Post);
const now = new Date();
if (publish) {
qb.set({
Expand Down Expand Up @@ -522,11 +523,11 @@ app.put(
});
})
);
qb.where('post.id IN (:...ids)', {
qb.where(`${alias}.id IN (:...ids)`, {
ids: all.map((post) => post.id),
});
} else {
qb.where('post.id IN (:...ids)', {
qb.where(`${alias}.id IN (:...ids)`, {
ids: posts.map((post) => post.id),
});
}
Expand Down Expand Up @@ -595,7 +596,7 @@ app.put(

await transactionManager.query(
getReplaceChildrenQuery(
'post',
postRepository.metadata.tableName,
'slugPath',
oldSlugPath,
newSlugPath
Expand Down
2 changes: 1 addition & 1 deletion src/server/controllers/tag.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ app.put(
tag.slugPath = newSlugPath;

await transactionManager.query(
getReplaceChildrenQuery('tag', 'slugPath', oldSlugPath, newSlugPath)
getReplaceChildrenQuery(tagRepository.metadata.tableName, 'slugPath', oldSlugPath, newSlugPath)
);
}

Expand Down