Rename edit REST handlers/requests to update
This commit is contained in:
parent
2feaf0f487
commit
3dcf10e398
@ -100,9 +100,9 @@
|
||||
"parameters": {}
|
||||
},
|
||||
{
|
||||
"name": "edit",
|
||||
"name": "update",
|
||||
"method": "POST",
|
||||
"title": "Edit page",
|
||||
"title": "Update page",
|
||||
"path": "/{pageID}",
|
||||
"parameters": {
|
||||
"path": [
|
||||
@ -272,9 +272,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "edit",
|
||||
"name": "update",
|
||||
"method": "POST",
|
||||
"title": "Edit module",
|
||||
"title": "Update module",
|
||||
"path": "/{moduleID}",
|
||||
"parameters": {
|
||||
"path": [
|
||||
@ -448,9 +448,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "record/edit",
|
||||
"name": "record/update",
|
||||
"method": "POST",
|
||||
"title": "Add/update records in module section",
|
||||
"title": "Update records in module section",
|
||||
"path": "/{moduleID}/record/{recordID}",
|
||||
"parameters": {
|
||||
"path": [
|
||||
@ -559,7 +559,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "edit",
|
||||
"name": "update",
|
||||
"method": "POST",
|
||||
"title": "Add/update charts in module section",
|
||||
"path": "/{chartID}",
|
||||
@ -687,9 +687,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "edit",
|
||||
"name": "update",
|
||||
"method": "POST",
|
||||
"title": "Edit trigger",
|
||||
"title": "Update trigger",
|
||||
"path": "/{triggerID}",
|
||||
"parameters": {
|
||||
"path": [
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "edit",
|
||||
"Name": "update",
|
||||
"Method": "POST",
|
||||
"Title": "Add/update charts in module section",
|
||||
"Path": "/{chartID}",
|
||||
|
||||
@ -77,9 +77,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "edit",
|
||||
"Name": "update",
|
||||
"Method": "POST",
|
||||
"Title": "Edit module",
|
||||
"Title": "Update module",
|
||||
"Path": "/{moduleID}",
|
||||
"Parameters": {
|
||||
"path": [
|
||||
@ -253,9 +253,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "record/edit",
|
||||
"Name": "record/update",
|
||||
"Method": "POST",
|
||||
"Title": "Add/update records in module section",
|
||||
"Title": "Update records in module section",
|
||||
"Path": "/{moduleID}/record/{recordID}",
|
||||
"Parameters": {
|
||||
"path": [
|
||||
|
||||
@ -101,9 +101,9 @@
|
||||
"Parameters": {}
|
||||
},
|
||||
{
|
||||
"Name": "edit",
|
||||
"Name": "update",
|
||||
"Method": "POST",
|
||||
"Title": "Edit page",
|
||||
"Title": "Update page",
|
||||
"Path": "/{pageID}",
|
||||
"Parameters": {
|
||||
"path": [
|
||||
|
||||
@ -82,9 +82,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "edit",
|
||||
"Name": "update",
|
||||
"Method": "POST",
|
||||
"Title": "Edit trigger",
|
||||
"Title": "Update trigger",
|
||||
"Path": "/{triggerID}",
|
||||
"Parameters": {
|
||||
"path": [
|
||||
|
||||
@ -43,7 +43,7 @@ func (ctrl *Chart) Read(ctx context.Context, r *request.ChartRead) (interface{},
|
||||
return ctrl.chart.With(ctx).FindByID(r.ChartID)
|
||||
}
|
||||
|
||||
func (ctrl *Chart) Edit(ctx context.Context, r *request.ChartEdit) (interface{}, error) {
|
||||
func (ctrl *Chart) Update(ctx context.Context, r *request.ChartUpdate) (interface{}, error) {
|
||||
chart := &types.Chart{
|
||||
ID: r.ChartID,
|
||||
Name: r.Name,
|
||||
|
||||
@ -30,7 +30,7 @@ type ChartAPI interface {
|
||||
List(context.Context, *request.ChartList) (interface{}, error)
|
||||
Create(context.Context, *request.ChartCreate) (interface{}, error)
|
||||
Read(context.Context, *request.ChartRead) (interface{}, error)
|
||||
Edit(context.Context, *request.ChartEdit) (interface{}, error)
|
||||
Update(context.Context, *request.ChartUpdate) (interface{}, error)
|
||||
Delete(context.Context, *request.ChartDelete) (interface{}, error)
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ type Chart struct {
|
||||
List func(http.ResponseWriter, *http.Request)
|
||||
Create func(http.ResponseWriter, *http.Request)
|
||||
Read func(http.ResponseWriter, *http.Request)
|
||||
Edit func(http.ResponseWriter, *http.Request)
|
||||
Update func(http.ResponseWriter, *http.Request)
|
||||
Delete func(http.ResponseWriter, *http.Request)
|
||||
}
|
||||
|
||||
@ -66,11 +66,11 @@ func NewChart(ch ChartAPI) *Chart {
|
||||
return ch.Read(r.Context(), params)
|
||||
})
|
||||
},
|
||||
Edit: func(w http.ResponseWriter, r *http.Request) {
|
||||
Update: func(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
params := request.NewChartEdit()
|
||||
params := request.NewChartUpdate()
|
||||
resputil.JSON(w, params.Fill(r), func() (interface{}, error) {
|
||||
return ch.Edit(r.Context(), params)
|
||||
return ch.Update(r.Context(), params)
|
||||
})
|
||||
},
|
||||
Delete: func(w http.ResponseWriter, r *http.Request) {
|
||||
@ -90,7 +90,7 @@ func (ch *Chart) MountRoutes(r chi.Router, middlewares ...func(http.Handler) htt
|
||||
r.Get("/", ch.List)
|
||||
r.Post("/", ch.Create)
|
||||
r.Get("/{chartID}", ch.Read)
|
||||
r.Post("/{chartID}", ch.Edit)
|
||||
r.Post("/{chartID}", ch.Update)
|
||||
r.Delete("/{chartID}", ch.Delete)
|
||||
})
|
||||
})
|
||||
|
||||
@ -30,13 +30,13 @@ type ModuleAPI interface {
|
||||
List(context.Context, *request.ModuleList) (interface{}, error)
|
||||
Create(context.Context, *request.ModuleCreate) (interface{}, error)
|
||||
Read(context.Context, *request.ModuleRead) (interface{}, error)
|
||||
Edit(context.Context, *request.ModuleEdit) (interface{}, error)
|
||||
Update(context.Context, *request.ModuleUpdate) (interface{}, error)
|
||||
Delete(context.Context, *request.ModuleDelete) (interface{}, error)
|
||||
RecordReport(context.Context, *request.ModuleRecordReport) (interface{}, error)
|
||||
RecordList(context.Context, *request.ModuleRecordList) (interface{}, error)
|
||||
RecordCreate(context.Context, *request.ModuleRecordCreate) (interface{}, error)
|
||||
RecordRead(context.Context, *request.ModuleRecordRead) (interface{}, error)
|
||||
RecordEdit(context.Context, *request.ModuleRecordEdit) (interface{}, error)
|
||||
RecordUpdate(context.Context, *request.ModuleRecordUpdate) (interface{}, error)
|
||||
RecordDelete(context.Context, *request.ModuleRecordDelete) (interface{}, error)
|
||||
}
|
||||
|
||||
@ -45,13 +45,13 @@ type Module struct {
|
||||
List func(http.ResponseWriter, *http.Request)
|
||||
Create func(http.ResponseWriter, *http.Request)
|
||||
Read func(http.ResponseWriter, *http.Request)
|
||||
Edit func(http.ResponseWriter, *http.Request)
|
||||
Update func(http.ResponseWriter, *http.Request)
|
||||
Delete func(http.ResponseWriter, *http.Request)
|
||||
RecordReport func(http.ResponseWriter, *http.Request)
|
||||
RecordList func(http.ResponseWriter, *http.Request)
|
||||
RecordCreate func(http.ResponseWriter, *http.Request)
|
||||
RecordRead func(http.ResponseWriter, *http.Request)
|
||||
RecordEdit func(http.ResponseWriter, *http.Request)
|
||||
RecordUpdate func(http.ResponseWriter, *http.Request)
|
||||
RecordDelete func(http.ResponseWriter, *http.Request)
|
||||
}
|
||||
|
||||
@ -78,11 +78,11 @@ func NewModule(mh ModuleAPI) *Module {
|
||||
return mh.Read(r.Context(), params)
|
||||
})
|
||||
},
|
||||
Edit: func(w http.ResponseWriter, r *http.Request) {
|
||||
Update: func(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
params := request.NewModuleEdit()
|
||||
params := request.NewModuleUpdate()
|
||||
resputil.JSON(w, params.Fill(r), func() (interface{}, error) {
|
||||
return mh.Edit(r.Context(), params)
|
||||
return mh.Update(r.Context(), params)
|
||||
})
|
||||
},
|
||||
Delete: func(w http.ResponseWriter, r *http.Request) {
|
||||
@ -120,11 +120,11 @@ func NewModule(mh ModuleAPI) *Module {
|
||||
return mh.RecordRead(r.Context(), params)
|
||||
})
|
||||
},
|
||||
RecordEdit: func(w http.ResponseWriter, r *http.Request) {
|
||||
RecordUpdate: func(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
params := request.NewModuleRecordEdit()
|
||||
params := request.NewModuleRecordUpdate()
|
||||
resputil.JSON(w, params.Fill(r), func() (interface{}, error) {
|
||||
return mh.RecordEdit(r.Context(), params)
|
||||
return mh.RecordUpdate(r.Context(), params)
|
||||
})
|
||||
},
|
||||
RecordDelete: func(w http.ResponseWriter, r *http.Request) {
|
||||
@ -144,13 +144,13 @@ func (mh *Module) MountRoutes(r chi.Router, middlewares ...func(http.Handler) ht
|
||||
r.Get("/", mh.List)
|
||||
r.Post("/", mh.Create)
|
||||
r.Get("/{moduleID}", mh.Read)
|
||||
r.Post("/{moduleID}", mh.Edit)
|
||||
r.Post("/{moduleID}", mh.Update)
|
||||
r.Delete("/{moduleID}", mh.Delete)
|
||||
r.Get("/{moduleID}/report", mh.RecordReport)
|
||||
r.Get("/{moduleID}/record", mh.RecordList)
|
||||
r.Post("/{moduleID}/record", mh.RecordCreate)
|
||||
r.Get("/{moduleID}/record/{recordID}", mh.RecordRead)
|
||||
r.Post("/{moduleID}/record/{recordID}", mh.RecordEdit)
|
||||
r.Post("/{moduleID}/record/{recordID}", mh.RecordUpdate)
|
||||
r.Delete("/{moduleID}/record/{recordID}", mh.RecordDelete)
|
||||
})
|
||||
})
|
||||
|
||||
@ -31,7 +31,7 @@ type PageAPI interface {
|
||||
Create(context.Context, *request.PageCreate) (interface{}, error)
|
||||
Read(context.Context, *request.PageRead) (interface{}, error)
|
||||
Tree(context.Context, *request.PageTree) (interface{}, error)
|
||||
Edit(context.Context, *request.PageEdit) (interface{}, error)
|
||||
Update(context.Context, *request.PageUpdate) (interface{}, error)
|
||||
Reorder(context.Context, *request.PageReorder) (interface{}, error)
|
||||
Delete(context.Context, *request.PageDelete) (interface{}, error)
|
||||
}
|
||||
@ -42,7 +42,7 @@ type Page struct {
|
||||
Create func(http.ResponseWriter, *http.Request)
|
||||
Read func(http.ResponseWriter, *http.Request)
|
||||
Tree func(http.ResponseWriter, *http.Request)
|
||||
Edit func(http.ResponseWriter, *http.Request)
|
||||
Update func(http.ResponseWriter, *http.Request)
|
||||
Reorder func(http.ResponseWriter, *http.Request)
|
||||
Delete func(http.ResponseWriter, *http.Request)
|
||||
}
|
||||
@ -77,11 +77,11 @@ func NewPage(ph PageAPI) *Page {
|
||||
return ph.Tree(r.Context(), params)
|
||||
})
|
||||
},
|
||||
Edit: func(w http.ResponseWriter, r *http.Request) {
|
||||
Update: func(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
params := request.NewPageEdit()
|
||||
params := request.NewPageUpdate()
|
||||
resputil.JSON(w, params.Fill(r), func() (interface{}, error) {
|
||||
return ph.Edit(r.Context(), params)
|
||||
return ph.Update(r.Context(), params)
|
||||
})
|
||||
},
|
||||
Reorder: func(w http.ResponseWriter, r *http.Request) {
|
||||
@ -109,7 +109,7 @@ func (ph *Page) MountRoutes(r chi.Router, middlewares ...func(http.Handler) http
|
||||
r.Post("/", ph.Create)
|
||||
r.Get("/{pageID}", ph.Read)
|
||||
r.Get("/tree", ph.Tree)
|
||||
r.Post("/{pageID}", ph.Edit)
|
||||
r.Post("/{pageID}", ph.Update)
|
||||
r.Post("/{selfID}/reorder", ph.Reorder)
|
||||
r.Delete("/{pageID}", ph.Delete)
|
||||
})
|
||||
|
||||
@ -30,7 +30,7 @@ type TriggerAPI interface {
|
||||
List(context.Context, *request.TriggerList) (interface{}, error)
|
||||
Create(context.Context, *request.TriggerCreate) (interface{}, error)
|
||||
Read(context.Context, *request.TriggerRead) (interface{}, error)
|
||||
Edit(context.Context, *request.TriggerEdit) (interface{}, error)
|
||||
Update(context.Context, *request.TriggerUpdate) (interface{}, error)
|
||||
Delete(context.Context, *request.TriggerDelete) (interface{}, error)
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ type Trigger struct {
|
||||
List func(http.ResponseWriter, *http.Request)
|
||||
Create func(http.ResponseWriter, *http.Request)
|
||||
Read func(http.ResponseWriter, *http.Request)
|
||||
Edit func(http.ResponseWriter, *http.Request)
|
||||
Update func(http.ResponseWriter, *http.Request)
|
||||
Delete func(http.ResponseWriter, *http.Request)
|
||||
}
|
||||
|
||||
@ -66,11 +66,11 @@ func NewTrigger(th TriggerAPI) *Trigger {
|
||||
return th.Read(r.Context(), params)
|
||||
})
|
||||
},
|
||||
Edit: func(w http.ResponseWriter, r *http.Request) {
|
||||
Update: func(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
params := request.NewTriggerEdit()
|
||||
params := request.NewTriggerUpdate()
|
||||
resputil.JSON(w, params.Fill(r), func() (interface{}, error) {
|
||||
return th.Edit(r.Context(), params)
|
||||
return th.Update(r.Context(), params)
|
||||
})
|
||||
},
|
||||
Delete: func(w http.ResponseWriter, r *http.Request) {
|
||||
@ -90,7 +90,7 @@ func (th *Trigger) MountRoutes(r chi.Router, middlewares ...func(http.Handler) h
|
||||
r.Get("/", th.List)
|
||||
r.Post("/", th.Create)
|
||||
r.Get("/{triggerID}", th.Read)
|
||||
r.Post("/{triggerID}", th.Edit)
|
||||
r.Post("/{triggerID}", th.Update)
|
||||
r.Delete("/{triggerID}", th.Delete)
|
||||
})
|
||||
})
|
||||
|
||||
@ -45,7 +45,7 @@ func (s *Module) Create(ctx context.Context, r *request.ModuleCreate) (interface
|
||||
return s.module.With(ctx).Create(item)
|
||||
}
|
||||
|
||||
func (s *Module) Edit(ctx context.Context, r *request.ModuleEdit) (interface{}, error) {
|
||||
func (s *Module) Update(ctx context.Context, r *request.ModuleUpdate) (interface{}, error) {
|
||||
item := &types.Module{
|
||||
ID: r.ModuleID,
|
||||
Name: r.Name,
|
||||
@ -71,7 +71,7 @@ func (s *Module) RecordCreate(ctx context.Context, r *request.ModuleRecordCreate
|
||||
return s.record.With(ctx).Create(&types.Record{ModuleID: r.ModuleID, Values: r.Values})
|
||||
}
|
||||
|
||||
func (s *Module) RecordEdit(ctx context.Context, r *request.ModuleRecordEdit) (interface{}, error) {
|
||||
func (s *Module) RecordUpdate(ctx context.Context, r *request.ModuleRecordUpdate) (interface{}, error) {
|
||||
return s.record.With(ctx).Update(&types.Record{
|
||||
ID: r.RecordID,
|
||||
ModuleID: r.ModuleID,
|
||||
|
||||
@ -51,7 +51,7 @@ func (ctrl *Page) Reorder(ctx context.Context, r *request.PageReorder) (interfac
|
||||
return resputil.OK(), ctrl.page.With(ctx).Reorder(r.SelfID, payload.ParseUInt64s(r.PageIDs))
|
||||
}
|
||||
|
||||
func (ctrl *Page) Edit(ctx context.Context, r *request.PageEdit) (interface{}, error) {
|
||||
func (ctrl *Page) Update(ctx context.Context, r *request.PageUpdate) (interface{}, error) {
|
||||
p := &types.Page{
|
||||
ID: r.PageID,
|
||||
SelfID: r.SelfID,
|
||||
|
||||
@ -167,18 +167,18 @@ func (c *ChartRead) Fill(r *http.Request) (err error) {
|
||||
|
||||
var _ RequestFiller = NewChartRead()
|
||||
|
||||
// Chart edit request parameters
|
||||
type ChartEdit struct {
|
||||
// Chart update request parameters
|
||||
type ChartUpdate struct {
|
||||
ChartID uint64 `json:",string"`
|
||||
Config sqlxTypes.JSONText
|
||||
Name string
|
||||
}
|
||||
|
||||
func NewChartEdit() *ChartEdit {
|
||||
return &ChartEdit{}
|
||||
func NewChartUpdate() *ChartUpdate {
|
||||
return &ChartUpdate{}
|
||||
}
|
||||
|
||||
func (c *ChartEdit) Fill(r *http.Request) (err error) {
|
||||
func (c *ChartUpdate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
|
||||
@ -220,7 +220,7 @@ func (c *ChartEdit) Fill(r *http.Request) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
var _ RequestFiller = NewChartEdit()
|
||||
var _ RequestFiller = NewChartUpdate()
|
||||
|
||||
// Chart delete request parameters
|
||||
type ChartDelete struct {
|
||||
|
||||
@ -175,19 +175,19 @@ func (m *ModuleRead) Fill(r *http.Request) (err error) {
|
||||
|
||||
var _ RequestFiller = NewModuleRead()
|
||||
|
||||
// Module edit request parameters
|
||||
type ModuleEdit struct {
|
||||
// Module update request parameters
|
||||
type ModuleUpdate struct {
|
||||
ModuleID uint64 `json:",string"`
|
||||
Name string
|
||||
Fields types.ModuleFieldSet
|
||||
Meta sqlxTypes.JSONText
|
||||
}
|
||||
|
||||
func NewModuleEdit() *ModuleEdit {
|
||||
return &ModuleEdit{}
|
||||
func NewModuleUpdate() *ModuleUpdate {
|
||||
return &ModuleUpdate{}
|
||||
}
|
||||
|
||||
func (m *ModuleEdit) Fill(r *http.Request) (err error) {
|
||||
func (m *ModuleUpdate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
|
||||
@ -229,7 +229,7 @@ func (m *ModuleEdit) Fill(r *http.Request) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
var _ RequestFiller = NewModuleEdit()
|
||||
var _ RequestFiller = NewModuleUpdate()
|
||||
|
||||
// Module delete request parameters
|
||||
type ModuleDelete struct {
|
||||
@ -484,18 +484,18 @@ func (m *ModuleRecordRead) Fill(r *http.Request) (err error) {
|
||||
|
||||
var _ RequestFiller = NewModuleRecordRead()
|
||||
|
||||
// Module record/edit request parameters
|
||||
type ModuleRecordEdit struct {
|
||||
// Module record/update request parameters
|
||||
type ModuleRecordUpdate struct {
|
||||
ModuleID uint64 `json:",string"`
|
||||
RecordID uint64 `json:",string"`
|
||||
Values types.RecordValueSet
|
||||
}
|
||||
|
||||
func NewModuleRecordEdit() *ModuleRecordEdit {
|
||||
return &ModuleRecordEdit{}
|
||||
func NewModuleRecordUpdate() *ModuleRecordUpdate {
|
||||
return &ModuleRecordUpdate{}
|
||||
}
|
||||
|
||||
func (m *ModuleRecordEdit) Fill(r *http.Request) (err error) {
|
||||
func (m *ModuleRecordUpdate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
|
||||
@ -528,7 +528,7 @@ func (m *ModuleRecordEdit) Fill(r *http.Request) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
var _ RequestFiller = NewModuleRecordEdit()
|
||||
var _ RequestFiller = NewModuleRecordUpdate()
|
||||
|
||||
// Module record/delete request parameters
|
||||
type ModuleRecordDelete struct {
|
||||
|
||||
@ -233,8 +233,8 @@ func (p *PageTree) Fill(r *http.Request) (err error) {
|
||||
|
||||
var _ RequestFiller = NewPageTree()
|
||||
|
||||
// Page edit request parameters
|
||||
type PageEdit struct {
|
||||
// Page update request parameters
|
||||
type PageUpdate struct {
|
||||
PageID uint64 `json:",string"`
|
||||
SelfID uint64 `json:",string"`
|
||||
ModuleID uint64 `json:",string"`
|
||||
@ -244,11 +244,11 @@ type PageEdit struct {
|
||||
Blocks sqlxTypes.JSONText
|
||||
}
|
||||
|
||||
func NewPageEdit() *PageEdit {
|
||||
return &PageEdit{}
|
||||
func NewPageUpdate() *PageUpdate {
|
||||
return &PageUpdate{}
|
||||
}
|
||||
|
||||
func (p *PageEdit) Fill(r *http.Request) (err error) {
|
||||
func (p *PageUpdate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(p)
|
||||
|
||||
@ -306,7 +306,7 @@ func (p *PageEdit) Fill(r *http.Request) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
var _ RequestFiller = NewPageEdit()
|
||||
var _ RequestFiller = NewPageUpdate()
|
||||
|
||||
// Page reorder request parameters
|
||||
type PageReorder struct {
|
||||
|
||||
@ -180,8 +180,8 @@ func (t *TriggerRead) Fill(r *http.Request) (err error) {
|
||||
|
||||
var _ RequestFiller = NewTriggerRead()
|
||||
|
||||
// Trigger edit request parameters
|
||||
type TriggerEdit struct {
|
||||
// Trigger update request parameters
|
||||
type TriggerUpdate struct {
|
||||
TriggerID uint64 `json:",string"`
|
||||
ModuleID uint64 `json:",string"`
|
||||
Name string
|
||||
@ -190,11 +190,11 @@ type TriggerEdit struct {
|
||||
Source string
|
||||
}
|
||||
|
||||
func NewTriggerEdit() *TriggerEdit {
|
||||
return &TriggerEdit{}
|
||||
func NewTriggerUpdate() *TriggerUpdate {
|
||||
return &TriggerUpdate{}
|
||||
}
|
||||
|
||||
func (t *TriggerEdit) Fill(r *http.Request) (err error) {
|
||||
func (t *TriggerUpdate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(t)
|
||||
|
||||
@ -242,7 +242,7 @@ func (t *TriggerEdit) Fill(r *http.Request) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
var _ RequestFiller = NewTriggerEdit()
|
||||
var _ RequestFiller = NewTriggerUpdate()
|
||||
|
||||
// Trigger delete request parameters
|
||||
type TriggerDelete struct {
|
||||
|
||||
@ -53,7 +53,7 @@ func (ctrl *Trigger) Read(ctx context.Context, r *request.TriggerRead) (interfac
|
||||
return ctrl.trigger.With(ctx).FindByID(r.TriggerID)
|
||||
}
|
||||
|
||||
func (ctrl *Trigger) Edit(ctx context.Context, r *request.TriggerEdit) (interface{}, error) {
|
||||
func (ctrl *Trigger) Update(ctx context.Context, r *request.TriggerUpdate) (interface{}, error) {
|
||||
if trigger, err := ctrl.trigger.FindByID(r.TriggerID); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
|
||||
@ -123,7 +123,7 @@ CRM module definitions
|
||||
| --------- | ---- | ------ | ----------- | ------- | --------- |
|
||||
| moduleID | uint64 | PATH | Module ID | N/A | YES |
|
||||
|
||||
## Edit module
|
||||
## Update module
|
||||
|
||||
#### Method
|
||||
|
||||
@ -219,7 +219,7 @@ CRM module definitions
|
||||
| moduleID | uint64 | PATH | Module ID | N/A | YES |
|
||||
| recordID | uint64 | PATH | Record ID | N/A | YES |
|
||||
|
||||
## Add/update records in module section
|
||||
## Update records in module section
|
||||
|
||||
#### Method
|
||||
|
||||
@ -342,7 +342,7 @@ CRM module pages
|
||||
| Parameter | Type | Method | Description | Default | Required? |
|
||||
| --------- | ---- | ------ | ----------- | ------- | --------- |
|
||||
|
||||
## Edit page
|
||||
## Update page
|
||||
|
||||
#### Method
|
||||
|
||||
@ -444,7 +444,7 @@ CRM Triggers
|
||||
| --------- | ---- | ------ | ----------- | ------- | --------- |
|
||||
| triggerID | uint64 | PATH | Trigger ID | N/A | YES |
|
||||
|
||||
## Edit trigger
|
||||
## Update trigger
|
||||
|
||||
#### Method
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user