refactor: update Dockerfile cache identifiers and clean up console logs across multiple services
This commit is contained in:
@@ -14,7 +14,7 @@ export class BusinessActivitiesQueryService {
|
||||
async findAllByConsumer(consumer_id: string, select: BusinessActivitySelect) {
|
||||
const businessActivities = await this.prisma.businessActivity.findMany({
|
||||
where: { consumer_id },
|
||||
select,
|
||||
select: this.baseSelect,
|
||||
})
|
||||
return businessActivities.map(QUERY_CONSTANTS.BUSINESS_ACTIVITIES.mappedData)
|
||||
}
|
||||
@@ -34,9 +34,11 @@ export class BusinessActivitiesQueryService {
|
||||
|
||||
const businessActivity = await this.prisma.businessActivity.findUnique({
|
||||
where: { consumer_id, id },
|
||||
select,
|
||||
select: QUERY_CONSTANTS.BUSINESS_ACTIVITIES.select,
|
||||
})
|
||||
|
||||
console.log('businessActivity', businessActivity)
|
||||
|
||||
return QUERY_CONSTANTS.BUSINESS_ACTIVITIES.mappedData(businessActivity)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@ export function translateEnumValue(
|
||||
enumKey: keyof typeof translates.enums,
|
||||
value: string | null | undefined,
|
||||
): EnumTranslatedValue {
|
||||
console.log(enumKey, value)
|
||||
|
||||
const enumsRegistry = translates.enums as EnumsRegistry
|
||||
const enumMap = enumsRegistry[String(enumKey)]
|
||||
|
||||
|
||||
@@ -64,8 +64,6 @@ async function bootstrap() {
|
||||
.filter(Boolean)
|
||||
: []
|
||||
|
||||
console.log('envOrigins', envOrigins)
|
||||
|
||||
const allowedOrigins = (envOrigins.length ? envOrigins : defaultOrigins).filter(Boolean)
|
||||
|
||||
const isOriginAllowed = (origin: string) => {
|
||||
@@ -77,8 +75,6 @@ async function bootstrap() {
|
||||
const rootDomain = pattern.slice(2)
|
||||
return hostname === rootDomain || hostname.endsWith(`.${rootDomain}`)
|
||||
}
|
||||
console.log('origin', origin, 'pattern', pattern, 'hostname', hostname)
|
||||
console.log(hostname === pattern || origin === pattern)
|
||||
|
||||
return hostname === pattern || origin === pattern
|
||||
})
|
||||
@@ -90,18 +86,14 @@ async function bootstrap() {
|
||||
app.enableCors({
|
||||
origin: (origin, callback) => {
|
||||
if (!origin) {
|
||||
console.log('1')
|
||||
callback(null, true)
|
||||
return
|
||||
}
|
||||
|
||||
if (isOriginAllowed(origin)) {
|
||||
console.log('2')
|
||||
|
||||
callback(null, true)
|
||||
return
|
||||
}
|
||||
console.log('3')
|
||||
|
||||
callback(new Error('Not allowed by CORS'), false)
|
||||
},
|
||||
|
||||
@@ -61,9 +61,7 @@ export class BusinessActivitiesService {
|
||||
consumer_id,
|
||||
this.defaultSelect,
|
||||
)
|
||||
return ResponseMapper.list(
|
||||
businessActivities.map(this.prepareBusinessActivityResponse),
|
||||
)
|
||||
return ResponseMapper.list(businessActivities)
|
||||
}
|
||||
|
||||
async findOne(consumer_id: string, id: string) {
|
||||
@@ -72,7 +70,7 @@ export class BusinessActivitiesService {
|
||||
id,
|
||||
this.defaultSelect,
|
||||
)
|
||||
return ResponseMapper.single(this.prepareBusinessActivityResponse(businessActivity))
|
||||
return ResponseMapper.single(businessActivity)
|
||||
}
|
||||
|
||||
async update(consumer_id: string, id: string, data: any) {
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@ export class PosService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
|
||||
async getInfo(pos_id: string) {
|
||||
console.log('pos_id', pos_id)
|
||||
|
||||
const pos = await this.prisma.pos.findUniqueOrThrow({
|
||||
where: {
|
||||
id: pos_id,
|
||||
|
||||
@@ -80,8 +80,6 @@ export class NamaProviderSwitchAdapter implements IProviderSwitchAdapter {
|
||||
): Promise<TspProviderSendItemResultDto> {
|
||||
const mappedRequest = this.namaProviderUtils.mapToNamaRequestDto(payload)
|
||||
try {
|
||||
console.log(mappedRequest)
|
||||
|
||||
const response = await this.httpClient.request(
|
||||
this.buildSendUrl(),
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user