feat: add text to speech api
parent
4ea53f7088
commit
61cbbf81ef
|
@ -49,6 +49,7 @@
|
||||||
"exceljs": "^4.4.0",
|
"exceljs": "^4.4.0",
|
||||||
"fs-extra": "^11.2.0",
|
"fs-extra": "^11.2.0",
|
||||||
"googleapis": "^140.0.0",
|
"googleapis": "^140.0.0",
|
||||||
|
"gtts": "^0.2.1",
|
||||||
"handlebars": "^4.7.8",
|
"handlebars": "^4.7.8",
|
||||||
"mathjs": "^13.0.2",
|
"mathjs": "^13.0.2",
|
||||||
"midtrans-client": "^1.3.1",
|
"midtrans-client": "^1.3.1",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Body, Controller, Get, Param, Post } from '@nestjs/common';
|
import { Body, Controller, Get, Param, Post, Query, Res } from '@nestjs/common';
|
||||||
|
|
||||||
import { MODULE_NAME } from 'src/core/strings/constants/module.constants';
|
import { MODULE_NAME } from 'src/core/strings/constants/module.constants';
|
||||||
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
||||||
|
@ -15,6 +15,9 @@ import { mappingRevertTransaction } from 'src/modules/transaction/transaction/do
|
||||||
import { TransactionType } from 'src/modules/transaction/transaction/constants';
|
import { TransactionType } from 'src/modules/transaction/transaction/constants';
|
||||||
import { QueueModel } from '../../data/models/queue.model';
|
import { QueueModel } from '../../data/models/queue.model';
|
||||||
|
|
||||||
|
import * as Gtts from 'gtts';
|
||||||
|
import { Response } from 'express';
|
||||||
|
|
||||||
@ApiTags(`Queue`)
|
@ApiTags(`Queue`)
|
||||||
@Controller(`v1/${MODULE_NAME.QUEUE}`)
|
@Controller(`v1/${MODULE_NAME.QUEUE}`)
|
||||||
@Public(true)
|
@Public(true)
|
||||||
|
@ -105,6 +108,15 @@ export class QueueController {
|
||||||
return await this.orchestrator.queueOrderItems(id);
|
return await this.orchestrator.queueOrderItems(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get('speech')
|
||||||
|
async speech(
|
||||||
|
@Query('text') text: string,
|
||||||
|
@Res() response: Response,
|
||||||
|
): Promise<void> {
|
||||||
|
const gtts = new Gtts(text, 'id');
|
||||||
|
gtts.stream().pipe(response);
|
||||||
|
}
|
||||||
|
|
||||||
@Get(':id/items/:item_id')
|
@Get(':id/items/:item_id')
|
||||||
async queueItemTickets(
|
async queueItemTickets(
|
||||||
@Param('id') id: string,
|
@Param('id') id: string,
|
||||||
|
|
Loading…
Reference in New Issue