Skip to content

Commit 739fd2e

Browse files
committed
fix: crud attributes renamed
1 parent d22a5be commit 739fd2e

File tree

7 files changed

+34
-30
lines changed

7 files changed

+34
-30
lines changed

CoCreate.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ module.exports = {
44
"host": "",
55
"sources": [
66
{
7-
"collection": "files",
8-
"document": {
7+
"array": "files",
8+
"object": {
99
"_id": "601f02625803e43d00589077",
1010
"name": "index.html",
1111
"path": "/docs/api/index.html",

docs/form.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
<!-- CoCreate CSS -->
1515
<!-- CoCreate CSS -->
1616
<link rel="stylesheet" href="https://cdn.cocreate.app/latest/CoCreate.min.css" type="text/css" />
17-
<link rel="stylesheet" href="/docs/index.css" collection="files" document_id="60888216117c640e7596303f" name="src" type="text/css" save="true" />
17+
<link rel="stylesheet" href="/docs/index.css" array="files" object="60888216117c640e7596303f" name="src" type="text/css" save="true" />
1818
<link rel="manifest" href="/manifest.webmanifest" />
1919
</head>
2020

2121
<body>
22-
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10" collection="files" document_id="60395ef42b3ac232657040fd" name="src">
22+
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10" array="files" object="60395ef42b3ac232657040fd" name="src">
2323
</nav>
2424
<sidenav id="menuL" class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl" resizable resize-selector="[content_id='content']" resize-property="margin-left" resize-value="width">
25-
<menu collection="files" document_id="603717b07de7fb350ae9fec8" name="src"></menu>
25+
<menu array="files" object="603717b07de7fb350ae9fec8" name="src"></menu>
2626
<div resize="right"></div>
2727
</sidenav>
2828
<main class="padding-top:15px padding:15px@lg@xl" content_id="content" id="CoCreate-api-form">
@@ -182,7 +182,7 @@ <h2 class="padding:5px_0px">Demo</h2>
182182
<div class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px" id="playground">
183183

184184
<div id="demo-code" resizable class="position:relative height:50%">
185-
<textarea type="code" lang="html" collection="demos" document_id="" name="demo" save="false" id="demo" class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
185+
<textarea type="code" lang="html" array="demos" object="" name="demo" save="false" id="demo" class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
186186
<div resize="bottom" class="background:lightgrey"></div>
187187
</div>
188188

docs/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414

1515
<!-- CoCreate CSS -->
1616
<link rel="stylesheet" href="https://cdn.cocreate.app/latest/CoCreate.min.css" type="text/css" />
17-
<link rel="stylesheet" href="/docs/index.css" collection="files" document_id="60888216117c640e7596303f" name="src" type="text/css" save="true" />
17+
<link rel="stylesheet" href="/docs/index.css" array="files" object="60888216117c640e7596303f" name="src" type="text/css" save="true" />
1818

1919
<link rel="manifest" href="/manifest.webmanifest" />
2020
</head>
2121

2222
<body>
23-
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10" collection="files" document_id="60395ef42b3ac232657040fd"
23+
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10" array="files" object="60395ef42b3ac232657040fd"
2424
name="src">
2525
</nav>
2626
<sidenav id="menuL" class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl" resizable resize-selector="[content_id='content']" resize-property="margin-left" resize-value="width">
27-
<menu collection="files" document_id="603717b07de7fb350ae9fec8" name="src"></menu>
27+
<menu array="files" object="603717b07de7fb350ae9fec8" name="src"></menu>
2828
<div resize="right"></div>
2929
</sidenav>
3030
<main class="padding-top:15px padding:15px@lg@xl" content_id="content" id="CoCreate-api">
@@ -208,7 +208,7 @@ <h2 class="padding:5px_0px">Demo</h2>
208208
<div class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px" id="playground">
209209

210210
<div id="demo-code" resizable class="position:relative height:50%">
211-
<textarea type="code" lang="html" collection="demos" document_id="" name="demo" save="false" id="demo" class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
211+
<textarea type="code" lang="html" array="demos" object="" name="demo" save="false" id="demo" class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
212212
<div resize="bottom" class="background:lightgrey"></div>
213213
</div>
214214

docs/module.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515
<!-- CoCreate CSS -->
1616
<link rel="stylesheet" href="https://cdn.cocreate.app/latest/CoCreate.min.css" type="text/css" />
17-
<link rel="stylesheet" href="/docs/index.css" collection="files" document_id="60888216117c640e7596303f" name="src" type="text/css" save="true" />
17+
<link rel="stylesheet" href="/docs/index.css" array="files" object="60888216117c640e7596303f" name="src" type="text/css" save="true" />
1818
<link rel="manifest" href="/manifest.webmanifest">
1919
</head>
2020

2121
<body>
22-
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10" collection="files" document_id="60395ef42b3ac232657040fd" name="src">
22+
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10" array="files" object="60395ef42b3ac232657040fd" name="src">
2323
</nav>
2424
<sidenav id="menuL" class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl" resizable resize-selector="[content_id='content']" resize-property="margin-left" resize-value="width">
25-
<menu collection="files" document_id="603717b07de7fb350ae9fec8" name="src"></menu>
25+
<menu array="files" object="603717b07de7fb350ae9fec8" name="src"></menu>
2626
<div resize="right"></div>
2727
</sidenav>
2828
<main class="padding-top:15px padding:15px@lg@xl" content_id="content" id="CoCreate-api-module">
@@ -172,7 +172,7 @@ <h2 class="padding:5px_0px">Demo</h2>
172172
<div class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px" id="playground">
173173

174174
<div id="demo-code" resizable class="position:relative height:50%">
175-
<textarea type="code" lang="html" collection="demos" document_id="" name="demo" save="false" id="demo" class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
175+
<textarea type="code" lang="html" array="demos" object="" name="demo" save="false" id="demo" class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
176176
<div resize="bottom" class="background:lightgrey"></div>
177177
</div>
178178

docs/server.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515
<!-- CoCreate CSS -->
1616
<link rel="stylesheet" href="https://cdn.cocreate.app/latest/CoCreate.min.css" type="text/css" />
17-
<link rel="stylesheet" href="/docs/index.css" collection="files" document_id="60888216117c640e7596303f" name="src" type="text/css" save="true" />
17+
<link rel="stylesheet" href="/docs/index.css" array="files" object="60888216117c640e7596303f" name="src" type="text/css" save="true" />
1818
<link rel="manifest" href="/manifest.webmanifest">
1919
</head>
2020

2121
<body>
22-
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10" collection="files" document_id="60395ef42b3ac232657040fd" name="src">
22+
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10" array="files" object="60395ef42b3ac232657040fd" name="src">
2323
</nav>
2424
<sidenav id="menuL" class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl" resizable resize-selector="[content_id='content']" resize-property="margin-left" resize-value="width">
25-
<menu collection="files" document_id="603717b07de7fb350ae9fec8" name="src"></menu>
25+
<menu array="files" object="603717b07de7fb350ae9fec8" name="src"></menu>
2626
<div resize="right"></div>
2727
</sidenav>
2828
<main class="padding-top:15px padding:15px@lg@xl" content_id="content" id="CoCreate-api-server">
@@ -183,7 +183,7 @@ <h2 class="padding:5px_0px">Demo</h2>
183183
<div class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px" id="playground">
184184

185185
<div id="demo-code" resizable class="position:relative height:50%">
186-
<textarea type="code" lang="html" collection="demos" document_id="" name="demo" save="false" id="demo" class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
186+
<textarea type="code" lang="html" array="demos" object="" name="demo" save="false" id="demo" class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
187187
<div resize="bottom" class="background:lightgrey"></div>
188188
</div>
189189

src/client.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ const CoCreateApi = {
122122
},
123123

124124
send: function (name, endPoint, data) {
125-
socket.send(name, { endPoint, data, broadcastBrowser: false });
125+
let method = name + '.' + endPoint
126+
socket.send({ method, endPoint, data, broadcastBrowser: false });
126127
},
127128

128129
parseParams: function ({ name, endPoint, element }) {

src/server.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,23 @@ var api = (() => {
2626
host: config["host"]
2727
})
2828

29-
let org = await crud.readDocument({
30-
collection: "organizations",
29+
let org = await crud.send({
30+
method: 'read.object',
31+
array: "organizations",
3132
key: config["key"],
3233
organization_id: config["organization_id"],
33-
document: {
34+
object: {
3435
_id: config["organization_id"]
3536
}
3637

3738
});
3839

39-
if (!org || !org.document && !org.document[0]) {
40+
if (!org || !org.object && !org.object[0]) {
4041
console.log(component, " Error GET ORG in : ", e);
4142
return false;
4243
}
4344

44-
return org.document[0];
45+
return org.object[0];
4546
},
4647

4748
getOrgInRoutesbyHostname: async (config, hostname) => {
@@ -60,8 +61,9 @@ var api = (() => {
6061
host: socket_config.host
6162
})
6263

63-
let data2 = await crud.readDocument({
64-
collection: "organizations",
64+
let data2 = await crud.send({
65+
method: 'read.object',
66+
array: "organizations",
6567
filter: {
6668
query: [{
6769
name: 'host',
@@ -73,7 +75,7 @@ var api = (() => {
7375
organization_id: config["config"]["organization_id"]
7476
});
7577

76-
var org = data2.document[0]
78+
var org = data2.object[0]
7779

7880
var socket_config = {
7981
"config": {
@@ -91,11 +93,12 @@ var api = (() => {
9193
host: socket_config.host
9294
})
9395

94-
let myOrg = await crud.readDocument({
95-
collection: "organizations",
96+
let myOrg = await crud.send({
97+
method: 'read.object',
98+
array: "organizations",
9699
key: org["key"],
97100
organization_id: org["_id"],
98-
document: {
101+
object: {
99102
_id: org["_id"]
100103
}
101104
});

0 commit comments

Comments
 (0)