refactor: update Dockerfile cache identifiers and clean up console logs across multiple services
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { QUERY_CONSTANTS } from '@/common/queryConstants'
|
||||
import { translateEnumValue } from '@/common/utils'
|
||||
import { TspProviderResponseStatus } from '@/generated/prisma/enums'
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from 'common/response/response-mapper'
|
||||
@@ -6,6 +9,18 @@ import { ResponseMapper } from 'common/response/response-mapper'
|
||||
export class StatisticsService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
|
||||
private readonly invoiceMapper = (invoice: any) => {
|
||||
const { tsp_attempts, ...rest } = invoice || {}
|
||||
|
||||
return {
|
||||
...rest,
|
||||
status: translateEnumValue(
|
||||
'TspProviderResponseStatus',
|
||||
invoice.tsp_attempts?.[0]?.status || TspProviderResponseStatus.NOT_SEND,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
async getInvoices(consumer_id: string) {
|
||||
const startOfToday = new Date()
|
||||
startOfToday.setHours(0, 0, 0, 0)
|
||||
@@ -20,10 +35,7 @@ export class StatisticsService {
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
code: true,
|
||||
total_amount: true,
|
||||
created_at: true,
|
||||
...QUERY_CONSTANTS.SALE_INVOICE.summarySelect,
|
||||
consumer_account: {
|
||||
select: {
|
||||
role: true,
|
||||
@@ -54,6 +66,6 @@ export class StatisticsService {
|
||||
},
|
||||
},
|
||||
})
|
||||
return ResponseMapper.list(invoices)
|
||||
return ResponseMapper.list(invoices.map(this.invoiceMapper))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user