Skip to content

Commit

Permalink
[F] Add bulkDelete api resource + handle payload
Browse files Browse the repository at this point in the history
  • Loading branch information
1aurend committed Dec 12, 2024
1 parent 03b57c9 commit 11ebf48
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 16 deletions.
3 changes: 3 additions & 0 deletions client/src/api/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ export default class ApiClient {
if (json.meta) {
out.meta = json.meta;
}
if (json.bulk_deletions) {
out.bulk_deletions = json.bulk_deletions;
}
return Promise.resolve({ json: out, response });
};

Expand Down
1 change: 1 addition & 0 deletions client/src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ export journalIssuesAPI from "./resources/journalIssues";
export journalVolumesAPI from "./resources/journalVolumes";
export ingestionSourcesAPI from "./resources/ingestionSources";
export emailConfirmationsAPI from "./resources/emailConfirmations";
export bulkDeleteAPI from "./resources/bulkDelete";
8 changes: 0 additions & 8 deletions client/src/api/resources/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,5 @@ export default {
method: "DELETE",
options: {}
};
},

bulkDelete(args) {
return {
endpoint: `/api/v1/annotations/bulk_delete`,
method: "POST",
options: args
};
}
};
31 changes: 31 additions & 0 deletions client/src/api/resources/bulkDelete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
export default {
annotations(params) {
return {
endpoint: "/api/v1/bulk_delete/annotations",
method: "DELETE",
options: {
body: JSON.stringify({ bulk_delete: params })
}
};
},

readingGroups(params) {
return {
endpoint: "/api/v1/bulk_delete/reading_groups",
method: "DELETE",
options: {
body: JSON.stringify({ bulk_delete: params })
}
};
},

users(params) {
return {
endpoint: "/api/v1/bulk_delete/users",
method: "DELETE",
options: {
body: JSON.stringify({ bulk_delete: params })
}
};
}
};
8 changes: 0 additions & 8 deletions client/src/api/resources/readingGroups.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,5 @@ export default {
method: "DELETE",
options: {}
};
},

bulkDelete(args) {
return {
endpoint: `/api/v1/reading_groups/bulk_delete`,
method: "POST",
options: args
};
}
};

0 comments on commit 11ebf48

Please sign in to comment.