import type { DocumentBody, QueryListOption, Document, db } from "dbtype"; type DBDocument = db.Document; export type { Document, DBDocument }; export interface DocumentAccessor { /** * rescan document * it will update document's metadata and tags from file. */ rescanDocument(c: Document): Promise; /** * find list by option * @returns documents list */ findList: (option?: QueryListOption) => Promise; /** * @returns document if exist, otherwise undefined */ findById: (id: number, tagload?: boolean) => Promise; /** * find by base path and filename. * if you call this function with filename, its return array length is 0 or 1. */ findByPath: (basepath: string, filename?: string) => Promise; /** * find by gid list * @param gid_list * @returns Document list */ findByGidList: (gid_list: number[]) => Promise; /** * find deleted content */ findDeleted: (content_type: string) => Promise; /** * search by in document */ search: (search_word: string) => Promise; /** * update document except tag. */ update: (c: Partial & { id: number }) => Promise; /** * add document */ add: (c: DocumentBody) => Promise; /** * add document list */ addList: (content_list: DocumentBody[]) => Promise; /** * delete document * @returns if it exists, return true. */ del: (id: number) => Promise; /** * @param c Valid Document * @param tagname tag name to add * @returns if success, return true */ addTag: (c: Document, tag_name: string) => Promise; /** * @returns if success, return true */ delTag: (c: Document, tag_name: string) => Promise; /** * get similar document * @returns similar document list */ getSimilarDocument: (c: Document) => Promise; }