core&ui&elastic: support elastic search and allow search result pagination

This commit is contained in:
undefined committed 2022-03-18 22:48:23 +08:00
1 parent ea6529b523
commit 18fc66ecb7
33 files changed
+411 -244

No files matched your search

+22 -1
View File
@@ -103,6 +103,13 @@ export interface GDoc {
uids: number[];
}
export interface UserPreferenceDoc {
_id: ObjectID;
filename: string;
uid: number;
content: string;
}
export type ownerInfo = { owner: number, maintainer?: number[] };
export type User = import('./model/user').User;
@@ -579,6 +586,7 @@ export interface Collections {
'document.status': any;
'problem': ProblemDoc;
'user': Udoc;
'user.preference': UserPreferenceDoc;
'vuser': VUdoc;
'user.group': GDoc;
'check': any;
@@ -631,11 +639,23 @@ export interface Service {
storage: typeof import('./service/storage'),
}
interface GeoIP {
export interface GeoIP {
provider: string,
lookup: (ip: string, locale?: string) => any,
}
export interface ProblemSearchResponse {
hits: string[];
total: number;
countRelation: 'eq' | 'gte';
}
export interface ProblemSearchOptions {
limit?: number;
skip?: number;
}
export type ProblemSearch = (domainId: string, q: string, options?: ProblemSearchOptions) => Promise<ProblemSearchResponse>;
export interface Lib extends Record<string, any> {
download: typeof import('./lib/download'),
difficulty: typeof import('./lib/difficulty'),
@@ -655,6 +675,7 @@ export interface Lib extends Record<string, any> {
validator: typeof import('./lib/validator'),
template?: any,
geoip?: GeoIP,
problemSearch: ProblemSearch;
}
export interface UI {