mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[feature-136] parse model saber string search to query filter
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { MSGetQuery, MSGetQueryFilter, MSGetQueryFilterType, MSModel } from "shared/models/models/model-saber.model";
|
||||
import { IpcService } from "../ipc.service";
|
||||
import { Observable } from "rxjs";
|
||||
import { MS_QUERY_FILTER_TYPES } from "shared/models/models/constants";
|
||||
|
||||
export class ModelSaberService {
|
||||
|
||||
@@ -41,6 +42,13 @@ export class ModelSaberService {
|
||||
return {type: MSGetQueryFilterType.SearchName, value: trimed, isNegative}
|
||||
}
|
||||
|
||||
const [filterType, filterValue] = trimed.split(":");
|
||||
|
||||
if(MS_QUERY_FILTER_TYPES.includes(filterType as MSGetQueryFilterType)){
|
||||
return {type: filterType as MSGetQueryFilterType, value: filterValue, isNegative}
|
||||
}
|
||||
|
||||
return {type: MSGetQueryFilterType.SearchName, value: trimed, isNegative};
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MSGetSort, MSModelType } from "./model-saber.model";
|
||||
import { MSGetQueryFilterType, MSGetSort, MSModelType } from "./model-saber.model";
|
||||
|
||||
export const MODEL_SABER_URL = "https://modelsaber.com";
|
||||
|
||||
@@ -24,4 +24,6 @@ export const MODEL_FILE_EXTENSIONS = {
|
||||
}
|
||||
|
||||
export const MODEL_TYPES = Array.from(Object.values(MSModelType));
|
||||
export const MS_GET_QUERY_SORTS = Array.from(Object.values(MSGetSort));
|
||||
export const MS_GET_QUERY_SORTS = Array.from(Object.values(MSGetSort));
|
||||
|
||||
export const MS_QUERY_FILTER_TYPES = Array.from(Object.values(MSGetQueryFilterType));
|
||||
Reference in New Issue
Block a user