Skip to content

Commit

Permalink
waiting for uploads service
Browse files Browse the repository at this point in the history
  • Loading branch information
KevLehman committed Dec 19, 2022
1 parent 723c694 commit 2cf1815
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
38 changes: 21 additions & 17 deletions apps/meteor/ee/app/livechat-enterprise/server/api/transcript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@ import { API } from '../../../../../app/api/server';
import { OmnichannelTranscript } from '../../../../../server/sdk';

// This is a public route for testing purposes, this should be updated before merging into develop
API.v1.addRoute('omnichannel/request-transcript', {
async post() {
// Missing:
// Authentication
// Permissions
// Validation
// Actual body parsing
// Room access validation
// etc.
API.v1.addRoute(
'omnichannel/request-transcript',
{ authRequired: false },
{
async post() {
// Missing:
// Authentication
// Permissions
// Validation
// Actual body parsing
// Room access validation
// etc.

// Flow is as follows:
// 1. Call OmnichannelTranscript.requestTranscript()
// 2. OmnichannelTranscript.requestTranscript() calls QueueWorker.queueWork()
// 3. QueueWorker.queueWork() eventually calls PdfWorker.renderToStream()
// 4. PdfWorker.renderToStream() calls QueueWorker.queueWork() when processing ends and file has been uploaded
// 5. QueueWorker.queueWork() eventually calls OmnichannelTranscript.pdfComplete() and it notifies the user
await OmnichannelTranscript.requestTranscript();
// Flow is as follows:
// 1. Call OmnichannelTranscript.requestTranscript()
// 2. OmnichannelTranscript.requestTranscript() calls QueueWorker.queueWork()
// 3. QueueWorker.queueWork() eventually calls PdfWorker.renderToStream()
// 4. PdfWorker.renderToStream() calls QueueWorker.queueWork() when processing ends and file has been uploaded
// 5. QueueWorker.queueWork() eventually calls OmnichannelTranscript.pdfComplete() and it notifies the user
await OmnichannelTranscript.requestTranscript();
},
},
});
);
4 changes: 4 additions & 0 deletions ee/apps/omnichannel-transcript/src/OmnichannelTranscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ export class OmnichannelTranscript extends ServiceClass implements IOmnichannelT
}

async pdfComplete(data: any): Promise<void> {
// Details should be propagated from requestTranscript to here, so we can know where to send the file
// And who to notify (userId requesting)
// Do something with the file
console.log('pdfComplete', data);
// Uploads.sendFileMessage(data.userId, null: store, data.file, { msg: 'We need translation here?' })
// Uploads.sendFileMessage(rocket.cat, null, data.file, 'We need translation here?') // Your PDF has been generated!
}
}

0 comments on commit 2cf1815

Please sign in to comment.