Skip to content

Commit

Permalink
Add check existence workbook before restore (#189)
Browse files Browse the repository at this point in the history
* Add check workbook existence, before restore entry

* Add support code to error
  • Loading branch information
Sergey-weber authored Oct 2, 2024
1 parent ebc13ce commit 24da438
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/error-response-presenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ export default (error: AppError | DBError) => {
return {
code: 404,
response: {
code,
message: "The workbook doesn't exist",
},
};
Expand Down
4 changes: 3 additions & 1 deletion src/services/entry/actions/update-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,9 @@ export async function updateEntry(ctx: CTX, updateData: UpdateEntryData) {
>;
const newKey = entryObjInnerMeta.oldKey;

if (!entryObj.workbookId) {
if (entryObj.workbookId) {
await getWorkbook({ctx}, {workbookId: entryObj.workbookId});
} else {
const keyLowerCase = newKey.toLowerCase();
const isFolder = Utils.isFolder({scope: entryObj.scope});
const keyFormatted = Utils.formatKey(keyLowerCase, isFolder);
Expand Down

0 comments on commit 24da438

Please sign in to comment.