From 69dcaf37978d7f4ab6755db623ace57c72343c8c Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Thu, 19 Oct 2023 17:59:34 +0100 Subject: [PATCH] activity: Add initial data structure --- storage.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/storage.go b/storage.go index 18af06d..567b477 100644 --- a/storage.go +++ b/storage.go @@ -21,6 +21,36 @@ type telegramStore map[string]TelegramUser type matrixStore map[string]MatrixUser type emailStore map[string]EmailAddress +type ActivityType int + +const ( + ActivityCreation ActivityType = iota // FIXME + ActivityDeletion // FIXME + ActivityDisabled // FIXME + ActivityEnabled // FIXME + ActivityLinked // FIXME + ActivityChangePassword // FIXME + ActivityResetPassword // FIXME + ActivityCreateInvite // FIXME +) + +type ActivitySource int + +const ( + ActivityUser ActivitySource = iota // Source = UserID. For ActivityCreation, this would mean the referrer. + ActivityAdmin // Source = Admin's UserID, or simply just "admin" + ActivityAnon // Source = Blank, or potentially browser info. For ActivityCreation, this would be via an invite +) + +type Activity struct { + Type ActivityType `badgerhold:"index"` + UserID string + SourceType ActivitySource + Source string + InviteCode string // Only set for ActivityCreation + Time time.Time +} + type UserExpiry struct { JellyfinID string `badgerhold:"key"` Expiry time.Time