1
0
mirror of https://github.com/byulmaru/quesdon synced 2024-11-23 14:36:02 +09:00

서버 코드 오타 및 자잘한거 수정

This commit is contained in:
DW 2019-11-06 20:59:37 +11:00
parent f68e1678f2
commit b44b2e2e39
2 changed files with 4 additions and 5 deletions

View File

@ -22,7 +22,7 @@ router.get('/verify_credentials', async (ctx: Koa.ParameterizedContext): Promise
ctx.body = user;
});
router.get('/followers', async (ctx: Koa.ParameterizedContext): Promise<never|void> =>
router.get('/followers', async (ctx: Koa.ParameterizedContext): Promise<never|void|{}> =>
{
if (null === /^\d+$/.exec(ctx.query.max_id || '0'))
return ctx.throw('max_id is num only', 400);
@ -35,8 +35,7 @@ router.get('/followers', async (ctx: Koa.ParameterizedContext): Promise<never|vo
// twitter
if (user.hostName === 'twitter.com')
return;
// return { max_id: undefined, accounts: [] };
return ctx.body = { max_id: undefined, accounts: [] };
// TODO: add logic for misskey
// mastodon

View File

@ -33,7 +33,7 @@ router.get('/count', async (ctx: Koa.ParameterizedContext): Promise<never|void>
const count = await Question.find(
{
user: mongoose.Types.ObjectId(ctx.session!.user),
user: mongoose.Types.ObjectId(ctx.session.user),
answeredAt: null,
isDeleted: {$ne: true}
}).count();
@ -65,7 +65,7 @@ router.post('/:id/answer', async (ctx: Koa.ParameterizedContext): Promise<never|
if (question.user._id != ctx.session.user) // eslint-disable-line eqeqeq
return ctx.throw('not found', 404);
if (question.answeredAt)
return ctx.throw('alread answered', 400);
return ctx.throw('already answered', 400);
question.answer = ctx.request.body.fields.answer as string;
if (question.answer.length < 1)