This commit is contained in:
2024-03-12 18:28:04 +01:00
parent 7d20d83834
commit d1130b76c3
3 changed files with 22 additions and 25 deletions

View File

@@ -113,7 +113,6 @@ export class CardsRepository {
...queryParams
)) satisfies Array<any>
console.log('123', sqlQuery, queryParams)
const cards: CardWithGrades[] = cardsRaw.map(({ userGrade, ...card }) => ({
...card,
grades: [

View File

@@ -61,8 +61,6 @@ export class DecksRepository {
const result = await this.prisma
.$queryRaw`SELECT MAX(card_count) as "maxCardsCount", MIN(card_count) as "minCardsCount" FROM (SELECT deck.id, COUNT(card.id) as card_count FROM deck LEFT JOIN card ON deck.id = card."deckId" GROUP BY deck.id) AS card_counts;`
console.log(result)
return {
max: Number(result[0].maxCardsCount),
min: Number(result[0].minCardsCount),

View File

@@ -3,28 +3,28 @@ import { PrismaClient } from '@prisma/client'
@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
constructor() {
super({
log: [
{
emit: 'stdout',
level: 'query',
},
{
emit: 'stdout',
level: 'error',
},
{
emit: 'stdout',
level: 'info',
},
{
emit: 'stdout',
level: 'warn',
},
],
})
}
// constructor() {
// super({
// log: [
// {
// emit: 'stdout',
// level: 'query',
// },
// {
// emit: 'stdout',
// level: 'error',
// },
// {
// emit: 'stdout',
// level: 'info',
// },
// {
// emit: 'stdout',
// level: 'warn',
// },
// ],
// })
// }
async onModuleInit() {
await this.$connect()