Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
node-couchdb-management
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vegofy-Public
node-couchdb-management
Commits
3e8a0048
Commit
3e8a0048
authored
Sep 11, 2020
by
Sachinda
Committed by
Stephan Handuwala
Sep 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Master
parent
56c0b881
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
49 deletions
+85
-49
index.js
index.js
+84
-48
package.json
package.json
+1
-1
No files found.
index.js
View file @
3e8a0048
...
...
@@ -138,10 +138,14 @@ module.exports = {
await
validateDbmodel
(
singleElement
);
loopinfo
[
'db_name'
]
=
singleElement
.
db_name
}
catch
(
error
)
{
loopinfo
[
'error'
]
=
'Db Model Validation Error'
;
loopinfo
[
'debug_info'
]
=
error
;
infologs
.
push
(
loopinfo
);
continue
;
// throw error;
return
reject
(
error
);
// loopinfo['error'] = 'Db Model Validation Error';
// loopinfo['debug_info'] = error;
// infologs.push(loopinfo);
// continue;
}
var
db
=
await
dbconnectionMaker
(
singleElement
.
user_name
,
singleElement
.
password
,
singleElement
.
service_url
,
singleElement
.
service_port
);
...
...
@@ -149,10 +153,13 @@ module.exports = {
var
dbexist
=
await
checkDbexist
(
db
,
singleElement
.
db_name
);
loopinfo
[
'dbexist'
]
=
true
;
}
catch
(
error
)
{
loopinfo
[
'error'
]
=
'Db Exist check error'
;
loopinfo
[
'debug_info'
]
=
error
;
infologs
.
push
(
loopinfo
);
continue
;
return
reject
(
error
);
//throw error;
// loopinfo['error'] = 'Db Exist check error';
// loopinfo['debug_info'] = error;
// infologs.push(loopinfo);
// continue;
}
...
...
@@ -162,10 +169,15 @@ module.exports = {
await
dbcreate
(
db
,
singleElement
.
db_name
);
loopinfo
[
'create db '
]
=
true
;
}
catch
(
error
)
{
loopinfo
[
'error'
]
=
'Db Create Error'
;
loopinfo
[
'debug_info'
]
=
error
;
infologs
.
push
(
loopinfo
);
continue
;
return
reject
(
error
);
//throw error;
// loopinfo['error'] = 'Db Create Error';
// loopinfo['debug_info'] = error;
// infologs.push(loopinfo);
// continue;
}
// db does not exist create new one
}
...
...
@@ -180,10 +192,12 @@ module.exports = {
var
insertViewmodel
=
await
insertDocument
(
select_db
,
singleElement
.
view_document
);
viewinfodoc
=
'Document not found insert as new'
;
}
catch
(
error
)
{
viewinfodoc
=
{
'error'
:
'Insert View model error 1'
,
"debug"
:
error
};
return
reject
(
error
);
//throw error;
// viewinfodoc = {
// 'error': 'Insert View model error 1',
// "debug": error
// };
}
//console.log('insertViewmodel :>> ', insertViewmodel);
}
else
{
...
...
@@ -198,10 +212,13 @@ module.exports = {
console
.
log
(
'insertViewmodel :>> '
,
insertViewmodel
);
viewinfodoc
=
'Document found does not Equals to old one'
;
}
catch
(
error
)
{
viewinfodoc
=
{
'error'
:
'Insert View model error 2'
,
"debug"
:
error
};
return
reject
(
error
);
//throw error;
// viewinfodoc = {
// 'error': 'Insert View model error 2',
// "debug": error
// };
}
}
else
{
...
...
@@ -210,8 +227,10 @@ module.exports = {
}
loopinfo
[
'view_document'
]
=
viewinfodoc
;
}
catch
(
error
)
{
loopinfo
[
'error'
]
=
'view_document check exist error'
;
loopinfo
[
'debug_info'
]
=
error
;
return
reject
(
error
);
// throw error;
// loopinfo['error'] = 'view_document check exist error';
// loopinfo['debug_info'] = error;
}
}
/* index_document */
...
...
@@ -224,10 +243,13 @@ module.exports = {
indexinfodoc
=
'Document not found insert as new'
;
console
.
log
(
'index_document :>> '
,
index_document
);
}
catch
(
error
)
{
indexinfodoc
=
{
'error'
:
'Insert Index document error'
,
"debug"
:
error
};
return
reject
(
error
);
// throw error;
// indexinfodoc = {
// 'error': 'Insert Index document error',
// "debug": error
// };
}
}
else
{
var
rev
=
doc
.
_rev
;
...
...
@@ -241,10 +263,12 @@ module.exports = {
indexinfodoc
=
'Document found does not Equals to old one'
;
console
.
log
(
'insertmodel :>> '
,
insertmodel
);
}
catch
(
error
)
{
indexinfodoc
=
{
'error'
:
'Insert View model error'
,
"debug"
:
error
};
return
reject
(
error
);
//throw error;
// indexinfodoc = {
// 'error': 'Insert View model error',
// "debug": error
// };
}
}
else
{
indexinfodoc
=
'Document found Equals to old one'
;
...
...
@@ -252,8 +276,10 @@ module.exports = {
}
loopinfo
[
'index_document'
]
=
indexinfodoc
;
}
catch
(
error
)
{
loopinfo
[
'error'
]
=
'index_document check exist error'
;
loopinfo
[
'debug_info'
]
=
error
;
return
reject
(
error
);
//throw error;
// loopinfo['error'] = 'index_document check exist error';
// loopinfo['debug_info'] = error;
}
}
/* update handler */
...
...
@@ -267,10 +293,13 @@ module.exports = {
console
.
log
(
'index_document :>> '
,
insertmodel
);
updatehandleinfodoc
=
'Document not found insert as new'
;
}
catch
(
error
)
{
updatehandleinfodoc
=
{
'error'
:
'Insert Update handler document error'
,
"debug"
:
error
};
return
reject
(
error
);
//throw error;
// updatehandleinfodoc = {
// 'error': 'Insert Update handler document error',
// "debug": error
// };
}
}
else
{
var
rev
=
doc
.
_rev
;
...
...
@@ -284,31 +313,38 @@ module.exports = {
console
.
log
(
'insertmodel :>> '
,
insertmodel
);
updatehandleinfodoc
=
'Document found does not Equals to old one'
;
}
catch
(
error
)
{
updatehandleinfodoc
=
{
'error'
:
'Insert Update handler document error'
,
"debug"
:
error
};
return
reject
(
error
);
//throw error;
// updatehandleinfodoc = {
// 'error': 'Insert Update handler document error',
// "debug": error
// };
}
}
else
{
updatehandleinfodoc
=
'Document found Equals to old one'
;
}
}
}
catch
(
error
)
{
loopinfo
[
'error'
]
=
'Update handler check exist error'
;
loopinfo
[
'debug_info'
]
=
error
;
return
reject
(
error
);
//throw error;
// loopinfo['error'] = 'Update handler check exist error';
// loopinfo['debug_info'] = error;
}
loopinfo
[
'Update_handler_document'
]
=
updatehandleinfodoc
;
}
infologs
.
push
(
loopinfo
);
}
catch
(
error
)
{
infologs
.
push
({
"db_name"
:
singleElement
.
db_name
,
"error"
:
error
})
console
.
log
(
'error'
,
error
)
return
reject
(
error
);
// infologs.push({
// "db_name": singleElement.db_name,
// "error": error
// })
// console.log('error', error)
}
}
return
resolve
(
infologs
);
})
}
}
\ No newline at end of file
}
package.json
View file @
3e8a0048
{
"name"
:
"couch_db_create"
,
"version"
:
"1.0.
0
"
,
"version"
:
"1.0.
1
"
,
"description"
:
"ls -l"
,
"main"
:
"index.js"
,
"scripts"
:
{
...
...
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