feat: stack model processor
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
const (
|
||||
IMAGE_TYPE = "image"
|
||||
LIST_TYPE = "list"
|
||||
STACK_TYPE = "list"
|
||||
)
|
||||
|
||||
type ImageNotification struct {
|
||||
@@ -21,18 +21,18 @@ type ImageNotification struct {
|
||||
Status string
|
||||
}
|
||||
|
||||
type ListNotification struct {
|
||||
type StackNotification struct {
|
||||
Type string
|
||||
|
||||
ListID uuid.UUID
|
||||
Name string
|
||||
StackID uuid.UUID
|
||||
Name string
|
||||
|
||||
Status string
|
||||
}
|
||||
|
||||
type Notification struct {
|
||||
image *ImageNotification
|
||||
list *ListNotification
|
||||
stack *StackNotification
|
||||
}
|
||||
|
||||
func GetImageNotification(image ImageNotification) Notification {
|
||||
@@ -41,9 +41,9 @@ func GetImageNotification(image ImageNotification) Notification {
|
||||
}
|
||||
}
|
||||
|
||||
func GetListNotification(list ListNotification) Notification {
|
||||
func GetStackNotification(list StackNotification) Notification {
|
||||
return Notification{
|
||||
list: &list,
|
||||
stack: &list,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ func (n Notification) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(n.image)
|
||||
}
|
||||
|
||||
if n.list != nil {
|
||||
return json.Marshal(n.list)
|
||||
if n.stack != nil {
|
||||
return json.Marshal(n.stack)
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("no image or list present")
|
||||
|
||||
Reference in New Issue
Block a user