feat: Events / audit log (#1008)

* feat: Record events in DB

* feat: events API

* First pass, hacky activity feed

* WIP

* Reset dashboard

* feat: audit log UI
feat: store ip address

* chore: Document events.list api

* fix: command specs

* await event create

* fix: backlinks service

* tidy

* fix: Hide audit log menu item if not admin
This commit is contained in:
Tom Moor
2019-08-05 20:38:31 -07:00
committed by GitHub
parent 75b03fdba2
commit fb4f6822a4
37 changed files with 911 additions and 148 deletions

View File

@@ -9,7 +9,7 @@ export type UserEvent =
| 'users.suspend'
| 'users.activate'
| 'users.delete',
modelId: string,
userId: string,
teamId: string,
actorId: string,
}
@@ -17,7 +17,10 @@ export type UserEvent =
name: 'users.invite',
teamId: string,
actorId: string,
email: string,
data: {
email: string,
name: string,
},
};
export type DocumentEvent =
@@ -32,27 +35,32 @@ export type DocumentEvent =
| 'documents.restore'
| 'documents.star'
| 'documents.unstar',
modelId: string,
documentId: string,
collectionId: string,
teamId: string,
actorId: string,
}
| {
name: 'documents.move',
modelId: string,
collectionIds: string[],
documentIds: string[],
teamId: string,
actorId: string,
}
| {
name: 'documents.update',
modelId: string,
documentId: string,
collectionId: string,
teamId: string,
actorId: string,
autosave: boolean,
done: boolean,
data: {
collectionIds: string[],
documentIds: string[],
},
}
| {
name: 'documents.update',
documentId: string,
collectionId: string,
teamId: string,
actorId: string,
data: {
autosave: boolean,
done: boolean,
},
};
export type CollectionEvent =
@@ -60,20 +68,20 @@ export type CollectionEvent =
name: | 'collections.create' // eslint-disable-line
| 'collections.update'
| 'collections.delete',
modelId: string,
collectionId: string,
teamId: string,
actorId: string,
}
| {
name: 'collections.add_user' | 'collections.remove_user',
modelId: string,
userId: string,
collectionId: string,
teamId: string,
actorId: string,
};
export type IntegrationEvent = {
name: 'integrations.create' | 'integrations.update' | 'collections.delete',
name: 'integrations.create' | 'integrations.update',
modelId: string,
teamId: string,
actorId: string,