File tree 1 file changed +16
-4
lines changed
1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -40,12 +40,16 @@ exports.findAll = function(req, res) {
40
40
41
41
exports . findById = function ( req , res ) {
42
42
var id = req . params . id ;
43
- res . json ( { status : 'ok' , id : id } ) ;
43
+ character . getProfileById ( id ) . then ( function ( profile ) {
44
+ res . json ( profile ) ;
45
+ } ) . catch ( function ( ) {
46
+ res . status ( 400 ) . json ( { status : 'something went wrong' } ) ;
47
+ } ) ;
44
48
} ;
45
49
46
50
exports . create = function ( req , res ) {
47
51
debug ( 'name' , req . params . name ) ;
48
- character . newCharacter ( req . params . name ) . then ( function ( name ) {
52
+ character . newProfile ( req . params . name ) . then ( function ( name ) {
49
53
res . json ( { name : name } ) ;
50
54
debug ( 'fulfilled' , name ) ;
51
55
} ) . catch ( function ( ) {
@@ -55,10 +59,18 @@ exports.create = function(req, res) {
55
59
56
60
exports . update = function ( req , res ) {
57
61
var id = req . params . id ;
58
- res . json ( { status : 'ok' , id : id } ) ;
62
+ character . updateProfileById ( id ) . then ( function ( profile ) {
63
+ res . json ( profile ) ;
64
+ } ) . catch ( function ( ) {
65
+ res . status ( 400 ) . json ( { status : 'something went wrong' } ) ;
66
+ } ) ;
59
67
} ;
60
68
61
69
exports . destroy = function ( req , res ) {
62
70
var id = req . params . id ;
63
- res . json ( { status : 'ok' , id : id } ) ;
71
+ character . destroyProfile ( id ) . then ( function ( profile ) {
72
+ res . json ( profile ) ;
73
+ } ) . catch ( function ( ) {
74
+ res . status ( 400 ) . json ( { status : 'something went wrong' } ) ;
75
+ } ) ;
64
76
} ;
You can’t perform that action at this time.
0 commit comments