diff options
Diffstat (limited to 'eventlogging')
-rw-r--r-- | eventlogging/eventlogger.go | 18 | ||||
-rw-r--r-- | eventlogging/events.txt | 8 | ||||
-rw-r--r-- | eventlogging/types.go | 52 |
3 files changed, 78 insertions, 0 deletions
diff --git a/eventlogging/eventlogger.go b/eventlogging/eventlogger.go new file mode 100644 index 0000000..e5a1b2b --- /dev/null +++ b/eventlogging/eventlogger.go | |||
@@ -0,0 +1,18 @@ | |||
1 | package eventlogging | ||
2 | |||
3 | import "fagott.pw/nsa" | ||
4 | |||
5 | type EventLoggerData struct { | ||
6 | User string `json:"user"` | ||
7 | UserAgent string `json:"userAgent"` | ||
8 | } | ||
9 | |||
10 | type EventLogger struct { | ||
11 | base *nsa.Logger | ||
12 | } | ||
13 | |||
14 | func NewEventLogger(ip string) *EventLogger { | ||
15 | return &EventLogger{ | ||
16 | base: nsa.NewLogger(ip), | ||
17 | } | ||
18 | } | ||
diff --git a/eventlogging/events.txt b/eventlogging/events.txt new file mode 100644 index 0000000..0e170dc --- /dev/null +++ b/eventlogging/events.txt | |||
@@ -0,0 +1,8 @@ | |||
1 | VIEW_GRIL | ||
2 | VIEW_LIST | ||
3 | CREATE_LIST | ||
4 | ADD_GRIL_TO_LIST | ||
5 | DELETE_GRIL_FROM_LIST | ||
6 | DELETE_LIST | ||
7 | EDIT_LIST | ||
8 | CHANGE_GRIL_ORDER | ||
diff --git a/eventlogging/types.go b/eventlogging/types.go new file mode 100644 index 0000000..96d0ce0 --- /dev/null +++ b/eventlogging/types.go | |||
@@ -0,0 +1,52 @@ | |||
1 | package eventlogging | ||
2 | |||
3 | type ViewGrilData struct { | ||
4 | EventLoggerData | ||
5 | GrilID int | ||
6 | } | ||
7 | |||
8 | type ViewListData struct { | ||
9 | EventLoggerData | ||
10 | ListID int | ||
11 | } | ||
12 | |||
13 | type CreateListData struct { | ||
14 | EventLoggerData | ||
15 | ListID int | ||
16 | Name string | ||
17 | Description string | ||
18 | } | ||
19 | |||
20 | type AddGrilToListData struct { | ||
21 | EventLoggerData | ||
22 | GrilID int | ||
23 | ListID int | ||
24 | } | ||
25 | |||
26 | type DeleteGrilFromListData struct { | ||
27 | EventLoggerData | ||
28 | ListID int | ||
29 | GrilID int | ||
30 | } | ||
31 | |||
32 | type DeleteListData struct { | ||
33 | EventLoggerData | ||
34 | ListID int | ||
35 | } | ||
36 | |||
37 | type EditListData struct { | ||
38 | EventLoggerData | ||
39 | ListID int | ||
40 | OldName string | ||
41 | OldDescription string | ||
42 | NewName string | ||
43 | NewDescription string | ||
44 | } | ||
45 | |||
46 | type ChangeGrilOrderData struct { | ||
47 | EventLoggerData | ||
48 | ListID int | ||
49 | GrilID int | ||
50 | OldOrder int | ||
51 | NewOrder int | ||
52 | } | ||