Page MenuHomePhabricator

D11943.id39975.diff
No OneTemporary

D11943.id39975.diff

diff --git a/keyserver/src/endpoints.js b/keyserver/src/endpoints.js
--- a/keyserver/src/endpoints.js
+++ b/keyserver/src/endpoints.js
@@ -34,6 +34,14 @@
} from 'lib/types/validators/message-validators.js';
import { initialReduxStateValidator } from 'lib/types/validators/redux-state-validators.js';
import { relationshipErrorsValidator } from 'lib/types/validators/relationship-validators.js';
+import {
+ fetchErrorReportInfosResponseValidator,
+ reportCreationResponseValidator,
+} from 'lib/types/validators/report-validators.js';
+import {
+ exactUserSearchResultValidator,
+ userSearchResultValidator,
+} from 'lib/types/validators/search-validators.js';
import { updateUserAvatarRequestValidator } from 'lib/utils/avatar-utils.js';
import {
@@ -113,18 +121,14 @@
reportMultiCreationResponder,
errorReportFetchInfosResponder,
reportCreationRequestInputValidator,
- reportCreationResponseValidator,
fetchErrorReportInfosRequestInputValidator,
- fetchErrorReportInfosResponseValidator,
reportMultiCreationRequestInputValidator,
} from './responders/report-responders.js';
import {
userSearchResponder,
exactUserSearchResponder,
exactUserSearchRequestInputValidator,
- exactUserSearchResultValidator,
userSearchRequestInputValidator,
- userSearchResultValidator,
} from './responders/search-responders.js';
import {
siweNonceResponder,
diff --git a/keyserver/src/responders/report-responders.js b/keyserver/src/responders/report-responders.js
--- a/keyserver/src/responders/report-responders.js
+++ b/keyserver/src/responders/report-responders.js
@@ -18,9 +18,7 @@
type MediaMissionReportCreationRequest,
type UserInconsistencyReportCreationRequest,
reportTypes,
- reportInfoValidator,
} from 'lib/types/report-types.js';
-import { userInfoValidator } from 'lib/types/user-types.js';
import { ServerError } from 'lib/utils/errors.js';
import { tShape, tPlatformDetails } from 'lib/utils/validation-utils.js';
@@ -141,9 +139,6 @@
userInconsistencyReportCreationRequest,
]);
-export const reportCreationResponseValidator: TInterface<ReportCreationResponse> =
- tShape<ReportCreationResponse>({ id: t.String });
-
async function reportCreationResponder(
viewer: Viewer,
request: ReportCreationRequest,
@@ -189,12 +184,6 @@
cursor: t.maybe(t.String),
});
-export const fetchErrorReportInfosResponseValidator: TInterface<FetchErrorReportInfosResponse> =
- tShape<FetchErrorReportInfosResponse>({
- reports: t.list(reportInfoValidator),
- userInfos: t.list(userInfoValidator),
- });
-
async function errorReportFetchInfosResponder(
viewer: Viewer,
request: FetchErrorReportInfosRequest,
diff --git a/keyserver/src/responders/responder-validators.test.js b/keyserver/src/responders/responder-validators.test.js
--- a/keyserver/src/responders/responder-validators.test.js
+++ b/keyserver/src/responders/responder-validators.test.js
@@ -24,9 +24,9 @@
sendMessageResponseValidator,
} from 'lib/types/validators/message-validators.js';
import { relationshipErrorsValidator } from 'lib/types/validators/relationship-validators.js';
+import { reportCreationResponseValidator } from 'lib/types/validators/report-validators.js';
+import { userSearchResultValidator } from 'lib/types/validators/search-validators.js';
-import { reportCreationResponseValidator } from './report-responders.js';
-import { userSearchResultValidator } from './search-responders.js';
import { siweNonceResponseValidator } from './siwe-nonce-responders.js';
import {
changeThreadSettingsResultValidator,
diff --git a/keyserver/src/responders/search-responders.js b/keyserver/src/responders/search-responders.js
--- a/keyserver/src/responders/search-responders.js
+++ b/keyserver/src/responders/search-responders.js
@@ -8,7 +8,6 @@
ExactUserSearchRequest,
ExactUserSearchResult,
} from 'lib/types/search-types.js';
-import { globalAccountUserInfoValidator } from 'lib/types/user-types.js';
import { tShape } from 'lib/utils/validation-utils.js';
import { searchForUsers, searchForUser } from '../search/users.js';
@@ -19,11 +18,6 @@
prefix: t.maybe(t.String),
});
-export const userSearchResultValidator: TInterface<UserSearchResult> =
- tShape<UserSearchResult>({
- userInfos: t.list(globalAccountUserInfoValidator),
- });
-
async function userSearchResponder(
viewer: Viewer,
request: UserSearchRequest,
@@ -37,11 +31,6 @@
username: t.String,
});
-export const exactUserSearchResultValidator: TInterface<ExactUserSearchResult> =
- tShape<ExactUserSearchResult>({
- userInfo: t.maybe(globalAccountUserInfoValidator),
- });
-
async function exactUserSearchResponder(
viewer: Viewer,
request: ExactUserSearchRequest,
diff --git a/lib/types/validators/report-validators.js b/lib/types/validators/report-validators.js
new file mode 100644
--- /dev/null
+++ b/lib/types/validators/report-validators.js
@@ -0,0 +1,21 @@
+// @flow
+
+import t from 'tcomb';
+import type { TInterface } from 'tcomb';
+
+import { tShape } from '../../utils/validation-utils.js';
+import {
+ type ReportCreationResponse,
+ type FetchErrorReportInfosResponse,
+ reportInfoValidator,
+} from '../report-types.js';
+import { userInfoValidator } from '../user-types.js';
+
+export const reportCreationResponseValidator: TInterface<ReportCreationResponse> =
+ tShape<ReportCreationResponse>({ id: t.String });
+
+export const fetchErrorReportInfosResponseValidator: TInterface<FetchErrorReportInfosResponse> =
+ tShape<FetchErrorReportInfosResponse>({
+ reports: t.list(reportInfoValidator),
+ userInfos: t.list(userInfoValidator),
+ });
diff --git a/lib/types/validators/search-validators.js b/lib/types/validators/search-validators.js
new file mode 100644
--- /dev/null
+++ b/lib/types/validators/search-validators.js
@@ -0,0 +1,20 @@
+// @flow
+
+import t, { type TInterface } from 'tcomb';
+
+import { tShape } from '../../utils/validation-utils.js';
+import type {
+ ExactUserSearchResult,
+ UserSearchResult,
+} from '../search-types.js';
+import { globalAccountUserInfoValidator } from '../user-types.js';
+
+export const exactUserSearchResultValidator: TInterface<ExactUserSearchResult> =
+ tShape<ExactUserSearchResult>({
+ userInfo: t.maybe(globalAccountUserInfoValidator),
+ });
+
+export const userSearchResultValidator: TInterface<UserSearchResult> =
+ tShape<UserSearchResult>({
+ userInfos: t.list(globalAccountUserInfoValidator),
+ });

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 20, 2:34 AM (22 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2540823
Default Alt Text
D11943.id39975.diff (6 KB)

Event Timeline