summaryrefslogtreecommitdiff
path: root/app/struct.go
blob: 80d6bf2425cf17ed5b875682050233992e713435 (plain)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package main

import (
	"time"
)

type User struct {
	Id              int64
	Email           string `sql:"unique"`
	Name            string `sql:"unique"`
	Password        string
	Confirmed       bool
	ConfirmationKey string
	Alerts          []Alert
	CreatedAt       time.Time
	DeletedAt       time.Time
	UpdatedAt       time.Time
}

// Multiple accounts which are alerted
type Alert struct {
	Id        int64
	UserId    int64
	Email     string
	CreatedAt time.Time
	DeletedAt time.Time
	UpdatedAt time.Time
}

type Job struct {
	Id        int64
	UserId    int64
	Name      string
	Url       string
	Versions  []Version
	Diff      string
	DiffLen   int64
	CreatedAt time.Time
	DeletedAt time.Time
	UpdatedAt time.Time
}

// Save history version of jobs
type Version struct {
	Id        int64
	JobId     int64
	Content   string
	Hash      string
	CreatedAt time.Time
	DeletedAt time.Time
	UpdatedAt time.Time
}

/* Maybe worth saving uptime history? */

/*
type Host struct {
	Id   int64
	Host string
	Url  string
	//	Protocoll  string // e.g. http
	Monitored   bool // disable monitoring on error
	Private     bool
	Status      string
	StatusCode  int64
	Success     bool
	Reason      string // Connection failure
	Description string
	/*
		Date      time.Time
		Include   string // Website must include this string
		Except    string // Website must not include this string
		Alert     bool   // True to send alert on failure
		DeletedAt time.Time
*/
/*
	CreatedAt time.Time
	UpdatedAt time.Time
	Class     string
}
*/

/*
type Messages struct {
	Success     []interface{}
	Error       []interface{}
	Hosts       []Host
	moreScripts []string
	NextRun     time.Time
	Sticky      string
}
*/