create license management
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
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) {
|
||||
const consumer = await this.prisma.consumer.findUnique({
|
||||
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}`,
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user