feat: initial commit

This commit is contained in:
s.esmaeili
2026-09-09 06:46:27 +03:30
commit 0ed6bed028
214 changed files with 20177 additions and 0 deletions
@@ -0,0 +1,23 @@
import { Injectable, NotFoundException } from '@nestjs/common';
import { Prisma } from '@prisma/client';
import { PrismaService } from '../../prisma/prisma.service';
@Injectable()
export class PricingService {
constructor(private readonly prisma: PrismaService) {}
async recordQuote(karatPerMille: number, pricePerGramRial: Prisma.Decimal.Value, source: string) {
return this.prisma.goldPriceQuote.create({
data: { karatPerMille, pricePerGramRial, source },
});
}
async getLatestQuote(karatPerMille: number) {
const quote = await this.prisma.goldPriceQuote.findFirst({
where: { karatPerMille },
orderBy: { quotedAt: 'desc' },
});
if (!quote) throw new NotFoundException(`No gold price quote recorded for ${karatPerMille}‰`);
return quote;
}
}