feat(service): add interaction to page struct

This commit is contained in:
Guz
2025-03-28 16:41:31 -03:00
parent 757ed62edd
commit cdcc410089
2 changed files with 10 additions and 1 deletions

View File

@@ -24,9 +24,16 @@ type Project struct {
type ProjectPage struct { type ProjectPage struct {
ID string `json:"id"` ID string `json:"id"`
Interactions map[string]PageInteraction `json:"interactions"`
Image io.ReadCloser `json:"-"` 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 { func (s *Service) AddPage(projectID string, img io.Reader) error {
s.assert.NotNil(s.ctx) s.assert.NotNil(s.ctx)
s.assert.NotNil(s.s3) 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(res.Body)
s.assert.NotNil(page.Interactions)
page.Image = res.Body page.Image = res.Body
return page, nil return page, nil

View File

@@ -45,7 +45,7 @@ func (s *Service) CreateProject() (Project, error) {
p := Project{ p := Project{
ID: id, ID: id,
Title: title, Title: title,
Pages: map[string]ProjectPage{}, Pages: []ProjectPage{},
} }
c, err := json.Marshal(p) c, err := json.Marshal(p)