mirror of
https://github.com/wassname/talk.git
synced 2026-08-03 13:20:59 +08:00
fix: renamed, middleware fixes
This commit is contained in:
@@ -9,15 +9,9 @@ export const errorHandler: ErrorRequestHandler = (err, req, res, next) => {
|
||||
// TODO: handle better when we improve errors.
|
||||
if (err.message === "not found") {
|
||||
// TODO: handle better when we improve errors.
|
||||
res
|
||||
.status(404)
|
||||
.send(err.message)
|
||||
.end();
|
||||
res.status(404).send(err.message);
|
||||
} else {
|
||||
// TODO: handle better when we improve errors.
|
||||
res
|
||||
.status(500)
|
||||
.send(err.message)
|
||||
.end();
|
||||
res.status(500).send(err.message);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
import { RequestHandler } from "express";
|
||||
import { MiddlewareOptions } from "graphql-playground-html";
|
||||
import playground from "graphql-playground-middleware-express";
|
||||
|
||||
export default (options: MiddlewareOptions) => playground(options);
|
||||
export default (options: MiddlewareOptions): RequestHandler => (
|
||||
req,
|
||||
res,
|
||||
next
|
||||
) => {
|
||||
try {
|
||||
playground(options)(req, res, () => {
|
||||
// The playground calls next() when it's not supposed to.
|
||||
});
|
||||
} catch (err) {
|
||||
return next(err);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
import {
|
||||
ACTION_ITEM_TYPE,
|
||||
retrieveManyUserActionPresence,
|
||||
} from "talk-server/models/actions";
|
||||
} from "talk-server/models/action";
|
||||
import {
|
||||
retrieveCommentAssetConnection,
|
||||
retrieveCommentRepliesConnection,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GQLAssetTypeResolver } from "talk-server/graph/tenant/schema/__generated__/types";
|
||||
import { decodeActionCounts } from "talk-server/models/actions";
|
||||
import { decodeActionCounts } from "talk-server/models/action";
|
||||
import { Asset } from "talk-server/models/asset";
|
||||
|
||||
const Asset: GQLAssetTypeResolver<Asset> = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GQLCommentTypeResolver } from "talk-server/graph/tenant/schema/__generated__/types";
|
||||
import { decodeActionCounts } from "talk-server/models/actions";
|
||||
import { decodeActionCounts } from "talk-server/models/action";
|
||||
import { Comment } from "talk-server/models/comment";
|
||||
|
||||
const Comment: GQLCommentTypeResolver<Comment> = {
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
decodeActionCounts,
|
||||
encodeActionCounts,
|
||||
validateAction,
|
||||
} from "talk-server/models/actions";
|
||||
} from "talk-server/models/action";
|
||||
|
||||
describe("#encodeActionCounts", () => {
|
||||
it("generates the action counts correctly", () => {
|
||||
@@ -186,6 +186,7 @@ export async function createActions(
|
||||
tenantID: string,
|
||||
inputs: CreateActionInput[]
|
||||
): Promise<CreateActionResultObject[]> {
|
||||
// TODO: (wyattjoh) replace with a batch write.
|
||||
return Promise.all(inputs.map(input => createAction(mongo, tenantID, input)));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import uuid from "uuid";
|
||||
|
||||
import { Omit } from "talk-common/types";
|
||||
import { dotize } from "talk-common/utils/dotize";
|
||||
import { EncodedActionCounts } from "talk-server/models/actions";
|
||||
import { EncodedActionCounts } from "talk-server/models/action";
|
||||
import { ModerationSettings } from "talk-server/models/settings";
|
||||
import { TenantResource } from "talk-server/models/tenant";
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
GQLCOMMENT_SORT,
|
||||
GQLCOMMENT_STATUS,
|
||||
} from "talk-server/graph/tenant/schema/__generated__/types";
|
||||
import { EncodedActionCounts } from "talk-server/models/actions";
|
||||
import { EncodedActionCounts } from "talk-server/models/action";
|
||||
import {
|
||||
Connection,
|
||||
Cursor,
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
GQLUSER_ROLE,
|
||||
GQLUSER_USERNAME_STATUS,
|
||||
} from "talk-server/graph/tenant/schema/__generated__/types";
|
||||
import { EncodedActionCounts } from "talk-server/models/actions";
|
||||
import { EncodedActionCounts } from "talk-server/models/action";
|
||||
import { FilterQuery } from "talk-server/models/query";
|
||||
import { TenantResource } from "talk-server/models/tenant";
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
CreateActionInput,
|
||||
createActions,
|
||||
encodeActionCounts,
|
||||
} from "talk-server/models/actions";
|
||||
} from "talk-server/models/action";
|
||||
import {
|
||||
retrieveAsset,
|
||||
updateAssetActionCounts,
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
GQLCOMMENT_FLAG_REASON,
|
||||
GQLCOMMENT_STATUS,
|
||||
} from "talk-server/graph/tenant/schema/__generated__/types";
|
||||
import { ACTION_TYPE } from "talk-server/models/actions";
|
||||
import { ACTION_TYPE } from "talk-server/models/action";
|
||||
import {
|
||||
compose,
|
||||
ModerationPhaseContext,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Omit, Promiseable } from "talk-common/types";
|
||||
import { GQLCOMMENT_STATUS } from "talk-server/graph/tenant/schema/__generated__/types";
|
||||
import { CreateActionInput } from "talk-server/models/actions";
|
||||
import { CreateActionInput } from "talk-server/models/action";
|
||||
import { Asset } from "talk-server/models/asset";
|
||||
import { Comment } from "talk-server/models/comment";
|
||||
import { Tenant } from "talk-server/models/tenant";
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
GQLCOMMENT_FLAG_REASON,
|
||||
GQLCOMMENT_STATUS,
|
||||
} from "talk-server/graph/tenant/schema/__generated__/types";
|
||||
import { ACTION_TYPE } from "talk-server/models/actions";
|
||||
import { ACTION_TYPE } from "talk-server/models/action";
|
||||
import { ModerationSettings } from "talk-server/models/settings";
|
||||
import {
|
||||
IntermediateModerationPhase,
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
GQLCOMMENT_FLAG_REASON,
|
||||
GQLCOMMENT_STATUS,
|
||||
} from "talk-server/graph/tenant/schema/__generated__/types";
|
||||
import { ACTION_TYPE } from "talk-server/models/actions";
|
||||
import { ACTION_TYPE } from "talk-server/models/action";
|
||||
import {
|
||||
IntermediateModerationPhase,
|
||||
IntermediatePhaseResult,
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
GQLCOMMENT_FLAG_REASON,
|
||||
GQLCOMMENT_STATUS,
|
||||
} from "talk-server/graph/tenant/schema/__generated__/types";
|
||||
import { ACTION_TYPE } from "talk-server/models/actions";
|
||||
import { ACTION_TYPE } from "talk-server/models/action";
|
||||
import { ModerationSettings } from "talk-server/models/settings";
|
||||
import {
|
||||
IntermediateModerationPhase,
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
GQLCOMMENT_STATUS,
|
||||
} from "talk-server/graph/tenant/schema/__generated__/types";
|
||||
import logger from "talk-server/logger";
|
||||
import { ACTION_TYPE } from "talk-server/models/actions";
|
||||
import { ACTION_TYPE } from "talk-server/models/action";
|
||||
import {
|
||||
IntermediateModerationPhase,
|
||||
IntermediatePhaseResult,
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
GQLPerspectiveExternalIntegration,
|
||||
} from "talk-server/graph/tenant/schema/__generated__/types";
|
||||
import logger from "talk-server/logger";
|
||||
import { ACTION_TYPE } from "talk-server/models/actions";
|
||||
import { ACTION_TYPE } from "talk-server/models/action";
|
||||
import {
|
||||
IntermediateModerationPhase,
|
||||
IntermediatePhaseResult,
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
GQLCOMMENT_FLAG_REASON,
|
||||
GQLCOMMENT_STATUS,
|
||||
} from "talk-server/graph/tenant/schema/__generated__/types";
|
||||
import { ACTION_TYPE } from "talk-server/models/actions";
|
||||
import { ACTION_TYPE } from "talk-server/models/action";
|
||||
import {
|
||||
IntermediateModerationPhase,
|
||||
IntermediatePhaseResult,
|
||||
|
||||
Reference in New Issue
Block a user