@miso.ai/doggoganger 0.9.0-beta.7 → 0.9.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api/ask.js +8 -2
package/package.json
CHANGED
package/src/api/ask.js
CHANGED
|
@@ -62,6 +62,10 @@ class Answer {
|
|
|
62
62
|
answers.set(this.question_id, this);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
get id() {
|
|
66
|
+
return this.question_id;
|
|
67
|
+
}
|
|
68
|
+
|
|
65
69
|
get() {
|
|
66
70
|
const now = Date.now();
|
|
67
71
|
const elapsed = (now - this.timestamp) / 1000;
|
|
@@ -118,10 +122,12 @@ export default function({ answerFormat }) {
|
|
|
118
122
|
const router = new Router();
|
|
119
123
|
|
|
120
124
|
router.post('/questions', (ctx) => {
|
|
121
|
-
const {
|
|
125
|
+
const { question, previous_answer_id } = JSON.parse(ctx.request.body);
|
|
122
126
|
const answerFormat = ctx.get('x-answer-format') || options.answerFormat;
|
|
123
127
|
const answer = new Answer(question, previous_answer_id, { answerFormat });
|
|
124
|
-
const data =
|
|
128
|
+
const data = {
|
|
129
|
+
question_id: answer.id,
|
|
130
|
+
};
|
|
125
131
|
ctx.body = JSON.stringify({ data });
|
|
126
132
|
});
|
|
127
133
|
|