Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alain Takoudjou
jio
Commits
23242819
Commit
23242819
authored
Jul 17, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gidstorage.js put method done
parent
63d104a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
15 deletions
+30
-15
src/jio.storage/gidstorage.js
src/jio.storage/gidstorage.js
+30
-15
No files found.
src/jio.storage/gidstorage.js
View file @
23242819
...
...
@@ -296,7 +296,7 @@
};
};
that
.
post
=
function
(
comman
d
)
{
priv
.
putOrPost
=
function
(
command
,
metho
d
)
{
setTimeout
(
function
()
{
var
gid
,
complex_query
,
doc
=
command
.
cloneDoc
();
gid
=
gidFormat
(
doc
,
priv
.
constraints
);
...
...
@@ -305,7 +305,7 @@
"
status
"
:
409
,
"
statusText
"
:
"
Conflict
"
,
"
error
"
:
"
conflict
"
,
"
message
"
:
"
Cannot
post
document
"
,
"
message
"
:
"
Cannot
"
+
method
+
"
document
"
,
"
reason
"
:
"
metadata should respect constraints
"
});
}
...
...
@@ -314,33 +314,48 @@
"
query
"
:
complex_query
,
"
wildcard_character
"
:
null
},
function
(
response
)
{
var
doc
;
var
doc
,
update_method
=
method
;
if
(
response
.
total_rows
!==
0
)
{
return
that
.
error
({
"
status
"
:
409
,
"
statusText
"
:
"
Conflict
"
,
"
error
"
:
"
conflict
"
,
"
message
"
:
"
Cannot post document
"
,
"
reason
"
:
"
Document already exist
"
});
if
(
method
===
'
post
'
)
{
return
that
.
error
({
"
status
"
:
409
,
"
statusText
"
:
"
Conflict
"
,
"
error
"
:
"
conflict
"
,
"
message
"
:
"
Cannot post document
"
,
"
reason
"
:
"
Document already exist
"
});
}
else
{
doc
=
command
.
cloneDoc
();
doc
.
_id
=
response
.
rows
[
0
].
id
;
}
}
else
{
doc
=
command
.
cloneDoc
();
delete
doc
.
_id
;
update_method
=
'
post
'
;
}
doc
=
command
.
cloneDoc
();
delete
doc
.
_id
;
that
.
addJob
(
'
post
'
,
priv
.
sub_storage
,
doc
,
{
that
.
addJob
(
update_method
,
priv
.
sub_storage
,
doc
,
{
},
function
(
response
)
{
response
.
id
=
gid
;
that
.
success
(
response
);
},
function
(
err
)
{
err
.
message
=
"
Cannot
post
document
"
;
err
.
message
=
"
Cannot
"
+
method
+
"
document
"
;
that
.
error
(
err
);
});
},
function
(
err
)
{
err
.
message
=
"
Cannot
post
document
"
;
err
.
message
=
"
Cannot
"
+
method
+
"
document
"
;
that
.
error
(
err
);
});
});
};
that
.
post
=
function
(
command
)
{
priv
.
putOrPost
(
command
,
'
post
'
);
};
that
.
put
=
function
(
command
)
{
priv
.
putOrPost
(
command
,
'
put
'
);
};
that
.
get
=
function
(
command
)
{
setTimeout
(
function
()
{
var
gid_object
,
complex_query
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment