mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-25 10:05:02 +03:00
remove unused search endpoints
This commit is contained in:
parent
70cf111b08
commit
54a2da74f6
@ -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) => {
|
export const getSlateById = async (data) => {
|
||||||
return await returnJSON(`/api/slates/get`, {
|
return await returnJSON(`/api/slates/get`, {
|
||||||
...DEFAULT_OPTIONS,
|
...DEFAULT_OPTIONS,
|
||||||
@ -125,6 +118,7 @@ export const search = async (data) => {
|
|||||||
if (Strings.isEmpty(data.query)) {
|
if (Strings.isEmpty(data.query)) {
|
||||||
return { decorator: "NO_SERVER_TRIP", data: { results: [] } };
|
return { decorator: "NO_SERVER_TRIP", data: { results: [] } };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Strings.isEmpty(data.resourceURI)) {
|
if (Strings.isEmpty(data.resourceURI)) {
|
||||||
return { decorator: "NO_RESOURCE_URI", data: { results: [] } };
|
return { decorator: "NO_RESOURCE_URI", data: { results: [] } };
|
||||||
}
|
}
|
||||||
|
@ -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 },
|
|
||||||
});
|
|
||||||
};
|
|
@ -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 },
|
|
||||||
});
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user