mirror of
https://github.com/filecoin-project/slate.git
synced 2024-09-11 22:07:08 +03:00
plugged in search update function where appropriate
This commit is contained in:
parent
3abdd3f517
commit
14eb5925b2
@ -303,13 +303,6 @@ export const updateStatus = async (data) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const updateSearch = async (data) => {
|
||||
return await returnJSON(`/api/search/update`, {
|
||||
...DEFAULT_OPTIONS,
|
||||
body: JSON.stringify({ data }),
|
||||
});
|
||||
};
|
||||
|
||||
// export const checkCIDStatus = async (data) => {
|
||||
// return await returnJSON(`/api/data/cid-status`, {
|
||||
// ...DEFAULT_OPTIONS,
|
||||
|
@ -107,8 +107,6 @@ export const signOut = async ({ viewer }) => {
|
||||
|
||||
// NOTE(jim): Permanently deletes you, forever.
|
||||
export const deleteMe = async ({ viewer }) => {
|
||||
await Actions.updateSearch("delete-user");
|
||||
|
||||
let response = await Actions.deleteViewer();
|
||||
|
||||
if (Events.hasError(response)) {
|
||||
|
@ -285,10 +285,6 @@ export default class ApplicationPage extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
if (newAccount) {
|
||||
Actions.updateSearch("create-user");
|
||||
}
|
||||
|
||||
// let redirected = this._handleURLRedirect();
|
||||
// if (!redirected) {
|
||||
// this._handleAction({ type: "NAVIGATE", value: "NAV_DATA" });
|
||||
|
@ -5,7 +5,7 @@ import {
|
||||
deleteUserIndex,
|
||||
deleteFileIndex,
|
||||
deleteSlateIndex,
|
||||
} from "~/node_common/managers/search/create";
|
||||
} from "~/node_common/managers/search/manage";
|
||||
import {
|
||||
searchAll,
|
||||
searchUser,
|
||||
@ -24,7 +24,7 @@ import {
|
||||
deleteFile,
|
||||
} from "~/node_common/managers/search/update";
|
||||
|
||||
export default {
|
||||
const SearchManager = {
|
||||
createUserIndex,
|
||||
createFileIndex,
|
||||
createSlateIndex,
|
||||
@ -45,3 +45,5 @@ export default {
|
||||
searchSlate,
|
||||
searchFile,
|
||||
};
|
||||
|
||||
export default SearchManager;
|
||||
|
@ -227,7 +227,7 @@ export const createFileIndex = async () => {
|
||||
|
||||
export const deleteUserIndex = async () => {
|
||||
try {
|
||||
let result = await searchClient.indices.delete({ index: usersIndex });
|
||||
let result = await searchClient.indices.delete({ index: "users" });
|
||||
console.log(result);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
@ -236,7 +236,7 @@ export const deleteUserIndex = async () => {
|
||||
|
||||
export const deleteSlateIndex = async () => {
|
||||
try {
|
||||
let result = await searchClient.indices.delete({ index: slatesIndex });
|
||||
let result = await searchClient.indices.delete({ index: "slates" });
|
||||
console.log(result);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
@ -245,7 +245,7 @@ export const deleteSlateIndex = async () => {
|
||||
|
||||
export const deleteFileIndex = async () => {
|
||||
try {
|
||||
let result = await searchClient.indices.delete({ index: filesIndex });
|
||||
let result = await searchClient.indices.delete({ index: "files" });
|
||||
console.log(result);
|
||||
} catch (e) {
|
||||
console.log(e);
|
@ -14,9 +14,10 @@ const searchClient = new Client({
|
||||
},
|
||||
});
|
||||
|
||||
export default {
|
||||
searchClient,
|
||||
usersIndex: `${Environment.POSTGRES_DATABASE}_users`,
|
||||
slatesIndex: `${Environment.POSTGRES_DATABASE}_slates`,
|
||||
filesIndex: `${Environment.POSTGRES_DATABASE}_files`,
|
||||
};
|
||||
const usersIndex = `${Environment.POSTGRES_DATABASE}_users`;
|
||||
|
||||
const slatesIndex = `${Environment.POSTGRES_DATABASE}_slates`;
|
||||
|
||||
const filesIndex = `${Environment.POSTGRES_DATABASE}_files`;
|
||||
|
||||
export { searchClient, usersIndex, slatesIndex, filesIndex };
|
||||
|
@ -110,9 +110,10 @@ const indexObject = async (objects, cleanObject, index) => {
|
||||
if (Array.isArray(objects)) {
|
||||
let body = [];
|
||||
for (let object of objects) {
|
||||
body.push({ update: { _index: index, _id: object.id } });
|
||||
body.push({ index: { _index: index, _id: object.id } });
|
||||
body.push(cleanObject(object));
|
||||
}
|
||||
console.log(body);
|
||||
const result = await searchClient.bulk({
|
||||
body,
|
||||
});
|
||||
|
@ -387,7 +387,7 @@ export const removeFromPublicCollectionUpdatePrivacy = async ({ files }) => {
|
||||
}
|
||||
}
|
||||
if (madePrivate.length) {
|
||||
SearchManager.updateFile(madePrivate, "REMOVE");
|
||||
SearchManager.updateFile(madePrivate);
|
||||
}
|
||||
return madePrivate;
|
||||
};
|
||||
@ -403,7 +403,7 @@ export const addToPublicCollectionUpdatePrivacy = async ({ files }) => {
|
||||
}
|
||||
}
|
||||
if (madePublic.length) {
|
||||
SearchManager.updateFile(madePublic, "ADD");
|
||||
SearchManager.updateFile(madePublic);
|
||||
}
|
||||
return madePublic;
|
||||
};
|
||||
|
@ -138,9 +138,8 @@ export default async (req, res) => {
|
||||
added = addedToSlate;
|
||||
}
|
||||
|
||||
if (slate?.isPublic) {
|
||||
SearchManager.updateFile(createdFiles, "ADD");
|
||||
}
|
||||
SearchManager.indexFile(createdFiles);
|
||||
|
||||
ViewerManager.hydratePartial(id, { library: true, slates: slate ? true : false });
|
||||
|
||||
if (!slate) {
|
||||
|
@ -75,9 +75,8 @@ export default async (req, res) => {
|
||||
added = addedToSlate;
|
||||
}
|
||||
|
||||
if (slate?.isPublic) {
|
||||
SearchManager.updateFile(createdFiles, "ADD");
|
||||
}
|
||||
SearchManager.indexFile(createdFiles);
|
||||
|
||||
ViewerManager.hydratePartial(id, { library: true, slates: slate ? true : false });
|
||||
|
||||
if (!slate) {
|
||||
|
@ -139,7 +139,7 @@ export default async (req, res) => {
|
||||
|
||||
await Data.deleteFilesByIds({ ownerId: id, ids });
|
||||
|
||||
SearchManager.updateFile(files, "REMOVE");
|
||||
SearchManager.deleteFile(files);
|
||||
|
||||
ViewerManager.hydratePartial(id, { slates: true, library: true });
|
||||
|
||||
|
@ -105,10 +105,13 @@ export default async (req, res) => {
|
||||
added = addedToSlate;
|
||||
}
|
||||
|
||||
SearchManager.createFile(createdFiles);
|
||||
|
||||
//NOTE(martina): leaving createdFiles out of the privacy recalculation since those should already have the correct privacy
|
||||
if (slate?.isPublic) {
|
||||
Utilities.addToPublicCollectionUpdatePrivacy({ files: filesToAddToSlate });
|
||||
SearchManager.updateFile(createdFiles, "ADD");
|
||||
Utilities.addToPublicCollectionUpdatePrivacy({ files: duplicateFiles });
|
||||
}
|
||||
|
||||
ViewerManager.hydratePartial(id, { library: true, slates: slate ? true : false });
|
||||
|
||||
if (!slate) {
|
||||
|
@ -33,14 +33,7 @@ export default async (req, res) => {
|
||||
return res.status(500).send({ decorator: "SERVER_EDIT_DATA_FAILED", error: true });
|
||||
}
|
||||
|
||||
const publicFiles = await Data.getFilesByIds({
|
||||
ids: responses.map((file) => file.id),
|
||||
publicOnly: true,
|
||||
});
|
||||
|
||||
if (publicFiles.length) {
|
||||
SearchManager.updateFile(publicFiles, "EDIT");
|
||||
}
|
||||
SearchManager.updateFile(responses);
|
||||
|
||||
ViewerManager.hydratePartial(id, { library: true, slates: true });
|
||||
|
||||
|
@ -1,24 +0,0 @@
|
||||
import * as Environment from "~/node_common/environment";
|
||||
import * as Data from "~/node_common/data";
|
||||
import * as Utilities from "~/node_common/utilities";
|
||||
import * as Social from "~/node_common/social";
|
||||
import * as SearchManager from "~/node_common/managers/search";
|
||||
import * as RequestUtilities from "~/node_common/request-utilities";
|
||||
|
||||
export default async (req, res) => {
|
||||
const userInfo = await RequestUtilities.checkAuthorizationInternal(req, res);
|
||||
if (!userInfo) return;
|
||||
const { id, user } = userInfo;
|
||||
|
||||
let action;
|
||||
if (req.body.data === "create-user") {
|
||||
action = "ADD";
|
||||
} else if (req.body.data === "delete-user") {
|
||||
action = "REMOVE";
|
||||
}
|
||||
if (action) {
|
||||
SearchManager.updateUser(user, action);
|
||||
}
|
||||
|
||||
return res.status(200).send({ decorator: "SERVER_SEARCH_UPDATE", updated: true });
|
||||
};
|
@ -42,7 +42,7 @@ export default async (req, res) => {
|
||||
|
||||
ViewerManager.hydratePartial(id, { slates: true });
|
||||
|
||||
SearchManager.updateSlate(slate, "ADD");
|
||||
SearchManager.indexSlate(slate);
|
||||
|
||||
Monitor.createSlate({ user, slate });
|
||||
|
||||
|
@ -36,7 +36,7 @@ export default async (req, res) => {
|
||||
|
||||
ViewerManager.hydratePartial(id, { slates: true });
|
||||
|
||||
SearchManager.updateSlate(slate, "REMOVE");
|
||||
SearchManager.deleteSlate(slate);
|
||||
|
||||
if (slate.isPublic) {
|
||||
Utilities.removeFromPublicCollectionUpdatePrivacy({ files: slate.objects });
|
||||
|
@ -95,16 +95,12 @@ export default async (req, res) => {
|
||||
|
||||
ViewerManager.hydratePartial(id, { slates: true });
|
||||
|
||||
if (slate.isPublic && !updates.isPublic) {
|
||||
SearchManager.updateSlate(response, "REMOVE");
|
||||
SearchManager.updateSlate(response);
|
||||
|
||||
if (slate.isPublic && !updates.isPublic) {
|
||||
Utilities.removeFromPublicCollectionUpdatePrivacy({ files: slate.objects });
|
||||
} else if (!slate.isPublic && updates.isPublic) {
|
||||
SearchManager.updateSlate(response, "ADD");
|
||||
|
||||
Utilities.addToPublicCollectionUpdatePrivacy({ files: slate.objects });
|
||||
} else {
|
||||
SearchManager.updateSlate(response, "EDIT");
|
||||
}
|
||||
|
||||
return res.status(200).send({ decorator: "SERVER_UPDATE_SLATE", slate: response });
|
||||
|
@ -112,11 +112,21 @@ export default async (req, res) => {
|
||||
|
||||
if (targetUser) {
|
||||
ViewerManager.hydratePartial(id, { following: true });
|
||||
|
||||
targetUser = await Data.getUserById({
|
||||
id: req.body.data.userId,
|
||||
});
|
||||
SearchManager.updateUser(targetUser);
|
||||
|
||||
Monitor.subscribeUser({ user, targetUser });
|
||||
}
|
||||
|
||||
if (targetSlate) {
|
||||
ViewerManager.hydratePartial(id, { subscriptions: true });
|
||||
|
||||
targetSlate = await Data.getSlateById({ id: req.body.data.slateId });
|
||||
SearchManager.updateSlate(targetSlate);
|
||||
|
||||
Monitor.subscribeSlate({ user, targetSlate });
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ import * as Data from "~/node_common/data";
|
||||
import * as Utilities from "~/node_common/utilities";
|
||||
import * as Strings from "~/common/strings";
|
||||
import * as Validations from "~/common/validations";
|
||||
import * as SlateManager from "~/node_common/managers/slate";
|
||||
import * as SearchManager from "~/node_common/managers/search";
|
||||
import * as Constants from "~/node_common/constants";
|
||||
|
||||
import JWT from "jsonwebtoken";
|
||||
@ -114,6 +114,8 @@ export default async (req, res) => {
|
||||
return res.status(500).send({ decorator: "SERVER_CREATE_USER_FAILED", error: true });
|
||||
}
|
||||
|
||||
SearchManager.indexUser(user);
|
||||
|
||||
const token = JWT.sign({ id: user.id, username: user.username }, Environment.JWT_SECRET);
|
||||
return res.status(200).send({ decorator: "SERVER_SIGN_IN", success: true, token });
|
||||
};
|
||||
|
@ -3,7 +3,7 @@ import * as Data from "~/node_common/data";
|
||||
import * as Utilities from "~/node_common/utilities";
|
||||
import * as Strings from "~/common/strings";
|
||||
import * as Validations from "~/common/validations";
|
||||
import * as SlateManager from "~/node_common/managers/slate";
|
||||
import * as SearchManager from "~/node_common/managers/search";
|
||||
|
||||
import JWT from "jsonwebtoken";
|
||||
|
||||
@ -98,6 +98,8 @@ export default async (req, res) => {
|
||||
return res.status(500).send({ decorator: "SERVER_CREATE_USER_FAILED", error: true });
|
||||
}
|
||||
|
||||
SearchManager.indexUser(user);
|
||||
|
||||
const token = JWT.sign({ id: user.id, username: user.username }, Environment.JWT_SECRET);
|
||||
return res.status(200).send({ decorator: "SERVER_SIGN_IN", success: true, token });
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as Environment from "~/node_common/environment";
|
||||
import * as Data from "~/node_common/data";
|
||||
import * as Utilities from "~/node_common/utilities";
|
||||
import * as SlateManager from "~/node_common/managers/slate";
|
||||
import * as SearchManager from "~/node_common/managers/search";
|
||||
import * as Validations from "~/common/validations";
|
||||
import * as Strings from "~/common/strings";
|
||||
import * as EmailManager from "~/node_common/managers/emails";
|
||||
@ -102,5 +102,7 @@ export default async (req, res) => {
|
||||
templateId: welcomeTemplateId,
|
||||
});
|
||||
|
||||
SearchManager.indexUser(user);
|
||||
|
||||
Monitor.createUser({ user });
|
||||
};
|
||||
|
@ -12,10 +12,10 @@ export default async (req, res) => {
|
||||
|
||||
// NOTE(jim): remove their public slates and files from the search cache.
|
||||
let slates = await Data.getSlatesByUserId({ ownerId: id, publicOnly: true });
|
||||
SearchManager.updateSlate(slates, "REMOVE");
|
||||
SearchManager.deleteSlate(slates);
|
||||
|
||||
let files = await Data.getFilesByUserId({ id, publicOnly: true });
|
||||
SearchManager.updateFile(files, "REMOVE");
|
||||
SearchManager.deleteFile(files);
|
||||
|
||||
//NOTE(migration): may be able to just condense these two parts since they return it from delete anyways
|
||||
// NOTE(jim): delete all of their public and private slates.
|
||||
@ -43,7 +43,7 @@ export default async (req, res) => {
|
||||
});
|
||||
}
|
||||
|
||||
SearchManager.updateUser(user, "REMOVE");
|
||||
SearchManager.deleteUser(user);
|
||||
|
||||
// NOTE(jim): remove orphan
|
||||
await Data.createOrphan({
|
||||
|
@ -80,9 +80,10 @@ export default async (req, res) => {
|
||||
if (
|
||||
user.username !== unsafeResponse.username ||
|
||||
user.name !== unsafeResponse.name ||
|
||||
user.photo !== unsafeResponse.photo
|
||||
user.photo !== unsafeResponse.photo ||
|
||||
user.body !== unsafeResponse.body
|
||||
) {
|
||||
SearchManager.updateUser(unsafeResponse, "EDIT");
|
||||
SearchManager.updateUser(unsafeResponse);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,25 +62,9 @@ export default async (req, res) => {
|
||||
}
|
||||
|
||||
if (!updates.isPublic) {
|
||||
//NOTE(martina): if any of the files in it are now private (because they are no longer in any public slates) remove them from search
|
||||
const files = slate.objects;
|
||||
|
||||
const publicFiles = await Data.getFilesByIds({
|
||||
ids: files.map((file) => file.id),
|
||||
publicOnly: true,
|
||||
});
|
||||
const publicIds = publicFiles.map((file) => file.id);
|
||||
|
||||
let privateFiles = files.filter((file) => !publicIds.includes(file.id));
|
||||
|
||||
if (privateFiles.length) {
|
||||
SearchManager.updateFile(privateFiles, "REMOVE");
|
||||
}
|
||||
Utilities.removeFromPublicCollectionUpdatePrivacy({ files: slate.objects });
|
||||
} else {
|
||||
//NOTE(martina): make sure all the now-public files are in search if they weren't already
|
||||
const files = slate.objects;
|
||||
|
||||
SearchManager.updateFile(files, "ADD");
|
||||
Utilities.addToPublicCollectionUpdatePrivacy({ files: slate.objects });
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,13 +101,7 @@ export default async (req, res) => {
|
||||
return res.status(500).send({ decorator: "UPDATE_SLATE_FAILED", error: true });
|
||||
}
|
||||
|
||||
if (slate.isPublic && !updates.isPublic) {
|
||||
SearchManager.updateSlate(updatedSlate, "REMOVE");
|
||||
} else if (!slate.isPublic && updates.isPublic) {
|
||||
SearchManager.updateSlate(updatedSlate, "ADD");
|
||||
} else {
|
||||
SearchManager.updateSlate(updatedSlate, "EDIT");
|
||||
}
|
||||
SearchManager.updateSlate(updatedSlate);
|
||||
|
||||
ViewerManager.hydratePartial(user.id, { slates: true });
|
||||
|
||||
|
@ -43,7 +43,7 @@ export default async (req, res) => {
|
||||
|
||||
ViewerManager.hydratePartial(id, { slates: true });
|
||||
|
||||
SearchManager.updateSlate(slate, "ADD");
|
||||
SearchManager.indexSlate(slate);
|
||||
|
||||
Monitor.createSlate({ user, slate });
|
||||
|
||||
|
@ -130,9 +130,8 @@ export default async (req, res) => {
|
||||
added = addedToSlate;
|
||||
}
|
||||
|
||||
if (slate?.isPublic) {
|
||||
SearchManager.updateFile(createdFiles, "ADD");
|
||||
}
|
||||
SearchManager.indexFile(createdFiles);
|
||||
|
||||
ViewerManager.hydratePartial(id, { library: true, slates: slate ? true : false });
|
||||
|
||||
if (!slate) {
|
||||
|
@ -95,15 +95,13 @@ export default async (req, res) => {
|
||||
}
|
||||
|
||||
if (slate.isPublic && !updates.isPublic) {
|
||||
SearchManager.updateSlate(updatedSlate, "REMOVE");
|
||||
Utilities.removeFromPublicCollectionUpdatePrivacy({ files: slate.objects });
|
||||
} else if (!slate.isPublic && updates.isPublic) {
|
||||
SearchManager.updateSlate(updatedSlate, "ADD");
|
||||
Utilities.addToPublicCollectionUpdatePrivacy({ files: slate.objects });
|
||||
} else {
|
||||
SearchManager.updateSlate(updatedSlate, "EDIT");
|
||||
}
|
||||
|
||||
SearchManager.updateSlate(updatedSlate);
|
||||
|
||||
ViewerManager.hydratePartial(user.id, { slates: true });
|
||||
|
||||
return res.status(200).send({ decorator: "UPDATE_COLLECTION", collection: updatedSlate });
|
||||
|
@ -39,9 +39,7 @@ export default async (req, res) => {
|
||||
return res.status(500).send({ decorator: "UPDATE_FILE_FAILED", error: true });
|
||||
}
|
||||
|
||||
if (response.isPublic) {
|
||||
SearchManager.updateFile(response, "EDIT");
|
||||
}
|
||||
SearchManager.updateFile(response);
|
||||
|
||||
ViewerManager.hydratePartial(user.id, { library: true, slates: true });
|
||||
|
||||
|
@ -1,68 +1,124 @@
|
||||
import * as Logging from "~/common/logging";
|
||||
|
||||
import * as SearchManager from "~/node_common/managers/search";
|
||||
import SearchManager from "~/node_common/managers/search";
|
||||
|
||||
async function manage() {
|
||||
// await SearchManager.createUserIndex();
|
||||
// await SearchManager.createSlateIndex();
|
||||
// await SearchManager.createFileIndex();
|
||||
// await SearchManager.deleteUserIndex();
|
||||
// await SearchManager.deleteSlateIndex();
|
||||
// await SearchManager.deleteFileIndex();
|
||||
// await SearchManager.createUserIndex();
|
||||
// await SearchManager.createSlateIndex();
|
||||
// await SearchManager.createFileIndex();
|
||||
// await SearchManager.deleteUserIndex();
|
||||
// await SearchManager.deleteSlateIndex();
|
||||
// await SearchManager.deleteFileIndex();
|
||||
}
|
||||
|
||||
async function update() {
|
||||
// await SearchManager.indexUser({
|
||||
// id: "5172dd8b-6b11-40d3-8c9f-b4cbaa0eb8e7",
|
||||
// username: "martina",
|
||||
// name: "Martina Long",
|
||||
// body:
|
||||
// "My name is Martina. Working at @slate aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
// photo:
|
||||
// "https://slate.textile.io/ipfs/bafybeid7ykqgrsgmqsknpmxs25k6zbt4n5yoq72auboyyhgbmaf647wbku",
|
||||
// followerCount: 2,
|
||||
// slateCount: 41,
|
||||
// });
|
||||
//
|
||||
// await SearchManager.indexSlate({
|
||||
// id: "0824a3cb-e839-4246-8ff4-d919919e1487",
|
||||
// slatename: "bird-drinks",
|
||||
// ownerId: "5172dd8b-6b11-40d3-8c9f-b4cbaa0eb8e7",
|
||||
// isPublic: true,
|
||||
// subscriberCount: 1,
|
||||
// fileCount: 14,
|
||||
// body: "drinks in cool bird cups",
|
||||
// name: "bird drinks",
|
||||
// preview: null,
|
||||
// });
|
||||
//
|
||||
// await SearchManager.indexFile({
|
||||
// id: "10071abd-95c5-415e-8a12-aa17e7f560cf",
|
||||
// ownerId: "f9cc7b00-ce59-4b49-abd1-c7ef7253e258",
|
||||
// cid: "bafybeihr3eepugleul7tyw7niwpralwrnfhpxlnafies7cuufhssnkvsqe",
|
||||
// isPublic: true,
|
||||
// filename: "foggy.jpeg",
|
||||
// downloadCount: 0,
|
||||
// saveCount: 0,
|
||||
// url: null,
|
||||
// isLink: false,
|
||||
// name: "foggy.jpeg",
|
||||
// size: 485757,
|
||||
// type: "image/jpeg",
|
||||
// blurhash: "UJD,Gx~WIpWVIpR.R+RjSjNHITWBR,oes:s:",
|
||||
// tags: [
|
||||
// { id: "d82fbc78-88de-4015-adec-a7ea832fc922", name: "martuna", slatename: "martuna" },
|
||||
// { id: "0824a3cb-e839-4246-8ff4-d919919e1487", name: "bird drinks", slatename: "bird-drinks" },
|
||||
// ],
|
||||
// });
|
||||
// await SearchManager.updateFile({
|
||||
// id: "10071abd-95c5-415e-8a12-aa17e7f560cf",
|
||||
// filename: "sunny.jpeg",
|
||||
// name: "sunny.jpeg",
|
||||
// await SearchManager.indexUser({
|
||||
// id: "5172dd8b-6b11-40d3-8c9f-b4cbaa0eb8e7",
|
||||
// username: "martina",
|
||||
// name: "Martina Long",
|
||||
// body:
|
||||
// "My name is Martina. Working at @slate aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
// photo:
|
||||
// "https://slate.textile.io/ipfs/bafybeid7ykqgrsgmqsknpmxs25k6zbt4n5yoq72auboyyhgbmaf647wbku",
|
||||
// followerCount: 2,
|
||||
// slateCount: 41,
|
||||
// });
|
||||
// await SearchManager.deleteFile({
|
||||
// id: "10071abd-95c5-415e-8a12-aa17e7f560cf",
|
||||
//
|
||||
// await SearchManager.indexSlate({
|
||||
// id: "0824a3cb-e839-4246-8ff4-d919919e1487",
|
||||
// slatename: "bird-drinks",
|
||||
// ownerId: "5172dd8b-6b11-40d3-8c9f-b4cbaa0eb8e7",
|
||||
// isPublic: true,
|
||||
// subscriberCount: 1,
|
||||
// fileCount: 14,
|
||||
// body: "drinks in cool bird cups",
|
||||
// name: "bird drinks",
|
||||
// preview: null,
|
||||
// });
|
||||
// await SearchManager.indexFile({
|
||||
// id: "10071abd-95c5-415e-8a12-aa17e7f560cf",
|
||||
// ownerId: "f9cc7b00-ce59-4b49-abd1-c7ef7253e258",
|
||||
// cid: "bafybeihr3eepugleul7tyw7niwpralwrnfhpxlnafies7cuufhssnkvsqe",
|
||||
// isPublic: true,
|
||||
// filename: "foggy.jpeg",
|
||||
// downloadCount: 0,
|
||||
// saveCount: 0,
|
||||
// url: null,
|
||||
// isLink: false,
|
||||
// name: "foggy.jpeg",
|
||||
// size: 485757,
|
||||
// type: "image/jpeg",
|
||||
// blurhash: "UJD,Gx~WIpWVIpR.R+RjSjNHITWBR,oes:s:",
|
||||
// tags: [
|
||||
// { id: "d82fbc78-88de-4015-adec-a7ea832fc922", name: "martuna", slatename: "martuna" },
|
||||
// { id: "0824a3cb-e839-4246-8ff4-d919919e1487", name: "bird drinks", slatename: "bird-drinks" },
|
||||
// ],
|
||||
// });
|
||||
// await SearchManager.indexFile([
|
||||
// {
|
||||
// id: "10071abd-95c5-415e-8a12-aa17e7f560cf",
|
||||
// ownerId: "f9cc7b00-ce59-4b49-abd1-c7ef7253e258",
|
||||
// cid: "bafybeihr3eepugleul7tyw7niwpralwrnfhpxlnafies7cuufhssnkvsqe",
|
||||
// isPublic: true,
|
||||
// filename: "foggy.jpeg",
|
||||
// downloadCount: 0,
|
||||
// saveCount: 0,
|
||||
// url: null,
|
||||
// isLink: false,
|
||||
// name: "foggy.jpeg",
|
||||
// size: 485757,
|
||||
// type: "image/jpeg",
|
||||
// blurhash: "UJD,Gx~WIpWVIpR.R+RjSjNHITWBR,oes:s:",
|
||||
// tags: [
|
||||
// { id: "d82fbc78-88de-4015-adec-a7ea832fc922", name: "martuna", slatename: "martuna" },
|
||||
// {
|
||||
// id: "0824a3cb-e839-4246-8ff4-d919919e1487",
|
||||
// name: "bird drinks",
|
||||
// slatename: "bird-drinks",
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// id: "090ae73f-752d-4566-aacc-8d8b2008b628",
|
||||
// ownerId: "5172dd8b-6b11-40d3-8c9f-b4cbaa0eb8e7",
|
||||
// cid: "bafkreicqxymykq3wzpzsrgptqmesnoeuagjv42g53jbz4d37fpigux7k7i",
|
||||
// isPublic: false,
|
||||
// filename: "F1CCCCDE-326D-49DF-A8B4-7DD63095D656_1_105_c.jpeg",
|
||||
// downloadCount: 0,
|
||||
// saveCount: 0,
|
||||
// url: null,
|
||||
// isLink: false,
|
||||
// name: "Pig",
|
||||
// size: 200084,
|
||||
// type: "image/jpeg",
|
||||
// blurhash: null,
|
||||
// tags: [
|
||||
// { id: "d82fbc78-88de-4015-adec-a7ea832fc922", name: "martuna", slatename: "martuna" },
|
||||
// {
|
||||
// id: "0824a3cb-e839-4246-8ff4-d919919e1487",
|
||||
// name: "bird drinks",
|
||||
// slatename: "bird-drinks",
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// ]);
|
||||
// await SearchManager.updateFile([
|
||||
// {
|
||||
// id: "10071abd-95c5-415e-8a12-aa17e7f560cf",
|
||||
// filename: "sunny.jpeg",
|
||||
// name: "sunny.jpeg",
|
||||
// },
|
||||
// {
|
||||
// id: "090ae73f-752d-4566-aacc-8d8b2008b628",
|
||||
// isPublic: true,
|
||||
// },
|
||||
// ]);
|
||||
// await SearchManager.deleteFile([
|
||||
// { id: "10071abd-95c5-415e-8a12-aa17e7f560cf" },
|
||||
// { id: "090ae73f-752d-4566-aacc-8d8b2008b628" },
|
||||
// ]);
|
||||
// await SearchManager.deleteUser({ id: "5172dd8b-6b11-40d3-8c9f-b4cbaa0eb8e7" });
|
||||
// await SearchManager.deleteSlate({ id: "0824a3cb-e839-4246-8ff4-d919919e1487" });
|
||||
}
|
||||
|
||||
async function search() {
|
||||
@ -72,12 +128,12 @@ async function search() {
|
||||
// userId: "5172dd8b-6b11-40d3-8c9f-b4cbaa0eb8e7",
|
||||
// globalSearch: false,
|
||||
// });
|
||||
await SearchManager.searchFile({
|
||||
query: "sunny.jpeg",
|
||||
userId: "f9cc7b00-ce59-4b49-abd1-c7ef7253e258",
|
||||
globalSearch: true,
|
||||
tagIds: ["d82fbc78-88de-4015-adec-a7ea832fc922", "0824a3cb-e839-4246-8ff4-d919919e1487"],
|
||||
});
|
||||
// await SearchManager.searchFile({
|
||||
// query: "pig",
|
||||
// userId: "f9cc7b00-ce59-4b49-abd1-c7ef7253e258",
|
||||
// globalSearch: true,
|
||||
// tagIds: ["d82fbc78-88de-4015-adec-a7ea832fc922", "0824a3cb-e839-4246-8ff4-d919919e1487"],
|
||||
// });
|
||||
}
|
||||
|
||||
Promise.all([manage(), update(), search()]);
|
||||
|
Loading…
Reference in New Issue
Block a user