Skip to content

Commit d1989f1

Browse files
committed
#228 add notation for createNewUser
1 parent b292bac commit d1989f1

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

server/api/appUser/appUser.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ AppUserController.prototype = {
5454
}
5555

5656
RepoProxy.getRepo({
57-
ownerId: ownerId
57+
ownerId: ownerId // query by ownerId is enough, as the jwt can not be modify or it will not pass validate
5858
})
5959
.then(function (repoModel) {
6060
repoModel.findOne({

server/public/sampleapps/austack-nodejs/index.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,23 @@ function createNewUser(user) {
138138
}
139139

140140
function getUserDetail() {
141-
// body...
141+
var d = Q.defer();
142+
Austack.getApplicationJwt()
143+
.then(function (applicationJwt) {
144+
request.post(Austack.get('apiBaseURL') + '/appUsers/')
145+
.set('Content-Type', 'application/json')
146+
.set('Accept', 'application/json')
147+
.set('Authorization', 'Bearer ' + applicationJwt)
148+
.send(user)
149+
.end(function (err, res) {
150+
if (err) {
151+
return d.reject(err.response.body.message);
152+
}
153+
d.resolve(res.body);
154+
});
155+
});
156+
157+
return d.promise;
142158
}
143159

144160
function updateUser() {

server/public/sampleapps/austack-nodejs/test/index.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,14 @@ describe('Austack nodejs sdk', function () {
3131

3232
return Austack.createNewUser(data);
3333
});
34+
35+
it('getUserDetail', function () {
36+
var data = {
37+
mobile: '18959264509'
38+
};
39+
40+
return Austack.getUserDetail(data);
41+
});
42+
43+
3444
});

0 commit comments

Comments
 (0)