structure
This commit is contained in:
parent
8b548f4cdc
commit
1bede21bbb
2
.gitignore
vendored
2
.gitignore
vendored
@ -54,3 +54,5 @@ pids
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
/generated/prisma
|
||||
|
||||
30
docs.md
Normal file
30
docs.md
Normal file
@ -0,0 +1,30 @@
|
||||
3. (Première fois seulement) Faire une synchro complète
|
||||
curl -X POST http://localhost:3001/reporting/sync/full
|
||||
|
||||
|
||||
# Test de santé
|
||||
curl http://localhost:3001
|
||||
|
||||
# Transactions journalières (global)
|
||||
curl http://localhost:3001/reporting/transactions/daily
|
||||
|
||||
# Transactions journalières (par marché)
|
||||
curl "http://localhost:3001/reporting/transactions/daily?merchantPartnerId=1"
|
||||
|
||||
# Transactions hebdomadaires
|
||||
curl http://localhost:3001/reporting/transactions/weekly
|
||||
|
||||
# Transactions mensuelles
|
||||
curl http://localhost:3001/reporting/transactions/monthly
|
||||
|
||||
# Avec dates
|
||||
curl "http://localhost:3001/reporting/transactions/daily?startDate=2024-11-01&endDate=2024-11-30"
|
||||
|
||||
# Subscriptions journalières
|
||||
curl http://localhost:3001/reporting/subscriptions/daily
|
||||
|
||||
# Subscriptions mensuelles par marché
|
||||
curl "http://localhost:3001/reporting/subscriptions/monthly?merchantPartnerId=1"
|
||||
|
||||
# Synchronisation manuelle
|
||||
curl -X POST http://localhost:3001/reporting/sync/full
|
||||
1131
package-lock.json
generated
1131
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
@ -21,8 +21,17 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "^11.0.1",
|
||||
"@nestjs/config": "^4.0.2",
|
||||
"@nestjs/core": "^11.0.1",
|
||||
"@nestjs/mongoose": "^11.0.3",
|
||||
"@nestjs/platform-express": "^11.0.1",
|
||||
"@nestjs/schedule": "^6.0.1",
|
||||
"@prisma/client": "^7.0.1",
|
||||
"class-transformer": "^0.5.1",
|
||||
"class-validator": "^0.14.3",
|
||||
"date-fns": "^4.1.0",
|
||||
"mongoose": "^9.0.0",
|
||||
"prisma": "^7.0.1",
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"rxjs": "^7.8.1"
|
||||
},
|
||||
@ -34,7 +43,7 @@
|
||||
"@nestjs/testing": "^11.0.1",
|
||||
"@types/express": "^5.0.0",
|
||||
"@types/jest": "^30.0.0",
|
||||
"@types/node": "^22.10.7",
|
||||
"@types/node": "^22.19.1",
|
||||
"@types/supertest": "^6.0.2",
|
||||
"eslint": "^9.18.0",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
|
||||
14
prisma.config.ts
Normal file
14
prisma.config.ts
Normal file
@ -0,0 +1,14 @@
|
||||
// This file was generated by Prisma and assumes you have installed the following:
|
||||
// npm install --save-dev prisma dotenv
|
||||
import "dotenv/config";
|
||||
import { defineConfig, env } from "prisma/config";
|
||||
|
||||
export default defineConfig({
|
||||
schema: "prisma/schema.prisma",
|
||||
migrations: {
|
||||
path: "prisma/migrations",
|
||||
},
|
||||
datasource: {
|
||||
url: env("DATABASE_URL"),
|
||||
},
|
||||
});
|
||||
138
prisma/schema.prisma
Normal file
138
prisma/schema.prisma
Normal file
@ -0,0 +1,138 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
||||
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client"
|
||||
output = "../generated/prisma"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
}
|
||||
|
||||
|
||||
model Transaction {
|
||||
id Int @id @default(autoincrement())
|
||||
date DateTime @default(now())
|
||||
amount Float
|
||||
tax Float
|
||||
status TransactionStatus
|
||||
merchantPartnerId Int
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
reversementRequests ReversementRequest[]
|
||||
|
||||
@@map("transactions")
|
||||
}
|
||||
|
||||
enum TransactionStatus {
|
||||
SUCCESS
|
||||
FAILED
|
||||
PENDING
|
||||
}
|
||||
|
||||
enum SubscriptionStatus {
|
||||
ACTIVE
|
||||
TRIAL
|
||||
PENDING
|
||||
SUSPENDED
|
||||
EXPIRED
|
||||
CANCELLED
|
||||
}
|
||||
enum Periodicity {
|
||||
Daily
|
||||
Weekly
|
||||
Monthly
|
||||
OneTime
|
||||
}
|
||||
|
||||
model Subscription {
|
||||
id Int @id @default(autoincrement())
|
||||
externalReference String?
|
||||
periodicity Periodicity
|
||||
startDate DateTime
|
||||
endDate DateTime?
|
||||
amount Float
|
||||
currency String
|
||||
token String
|
||||
status SubscriptionStatus
|
||||
nextPaymentDate DateTime
|
||||
suspendedAt DateTime?
|
||||
merchantPartnerId Int
|
||||
customerId Int
|
||||
planId Int
|
||||
serviceId Int
|
||||
failureCount Int?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
metadata Json?
|
||||
|
||||
@@map("subscriptions")
|
||||
}
|
||||
|
||||
model ReversementRequest {
|
||||
id Int @id @default(autoincrement())
|
||||
externalReference String?
|
||||
startDate DateTime
|
||||
endDate DateTime
|
||||
amount Float
|
||||
tax Float
|
||||
status TransactionStatus
|
||||
transactionId Int
|
||||
paymentId Int?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
metadata Json?
|
||||
|
||||
transaction Transaction @relation(fields: [transactionId], references: [id], onDelete: Cascade)
|
||||
payment Payment? @relation(fields: [paymentId], references: [id])
|
||||
|
||||
@@map("reversement_requests")
|
||||
}
|
||||
|
||||
model Payment {
|
||||
id Int @id @default(autoincrement())
|
||||
externalReference String?
|
||||
reference String?
|
||||
type PaymentType
|
||||
status TransactionStatus
|
||||
merchantPartnerId Int
|
||||
failureReason String?
|
||||
amount Float?
|
||||
currency String
|
||||
completedAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
customerId Int
|
||||
subscriptionId Int?
|
||||
metadata Json?
|
||||
link String?
|
||||
|
||||
reversementRequests ReversementRequest[]
|
||||
|
||||
@@map("payments")
|
||||
}
|
||||
|
||||
enum PaymentType {
|
||||
MM
|
||||
BANK
|
||||
CHEQUE
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
msisdn String @unique
|
||||
userToken String @unique
|
||||
userAlias String
|
||||
operatorId String
|
||||
merchantPartnerId Int
|
||||
country String
|
||||
metadata Json?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
|
||||
0
prisma/seed.ts
Normal file
0
prisma/seed.ts
Normal file
0
src/Dockerfile
Normal file
0
src/Dockerfile
Normal file
0
src/mongodb/mongodb.module.ts
Normal file
0
src/mongodb/mongodb.module.ts
Normal file
0
src/mongodb/schemas/subscription.schema.ts
Normal file
0
src/mongodb/schemas/subscription.schema.ts
Normal file
0
src/mongodb/schemas/transaction.schema.ts
Normal file
0
src/mongodb/schemas/transaction.schema.ts
Normal file
0
src/prisma/prisma.module.ts
Normal file
0
src/prisma/prisma.module.ts
Normal file
0
src/prisma/prisma.service.ts
Normal file
0
src/prisma/prisma.service.ts
Normal file
0
src/reporting/dto/report-query.dto.ts
Normal file
0
src/reporting/dto/report-query.dto.ts
Normal file
0
src/reporting/dto/report-response.dto.ts
Normal file
0
src/reporting/dto/report-response.dto.ts
Normal file
0
src/reporting/reporting.controller.ts
Normal file
0
src/reporting/reporting.controller.ts
Normal file
0
src/reporting/reporting.module.ts
Normal file
0
src/reporting/reporting.module.ts
Normal file
0
src/reporting/reporting.service.ts
Normal file
0
src/reporting/reporting.service.ts
Normal file
0
src/sync/sync.module.ts
Normal file
0
src/sync/sync.module.ts
Normal file
0
src/sync/sync.scheduler.ts
Normal file
0
src/sync/sync.scheduler.ts
Normal file
0
src/sync/sync.service.ts
Normal file
0
src/sync/sync.service.ts
Normal file
Loading…
Reference in New Issue
Block a user