mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-16 20:59:26 +00:00
wip
This commit is contained in:
@@ -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: [
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user