2026-04-06 13:31:40 +03:30
|
|
|
import { ResponseMapper } from '@/common/response/response-mapper'
|
|
|
|
|
import { PrismaService } from '@/prisma/prisma.service'
|
|
|
|
|
import { Injectable } from '@nestjs/common'
|
|
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
|
export class ConsumerService {
|
|
|
|
|
constructor(private readonly prisma: PrismaService) {}
|
|
|
|
|
|
|
|
|
|
async getInfo(consumer_id: string) {
|
2026-04-13 13:21:50 +03:30
|
|
|
const consumer = await this.prisma.consumer.findUniqueOrThrow({
|
2026-04-06 13:31:40 +03:30
|
|
|
where: {
|
|
|
|
|
id: consumer_id,
|
|
|
|
|
},
|
|
|
|
|
select: {
|
|
|
|
|
id: true,
|
|
|
|
|
first_name: true,
|
|
|
|
|
last_name: true,
|
|
|
|
|
mobile_number: true,
|
|
|
|
|
status: true,
|
|
|
|
|
license: {
|
|
|
|
|
select: {
|
|
|
|
|
starts_at: true,
|
|
|
|
|
expires_at: true,
|
|
|
|
|
status: true,
|
|
|
|
|
partner: {
|
|
|
|
|
select: {
|
|
|
|
|
name: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return ResponseMapper.single({
|
|
|
|
|
...consumer,
|
|
|
|
|
full_name: `${consumer?.first_name} ${consumer?.last_name}`,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|