feat: search

This commit is contained in:
opbnq-q
2025-03-15 19:01:28 +07:00
parent 9a7c5ca1fe
commit 11b96dc03e
6 changed files with 44 additions and 3 deletions

View File

@@ -53,6 +53,15 @@ export function GetById(id: number): Promise<$models.Author | null> & { cancel()
return $typingPromise; return $typingPromise;
} }
export function SearchByAllTextFields(phrase: string): Promise<($models.Author | null)[]> & { cancel(): void } {
let $resultPromise = $Call.ByID(3812644109, phrase) as any;
let $typingPromise = $resultPromise.then(($result: any) => {
return $$createType2($result);
}) as any;
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
return $typingPromise;
}
export function SortedByOrder(fieldsSortingOrder: utils$0.SortField[]): Promise<($models.Author | null)[]> & { cancel(): void } { export function SortedByOrder(fieldsSortingOrder: utils$0.SortField[]): Promise<($models.Author | null)[]> & { cancel(): void } {
let $resultPromise = $Call.ByID(3046628691, fieldsSortingOrder) as any; let $resultPromise = $Call.ByID(3046628691, fieldsSortingOrder) as any;
let $typingPromise = $resultPromise.then(($result: any) => { let $typingPromise = $resultPromise.then(($result: any) => {

View File

@@ -53,8 +53,17 @@ export function GetById(id: number): Promise<$models.Comment | null> & { cancel(
return $typingPromise; return $typingPromise;
} }
export function SortedByOrder(fieldsSortOrder: utils$0.SortField[]): Promise<($models.Comment | null)[]> & { cancel(): void } { export function SearchByAllTextFields(phrase: string): Promise<($models.Comment | null)[]> & { cancel(): void } {
let $resultPromise = $Call.ByID(4244533291, fieldsSortOrder) as any; let $resultPromise = $Call.ByID(480333285, phrase) as any;
let $typingPromise = $resultPromise.then(($result: any) => {
return $$createType2($result);
}) as any;
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
return $typingPromise;
}
export function SortedByOrder(fieldsSortingOrder: utils$0.SortField[]): Promise<($models.Comment | null)[]> & { cancel(): void } {
let $resultPromise = $Call.ByID(4244533291, fieldsSortingOrder) as any;
let $typingPromise = $resultPromise.then(($result: any) => { let $typingPromise = $resultPromise.then(($result: any) => {
return $$createType2($result); return $$createType2($result);
}) as any; }) as any;

View File

@@ -53,6 +53,15 @@ export function GetById(id: number): Promise<$models.Post | null> & { cancel():
return $typingPromise; return $typingPromise;
} }
export function SearchByAllTextFields(phrase: string): Promise<($models.Post | null)[]> & { cancel(): void } {
let $resultPromise = $Call.ByID(591521802, phrase) as any;
let $typingPromise = $resultPromise.then(($result: any) => {
return $$createType2($result);
}) as any;
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
return $typingPromise;
}
export function SortedByOrder(fieldsSortOrder: utils$0.SortField[]): Promise<($models.Post | null)[]> & { cancel(): void } { export function SortedByOrder(fieldsSortOrder: utils$0.SortField[]): Promise<($models.Post | null)[]> & { cancel(): void } {
let $resultPromise = $Call.ByID(471862744, fieldsSortOrder) as any; let $resultPromise = $Call.ByID(471862744, fieldsSortOrder) as any;
let $typingPromise = $resultPromise.then(($result: any) => { let $typingPromise = $resultPromise.then(($result: any) => {

View File

@@ -53,6 +53,15 @@ export function GetById(id: number): Promise<$models.PostType | null> & { cancel
return $typingPromise; return $typingPromise;
} }
export function SearchByAllTextFields(phrase: string): Promise<($models.PostType | null)[]> & { cancel(): void } {
let $resultPromise = $Call.ByID(4207540242, phrase) as any;
let $typingPromise = $resultPromise.then(($result: any) => {
return $$createType2($result);
}) as any;
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
return $typingPromise;
}
export function SortedByOrder(fieldsSortOrder: utils$0.SortField[]): Promise<($models.PostType | null)[]> & { cancel(): void } { export function SortedByOrder(fieldsSortOrder: utils$0.SortField[]): Promise<($models.PostType | null)[]> & { cancel(): void } {
let $resultPromise = $Call.ByID(1097313920, fieldsSortOrder) as any; let $resultPromise = $Call.ByID(1097313920, fieldsSortOrder) as any;
let $typingPromise = $resultPromise.then(($result: any) => { let $typingPromise = $resultPromise.then(($result: any) => {

View File

@@ -131,7 +131,7 @@ const validate: Validate<Post> = (entity) => {
}; };
const search = async (input: string) => { const search = async (input: string) => {
items.value = await service.search(input)
} }
const sortOptions = ref(getDefaultSortOptions(scheme)) const sortOptions = ref(getDefaultSortOptions(scheme))

View File

@@ -10,6 +10,7 @@ import type { Post } from "../../bindings/app/internal/services";
import type { IService } from "../types/service.type.ts"; import type { IService } from "../types/service.type.ts";
import type {SortOptions} from "../types/sort-options.type.ts"; import type {SortOptions} from "../types/sort-options.type.ts";
import {SortField} from "../../bindings/app/internal/utils"; import {SortField} from "../../bindings/app/internal/utils";
import { SearchByAllTextFields } from "../../bindings/app/internal/services/postservice.ts";
export default class PostService implements IService<Post> { export default class PostService implements IService<Post> {
async read(id: number) { async read(id: number) {
@@ -39,4 +40,8 @@ export default class PostService implements IService<Post> {
async sort(options: SortOptions<Post>) { async sort(options: SortOptions<Post>) {
return await SortedByOrder(Object.entries(options).map(item => ({Name: item[0], Order: item[1]}))) as Post[] return await SortedByOrder(Object.entries(options).map(item => ({Name: item[0], Order: item[1]}))) as Post[]
} }
async search(input: string): Promise<Post[]> {
return await SearchByAllTextFields(input) as Post[]
}
} }