From cfd95a6682db606f0ebea3bd08e5f232b49e191a Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Tue, 14 Sep 2021 20:42:52 +0200 Subject: [PATCH] Rename resource translation routes --- compose/rest.yaml | 48 +++++++++++++++--------------- compose/rest/handlers/module.go | 36 +++++++++++----------- compose/rest/handlers/namespace.go | 38 +++++++++++------------ compose/rest/handlers/page.go | 42 +++++++++++++------------- compose/rest/module.go | 6 ++-- compose/rest/namespace.go | 6 ++-- compose/rest/page.go | 6 ++-- compose/rest/request/module.go | 48 +++++++++++++++--------------- compose/rest/request/namespace.go | 44 +++++++++++++-------------- compose/rest/request/page.go | 48 +++++++++++++++--------------- system/rest.yaml | 2 +- system/rest/request/locale.go | 2 +- 12 files changed, 163 insertions(+), 163 deletions(-) diff --git a/compose/rest.yaml b/compose/rest.yaml index 1aa25d258..3e6a80bf4 100644 --- a/compose/rest.yaml +++ b/compose/rest.yaml @@ -149,20 +149,20 @@ endpoints: type: string title: Script to execute required: true - - name: list resource + - name: listTranslations method: GET - title: List resource translations - path: "/{namespaceID}/locale" + title: List translation + path: "/{namespaceID}/translation" parameters: path: - type: uint64 name: namespaceID required: true title: ID - - name: update resource + - name: updateTranslations method: PATCH - title: Update resource translations - path: "/{namespaceID}/locale" + title: Update translation + path: "/{namespaceID}/translation" parameters: path: - type: uint64 @@ -170,9 +170,9 @@ endpoints: required: true title: ID post: - - name: locale + - name: translation type: locale.ResourceTranslationSet - title: Resource translations to upsert + title: Resource translation to upsert required: true - title: Pages @@ -386,20 +386,20 @@ endpoints: title: Script to execute required: true - - name: list resource + - name: listTranslations method: GET - title: List resource translations - path: "/{pageID}/locale" + title: List page translation + path: "/{pageID}/translation" parameters: path: - type: uint64 name: pageID required: true title: ID - - name: update resource + - name: updateTranslations method: PATCH - title: Update resource translations - path: "/{pageID}/locale" + title: Update page translation + path: "/{pageID}/translation" parameters: path: - type: uint64 @@ -407,9 +407,9 @@ endpoints: required: true title: ID post: - - name: locale + - name: translation type: locale.ResourceTranslationSet - title: Resource translations to upsert + title: Resource translation to upsert required: true - title: Modules @@ -557,20 +557,20 @@ endpoints: type: string title: Script to execute required: true - - name: list resource + - name: listTranslations method: GET - title: List resource translations - path: "/{moduleID}/locale" + title: List moudle translation + path: "/{moduleID}/translation" parameters: path: - type: uint64 name: moduleID required: true title: ID - - name: update resource + - name: updateTranslations method: PATCH - title: Update resource translations - path: "/{moduleID}/locale" + title: Update module translation + path: "/{moduleID}/translation" parameters: path: - type: uint64 @@ -578,9 +578,9 @@ endpoints: required: true title: ID post: - - name: locale + - name: translation type: locale.ResourceTranslationSet - title: Resource translations to upsert + title: Resource translation to upsert required: true - title: Records diff --git a/compose/rest/handlers/module.go b/compose/rest/handlers/module.go index 86d499cf7..6c89c582a 100644 --- a/compose/rest/handlers/module.go +++ b/compose/rest/handlers/module.go @@ -25,20 +25,20 @@ type ( Update(context.Context, *request.ModuleUpdate) (interface{}, error) Delete(context.Context, *request.ModuleDelete) (interface{}, error) TriggerScript(context.Context, *request.ModuleTriggerScript) (interface{}, error) - ListLocale(context.Context, *request.ModuleListLocale) (interface{}, error) - UpdateLocale(context.Context, *request.ModuleUpdateLocale) (interface{}, error) + ListTranslations(context.Context, *request.ModuleListTranslations) (interface{}, error) + UpdateTranslations(context.Context, *request.ModuleUpdateTranslations) (interface{}, error) } // HTTP API interface Module struct { - List func(http.ResponseWriter, *http.Request) - Create func(http.ResponseWriter, *http.Request) - Read func(http.ResponseWriter, *http.Request) - Update func(http.ResponseWriter, *http.Request) - Delete func(http.ResponseWriter, *http.Request) - TriggerScript func(http.ResponseWriter, *http.Request) - ListLocale func(http.ResponseWriter, *http.Request) - UpdateLocale func(http.ResponseWriter, *http.Request) + List func(http.ResponseWriter, *http.Request) + Create func(http.ResponseWriter, *http.Request) + Read func(http.ResponseWriter, *http.Request) + Update func(http.ResponseWriter, *http.Request) + Delete func(http.ResponseWriter, *http.Request) + TriggerScript func(http.ResponseWriter, *http.Request) + ListTranslations func(http.ResponseWriter, *http.Request) + UpdateTranslations func(http.ResponseWriter, *http.Request) } ) @@ -140,15 +140,15 @@ func NewModule(h ModuleAPI) *Module { api.Send(w, r, value) }, - ListLocale: func(w http.ResponseWriter, r *http.Request) { + ListTranslations: func(w http.ResponseWriter, r *http.Request) { defer r.Body.Close() - params := request.NewModuleListLocale() + params := request.NewModuleListTranslations() if err := params.Fill(r); err != nil { api.Send(w, r, err) return } - value, err := h.ListLocale(r.Context(), params) + value, err := h.ListTranslations(r.Context(), params) if err != nil { api.Send(w, r, err) return @@ -156,15 +156,15 @@ func NewModule(h ModuleAPI) *Module { api.Send(w, r, value) }, - UpdateLocale: func(w http.ResponseWriter, r *http.Request) { + UpdateTranslations: func(w http.ResponseWriter, r *http.Request) { defer r.Body.Close() - params := request.NewModuleUpdateLocale() + params := request.NewModuleUpdateTranslations() if err := params.Fill(r); err != nil { api.Send(w, r, err) return } - value, err := h.UpdateLocale(r.Context(), params) + value, err := h.UpdateTranslations(r.Context(), params) if err != nil { api.Send(w, r, err) return @@ -184,7 +184,7 @@ func (h Module) MountRoutes(r chi.Router, middlewares ...func(http.Handler) http r.Post("/namespace/{namespaceID}/module/{moduleID}", h.Update) r.Delete("/namespace/{namespaceID}/module/{moduleID}", h.Delete) r.Post("/namespace/{namespaceID}/module/{moduleID}/trigger", h.TriggerScript) - r.Get("/namespace/{namespaceID}/module/{moduleID}/locale", h.ListLocale) - r.Patch("/namespace/{namespaceID}/module/{moduleID}/locale", h.UpdateLocale) + r.Get("/namespace/{namespaceID}/module/{moduleID}/translation", h.ListTranslations) + r.Patch("/namespace/{namespaceID}/module/{moduleID}/translation", h.UpdateTranslations) }) } diff --git a/compose/rest/handlers/namespace.go b/compose/rest/handlers/namespace.go index 4e438d4e5..8b387abfb 100644 --- a/compose/rest/handlers/namespace.go +++ b/compose/rest/handlers/namespace.go @@ -26,21 +26,21 @@ type ( Delete(context.Context, *request.NamespaceDelete) (interface{}, error) Upload(context.Context, *request.NamespaceUpload) (interface{}, error) TriggerScript(context.Context, *request.NamespaceTriggerScript) (interface{}, error) - ListLocale(context.Context, *request.NamespaceListLocale) (interface{}, error) - UpdateLocale(context.Context, *request.NamespaceUpdateLocale) (interface{}, error) + ListTranslations(context.Context, *request.NamespaceListTranslations) (interface{}, error) + UpdateTranslations(context.Context, *request.NamespaceUpdateTranslations) (interface{}, error) } // HTTP API interface Namespace struct { - List func(http.ResponseWriter, *http.Request) - Create func(http.ResponseWriter, *http.Request) - Read func(http.ResponseWriter, *http.Request) - Update func(http.ResponseWriter, *http.Request) - Delete func(http.ResponseWriter, *http.Request) - Upload func(http.ResponseWriter, *http.Request) - TriggerScript func(http.ResponseWriter, *http.Request) - ListLocale func(http.ResponseWriter, *http.Request) - UpdateLocale func(http.ResponseWriter, *http.Request) + List func(http.ResponseWriter, *http.Request) + Create func(http.ResponseWriter, *http.Request) + Read func(http.ResponseWriter, *http.Request) + Update func(http.ResponseWriter, *http.Request) + Delete func(http.ResponseWriter, *http.Request) + Upload func(http.ResponseWriter, *http.Request) + TriggerScript func(http.ResponseWriter, *http.Request) + ListTranslations func(http.ResponseWriter, *http.Request) + UpdateTranslations func(http.ResponseWriter, *http.Request) } ) @@ -158,15 +158,15 @@ func NewNamespace(h NamespaceAPI) *Namespace { api.Send(w, r, value) }, - ListLocale: func(w http.ResponseWriter, r *http.Request) { + ListTranslations: func(w http.ResponseWriter, r *http.Request) { defer r.Body.Close() - params := request.NewNamespaceListLocale() + params := request.NewNamespaceListTranslations() if err := params.Fill(r); err != nil { api.Send(w, r, err) return } - value, err := h.ListLocale(r.Context(), params) + value, err := h.ListTranslations(r.Context(), params) if err != nil { api.Send(w, r, err) return @@ -174,15 +174,15 @@ func NewNamespace(h NamespaceAPI) *Namespace { api.Send(w, r, value) }, - UpdateLocale: func(w http.ResponseWriter, r *http.Request) { + UpdateTranslations: func(w http.ResponseWriter, r *http.Request) { defer r.Body.Close() - params := request.NewNamespaceUpdateLocale() + params := request.NewNamespaceUpdateTranslations() if err := params.Fill(r); err != nil { api.Send(w, r, err) return } - value, err := h.UpdateLocale(r.Context(), params) + value, err := h.UpdateTranslations(r.Context(), params) if err != nil { api.Send(w, r, err) return @@ -203,7 +203,7 @@ func (h Namespace) MountRoutes(r chi.Router, middlewares ...func(http.Handler) h r.Delete("/namespace/{namespaceID}", h.Delete) r.Post("/namespace/upload", h.Upload) r.Post("/namespace/{namespaceID}/trigger", h.TriggerScript) - r.Get("/namespace/{namespaceID}/locale", h.ListLocale) - r.Patch("/namespace/{namespaceID}/locale", h.UpdateLocale) + r.Get("/namespace/{namespaceID}/translation", h.ListTranslations) + r.Patch("/namespace/{namespaceID}/translation", h.UpdateTranslations) }) } diff --git a/compose/rest/handlers/page.go b/compose/rest/handlers/page.go index 73ecacb11..02c0f1c32 100644 --- a/compose/rest/handlers/page.go +++ b/compose/rest/handlers/page.go @@ -28,23 +28,23 @@ type ( Delete(context.Context, *request.PageDelete) (interface{}, error) Upload(context.Context, *request.PageUpload) (interface{}, error) TriggerScript(context.Context, *request.PageTriggerScript) (interface{}, error) - ListLocale(context.Context, *request.PageListLocale) (interface{}, error) - UpdateLocale(context.Context, *request.PageUpdateLocale) (interface{}, error) + ListTranslations(context.Context, *request.PageListTranslations) (interface{}, error) + UpdateTranslations(context.Context, *request.PageUpdateTranslations) (interface{}, error) } // HTTP API interface Page struct { - List func(http.ResponseWriter, *http.Request) - Create func(http.ResponseWriter, *http.Request) - Read func(http.ResponseWriter, *http.Request) - Tree func(http.ResponseWriter, *http.Request) - Update func(http.ResponseWriter, *http.Request) - Reorder func(http.ResponseWriter, *http.Request) - Delete func(http.ResponseWriter, *http.Request) - Upload func(http.ResponseWriter, *http.Request) - TriggerScript func(http.ResponseWriter, *http.Request) - ListLocale func(http.ResponseWriter, *http.Request) - UpdateLocale func(http.ResponseWriter, *http.Request) + List func(http.ResponseWriter, *http.Request) + Create func(http.ResponseWriter, *http.Request) + Read func(http.ResponseWriter, *http.Request) + Tree func(http.ResponseWriter, *http.Request) + Update func(http.ResponseWriter, *http.Request) + Reorder func(http.ResponseWriter, *http.Request) + Delete func(http.ResponseWriter, *http.Request) + Upload func(http.ResponseWriter, *http.Request) + TriggerScript func(http.ResponseWriter, *http.Request) + ListTranslations func(http.ResponseWriter, *http.Request) + UpdateTranslations func(http.ResponseWriter, *http.Request) } ) @@ -194,15 +194,15 @@ func NewPage(h PageAPI) *Page { api.Send(w, r, value) }, - ListLocale: func(w http.ResponseWriter, r *http.Request) { + ListTranslations: func(w http.ResponseWriter, r *http.Request) { defer r.Body.Close() - params := request.NewPageListLocale() + params := request.NewPageListTranslations() if err := params.Fill(r); err != nil { api.Send(w, r, err) return } - value, err := h.ListLocale(r.Context(), params) + value, err := h.ListTranslations(r.Context(), params) if err != nil { api.Send(w, r, err) return @@ -210,15 +210,15 @@ func NewPage(h PageAPI) *Page { api.Send(w, r, value) }, - UpdateLocale: func(w http.ResponseWriter, r *http.Request) { + UpdateTranslations: func(w http.ResponseWriter, r *http.Request) { defer r.Body.Close() - params := request.NewPageUpdateLocale() + params := request.NewPageUpdateTranslations() if err := params.Fill(r); err != nil { api.Send(w, r, err) return } - value, err := h.UpdateLocale(r.Context(), params) + value, err := h.UpdateTranslations(r.Context(), params) if err != nil { api.Send(w, r, err) return @@ -241,7 +241,7 @@ func (h Page) MountRoutes(r chi.Router, middlewares ...func(http.Handler) http.H r.Delete("/namespace/{namespaceID}/page/{pageID}", h.Delete) r.Post("/namespace/{namespaceID}/page/{pageID}/attachment", h.Upload) r.Post("/namespace/{namespaceID}/page/{pageID}/trigger", h.TriggerScript) - r.Get("/namespace/{namespaceID}/page/{pageID}/locale", h.ListLocale) - r.Patch("/namespace/{namespaceID}/page/{pageID}/locale", h.UpdateLocale) + r.Get("/namespace/{namespaceID}/page/{pageID}/translation", h.ListTranslations) + r.Patch("/namespace/{namespaceID}/page/{pageID}/translation", h.UpdateTranslations) }) } diff --git a/compose/rest/module.go b/compose/rest/module.go index a7e548e9d..9c31fcac3 100644 --- a/compose/rest/module.go +++ b/compose/rest/module.go @@ -94,12 +94,12 @@ func (ctrl *Module) Read(ctx context.Context, r *request.ModuleRead) (interface{ return ctrl.makePayload(ctx, mod, err) } -func (ctrl *Module) ListLocale(ctx context.Context, r *request.ModuleListLocale) (interface{}, error) { +func (ctrl *Module) ListTranslations(ctx context.Context, r *request.ModuleListTranslations) (interface{}, error) { return ctrl.locale.Module(ctx, r.NamespaceID, r.ModuleID) } -func (ctrl *Module) UpdateLocale(ctx context.Context, r *request.ModuleUpdateLocale) (interface{}, error) { - return api.OK(), ctrl.locale.Upsert(ctx, r.Locale) +func (ctrl *Module) UpdateTranslations(ctx context.Context, r *request.ModuleUpdateTranslations) (interface{}, error) { + return api.OK(), ctrl.locale.Upsert(ctx, r.Translation) } func (ctrl *Module) Create(ctx context.Context, r *request.ModuleCreate) (interface{}, error) { diff --git a/compose/rest/namespace.go b/compose/rest/namespace.go index 5c7462eea..82d9b6e99 100644 --- a/compose/rest/namespace.go +++ b/compose/rest/namespace.go @@ -105,12 +105,12 @@ func (ctrl Namespace) Read(ctx context.Context, r *request.NamespaceRead) (inter return ctrl.makePayload(ctx, ns, err) } -func (ctrl Namespace) ListLocale(ctx context.Context, r *request.NamespaceListLocale) (interface{}, error) { +func (ctrl Namespace) ListTranslations(ctx context.Context, r *request.NamespaceListTranslations) (interface{}, error) { return ctrl.locale.Namespace(ctx, r.NamespaceID) } -func (ctrl Namespace) UpdateLocale(ctx context.Context, r *request.NamespaceUpdateLocale) (interface{}, error) { - return api.OK(), ctrl.locale.Upsert(ctx, r.Locale) +func (ctrl Namespace) UpdateTranslations(ctx context.Context, r *request.NamespaceUpdateTranslations) (interface{}, error) { + return api.OK(), ctrl.locale.Upsert(ctx, r.Translation) } func (ctrl Namespace) Update(ctx context.Context, r *request.NamespaceUpdate) (interface{}, error) { diff --git a/compose/rest/page.go b/compose/rest/page.go index 08a6e464f..1a17491a3 100644 --- a/compose/rest/page.go +++ b/compose/rest/page.go @@ -129,12 +129,12 @@ func (ctrl *Page) Read(ctx context.Context, r *request.PageRead) (interface{}, e return ctrl.makePayload(ctx, mod, err) } -func (ctrl *Page) ListLocale(ctx context.Context, r *request.PageListLocale) (interface{}, error) { +func (ctrl *Page) ListTranslations(ctx context.Context, r *request.PageListTranslations) (interface{}, error) { return ctrl.locale.Page(ctx, r.NamespaceID, r.PageID) } -func (ctrl *Page) UpdateLocale(ctx context.Context, r *request.PageUpdateLocale) (interface{}, error) { - return api.OK(), ctrl.locale.Upsert(ctx, r.Locale) +func (ctrl *Page) UpdateTranslations(ctx context.Context, r *request.PageUpdateTranslations) (interface{}, error) { + return api.OK(), ctrl.locale.Upsert(ctx, r.Translation) } func (ctrl *Page) Reorder(ctx context.Context, r *request.PageReorder) (interface{}, error) { diff --git a/compose/rest/request/module.go b/compose/rest/request/module.go index cfa313818..8569228e8 100644 --- a/compose/rest/request/module.go +++ b/compose/rest/request/module.go @@ -195,7 +195,7 @@ type ( Script string } - ModuleListLocale struct { + ModuleListTranslations struct { // NamespaceID PATH parameter // // Namespace ID @@ -207,7 +207,7 @@ type ( ModuleID uint64 `json:",string"` } - ModuleUpdateLocale struct { + ModuleUpdateTranslations struct { // NamespaceID PATH parameter // // Namespace ID @@ -218,10 +218,10 @@ type ( // ID ModuleID uint64 `json:",string"` - // Locale POST parameter + // Translation POST parameter // - // ... - Locale locale.ResourceTranslationSet + // Resource translation to upsert + Translation locale.ResourceTranslationSet } ) @@ -801,13 +801,13 @@ func (r *ModuleTriggerScript) Fill(req *http.Request) (err error) { return err } -// NewModuleListLocale request -func NewModuleListLocale() *ModuleListLocale { - return &ModuleListLocale{} +// NewModuleListTranslations request +func NewModuleListTranslations() *ModuleListTranslations { + return &ModuleListTranslations{} } // Auditable returns all auditable/loggable parameters -func (r ModuleListLocale) Auditable() map[string]interface{} { +func (r ModuleListTranslations) Auditable() map[string]interface{} { return map[string]interface{}{ "namespaceID": r.NamespaceID, "moduleID": r.ModuleID, @@ -815,17 +815,17 @@ func (r ModuleListLocale) Auditable() map[string]interface{} { } // Auditable returns all auditable/loggable parameters -func (r ModuleListLocale) GetNamespaceID() uint64 { +func (r ModuleListTranslations) GetNamespaceID() uint64 { return r.NamespaceID } // Auditable returns all auditable/loggable parameters -func (r ModuleListLocale) GetModuleID() uint64 { +func (r ModuleListTranslations) GetModuleID() uint64 { return r.ModuleID } // Fill processes request and fills internal variables -func (r *ModuleListLocale) Fill(req *http.Request) (err error) { +func (r *ModuleListTranslations) Fill(req *http.Request) (err error) { { var val string @@ -848,37 +848,37 @@ func (r *ModuleListLocale) Fill(req *http.Request) (err error) { return err } -// NewModuleUpdateLocale request -func NewModuleUpdateLocale() *ModuleUpdateLocale { - return &ModuleUpdateLocale{} +// NewModuleUpdateTranslations request +func NewModuleUpdateTranslations() *ModuleUpdateTranslations { + return &ModuleUpdateTranslations{} } // Auditable returns all auditable/loggable parameters -func (r ModuleUpdateLocale) Auditable() map[string]interface{} { +func (r ModuleUpdateTranslations) Auditable() map[string]interface{} { return map[string]interface{}{ "namespaceID": r.NamespaceID, "moduleID": r.ModuleID, - "locale": r.Locale, + "translation": r.Translation, } } // Auditable returns all auditable/loggable parameters -func (r ModuleUpdateLocale) GetNamespaceID() uint64 { +func (r ModuleUpdateTranslations) GetNamespaceID() uint64 { return r.NamespaceID } // Auditable returns all auditable/loggable parameters -func (r ModuleUpdateLocale) GetModuleID() uint64 { +func (r ModuleUpdateTranslations) GetModuleID() uint64 { return r.ModuleID } // Auditable returns all auditable/loggable parameters -func (r ModuleUpdateLocale) GetLocale() locale.ResourceTranslationSet { - return r.Locale +func (r ModuleUpdateTranslations) GetTranslation() locale.ResourceTranslationSet { + return r.Translation } // Fill processes request and fills internal variables -func (r *ModuleUpdateLocale) Fill(req *http.Request) (err error) { +func (r *ModuleUpdateTranslations) Fill(req *http.Request) (err error) { if strings.ToLower(req.Header.Get("content-type")) == "application/json" { err = json.NewDecoder(req.Body).Decode(r) @@ -898,8 +898,8 @@ func (r *ModuleUpdateLocale) Fill(req *http.Request) (err error) { // POST params - //if val, ok := req.Form["locale[]"]; ok && len(val) > 0 { - // r.Locale, err = locale.ResourceTranslationSet(val), nil + //if val, ok := req.Form["translation[]"]; ok && len(val) > 0 { + // r.Translation, err = locale.ResourceTranslationSet(val), nil // if err != nil { // return err // } diff --git a/compose/rest/request/namespace.go b/compose/rest/request/namespace.go index a5e059c93..d33a0479b 100644 --- a/compose/rest/request/namespace.go +++ b/compose/rest/request/namespace.go @@ -166,23 +166,23 @@ type ( Script string } - NamespaceListLocale struct { + NamespaceListTranslations struct { // NamespaceID PATH parameter // // ID NamespaceID uint64 `json:",string"` } - NamespaceUpdateLocale struct { + NamespaceUpdateTranslations struct { // NamespaceID PATH parameter // // ID NamespaceID uint64 `json:",string"` - // Locale POST parameter + // Translation POST parameter // - // ... - Locale locale.ResourceTranslationSet + // Resource translation to upsert + Translation locale.ResourceTranslationSet } ) @@ -713,25 +713,25 @@ func (r *NamespaceTriggerScript) Fill(req *http.Request) (err error) { return err } -// NewNamespaceListLocale request -func NewNamespaceListLocale() *NamespaceListLocale { - return &NamespaceListLocale{} +// NewNamespaceListTranslations request +func NewNamespaceListTranslations() *NamespaceListTranslations { + return &NamespaceListTranslations{} } // Auditable returns all auditable/loggable parameters -func (r NamespaceListLocale) Auditable() map[string]interface{} { +func (r NamespaceListTranslations) Auditable() map[string]interface{} { return map[string]interface{}{ "namespaceID": r.NamespaceID, } } // Auditable returns all auditable/loggable parameters -func (r NamespaceListLocale) GetNamespaceID() uint64 { +func (r NamespaceListTranslations) GetNamespaceID() uint64 { return r.NamespaceID } // Fill processes request and fills internal variables -func (r *NamespaceListLocale) Fill(req *http.Request) (err error) { +func (r *NamespaceListTranslations) Fill(req *http.Request) (err error) { { var val string @@ -748,31 +748,31 @@ func (r *NamespaceListLocale) Fill(req *http.Request) (err error) { return err } -// NewNamespaceUpdateLocale request -func NewNamespaceUpdateLocale() *NamespaceUpdateLocale { - return &NamespaceUpdateLocale{} +// NewNamespaceUpdateTranslations request +func NewNamespaceUpdateTranslations() *NamespaceUpdateTranslations { + return &NamespaceUpdateTranslations{} } // Auditable returns all auditable/loggable parameters -func (r NamespaceUpdateLocale) Auditable() map[string]interface{} { +func (r NamespaceUpdateTranslations) Auditable() map[string]interface{} { return map[string]interface{}{ "namespaceID": r.NamespaceID, - "locale": r.Locale, + "translation": r.Translation, } } // Auditable returns all auditable/loggable parameters -func (r NamespaceUpdateLocale) GetNamespaceID() uint64 { +func (r NamespaceUpdateTranslations) GetNamespaceID() uint64 { return r.NamespaceID } // Auditable returns all auditable/loggable parameters -func (r NamespaceUpdateLocale) GetLocale() locale.ResourceTranslationSet { - return r.Locale +func (r NamespaceUpdateTranslations) GetTranslation() locale.ResourceTranslationSet { + return r.Translation } // Fill processes request and fills internal variables -func (r *NamespaceUpdateLocale) Fill(req *http.Request) (err error) { +func (r *NamespaceUpdateTranslations) Fill(req *http.Request) (err error) { if strings.ToLower(req.Header.Get("content-type")) == "application/json" { err = json.NewDecoder(req.Body).Decode(r) @@ -792,8 +792,8 @@ func (r *NamespaceUpdateLocale) Fill(req *http.Request) (err error) { // POST params - //if val, ok := req.Form["locale[]"]; ok && len(val) > 0 { - // r.Locale, err = locale.ResourceTranslationSet(val), nil + //if val, ok := req.Form["translation[]"]; ok && len(val) > 0 { + // r.Translation, err = locale.ResourceTranslationSet(val), nil // if err != nil { // return err // } diff --git a/compose/rest/request/page.go b/compose/rest/request/page.go index d817dabfd..37b1a9877 100644 --- a/compose/rest/request/page.go +++ b/compose/rest/request/page.go @@ -274,7 +274,7 @@ type ( Script string } - PageListLocale struct { + PageListTranslations struct { // NamespaceID PATH parameter // // Namespace ID @@ -286,7 +286,7 @@ type ( PageID uint64 `json:",string"` } - PageUpdateLocale struct { + PageUpdateTranslations struct { // NamespaceID PATH parameter // // Namespace ID @@ -297,10 +297,10 @@ type ( // ID PageID uint64 `json:",string"` - // Locale POST parameter + // Translation POST parameter // - // ... - Locale locale.ResourceTranslationSet + // Resource translation to upsert + Translation locale.ResourceTranslationSet } ) @@ -1174,13 +1174,13 @@ func (r *PageTriggerScript) Fill(req *http.Request) (err error) { return err } -// NewPageListLocale request -func NewPageListLocale() *PageListLocale { - return &PageListLocale{} +// NewPageListTranslations request +func NewPageListTranslations() *PageListTranslations { + return &PageListTranslations{} } // Auditable returns all auditable/loggable parameters -func (r PageListLocale) Auditable() map[string]interface{} { +func (r PageListTranslations) Auditable() map[string]interface{} { return map[string]interface{}{ "namespaceID": r.NamespaceID, "pageID": r.PageID, @@ -1188,17 +1188,17 @@ func (r PageListLocale) Auditable() map[string]interface{} { } // Auditable returns all auditable/loggable parameters -func (r PageListLocale) GetNamespaceID() uint64 { +func (r PageListTranslations) GetNamespaceID() uint64 { return r.NamespaceID } // Auditable returns all auditable/loggable parameters -func (r PageListLocale) GetPageID() uint64 { +func (r PageListTranslations) GetPageID() uint64 { return r.PageID } // Fill processes request and fills internal variables -func (r *PageListLocale) Fill(req *http.Request) (err error) { +func (r *PageListTranslations) Fill(req *http.Request) (err error) { { var val string @@ -1221,37 +1221,37 @@ func (r *PageListLocale) Fill(req *http.Request) (err error) { return err } -// NewPageUpdateLocale request -func NewPageUpdateLocale() *PageUpdateLocale { - return &PageUpdateLocale{} +// NewPageUpdateTranslations request +func NewPageUpdateTranslations() *PageUpdateTranslations { + return &PageUpdateTranslations{} } // Auditable returns all auditable/loggable parameters -func (r PageUpdateLocale) Auditable() map[string]interface{} { +func (r PageUpdateTranslations) Auditable() map[string]interface{} { return map[string]interface{}{ "namespaceID": r.NamespaceID, "pageID": r.PageID, - "locale": r.Locale, + "translation": r.Translation, } } // Auditable returns all auditable/loggable parameters -func (r PageUpdateLocale) GetNamespaceID() uint64 { +func (r PageUpdateTranslations) GetNamespaceID() uint64 { return r.NamespaceID } // Auditable returns all auditable/loggable parameters -func (r PageUpdateLocale) GetPageID() uint64 { +func (r PageUpdateTranslations) GetPageID() uint64 { return r.PageID } // Auditable returns all auditable/loggable parameters -func (r PageUpdateLocale) GetLocale() locale.ResourceTranslationSet { - return r.Locale +func (r PageUpdateTranslations) GetTranslation() locale.ResourceTranslationSet { + return r.Translation } // Fill processes request and fills internal variables -func (r *PageUpdateLocale) Fill(req *http.Request) (err error) { +func (r *PageUpdateTranslations) Fill(req *http.Request) (err error) { if strings.ToLower(req.Header.Get("content-type")) == "application/json" { err = json.NewDecoder(req.Body).Decode(r) @@ -1271,8 +1271,8 @@ func (r *PageUpdateLocale) Fill(req *http.Request) (err error) { // POST params - //if val, ok := req.Form["locale[]"]; ok && len(val) > 0 { - // r.Locale, err = locale.ResourceTranslationSet(val), nil + //if val, ok := req.Form["translation[]"]; ok && len(val) > 0 { + // r.Translation, err = locale.ResourceTranslationSet(val), nil // if err != nil { // return err // } diff --git a/system/rest.yaml b/system/rest.yaml index 6e8a94bba..75cb1547b 100644 --- a/system/rest.yaml +++ b/system/rest.yaml @@ -1780,7 +1780,7 @@ endpoints: - { name: resource, type: string, title: Resource } - { name: resourceType, type: string, title: Resource type } - { name: ownerID, type: uint64, title: OwnerID } - - { name: deleted, type: "uint64", title: "Exclude (0, default), include (1) or return only (2) deleted routes" } + - { name: deleted, type: "uint64", title: "Exclude (0, default), include (1) or return only (2) deleted resource translations" } - { name: limit, type: "uint", title: "Limit" } - { name: pageCursor, type: "string", title: "Page cursor" } - { name: sort, type: "string", title: "Sort items" } diff --git a/system/rest/request/locale.go b/system/rest/request/locale.go index 6688cd3ae..73073b82a 100644 --- a/system/rest/request/locale.go +++ b/system/rest/request/locale.go @@ -56,7 +56,7 @@ type ( // Deleted GET parameter // - // Exclude (0, default), include (1) or return only (2) deleted routes + // Exclude (0, default), include (1) or return only (2) deleted resource translations Deleted uint64 `json:",string"` // Limit GET parameter