| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package models |
||
| 2 | |||
| 3 | import ( |
||
| 4 | "gorm.io/gorm" |
||
| 5 | ) |
||
| 6 | |||
| 7 | // Mem structure |
||
| 8 | type UserLogs struct { |
||
| 9 | gorm.Model |
||
| 10 | UserID uint `json:"user_id" example:"1"` |
||
| 11 | User User |
||
| 12 | LogType UserLogType `json:"user_log_type" example:"1"` |
||
| 13 | Message string `json:"user_message" example:"Edited Profile Picture"` |
||
| 14 | } |
||
| 15 | |||
| 16 | type UserLogType int64 |
||
| 17 | |||
| 18 | const ( |
||
| 19 | UserUndefined UserLogType = iota |
||
| 20 | UserLogin |
||
| 21 | UserLogout |
||
| 22 | UserRegister |
||
| 23 | UserEdit |
||
| 24 | UserDeleted |
||
| 25 | UserSubscribe |
||
| 26 | UserUnsubscribe |
||
| 27 | ) |
||
| 28 | |||
| 29 | func (s UserLogType) ToString() string { |
||
| 30 | switch s { |
||
| 31 | case UserLogin: |
||
| 32 | return "User Login" |
||
| 33 | case UserLogout: |
||
| 34 | return "User Logout" |
||
| 35 | case UserRegister: |
||
| 36 | return "User Register" |
||
| 37 | case UserEdit: |
||
| 38 | return "User Edit" |
||
| 39 | case UserDeleted: |
||
| 40 | return "User Deleted" |
||
| 41 | case UserSubscribe: |
||
| 42 | return "User Subscribe" |
||
| 43 | case UserUnsubscribe: |
||
| 44 | return "User Unsubscribe" |
||
| 45 | |||
| 46 | default: |
||
| 47 | return "Unknown" |
||
| 48 | } |
||
| 50 |