-
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.
add dummy team and team component relationship and fixed test
- Loading branch information
1 parent
918bac4
commit 7f008c2
Showing
14 changed files
with
167 additions
and
14 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 |
---|---|---|
|
@@ -7,3 +7,7 @@ var ( | |
|
||
DummyYearOldDate = time.Now().AddDate(-1, 0, 0) | ||
) | ||
|
||
func ptr[T any](t T) *T { | ||
return &t | ||
} |
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,17 @@ | ||
package dummy | ||
|
||
import "github.com/flanksource/duty/models" | ||
|
||
var LogisticBackendTeamComponent = models.TeamComponent{ | ||
TeamID: Backend.ID, | ||
ComponentID: Logistics.ID, | ||
SelectorID: ptr("366d4ecb71d8ce12cf253e55d541f987"), | ||
} | ||
|
||
var LogisticUIFrontendTeamComponent = models.TeamComponent{ | ||
TeamID: Frontend.ID, | ||
ComponentID: LogisticsUI.ID, | ||
SelectorID: ptr("7fbaeebb537818e8b334fd336613f8d4 "), | ||
} | ||
|
||
var AllTeamComponents = []models.TeamComponent{LogisticBackendTeamComponent, LogisticUIFrontendTeamComponent} |
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,22 @@ | ||
package dummy | ||
|
||
import ( | ||
"github.com/flanksource/duty/models" | ||
"github.com/google/uuid" | ||
) | ||
|
||
var Backend = models.Team{ | ||
ID: uuid.MustParse("3d3f49ba-93d6-4058-8acc-96233f7c5c80"), | ||
Name: "Backend", | ||
Spec: []byte(`{"components": [{ "name": "logistics" }]}`), | ||
CreatedBy: JohnDoe.ID, | ||
} | ||
|
||
var Frontend = models.Team{ | ||
ID: uuid.MustParse("72d965e2-b58b-4a23-ba73-2cae0daf5981"), | ||
Name: "Frontend", | ||
Spec: []byte(`{"components": [{ "name": "logistics-ui" }]}`), | ||
CreatedBy: JohnDoe.ID, | ||
} | ||
|
||
var AllDummyTeams = []models.Team{Backend, Frontend} |
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
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
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
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,60 @@ | ||
{ | ||
"components": [ | ||
{ | ||
"id": "018681fc-e54f-bd4f-42be-068a9a69eeb5", | ||
"agent_id": "00000000-0000-0000-0000-000000000000", | ||
"external_id": "dummy/logistics", | ||
"name": "logistics", | ||
"labels": { | ||
"telemetry": "enabled" | ||
}, | ||
"status": "healthy", | ||
"type": "Entity", | ||
"owner": "logistics-team", | ||
"summary": { | ||
"healthy": 1 | ||
}, | ||
"is_leaf": false, | ||
"created_at": "2023-01-01T05:29:00+05:30", | ||
"updated_at": "2023-01-01T05:29:00+05:30", | ||
"components": [ | ||
{ | ||
"id": "018681fd-5770-336f-227c-259435d7fc6b", | ||
"agent_id": "00000000-0000-0000-0000-000000000000", | ||
"external_id": "dummy/logistics-api", | ||
"parent_id": "018681fc-e54f-bd4f-42be-068a9a69eeb5", | ||
"name": "logistics-api", | ||
"labels": { | ||
"telemetry": "enabled" | ||
}, | ||
"status": "healthy", | ||
"type": "Application", | ||
"owner": "logistics-team", | ||
"path": "018681fc-e54f-bd4f-42be-068a9a69eeb5", | ||
"summary": { | ||
"healthy": 1 | ||
}, | ||
"is_leaf": false, | ||
"created_at": "2023-01-01T05:29:00+05:30", | ||
"updated_at": "2023-01-01T05:29:00+05:30", | ||
"checks": { | ||
"healthy": 2 | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"healthStatuses": [ | ||
"healthy" | ||
], | ||
"teams": ["Backend"], | ||
"tags": { | ||
"telemetry": [ | ||
"enabled" | ||
] | ||
}, | ||
"types": [ | ||
"Application", | ||
"Entity" | ||
] | ||
} |
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 | ||
|
||
import ( | ||
"encoding/json" | ||
"time" | ||
|
||
"github.com/google/uuid" | ||
) | ||
|
||
type Team struct { | ||
ID uuid.UUID `json:"id" gorm:"primaryKey"` | ||
Name string `json:"name"` | ||
Icon string `json:"icon,omitempty"` | ||
Spec json.RawMessage `json:"spec,omitempty"` | ||
Source string `json:"source,omitempty"` | ||
CreatedBy uuid.UUID `json:"created_by"` | ||
CreatedAt time.Time `json:"created_at"` | ||
UpdatedAt time.Time `json:"updated_at"` | ||
DeletedAt *time.Time `json:"deleted_at,omitempty"` | ||
} | ||
|
||
type TeamComponent struct { | ||
TeamID uuid.UUID `json:"team_id" gorm:"primaryKey"` | ||
ComponentID uuid.UUID `json:"component_id" gorm:"primaryKey"` | ||
Role *string `json:"role,omitempty"` | ||
SelectorID *string `json:"selector_id,omitempty"` | ||
} |
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