remove unused search endpoints

This commit is contained in:
@wwwjim 2020-11-16 00:18:02 -08:00
parent 70cf111b08
commit 54a2da74f6
3 changed files with 1 additions and 70 deletions

View File

@ -79,13 +79,6 @@ export const getNetworkDirectory = async () => {
});
};
export const searchSlates = async (data) => {
return await returnJSON(`/api/search/slates/${data.query}`, {
...DEFAULT_OPTIONS,
body: JSON.stringify({ data }),
});
};
export const getSlateById = async (data) => {
return await returnJSON(`/api/slates/get`, {
...DEFAULT_OPTIONS,
@ -125,6 +118,7 @@ export const search = async (data) => {
if (Strings.isEmpty(data.query)) {
return { decorator: "NO_SERVER_TRIP", data: { results: [] } };
}
if (Strings.isEmpty(data.resourceURI)) {
return { decorator: "NO_RESOURCE_URI", data: { results: [] } };
}

View File

@ -1,22 +0,0 @@
import * as Strings from "~/common/strings";
import * as Data from "~/node_common/data";
export default async (req, res) => {
if (Strings.isEmpty(req.query.query)) {
return {
decorator: "SERVER_SEARCH_NO_QUERY",
data: { results: [] },
};
}
const { query } = req.query;
const users = await Data.queryUsers({ query });
const slates = await Data.querySlates({ query });
let results = [...users, ...slates];
return res.status(200).send({
decorator: "SERVER_SEARCH_QUERY",
data: { query, results },
});
};

View File

@ -1,41 +0,0 @@
import * as Data from "~/node_common/data";
import * as Serializers from "~/node_common/serializers";
import * as Strings from "~/common/strings";
export default async (req, res) => {
if (Strings.isEmpty(req.query.query)) {
return {
decorator: "SERVER_SEARCH_NO_QUERY",
data: { results: [] },
};
}
const { query } = req.query;
const slates = await Data.querySlates({ query });
//NOTE(martina): this way of deeplinking no longer works now that slates can have same names (however it is currently unused so I've left it here)
if (req.body.data.deeplink) {
if (slates.length) {
const slate = slates.filter((item) => item.slatename === query)[0];
const user = await Data.getUserById({ id: slate.data.ownerId });
slate.user = Serializers.user(user);
return res.status(200).send({
decorator: "SERVER_DEEPLINK",
data: { slate },
});
}
return res.status(500).send({
decorator: "SERVER_DEEPLINK_ERROR",
error: true,
});
}
let results = [...slates];
return res.status(200).send({
decorator: "SERVER_SEARCH_QUERY",
data: { query, results },
});
};