-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initial hooks boilerplate and updated screenshots
- Loading branch information
1 parent
c51bed6
commit 1ef49c4
Showing
22 changed files
with
1,101 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package models | ||
|
||
type CheckState string | ||
|
||
const ( | ||
CheckStateActive CheckState = "ACTIVE" | ||
CheckStatePaused CheckState = "PAUSED" | ||
CheckStateUnknown CheckState = "UNKNOWN" | ||
) | ||
|
||
type Check struct { | ||
CreatedAt *Time `db:"created_at"` | ||
UpdatedAt *Time `db:"updated_at"` | ||
|
||
Id string `db:"id"` | ||
Name string `db:"name"` | ||
|
||
Schedule string `db:"schedule"` | ||
Script string `db:"script"` | ||
Filter string `db:"filter"` | ||
} | ||
|
||
type CheckWithWorkerGroups struct { | ||
Check | ||
// List of worker group names | ||
WorkerGroups []string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package models | ||
|
||
type HookState string | ||
|
||
const ( | ||
HookStateActive HookState = "ACTIVE" | ||
HookStatePaused HookState = "PAUSED" | ||
HookStateUnknown HookState = "UNKNOWN" | ||
) | ||
|
||
type Hook struct { | ||
CreatedAt *Time `db:"created_at"` | ||
UpdatedAt *Time `db:"updated_at"` | ||
|
||
Id string `db:"id"` | ||
Name string `db:"name"` | ||
|
||
Schedule string `db:"schedule"` | ||
Script string `db:"script"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package models | ||
|
||
type TargetVisibility string | ||
|
||
const ( | ||
TargetVisibilityPublic TargetVisibility = "PUBLIC" | ||
TargetVisibilityPrivate TargetVisibility = "PRIVATE" | ||
TargetVisibilityUnknown TargetVisibility = "UNKNOWN" | ||
) | ||
|
||
type TargetState string | ||
|
||
const ( | ||
TargetStateActive TargetState = "ACTIVE" | ||
TargetStatePaused TargetState = "PAUSED" | ||
TargetStateUnknown TargetState = "UNKNOWN" | ||
) | ||
|
||
type Target struct { | ||
CreatedAt *Time `db:"created_at"` | ||
UpdatedAt *Time `db:"updated_at"` | ||
|
||
Id string `db:"id"` | ||
Name string `db:"name"` | ||
Group string `db:"group"` | ||
Visibility TargetVisibility `db:"visibility"` | ||
State TargetState `db:"state"` | ||
Metadata string `db:"metadata"` | ||
} | ||
|
||
type TargetStatus string | ||
|
||
const ( | ||
TargetStatusSuccess TargetStatus = "SUCCESS" | ||
TargetStatusFailure TargetStatus = "FAILURE" | ||
TargetStatusUnknown TargetStatus = "UNKNOWN" | ||
) | ||
|
||
type TargetHistory struct { | ||
CreatedAt *Time `db:"created_at"` | ||
|
||
TargetId string `db:"target_id"` | ||
WorkerGroupId string `db:"worker_group_id"` | ||
CheckId string `db:"check_id"` | ||
|
||
Status TargetStatus `db:"status"` | ||
Note string `db:"note"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- +migrate Up | ||
CREATE TABLE hooks ( | ||
id TEXT NOT NULL, | ||
name TEXT NOT NULL, | ||
schedule TEXT NOT NULL, | ||
script TEXT NOT NULL, | ||
|
||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ')), | ||
updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ')), | ||
|
||
PRIMARY KEY (id), | ||
CONSTRAINT unique_hooks_name UNIQUE (name) | ||
) STRICT; | ||
-- +migrate StatementBegin | ||
CREATE TRIGGER hooks_updated_timestamp AFTER UPDATE ON hooks BEGIN | ||
UPDATE hooks SET updated_at = strftime('%Y-%m-%dT%H:%M:%fZ') WHERE id = NEW.id; | ||
END; | ||
-- +migrate StatementEnd | ||
|
||
CREATE TABLE hook_worker_groups ( | ||
worker_group_id TEXT NOT NULL, | ||
hook_id TEXT NOT NULL, | ||
|
||
PRIMARY KEY (worker_group_id,hook_id), | ||
CONSTRAINT fk_hook_worker_groups_worker_group FOREIGN KEY (worker_group_id) REFERENCES worker_groups(id) ON DELETE CASCADE, | ||
CONSTRAINT fk_hook_worker_groups_hook FOREIGN KEY (hook_id) REFERENCES hooks(id) ON DELETE CASCADE | ||
) STRICT; | ||
-- +migrate Down | ||
DROP TABLE hook_worker_groups; | ||
DROP TABLE hooks; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.