feat(pkger): extend stack with name and description fields
parent
e116ecaf5e
commit
aae629bffd
|
@ -25,6 +25,8 @@ type (
|
|||
// If the pkg is applied, and no changes are had, then the stack is not updated.
|
||||
Stack struct {
|
||||
ID influxdb.ID
|
||||
Name string
|
||||
Desc string
|
||||
URLS []url.URL
|
||||
Resources []StackResource
|
||||
|
||||
|
|
|
@ -15,8 +15,10 @@ type (
|
|||
ID []byte `json:"id"`
|
||||
OrgID []byte `json:"orgID"`
|
||||
|
||||
URLs []string `json:"urls,omitempty"`
|
||||
Resources []entStackResource `json:"resources,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
URLs []string `json:"urls,omitempty"`
|
||||
Resources []entStackResource `json:"resources,omitempty"`
|
||||
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
|
@ -167,11 +169,13 @@ func convertStackToEnt(orgID influxdb.ID, stack Stack) (kv.Entity, error) {
|
|||
}
|
||||
|
||||
stEnt := entStack{
|
||||
ID: idBytes,
|
||||
OrgID: orgIDBytes,
|
||||
CreatedAt: stack.CreatedAt,
|
||||
UpdatedAt: stack.UpdatedAt,
|
||||
URLs: urlStrs,
|
||||
ID: idBytes,
|
||||
OrgID: orgIDBytes,
|
||||
Name: stack.Name,
|
||||
Description: stack.Desc,
|
||||
CreatedAt: stack.CreatedAt,
|
||||
UpdatedAt: stack.UpdatedAt,
|
||||
URLs: urlStrs,
|
||||
}
|
||||
|
||||
for _, res := range stack.Resources {
|
||||
|
@ -192,6 +196,8 @@ func convertStackToEnt(orgID influxdb.ID, stack Stack) (kv.Entity, error) {
|
|||
|
||||
func convertStackEntToStack(ent *entStack) (Stack, error) {
|
||||
stack := Stack{
|
||||
Name: ent.Name,
|
||||
Desc: ent.Description,
|
||||
CRUDLog: influxdb.CRUDLog{
|
||||
CreatedAt: ent.CreatedAt,
|
||||
UpdatedAt: ent.UpdatedAt,
|
||||
|
|
|
@ -19,7 +19,9 @@ func TestStoreKv(t *testing.T) {
|
|||
stackStub := func(id influxdb.ID) pkger.Stack {
|
||||
now := time.Time{}.Add(10 * 365 * 24 * time.Hour)
|
||||
return pkger.Stack{
|
||||
ID: id,
|
||||
ID: id,
|
||||
Name: "threeve",
|
||||
Desc: "desc",
|
||||
CRUDLog: influxdb.CRUDLog{
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now.Add(time.Hour),
|
||||
|
|
Loading…
Reference in New Issue