// Module: Schema library models. // ========= Users =========== export interface IUser { id: number | null username: string is_staff: boolean email: string first_name: string last_name: string } export interface ICurrentUser extends Pick { subscriptions: number[] } export interface IUserLoginData extends Pick { password: string } export interface IUserSignupData extends Omit { password: string password2: string } export interface IUserUpdateData extends Omit { } export interface IUserProfile extends Omit { } export interface IUserInfo extends Omit { } export interface IUserUpdatePassword { old_password: string new_password: string } // ========== LibraryItem ============ export enum LibraryItemType { RSFORM = 'rsform', OPERATIONS_SCHEMA = 'oss' } export interface ILibraryItem { id: number item_type: LibraryItemType title: string alias: string comment: string is_common: boolean is_canonical: boolean time_create: string time_update: string owner: number | null } export interface ILibraryUpdateData extends Omit { } // ============= API =============== export function matchLibraryItem(query: string, target: ILibraryItem): boolean { const queryI = query.toUpperCase() if (target.alias.toUpperCase().match(queryI)) { return true } else if (target.title.toUpperCase().match(queryI)) { return true } else { return false } }