OSDN Git Service
(root)
/
eos
/
zephyr.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6d59d6c
)
modified noteInfo api to returning user own notes
author
himetani_cafe
<fumifumi@yasunaga-lab.bio.kyutech.ac.jp>
Fri, 31 Jul 2015 09:50:06 +0000
(18:50 +0900)
committer
himetani_cafe
<fumifumi@yasunaga-lab.bio.kyutech.ac.jp>
Fri, 31 Jul 2015 09:50:06 +0000
(18:50 +0900)
auth
[deleted file]
patch
|
blob
|
history
client/app/app.js
patch
|
blob
|
history
client/app/components/board/board.controller.js
patch
|
blob
|
history
client/app/shared/user/user.service.js
patch
|
blob
|
history
server/api/noteInfo/index.js
patch
|
blob
|
history
server/auth/signup/index.js
patch
|
blob
|
history
server/jb.js
patch
|
blob
|
history
diff --git
a/auth
b/auth
deleted file mode 100644
(file)
index
e69de29
..0000000
diff --git
a/client/app/app.js
b/client/app/app.js
index
0043f0b
..
ed48dc2
100644
(file)
--- a/
client/app/app.js
+++ b/
client/app/app.js
@@
-10,7
+10,7
@@
angular.module('zephyrApp', ['ui.bootstrap', 'ui.router', 'restangular','ngRoute
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'
// Debug
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'
// Debug
-
//$urlRouterProvider.otherwise('/board
/504d41f91d2f81f02561b93a0e9ccde4')
+
$urlRouterProvider.otherwise('/notes
/504d41f91d2f81f02561b93a0e9ccde4')
})
.run(function($rootScope, $state, Restangular, user) {
})
.run(function($rootScope, $state, Restangular, user) {
diff --git
a/client/app/components/board/board.controller.js
b/client/app/components/board/board.controller.js
index
8ec0e17
..
7449f35
100644
(file)
--- a/
client/app/components/board/board.controller.js
+++ b/
client/app/components/board/board.controller.js
@@
-52,10
+52,17
@@
angular.module('zephyrApp')
// restore executeion log
var note = $state.params.noteID
// restore executeion log
var note = $state.params.noteID
- if(!note) {
+
+ if(note !== undefined) {
+ var baseNoteInfo = Restangular.all('/api/noteInfo/')
$scope.noteName = note
$scope.noteName = note
- var baseNoteInfo = Restangular.all('/api/noteInfo/'+note)
- baseNoteInfo.getList().then(function(commands) {
+
+ var params = {
+ note: note,
+ email: user.email
+ }
+
+ baseNoteInfo.post(params).then(function(commands) {
$scope.commands = commands
commands.forEach(function(params) {
var obj = {
$scope.commands = commands
commands.forEach(function(params) {
var obj = {
@@
-65,6
+72,7
@@
angular.module('zephyrApp')
$scope.commandDirectives.push(obj)
})
})
$scope.commandDirectives.push(obj)
})
})
+
$scope.$on('requestParams', function(event, i) {
$scope.$broadcast('sendParams'+i, $scope.commands[i])
})
$scope.$on('requestParams', function(event, i) {
$scope.$broadcast('sendParams'+i, $scope.commands[i])
})
diff --git
a/client/app/shared/user/user.service.js
b/client/app/shared/user/user.service.js
index
02ef761
..
0d462d6
100644
(file)
--- a/
client/app/shared/user/user.service.js
+++ b/
client/app/shared/user/user.service.js
@@
-12,7
+12,7
@@
angular.module('zephyrApp')
return userID
},
setEmail: function(addr) {
return userID
},
setEmail: function(addr) {
- email
:
addr
+ email
=
addr
},
getEmail: function() {
return email
},
getEmail: function() {
return email
diff --git
a/server/api/noteInfo/index.js
b/server/api/noteInfo/index.js
index
669ea7f
..
a54d4da
100644
(file)
--- a/
server/api/noteInfo/index.js
+++ b/
server/api/noteInfo/index.js
@@
-3,30
+3,48
@@
var express = require('express'),
router = express.Router(),
path = require('path'),
var express = require('express'),
router = express.Router(),
path = require('path'),
- fs = require('fs')
+ fs = require('fs'),
+ jb = require('../../jb')
-router.get('/:note', function(req, res) {
- var note = req.params.note
- var dirPath
+router.post('/', function(req, res) {
+ var note = req.body.note,
+ email = req.body.email,
+ dirPath
+
+
+ // Return file list at /note/*
if(note === 'root') {
if(note === 'root') {
- dirPath = path.normalize(__dirname+'/../../../notes/')
- var filesInfo = fs.readdirSync(dirPath).filter(function(file) {
- return file.substring(0,1) !== '.' && file !== 'preview'
- })
- .map(function(file) {
- var stat = fs.statSync(dirPath+'/'+file)
- stat.name = file
- return stat
- })
- .map(function(stat) {
- stat.name = stat.name.split('.')[0]
- return stat
+ jb.findOne('user', function(err, documents) {
+ var filesInfo = documents.notes.map(function(note) {
+ var notePath = path.normalize(__dirname+'/../../../notes/'+note)
+ var stat = fs.statSync(notePath)
+ stat.name = note.split('.')[0]
+
+ return stat
+ })
+ res.send(filesInfo)
})
})
- res.send(filesInfo)
+
+
+ /*
+ var filesInfo = fs.readdirSync(dirPath).filter(function(file) {
+ return file.substring(0,1) !== '.' && file !== 'preview'
+ })
+ .map(function(file) {
+ stat.name = file
+ return stat
+ })
+ .map(function(stat) {
+ stat.name = stat.name.split('.')[0]
+ return stat
+ })
+ res.send(filesInfo)
+ */
+ // Return content of the note
} else {
var noteJSON = require(path.normalize(__dirname+'/../../../notes/'+note+'.json'))
} else {
var noteJSON = require(path.normalize(__dirname+'/../../../notes/'+note+'.json'))
- res.json(noteJSON)
+
res.json(noteJSON)
}
})
}
})
-module.exports = router;
+
module.exports = router;
diff --git
a/server/auth/signup/index.js
b/server/auth/signup/index.js
index
b9a6cda
..
28f2ac1
100644
(file)
--- a/
server/auth/signup/index.js
+++ b/
server/auth/signup/index.js
@@
-15,7
+15,7
@@
router.post('/', function(req, res) {
var newuser = {
email: email,
password: password,
var newuser = {
email: email,
password: password,
- role : [],
+ role : [],
// superuser | expert | amature
notes: [],
workspaces:[]
}
notes: [],
workspaces:[]
}
diff --git
a/server/jb.js
b/server/jb.js
index
bfc238d
..
a51fb3c
100644
(file)
--- a/
server/jb.js
+++ b/
server/jb.js
@@
-6,9
+6,17
@@
var express = require('express'),
jb = EJDB.open("db/user.db")
if(process.env.DB_ZEPHYR === 'drop') {
jb = EJDB.open("db/user.db")
if(process.env.DB_ZEPHYR === 'drop') {
- jb.dropCollection('user',
- { prune: true },
- function() {})
+ jb.dropCollection('user',{ prune: true }, function() {})
+
+ var user1 = {
+ email: 'fumifumi@yasunaga-lab.bio.kyutech.ac.jp',
+ password: 'secret',
+ role: ['expert'],
+ notes: ['namae.json', 'sample_1.json']
+ }
+
+ var users = [user1]
+ jb.save('user', users, function() {} )
}
module.exports = jb
}
module.exports = jb