Skip to content

Commit

Permalink
fix: Scanner functions in service and repository classes explicitly t…
Browse files Browse the repository at this point in the history
…yped to public
  • Loading branch information
Axeloooo committed Feb 4, 2024
1 parent 68736b4 commit 39fff2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions backend/src/repositories/scanner.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import ScannerProvider from "../abstracts/scanner.abstract.js";
import { TesseractServiceError } from "../errors/tesseract.error.js";

class ScannerRepository implements ScannerProvider {
getMaterials = (_: string): Tag[] => {
public getMaterials = (_: string): Tag[] => {
throw new Error("Method not implemented.");
};

getTextFromImage = async (imagePath: string): Promise<string> => {
public getTextFromImage = async (imagePath: string): Promise<string> => {
try {
const worker: Tesseract.Worker = await createWorker("eng");
const ret: Tesseract.RecognizeResult = await worker.recognize(imagePath);
Expand Down
4 changes: 2 additions & 2 deletions backend/src/services/scanner.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ScannerService implements ScannerProvider {
this.provider = provider;
}

getMaterials = (text: string): Tag[] => {
public getMaterials = (text: string): Tag[] => {
const regex = /(100|\d{1,2})% *(\b\w+\b)/g;
const matches = text.matchAll(regex);
const scannedTags: Tag[] = [];
Expand All @@ -24,7 +24,7 @@ class ScannerService implements ScannerProvider {
return scannedTags;
};

getTextFromImage = async (imagePath: string): Promise<string> => {
public getTextFromImage = async (imagePath: string): Promise<string> => {
if (!imagePath) {
throw new HttpBadRequestError();
}
Expand Down

0 comments on commit 39fff2a

Please sign in to comment.