moves meilisearch indexing to pocketbase
This commit is contained in:
@@ -163,8 +163,6 @@ export async function trails_create(trail: Trail, formData: { [key: string]: any
|
||||
.collection("trails")
|
||||
.update<Trail>(model.id!, { thumbnail: thumbnail }, { expand: "category" });
|
||||
|
||||
index_trail(model);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -243,8 +241,6 @@ export async function trails_update(oldTrail: Trail, newTrail: Trail, formData:
|
||||
|
||||
trail.set(model);
|
||||
|
||||
index_trail(model);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -261,8 +257,6 @@ export async function trails_delete(trail: Trail) {
|
||||
}
|
||||
}
|
||||
|
||||
ms.index('trails').deleteDocument(trail.id!)
|
||||
|
||||
const success = await pb
|
||||
.collection("trails")
|
||||
.delete(trail.id!);
|
||||
@@ -313,6 +307,7 @@ function index_trail(trail: Trail) {
|
||||
ms.index('trails').addDocuments([
|
||||
{
|
||||
"id": trail.id,
|
||||
"author": trail.author,
|
||||
"name": trail.name,
|
||||
"description": trail.description,
|
||||
"location": trail.location,
|
||||
@@ -322,6 +317,7 @@ function index_trail(trail: Trail) {
|
||||
"category": trail.expand.category?.id,
|
||||
"completed": trail.expand.summit_logs?.length > 0,
|
||||
"created": trail.created,
|
||||
"public": trail.public,
|
||||
"_geo": {
|
||||
"lat": trail.lat,
|
||||
"lng": trail.lon,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { regenerateInstance } from "$lib/meilisearch";
|
||||
import { pb } from "$lib/pocketbase";
|
||||
import { type AuthModel } from 'pocketbase';
|
||||
import { writable, type Writable } from "svelte/store";
|
||||
@@ -18,8 +19,10 @@ export async function users_create(user: User) {
|
||||
|
||||
export async function login(user: User) {
|
||||
const authData = await pb.collection('users').authWithPassword(user.email ?? user.username!, user.password);
|
||||
regenerateInstance()
|
||||
}
|
||||
|
||||
export async function logout() {
|
||||
pb.authStore.clear();
|
||||
regenerateInstance()
|
||||
}
|
||||
Reference in New Issue
Block a user