123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- package api
- import "github.com/usememos/memos/server/profile"
- // ActivityType is the type for an activity.
- type ActivityType string
- const (
- // User related.
- // ActivityUserCreate is the type for creating users.
- ActivityUserCreate ActivityType = "user.create"
- // ActivityUserUpdate is the type for updating users.
- ActivityUserUpdate ActivityType = "user.update"
- // ActivityUserDelete is the type for deleting users.
- ActivityUserDelete ActivityType = "user.delete"
- // ActivityUserAuthSignIn is the type for user signin.
- ActivityUserAuthSignIn ActivityType = "user.auth.signin"
- // ActivityUserAuthSignUp is the type for user signup.
- ActivityUserAuthSignUp ActivityType = "user.auth.signup"
- // ActivityUserSettingUpdate is the type for updating user settings.
- ActivityUserSettingUpdate ActivityType = "user.setting.update"
- // Memo related.
- // ActivityMemoCreate is the type for creating memos.
- ActivityMemoCreate ActivityType = "memo.create"
- // ActivityMemoUpdate is the type for updating memos.
- ActivityMemoUpdate ActivityType = "memo.update"
- // ActivityMemoDelete is the type for deleting memos.
- ActivityMemoDelete ActivityType = "memo.delete"
- // Shortcut related.
- // ActivityShortcutCreate is the type for creating shortcuts.
- ActivityShortcutCreate ActivityType = "shortcut.create"
- // ActivityShortcutUpdate is the type for updating shortcuts.
- ActivityShortcutUpdate ActivityType = "shortcut.update"
- // ActivityShortcutDelete is the type for deleting shortcuts.
- ActivityShortcutDelete ActivityType = "shortcut.delete"
- // Resource related.
- // ActivityResourceCreate is the type for creating resources.
- ActivityResourceCreate ActivityType = "resource.create"
- // ActivityResourceDelete is the type for deleting resources.
- ActivityResourceDelete ActivityType = "resource.delete"
- // Tag related.
- // ActivityTagCreate is the type for creating tags.
- ActivityTagCreate ActivityType = "tag.create"
- // ActivityTagDelete is the type for deleting tags.
- ActivityTagDelete ActivityType = "tag.delete"
- // Server related.
- // ActivityServerStart is the type for starting server.
- ActivityServerStart ActivityType = "server.start"
- )
- // ActivityLevel is the level of activities.
- type ActivityLevel string
- const (
- // ActivityInfo is the INFO level of activities.
- ActivityInfo ActivityLevel = "INFO"
- // ActivityWarn is the WARN level of activities.
- ActivityWarn ActivityLevel = "WARN"
- // ActivityError is the ERROR level of activities.
- ActivityError ActivityLevel = "ERROR"
- )
- type ActivityUserCreatePayload struct {
- UserID int `json:"userId"`
- Username string `json:"username"`
- Role Role `json:"role"`
- }
- type ActivityUserAuthSignInPayload struct {
- UserID int `json:"userId"`
- IP string `json:"ip"`
- }
- type ActivityUserAuthSignUpPayload struct {
- Username string `json:"username"`
- IP string `json:"ip"`
- }
- type ActivityMemoCreatePayload struct {
- Content string `json:"content"`
- Visibility string `json:"visibility"`
- }
- type ActivityShortcutCreatePayload struct {
- Title string `json:"title"`
- Payload string `json:"payload"`
- }
- type ActivityResourceCreatePayload struct {
- Filename string `json:"filename"`
- Type string `json:"type"`
- Size int64 `json:"size"`
- }
- type ActivityTagCreatePayload struct {
- TagName string `json:"tagName"`
- }
- type ActivityServerStartPayload struct {
- ServerID string `json:"serverId"`
- Profile *profile.Profile `json:"profile"`
- }
- type Activity struct {
- ID int `json:"id"`
- // Standard fields
- CreatorID int `json:"creatorId"`
- CreatedTs int64 `json:"createdTs"`
- // Domain specific fields
- Type ActivityType `json:"type"`
- Level ActivityLevel `json:"level"`
- Payload string `json:"payload"`
- }
- // ActivityCreate is the API message for creating an activity.
- type ActivityCreate struct {
- // Standard fields
- CreatorID int
- // Domain specific fields
- Type ActivityType `json:"type"`
- Level ActivityLevel
- Payload string `json:"payload"`
- }
|