From cdcc41008952799b3a735810761cb86bc95f7bed Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L de Mello" Date: Fri, 28 Mar 2025 16:41:31 -0300 Subject: [PATCH] feat(service): add interaction to page struct --- service/editor.go | 9 +++++++++ service/projects.go | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/service/editor.go b/service/editor.go index e3d4688..5e17788 100644 --- a/service/editor.go +++ b/service/editor.go @@ -24,9 +24,16 @@ type Project struct { type ProjectPage struct { ID string `json:"id"` + Interactions map[string]PageInteraction `json:"interactions"` Image io.ReadCloser `json:"-"` } +type PageInteraction struct { + URL string `json:"url"` + X uint16 `json:"x"` + Y uint16 `json:"y"` +} + func (s *Service) AddPage(projectID string, img io.Reader) error { s.assert.NotNil(s.ctx) s.assert.NotNil(s.s3) @@ -96,6 +103,8 @@ func (s *Service) GetPage(projectID string, pageID string) (ProjectPage, error) } s.assert.NotNil(res.Body) + s.assert.NotNil(page.Interactions) + page.Image = res.Body return page, nil diff --git a/service/projects.go b/service/projects.go index c93ee17..f938b96 100644 --- a/service/projects.go +++ b/service/projects.go @@ -45,7 +45,7 @@ func (s *Service) CreateProject() (Project, error) { p := Project{ ID: id, Title: title, - Pages: map[string]ProjectPage{}, + Pages: []ProjectPage{}, } c, err := json.Marshal(p)