Skip to content

Commit

Permalink
Sync progress #12
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoOliveira committed Dec 12, 2023
1 parent 528625b commit 2ad883e
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
24 changes: 24 additions & 0 deletions core/integrations/printers/endpoints.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package printers

import (
"net/http"

"github.com/eduardooliveira/stLib/core/models"
"github.com/labstack/echo/v4"
)

func save(c echo.Context) error {

pPrinter := &models.Printer{}
err := c.Bind(pPrinter)

if err != nil {
return c.NoContent(http.StatusBadRequest)
}

if pPrinter.UUID != "" {

}

return c.NoContent(http.StatusInternalServerError)
}
12 changes: 12 additions & 0 deletions core/integrations/printers/printer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package printers

import "github.com/labstack/echo/v4"

var group *echo.Group

func Register(e *echo.Group) {

group = e
//group.GET("", index)
group.POST("", save)
}
8 changes: 8 additions & 0 deletions core/models/printer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package models

type Printer struct {
UUID string `json:"uuid" toml:"uuid" form:"uuid" query:"uuid"`
Name string `json:"name" toml:"name" form:"name" query:"name"`
Type string `json:"type" toml:"type" form:"type" query:"type"`
Address string `json:"address" toml:"address" form:"address" query:"address"`
}
7 changes: 2 additions & 5 deletions core/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ import (
)

var Projects = make(map[string]*models.Project)
var Models = make(map[string]*models.ProjectAsset)
var TempFiles = make(map[string]*models.TempFile)
var Images = make(map[string]*models.ProjectAsset)
var Slices = make(map[string]*models.ProjectAsset)
var Files = make(map[string]*models.ProjectAsset)
var Assets = make(map[string]*models.ProjectAsset)
var TempFiles = make(map[string]*models.TempFile)
var Printers = make(map[string]*models.Printer)

func PersistProject(project *models.Project) error {
f, err := os.OpenFile(fmt.Sprintf("%s/.project.stlib", utils.ToLibPath(project.FullPath())), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666)
Expand Down

0 comments on commit 2ad883e

Please sign in to comment.