Add collections.move event

This commit is contained in:
Saumya Pandey committed 2021-03-12 02:27:34 +05:30
1 parent 6ac39dbe55
commit 06c285bad2
3 files changed
+12 -1

No files matched your search

+3 -1
View File
@@ -658,6 +658,8 @@ router.post("collections.move", auth(), async (ctx) => {
const collection = await Collection.findByPk(id);
authorize(user, "move", collection);
const previousIndex = collection.index;
await collection.update({ index });
removeIndexCollisions(user.teamId);
@@ -667,7 +669,7 @@ router.post("collections.move", auth(), async (ctx) => {
collectionId: collection.id,
teamId: collection.teamId,
actorId: user.id,
data: { name: collection.name },
data: { previousIndex, currentIndex: collection.index },
ip: ctx.request.ip,
});
+8
View File
@@ -135,6 +135,14 @@ export type CollectionEvent =
actorId: string,
data: { name: string, groupId: string },
ip: string,
}
| {
name: "collections.move",
collectionId: string,
teamId: string,
actorId: string,
data: { previousIndex: string, currentIndex: string },
ip: string,
};
export type GroupEvent =
+1
View File
@@ -73,6 +73,7 @@ Event.AUDIT_EVENTS = [
"api_keys.delete",
"collections.create",
"collections.update",
"collections.move",
"collections.add_user",
"collections.remove_user",
"collections.add_group",