Skip to content
Snippets Groups Projects

fetchdocumentById in dms

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
189 await logInsertToDocumentsAuditLogs(
190 this.prisma,
191 'document_audit_logs',
192 {
193 logDetails: {
194 document_id: document?.document_id,
195 action: Action.FETCH,
196 performed_by: 'system',
197 performed_at: new Date(),
198 status: Status.FAILURE,
199 error_message: error.message,
200 created_at: new Date(),
201 },
202 },
203 );
204 throw new InternalServerErrorException('Failed to fetch document');
  • 216 *
    217 * @param prisma
    218 * @param model
    219 * @param args
    220 */
    221 export async function logInsertToDocumentsAuditLogs(
    222 prisma: PrismaClient,
    223 model: string,
    224 args: LogInsertionDocumentsAuditLogsArgs,
    225 ): Promise<any> {
    226 const {
    227 logDetails,
    228
    229
    230 } = args;
    231 await prisma[model].create({
  • 124 *
    125 * @param documentId
    126 */
    127 async fetchDocument(documentId: string) {
    128 const document = await this.prisma.documents.findUnique({
    129 where: {document_id: documentId},
    130 });
    131
    132 if (!document) throw new NotFoundException('Document not found');
    133
    134 try {
    135 // const file = await this.fileNetClient.get(document.document_id);//mock
    136 if (document.source === 'FILENET') {
    137 // Mock behavior: randomly return either base64 or presigned URL
    138 const usePresignedUrl =
    139 document.document_link !== null && Math.random() > 0.5;
  • added 1 commit

    • 685bd57a - fetch-document-by-id-review-changes

    Compare with previous version

  • 126 @ApiConsumes('application/json')
    127 @ApiBody({
    128 description: 'Fetch document by id request',
    129 type: FetchDocumentRequestDto,
    130 })
    131 @ApiResponse({
    132 status: 200,
    133 description: 'Document fetched successfully',
    134 type: FetchDocumentResponseDto,
    135 })
    136 async download(
    137 @Body() body: FetchDocumentRequestDto,
    138 ): Promise<FetchDocumentResponseDto> {
    139 const result = await this.documentService.fetchDocument(body.id);
    140 if (!result) {
    141 throw new NotFoundException('Document not found');
  • 125
    126 /**
    127 *
    128 * @param documentId
    129 */
    130 async fetchDocument(documentId: string) {
    131 const document = await this.prisma.documents.findUnique(
    132 {
    133 where: {
    134 document_id: documentId,
    135 },
    136 },
    137 );
    138
    139 if (!document) throw new NotFoundException('Document not found');
  • Manjunath Kumar added 3 commits

    added 3 commits

    • e4413f8a - 1 commit from branch develop-beta
    • 4f8519fa - Merge branch 'develop-beta' of...
    • 8413cabd - fetch-document-by-id-review-changes-1

    Compare with previous version

  • added 1 commit

    • c624c268 - fetch-document-by-id-review-changes-2

    Compare with previous version

  • added 1 commit

    • 2f7f936c - fetch-document-by-id-review-changes-3

    Compare with previous version

  • added 1 commit

    • e24012d5 - fetchdocumentbyid-review-changes-implemented

    Compare with previous version

  • added 1 commit

    • 6a4ac238 - fetchdocumentbyid-review-changes-implemented-1

    Compare with previous version

  • added 1 commit

    • 9224bc2f - fetchdocumentbyid-review-changes-implemented-2

    Compare with previous version

  • added 1 commit

    • 1f0e0b1d - fetchdocumentById- review-changes

    Compare with previous version

  • added 1 commit

    • 57c15b26 - fetch-document-by-id-review-file-changes

    Compare with previous version

  • added 1 commit

    • ae6f778e - fetch-document-by-id-review-sonar-coverage

    Compare with previous version

  • Please register or sign in to reply
    Loading