Files
KIS-TOiR/server/src/modules/price-list/price-list.service.ts

36 lines
775 B
TypeScript

import { Injectable } from '@nestjs/common';
import { PrismaService } from '../../prisma/prisma.service';
import { mapPriceList } from '../shared/record-mappers';
@Injectable()
export class PriceListService {
constructor(private readonly prisma: PrismaService) {}
async getRecord() {
const [employee, part] = await Promise.all([
this.prisma.employee.findFirst({
where: {
price: {
not: null,
},
},
orderBy: {
code: 'asc',
},
}),
this.prisma.part.findFirst({
where: {
price: {
not: null,
},
},
orderBy: {
name: 'asc',
},
}),
]);
return mapPriceList(employee?.price, part?.price);
}
}