-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev/textract/service' into codecov
- Loading branch information
Showing
17 changed files
with
2,229 additions
and
191 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
{ | ||
"apps": [ | ||
{ | ||
"name": "api", | ||
"script": "dist/src/main.js", | ||
"instances": 1, | ||
"exec_mode": "cluster" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { TextractController } from './textract.controller'; | ||
|
||
describe('TextractController', () => { | ||
let controller: TextractController; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
controllers: [TextractController], | ||
}).compile(); | ||
|
||
controller = module.get<TextractController>(TextractController); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(controller).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { | ||
Controller, | ||
Post, | ||
Body, | ||
UseInterceptors, | ||
} from '@nestjs/common'; | ||
import { FileInterceptor } from '@nestjs/platform-express'; | ||
import { MarkdownFileDTO } from '../markdown_files/dto/markdown_file.dto'; | ||
import { TextractService } from './textract.service'; | ||
|
||
@Controller('textract') | ||
export class TextractController { | ||
constructor( | ||
private readonly textractService: TextractService, | ||
) {} | ||
@Post('extract_image') | ||
@UseInterceptors(FileInterceptor('file')) | ||
async extractImage( | ||
@Body() fileDTO: MarkdownFileDTO, | ||
ExtractType: string, | ||
) { | ||
const retVal = | ||
await this.textractService.extractDocument( | ||
'sync', | ||
fileDTO, | ||
ExtractType, | ||
); | ||
|
||
console.log(retVal); | ||
|
||
return retVal; | ||
} | ||
|
||
@Post('extract_test') | ||
@UseInterceptors(FileInterceptor('file')) | ||
async extract_test( | ||
@Body() fileDTO: MarkdownFileDTO, | ||
ExtractType: string, | ||
) { | ||
const retVal = | ||
await this.textractService.test_get( | ||
ExtractType, | ||
); | ||
|
||
console.log(retVal); | ||
|
||
return retVal; | ||
} | ||
|
||
@Post('extract_msg') | ||
@UseInterceptors(FileInterceptor('file')) | ||
async extract_msg( | ||
@Body() fileDTO: MarkdownFileDTO, | ||
ExtractType: string, | ||
) { | ||
const retVal = | ||
await this.textractService.test_msg(); | ||
|
||
console.log(retVal); | ||
|
||
return retVal; | ||
} | ||
|
||
@Post('extract_del') | ||
@UseInterceptors(FileInterceptor('file')) | ||
async extract_del( | ||
@Body() fileDTO: MarkdownFileDTO, | ||
ExtractType: string, | ||
) { | ||
const retVal = | ||
await this.textractService.test_del(); | ||
|
||
console.log(retVal); | ||
|
||
return retVal; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { TextractService } from './textract.service'; | ||
|
||
@Module({ | ||
providers: [TextractService] | ||
}) | ||
export class TextractModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { TextractService } from './textract.service'; | ||
|
||
describe('TextractService', () => { | ||
let service: TextractService; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [TextractService], | ||
}).compile(); | ||
|
||
service = module.get<TextractService>(TextractService); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(service).toBeDefined(); | ||
}); | ||
}); |
Oops, something went wrong.