-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdash_types.go
More file actions
73 lines (67 loc) · 2.59 KB
/
dash_types.go
File metadata and controls
73 lines (67 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package korm
import (
"path"
"strings"
"time"
)
var (
paginationPer = 10
embededDashboard = false
mediaDir = "media"
docsUrl = "/docs"
staticUrl = "/static"
assetsDir = "assets"
staticDir = path.Join(assetsDir, "/", "static")
templatesDir = path.Join(assetsDir, "/", "templates")
repoUser = "kamalshkeir"
repoName = "korm-dash"
dahsboardUsed = false
adminPathNameGroup = "/admin"
terminalUIEnabled = false
kanbanUIEnabled = false
// Debug when true show extra useful logs for queries executed for migrations and queries statements
Debug = false
// FlushCacheEvery execute korm.FlushCache() every 10 min by default, you should not worry about it, but useful that you can change it
FlushCacheEvery = 10 * time.Minute
// MaxOpenConns set max open connections for db pool
MaxOpenConns = 50
// MaxIdleConns set max idle connections for db pool
MaxIdleConns = 30
// MaxLifetime set max lifetime for a connection in the db pool
MaxLifetime = 30 * time.Minute
// MaxIdleTime set max idletime for a connection in the db pool
MaxIdleTime = 30 * time.Minute
)
type User struct {
Id int `json:"id,omitempty" korm:"pk"`
Uuid string `json:"uuid,omitempty" korm:"size:40;iunique"`
Username string `json:"username,omitempty" korm:"size:40;iunique"`
Email string `json:"email,omitempty" korm:"size:50;iunique"`
Password string `json:"password,omitempty" korm:"size:150;default:''"`
IsAdmin bool `json:"is_admin,omitempty" korm:"default:false"`
Image string `json:"image,omitempty" korm:"size:100;default:''"`
CreatedAt time.Time `json:"created_at,omitempty" korm:"now"`
}
// SetAdminPath set admin path, default '/admin'
func SetAdminPath(path string) {
if !strings.HasPrefix(path, "/") {
adminPathNameGroup = "/" + path
} else {
adminPathNameGroup = path
}
}
type Board struct {
Id int `korm:"pk" json:"id,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
UpdatedAt time.Time `korm:"update" json:"updated_at"`
}
type Task struct {
Id int `korm:"pk" json:"id,omitempty"`
BoardId int `korm:"fk:_boards.id:cascade:cascade" json:"board_id"`
Title string `json:"title,omitempty"`
Description string `korm:"text" json:"description,omitempty"`
Status string `korm:"check: status IN ('todo','doing','done')" json:"status,omitempty"`
Priority string `korm:"check: priority IN ('low','medium','high')" json:"priority,omitempty"`
Position int `json:"position"`
}