upd(crm): renamed generic 'id' fields to 'objID'

This commit is contained in:
Tit Petric
2018-11-06 13:19:04 +01:00
parent b678bff3c1
commit e8537a0dd2
11 changed files with 66 additions and 66 deletions
+10 -10
View File
@@ -27,7 +27,7 @@ CRM input field definitions
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| id | string | PATH | Type ID | N/A | YES |
| typeID | string | PATH | Type ID | N/A | YES |
@@ -77,7 +77,7 @@ CRM module definitions
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| id | uint64 | PATH | Module ID | N/A | YES |
| moduleID | uint64 | PATH | Module ID | N/A | YES |
## Edit module
@@ -91,7 +91,7 @@ CRM module definitions
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| id | uint64 | PATH | Module ID | N/A | YES |
| moduleID | uint64 | PATH | Module ID | N/A | YES |
| name | string | POST | Module Name | N/A | YES |
| fields | types.JSONText | POST | Fields JSON | N/A | YES |
@@ -107,7 +107,7 @@ CRM module definitions
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| id | uint64 | PATH | Module ID | N/A | YES |
| moduleID | uint64 | PATH | Module ID | N/A | YES |
## List/read contents from module section
@@ -153,7 +153,7 @@ CRM module definitions
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| moduleID | uint64 | PATH | Module ID | N/A | YES |
| id | uint64 | PATH | Content ID | N/A | YES |
| contentID | uint64 | PATH | Content ID | N/A | YES |
## Add/update contents in module section
@@ -168,7 +168,7 @@ CRM module definitions
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| moduleID | uint64 | PATH | Module ID | N/A | YES |
| id | uint64 | PATH | Content ID | N/A | YES |
| contentID | uint64 | PATH | Content ID | N/A | YES |
| fields | types.JSONText | POST | Content JSON | N/A | YES |
## Delete content row from module section
@@ -184,7 +184,7 @@ CRM module definitions
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| moduleID | uint64 | PATH | Module ID | N/A | YES |
| id | uint64 | PATH | Content ID | N/A | YES |
| contentID | uint64 | PATH | Content ID | N/A | YES |
@@ -238,7 +238,7 @@ CRM module pages
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| id | uint64 | PATH | Page ID | N/A | YES |
| pageID | uint64 | PATH | Page ID | N/A | YES |
## Create page
@@ -252,7 +252,7 @@ CRM module pages
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| id | uint64 | PATH | Page ID | N/A | YES |
| pageID | uint64 | PATH | Page ID | N/A | YES |
| selfID | uint64 | POST | Parent Page ID | N/A | NO |
| moduleID | uint64 | POST | Module ID (optional) | N/A | NO |
| title | string | POST | Title | N/A | YES |
@@ -287,4 +287,4 @@ CRM module pages
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| id | uint64 | PATH | Page ID | N/A | YES |
| pageID | uint64 | PATH | Page ID | N/A | YES |
+10 -10
View File
@@ -45,7 +45,7 @@
"path": [
{
"type": "string",
"name": "id",
"name": "typeID",
"required": true,
"title": "Type ID"
}
@@ -134,7 +134,7 @@
"path": [
{
"type": "uint64",
"name": "id",
"name": "pageID",
"required": true,
"title": "Page ID"
}
@@ -150,7 +150,7 @@
"path": [
{
"type": "uint64",
"name": "id",
"name": "pageID",
"required": true,
"title": "Page ID"
}
@@ -228,7 +228,7 @@
"path": [
{
"type": "uint64",
"name": "id",
"name": "pageID",
"required": true,
"title": "Page ID"
}
@@ -362,7 +362,7 @@
"path": [
{
"type": "uint64",
"name": "id",
"name": "moduleID",
"required": true,
"title": "Module ID"
}
@@ -378,7 +378,7 @@
"path": [
{
"type": "uint64",
"name": "id",
"name": "moduleID",
"required": true,
"title": "Module ID"
}
@@ -408,7 +408,7 @@
"path": [
{
"type": "uint64",
"name": "id",
"name": "moduleID",
"required": true,
"title": "Module ID"
}
@@ -484,7 +484,7 @@
},
{
"type": "uint64",
"name": "id",
"name": "contentID",
"required": true,
"title": "Content ID"
}
@@ -506,7 +506,7 @@
},
{
"type": "uint64",
"name": "id",
"name": "contentID",
"required": true,
"title": "Content ID"
}
@@ -536,7 +536,7 @@
},
{
"type": "uint64",
"name": "id",
"name": "contentID",
"required": true,
"title": "Content ID"
}
+1 -1
View File
@@ -46,7 +46,7 @@
"Parameters": {
"path": [
{
"name": "id",
"name": "typeID",
"required": true,
"title": "Type ID",
"type": "string"
+6 -6
View File
@@ -124,7 +124,7 @@
"Parameters": {
"path": [
{
"name": "id",
"name": "moduleID",
"required": true,
"title": "Module ID",
"type": "uint64"
@@ -140,7 +140,7 @@
"Parameters": {
"path": [
{
"name": "id",
"name": "moduleID",
"required": true,
"title": "Module ID",
"type": "uint64"
@@ -170,7 +170,7 @@
"Parameters": {
"path": [
{
"name": "id",
"name": "moduleID",
"required": true,
"title": "Module ID",
"type": "uint64"
@@ -246,7 +246,7 @@
"type": "uint64"
},
{
"name": "id",
"name": "contentID",
"required": true,
"title": "Content ID",
"type": "uint64"
@@ -268,7 +268,7 @@
"type": "uint64"
},
{
"name": "id",
"name": "contentID",
"required": true,
"title": "Content ID",
"type": "uint64"
@@ -298,7 +298,7 @@
"type": "uint64"
},
{
"name": "id",
"name": "contentID",
"required": true,
"title": "Content ID",
"type": "uint64"
+3 -3
View File
@@ -79,7 +79,7 @@
"Parameters": {
"path": [
{
"name": "id",
"name": "pageID",
"required": true,
"title": "Page ID",
"type": "uint64"
@@ -95,7 +95,7 @@
"Parameters": {
"path": [
{
"name": "id",
"name": "pageID",
"required": true,
"title": "Page ID",
"type": "uint64"
@@ -173,7 +173,7 @@
"Parameters": {
"path": [
{
"name": "id",
"name": "pageID",
"required": true,
"title": "Page ID",
"type": "uint64"
+1 -1
View File
@@ -28,5 +28,5 @@ func (s *Field) List(ctx context.Context, _ *request.FieldList) (interface{}, er
}
func (s *Field) Type(ctx context.Context, r *request.FieldType) (interface{}, error) {
return s.field.With(ctx).FindByType(r.ID)
return s.field.With(ctx).FindByType(r.TypeID)
}
+6 -6
View File
@@ -26,11 +26,11 @@ func (s *Module) List(ctx context.Context, r *request.ModuleList) (interface{},
}
func (s *Module) Read(ctx context.Context, r *request.ModuleRead) (interface{}, error) {
return s.module.With(ctx).FindByID(r.ID)
return s.module.With(ctx).FindByID(r.ModuleID)
}
func (s *Module) Delete(ctx context.Context, r *request.ModuleDelete) (interface{}, error) {
return resputil.OK(), s.module.With(ctx).DeleteByID(r.ID)
return resputil.OK(), s.module.With(ctx).DeleteByID(r.ModuleID)
}
func (s *Module) Create(ctx context.Context, r *request.ModuleCreate) (interface{}, error) {
@@ -43,7 +43,7 @@ func (s *Module) Create(ctx context.Context, r *request.ModuleCreate) (interface
func (s *Module) Edit(ctx context.Context, r *request.ModuleEdit) (interface{}, error) {
item := &types.Module{
ID: r.ID,
ID: r.ModuleID,
Name: r.Name,
Fields: r.Fields,
}
@@ -55,7 +55,7 @@ func (s *Module) ContentList(ctx context.Context, r *request.ModuleContentList)
}
func (s *Module) ContentRead(ctx context.Context, r *request.ModuleContentRead) (interface{}, error) {
return s.content.With(ctx).FindByID(r.ID)
return s.content.With(ctx).FindByID(r.ContentID)
}
func (s *Module) ContentCreate(ctx context.Context, r *request.ModuleContentCreate) (interface{}, error) {
@@ -68,7 +68,7 @@ func (s *Module) ContentCreate(ctx context.Context, r *request.ModuleContentCrea
func (s *Module) ContentEdit(ctx context.Context, r *request.ModuleContentEdit) (interface{}, error) {
item := &types.Content{
ID: r.ID,
ID: r.ContentID,
ModuleID: r.ModuleID,
Fields: r.Fields,
}
@@ -76,5 +76,5 @@ func (s *Module) ContentEdit(ctx context.Context, r *request.ModuleContentEdit)
}
func (s *Module) ContentDelete(ctx context.Context, r *request.ModuleContentDelete) (interface{}, error) {
return resputil.OK(), s.content.With(ctx).DeleteByID(r.ID)
return resputil.OK(), s.content.With(ctx).DeleteByID(r.ContentID)
}
+3 -3
View File
@@ -37,7 +37,7 @@ func (ctrl *Page) Create(ctx context.Context, r *request.PageCreate) (interface{
}
func (ctrl *Page) Read(ctx context.Context, r *request.PageRead) (interface{}, error) {
return ctrl.page.With(ctx).FindByID(r.ID)
return ctrl.page.With(ctx).FindByID(r.PageID)
}
func (ctrl *Page) Reorder(ctx context.Context, r *request.PageReorder) (interface{}, error) {
@@ -46,7 +46,7 @@ func (ctrl *Page) Reorder(ctx context.Context, r *request.PageReorder) (interfac
func (ctrl *Page) Edit(ctx context.Context, r *request.PageEdit) (interface{}, error) {
p := &types.Page{
ID: r.ID,
ID: r.PageID,
SelfID: r.SelfID,
ModuleID: r.ModuleID,
Title: r.Title,
@@ -58,5 +58,5 @@ func (ctrl *Page) Edit(ctx context.Context, r *request.PageEdit) (interface{}, e
}
func (ctrl *Page) Delete(ctx context.Context, r *request.PageDelete) (interface{}, error) {
return resputil.OK(), ctrl.page.With(ctx).DeleteByID(r.ID)
return resputil.OK(), ctrl.page.With(ctx).DeleteByID(r.PageID)
}
+2 -2
View File
@@ -72,7 +72,7 @@ var _ RequestFiller = NewFieldList()
// Field type request parameters
type FieldType struct {
ID string
TypeID string
}
func NewFieldType() *FieldType {
@@ -106,7 +106,7 @@ func (f *FieldType) Fill(r *http.Request) (err error) {
post[name] = string(param[0])
}
f.ID = chi.URLParam(r, "id")
f.TypeID = chi.URLParam(r, "typeID")
return err
}
+18 -18
View File
@@ -131,7 +131,7 @@ var _ RequestFiller = NewModuleCreate()
// Module read request parameters
type ModuleRead struct {
ID uint64 `json:",string"`
ModuleID uint64 `json:",string"`
}
func NewModuleRead() *ModuleRead {
@@ -165,7 +165,7 @@ func (m *ModuleRead) Fill(r *http.Request) (err error) {
post[name] = string(param[0])
}
m.ID = parseUInt64(chi.URLParam(r, "id"))
m.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
return err
}
@@ -174,9 +174,9 @@ var _ RequestFiller = NewModuleRead()
// Module edit request parameters
type ModuleEdit struct {
ID uint64 `json:",string"`
Name string
Fields types.JSONText
ModuleID uint64 `json:",string"`
Name string
Fields types.JSONText
}
func NewModuleEdit() *ModuleEdit {
@@ -210,7 +210,7 @@ func (m *ModuleEdit) Fill(r *http.Request) (err error) {
post[name] = string(param[0])
}
m.ID = parseUInt64(chi.URLParam(r, "id"))
m.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
if val, ok := post["name"]; ok {
m.Name = val
@@ -229,7 +229,7 @@ var _ RequestFiller = NewModuleEdit()
// Module delete request parameters
type ModuleDelete struct {
ID uint64 `json:",string"`
ModuleID uint64 `json:",string"`
}
func NewModuleDelete() *ModuleDelete {
@@ -263,7 +263,7 @@ func (m *ModuleDelete) Fill(r *http.Request) (err error) {
post[name] = string(param[0])
}
m.ID = parseUInt64(chi.URLParam(r, "id"))
m.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
return err
}
@@ -375,8 +375,8 @@ var _ RequestFiller = NewModuleContentCreate()
// Module content/read request parameters
type ModuleContentRead struct {
ModuleID uint64 `json:",string"`
ID uint64 `json:",string"`
ModuleID uint64 `json:",string"`
ContentID uint64 `json:",string"`
}
func NewModuleContentRead() *ModuleContentRead {
@@ -411,7 +411,7 @@ func (m *ModuleContentRead) Fill(r *http.Request) (err error) {
}
m.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
m.ID = parseUInt64(chi.URLParam(r, "id"))
m.ContentID = parseUInt64(chi.URLParam(r, "contentID"))
return err
}
@@ -420,9 +420,9 @@ var _ RequestFiller = NewModuleContentRead()
// Module content/edit request parameters
type ModuleContentEdit struct {
ModuleID uint64 `json:",string"`
ID uint64 `json:",string"`
Fields types.JSONText
ModuleID uint64 `json:",string"`
ContentID uint64 `json:",string"`
Fields types.JSONText
}
func NewModuleContentEdit() *ModuleContentEdit {
@@ -457,7 +457,7 @@ func (m *ModuleContentEdit) Fill(r *http.Request) (err error) {
}
m.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
m.ID = parseUInt64(chi.URLParam(r, "id"))
m.ContentID = parseUInt64(chi.URLParam(r, "contentID"))
if val, ok := post["fields"]; ok {
if m.Fields, err = parseJSONText(val); err != nil {
@@ -472,8 +472,8 @@ var _ RequestFiller = NewModuleContentEdit()
// Module content/delete request parameters
type ModuleContentDelete struct {
ModuleID uint64 `json:",string"`
ID uint64 `json:",string"`
ModuleID uint64 `json:",string"`
ContentID uint64 `json:",string"`
}
func NewModuleContentDelete() *ModuleContentDelete {
@@ -508,7 +508,7 @@ func (m *ModuleContentDelete) Fill(r *http.Request) (err error) {
}
m.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
m.ID = parseUInt64(chi.URLParam(r, "id"))
m.ContentID = parseUInt64(chi.URLParam(r, "contentID"))
return err
}
+6 -6
View File
@@ -151,7 +151,7 @@ var _ RequestFiller = NewPageCreate()
// Page read request parameters
type PageRead struct {
ID uint64 `json:",string"`
PageID uint64 `json:",string"`
}
func NewPageRead() *PageRead {
@@ -185,7 +185,7 @@ func (p *PageRead) Fill(r *http.Request) (err error) {
post[name] = string(param[0])
}
p.ID = parseUInt64(chi.URLParam(r, "id"))
p.PageID = parseUInt64(chi.URLParam(r, "pageID"))
return err
}
@@ -194,7 +194,7 @@ var _ RequestFiller = NewPageRead()
// Page edit request parameters
type PageEdit struct {
ID uint64 `json:",string"`
PageID uint64 `json:",string"`
SelfID uint64 `json:",string"`
ModuleID uint64 `json:",string"`
Title string
@@ -234,7 +234,7 @@ func (p *PageEdit) Fill(r *http.Request) (err error) {
post[name] = string(param[0])
}
p.ID = parseUInt64(chi.URLParam(r, "id"))
p.PageID = parseUInt64(chi.URLParam(r, "pageID"))
if val, ok := post["selfID"]; ok {
p.SelfID = parseUInt64(val)
@@ -314,7 +314,7 @@ var _ RequestFiller = NewPageReorder()
// Page delete request parameters
type PageDelete struct {
ID uint64 `json:",string"`
PageID uint64 `json:",string"`
}
func NewPageDelete() *PageDelete {
@@ -348,7 +348,7 @@ func (p *PageDelete) Fill(r *http.Request) (err error) {
post[name] = string(param[0])
}
p.ID = parseUInt64(chi.URLParam(r, "id"))
p.PageID = parseUInt64(chi.URLParam(r, "pageID"))
return err
}