refactor(document-service): Umbenennung der Methode getDocuments in get für Konsistenz
- Die Methode `getDocuments` in `DocService` wurde in `get` umbenannt, um die Verwendung zu vereinfachen und die Konsistenz der Namensgebung bei allen Abfragemethoden (`getDocumentById`, `getDocumentByName`, `getDocumentByAttributes`) zu verbessern. - Keine Änderungen an der Funktionalität oder dem externen Verhalten.
This commit is contained in:
parent
a88238f209
commit
8c7e18637a
@ -559,5 +559,6 @@ export function _genFile(name: string): Uint8Array | undefined {
|
|||||||
case "report.docx":
|
case "report.docx":
|
||||||
return base64ToUint8Array(_base64.report_docx);
|
return base64ToUint8Array(_base64.report_docx);
|
||||||
default:
|
default:
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ export function DocSearchView() {
|
|||||||
const [docs, setDocs] = useState<Doc[]>([]);
|
const [docs, setDocs] = useState<Doc[]>([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
docService.getDocuments({}).then((res) => {
|
docService.get({}).then((res) => {
|
||||||
setDocs(res);
|
setDocs(res);
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
@ -49,7 +49,7 @@ export function DocSearchView() {
|
|||||||
const [attributes, setAttributes] = useState<Record<string, string>>({});
|
const [attributes, setAttributes] = useState<Record<string, string>>({});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
docService.getDocumentByAttributes(attributes).then(setDocs);
|
docService.getByAttribute(attributes).then(setDocs);
|
||||||
}, [attributes]);
|
}, [attributes]);
|
||||||
|
|
||||||
function setAttribute(name: string, serilizedValue: string) {
|
function setAttribute(name: string, serilizedValue: string) {
|
||||||
|
|||||||
@ -78,7 +78,7 @@ export type DocQuery = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class DocService {
|
class DocService {
|
||||||
getDocuments(query: DocQuery | undefined = undefined): Promise<Doc[]> {
|
get(query: DocQuery | undefined = undefined): Promise<Doc[]> {
|
||||||
let documents = _documents;
|
let documents = _documents;
|
||||||
|
|
||||||
if (query?.id)
|
if (query?.id)
|
||||||
@ -95,16 +95,16 @@ class DocService {
|
|||||||
return Promise.resolve(documents);
|
return Promise.resolve(documents);
|
||||||
}
|
}
|
||||||
|
|
||||||
getDocumentById(id: number): Promise<Doc[]> {
|
getById(id: number): Promise<Doc[]> {
|
||||||
return this.getDocuments({ id: id });
|
return this.get({ id: id });
|
||||||
}
|
}
|
||||||
|
|
||||||
getDocumentByName(name: string): Promise<Doc[]> {
|
getByName(name: string): Promise<Doc[]> {
|
||||||
return this.getDocuments({ name: name });
|
return this.get({ name: name });
|
||||||
}
|
}
|
||||||
|
|
||||||
getDocumentByAttributes(attributes: Record<string, string>): Promise<Doc[]> {
|
getByAttribute(attributes: Record<string, string>): Promise<Doc[]> {
|
||||||
return this.getDocuments({ attributes: attributes });
|
return this.get({ attributes: attributes });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user