Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bc. Michael Heiland
AffinityAnalytics-Automated_Appointment_Assistant
Commits
1c417920
Commit
1c417920
authored
Nov 09, 2017
by
Vincent Horvath
Browse files
clear master
parent
85f744c5
Changes
8
Hide whitespace changes
Inline
Side-by-side
.gitignore
0 → 100644
View file @
1c417920
.idea
.idea/
tropo/api/controllers/restController.js
deleted
100644 → 0
View file @
85f744c5
'
use strict
'
;
var
mongoose
=
require
(
'
mongoose
'
),
Day
=
mongoose
.
model
(
'
Days
'
);
exports
.
list_all_days
=
function
(
req
,
res
)
{
Day
.
find
({},
function
(
err
,
day
)
{
if
(
err
)
res
.
send
(
err
);
res
.
json
(
day
);
});
};
exports
.
list_free_days
=
function
(
req
,
res
)
{
Day
.
find
({
"
occupied
"
:
false
},
function
(
err
,
day
)
{
if
(
err
)
res
.
send
(
err
);
res
.
json
(
day
);
});
};
exports
.
reset_days
=
function
(
req
,
res
)
{
Day
.
update
({},
{
$set
:
{
occupied
:
false
}
},
{
multi
:
true
},
function
(
err
,
result
)
{
if
(
err
)
res
.
send
(
err
);
res
.
json
(
result
);
}
);
};
exports
.
create_a_day
=
function
(
req
,
res
)
{
var
new_day
=
new
Day
(
req
.
body
);
new_day
.
save
(
function
(
err
,
day
)
{
if
(
err
)
res
.
send
(
err
);
res
.
json
(
day
);
});
};
exports
.
read_a_day
=
function
(
req
,
res
)
{
Day
.
find
({
"
day
"
:
{
$regex
:
new
RegExp
(
"
^
"
+
req
.
params
.
day
,
"
i
"
)
}
},
function
(
err
,
result
)
{
if
(
err
)
res
.
send
(
err
);
res
.
json
(
result
);
});
};
exports
.
update_a_day
=
function
(
req
,
res
)
{
Day
.
findOneAndUpdate
({
"
day
"
:
{
$regex
:
new
RegExp
(
"
^
"
+
req
.
params
.
day
,
"
i
"
)
}},
req
.
body
,
{
new
:
true
},
function
(
err
,
result
)
{
if
(
err
)
res
.
send
(
err
);
res
.
json
(
result
);
});
};
tropo/api/controllers/tropoController.js
deleted
100644 → 0
View file @
85f744c5
'
use strict
'
;
var
sys
=
require
(
'
sys
'
);
var
tropowebapi
=
require
(
'
tropo-webapi
'
);
exports
.
tropo_test
=
function
(
req
,
res
)
{
var
tropo
=
new
tropowebapi
.
TropoWebAPI
();
// Use the say method https://www.tropo.com/docs/webapi/say.htm
var
say
=
new
Say
(
"
Hello, how can i help you?
"
);
var
choices
=
new
Choices
(
"
appointment, meeting, glasses
"
);
tropo
.
ask
(
choices
,
null
,
null
,
null
,
"
answer
"
,
null
,
null
,
say
,
60
,
null
);
tropo
.
on
(
"
continue
"
,
null
,
"
/continue
"
,
true
);
res
.
send
(
tropowebapi
.
TropoJSON
(
tropo
));
};
exports
.
tropo_test_continue
=
function
(
req
,
res
)
{
var
tropo
=
new
tropowebapi
.
TropoWebAPI
();
var
answer
=
req
.
body
[
'
result
'
][
'
actions
'
][
'
value
'
];
var
say
;
var
choices
;
if
(
answer
==
"
appointment
"
||
answer
==
"
meeting
"
){
say
=
new
Say
(
"
Which day do you need
"
+
answer
+
"
?
"
);
choices
=
new
Choices
(
"
Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
"
);
}
else
if
(
answer
==
"
glasses
"
){
say
=
new
Say
(
"
Which size
"
+
"
glasses
"
+
"
do you need ?
"
);
choices
=
new
Choices
(
"
one, two, three, four, five, six, seven, eight
"
);
}
tropo
.
ask
(
choices
,
null
,
null
,
null
,
"
answer
"
,
null
,
null
,
say
,
60
,
null
);
tropo
.
on
(
"
continue
"
,
null
,
"
/comfirm
"
,
true
);
res
.
send
(
tropowebapi
.
TropoJSON
(
tropo
));
};
exports
.
tropo_test_comfirm
=
function
(
req
,
res
)
{
var
tropo
=
new
tropowebapi
.
TropoWebAPI
();
var
answer
=
req
.
body
[
'
result
'
][
'
actions
'
][
'
value
'
];
if
(
answer
==
"
Monday
"
||
answer
==
"
Tuesday
"
||
answer
==
"
Wednesday
"
||
answer
==
"
Thursday
"
||
answer
==
"
Friday
"
||
answer
==
"
Saturday
"
||
answer
==
"
Sunday
"
){
tropo
.
say
(
"
Your appointment is on
"
+
answer
);
}
else
if
(
answer
==
"
one
"
||
answer
==
"
two
"
||
answer
==
"
three
"
||
answer
==
"
four
"
||
answer
==
"
five
"
||
answer
==
"
six
"
||
answer
==
"
seven
"
||
answer
==
"
eight
"
){
tropo
.
say
(
"
Oukey your size is
"
+
answer
);
}
tropo
.
say
(
"
Goodbye
"
);
tropo
.
hangup
();
res
.
send
(
tropowebapi
.
TropoJSON
(
tropo
));
};
exports
.
test
=
function
(
req
,
res
)
{
res
.
send
(
tropowebapi
.
TropoJSON
(
tropo
));
};
tropo/api/models/model.js
deleted
100644 → 0
View file @
85f744c5
'
use strict
'
;
var
mongoose
=
require
(
'
mongoose
'
);
var
Schema
=
mongoose
.
Schema
;
var
DaySchema
=
new
Schema
({
day
:
{
type
:
String
,
required
:
'
Name of day
'
},
occupied
:
{
type
:
Boolean
,
required
:
'
Occupied value
'
,
default
:
false
}
});
module
.
exports
=
mongoose
.
model
(
'
Days
'
,
DaySchema
);
tropo/api/routes/routes.js
deleted
100644 → 0
View file @
85f744c5
'
use strict
'
;
module
.
exports
=
function
(
app
)
{
var
rest
=
require
(
'
../controllers/restController
'
);
var
tropo
=
require
(
'
../controllers/tropoController
'
);
//rest Routes
app
.
route
(
'
/days
'
)
.
get
(
rest
.
list_all_days
)
.
post
(
rest
.
reset_days
);
app
.
route
(
'
/freeDays
'
)
.
get
(
rest
.
list_free_days
);
app
.
route
(
'
/createDay
'
)
.
post
(
rest
.
create_a_day
);
app
.
route
(
'
/days/:day
'
)
.
get
(
rest
.
read_a_day
)
.
put
(
rest
.
update_a_day
);
//tropo Routes
app
.
route
(
'
/
'
)
.
get
(
tropo
.
tropo_test
)
.
post
(
tropo
.
tropo_test
);
app
.
route
(
'
/continue
'
)
.
post
(
tropo
.
tropo_test_continue
);
app
.
route
(
'
/comfirm
'
)
.
post
(
tropo
.
tropo_test_comfirm
);
};
tropo/nohup.out
deleted
100644 → 0
View file @
85f744c5
> aarestapi@1.0.0 start /home/ec2-user/AAA
> nodemon server.js
[33m[nodemon] 1.12.1[39m
[33m[nodemon] to restart at any time, enter `rs`[39m
[33m[nodemon] watching: *.*[39m
[32m[nodemon] starting `node server.js`[39m
events.js:141
throw er; // Unhandled 'error' event
^
Error: EBADF: bad file descriptor, read
at Error (native)
npm ERR! Linux 4.9.51-10.52.amzn1.x86_64
npm ERR! argv "/home/ec2-user/.nvm/versions/node/v4.4.5/bin/node" "/home/ec2-user/.nvm/versions/node/v4.4.5/bin/npm" "run" "start"
npm ERR! node v4.4.5
npm ERR! npm v2.15.5
npm ERR! code ELIFECYCLE
npm ERR! aarestapi@1.0.0 start: `nodemon server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the aarestapi@1.0.0 start script 'nodemon server.js'.
npm ERR! This is most likely a problem with the aarestapi package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! nodemon server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs aarestapi
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls aarestapi
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/ec2-user/AAA/npm-debug.log
> aarestapi@1.0.0 start /home/ec2-user/AAA
> nodemon server.js
[33m[nodemon] 1.12.1[39m
[33m[nodemon] to restart at any time, enter `rs`[39m
[33m[nodemon] watching: *.*[39m
[32m[nodemon] starting `node server.js`[39m
events.js:141
throw er; // Unhandled 'error' event
^
Error: EBADF: bad file descriptor, read
at Error (native)
npm ERR! Linux 4.9.51-10.52.amzn1.x86_64
npm ERR! argv "/home/ec2-user/.nvm/versions/node/v4.4.5/bin/node" "/home/ec2-user/.nvm/versions/node/v4.4.5/bin/npm" "run" "start"
npm ERR! node v4.4.5
npm ERR! npm v2.15.5
npm ERR! code ELIFECYCLE
npm ERR! aarestapi@1.0.0 start: `nodemon server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the aarestapi@1.0.0 start script 'nodemon server.js'.
npm ERR! This is most likely a problem with the aarestapi package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! nodemon server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs aarestapi
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls aarestapi
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/ec2-user/AAA/npm-debug.log
> aarestapi@1.0.0 start /home/ec2-user/AAA
> nodemon server.js
[33m[nodemon] 1.12.1[39m
[33m[nodemon] to restart at any time, enter `rs`[39m
[33m[nodemon] watching: *.*[39m
[32m[nodemon] starting `node server.js`[39m
events.js:141
throw er; // Unhandled 'error' event
^
Error: EBADF: bad file descriptor, read
at Error (native)
npm ERR! Linux 4.9.51-10.52.amzn1.x86_64
npm ERR! argv "/home/ec2-user/.nvm/versions/node/v4.4.5/bin/node" "/home/ec2-user/.nvm/versions/node/v4.4.5/bin/npm" "start"
npm ERR! node v4.4.5
npm ERR! npm v2.15.5
npm ERR! code ELIFECYCLE
npm ERR! aarestapi@1.0.0 start: `nodemon server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the aarestapi@1.0.0 start script 'nodemon server.js'.
npm ERR! This is most likely a problem with the aarestapi package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! nodemon server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs aarestapi
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls aarestapi
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/ec2-user/AAA/npm-debug.log
tropo/package.json
deleted
100644 → 0
View file @
85f744c5
{
"name"
:
"aarestapi"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
,
"start"
:
"nodemon server.js"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"express"
:
"^4.16.2"
,
"mongoose"
:
"^4.12.4"
,
"nodemon"
:
"^1.12.1"
}
}
tropo/server.js
deleted
100644 → 0
View file @
85f744c5
var
express
=
require
(
'
express
'
),
app
=
express
(),
port
=
process
.
env
.
PORT
||
3000
,
mongoose
=
require
(
'
mongoose
'
),
Day
=
require
(
'
./api/models/model
'
),
bodyParser
=
require
(
'
body-parser
'
);
//mongoose instance connection url connection
mongoose
.
Promise
=
global
.
Promise
;
mongoose
.
connect
(
'
mongodb://localhost:27017/AAAdb
'
,
{
useMongoClient
:
true
});
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}));
app
.
use
(
bodyParser
.
json
());
var
routes
=
require
(
'
./api/routes/routes
'
);
//import routes
routes
(
app
);
//register routes
app
.
listen
(
port
);
console
.
log
(
'
Server is running on port:
'
+
port
);
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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