Fix types

This commit is contained in:
syuilo 2019-01-22 21:42:05 +09:00
parent 97e8ac1d27
commit 8bf9e87117
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
11 changed files with 20 additions and 20 deletions

View file

@ -7,12 +7,12 @@ import DriveFileWebpublic, { getDriveFileWebpublicBucket } from '../../models/dr
const assets = `${__dirname}/../../server/file/assets/`;
const commonReadableHandlerGenerator = (ctx: Koa.Context) => (e: Error): void => {
const commonReadableHandlerGenerator = (ctx: Koa.BaseContext) => (e: Error): void => {
console.error(e);
ctx.status = 500;
};
export default async function(ctx: Koa.Context) {
export default async function(ctx: Koa.BaseContext) {
// Validate id
if (!mongodb.ObjectID.isValid(ctx.params.id)) {
ctx.throw(400, 'incorrect id');
@ -26,13 +26,13 @@ export default async function(ctx: Koa.Context) {
if (file == null) {
ctx.status = 404;
await send(ctx, '/dummy.png', { root: assets });
await send(ctx as any, '/dummy.png', { root: assets });
return;
}
if (file.metadata.deletedAt) {
ctx.status = 410;
await send(ctx, '/tombstone.png', { root: assets });
await send(ctx as any, '/tombstone.png', { root: assets });
return;
}