Merge pull request #1 from NabilOuldHamou/features/models
Features/models
This commit is contained in:
commit
5af779e6e5
11 changed files with 754 additions and 19 deletions
41
docker-compose.yml
Normal file
41
docker-compose.yml
Normal file
|
@ -0,0 +1,41 @@
|
|||
services:
|
||||
mongodb:
|
||||
image: mongo:latest
|
||||
hostname: mongodb
|
||||
restart: always
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
- MONGO_INITDB_ROOT_USERNAME=temp-root-username
|
||||
- MONGO_INITDB_ROOT_PASSWORD=temp-password
|
||||
- MONGO_INITDB_DATABASE=chat_projetweb
|
||||
ports:
|
||||
- "27017:27017"
|
||||
volumes:
|
||||
- mongo-data:/data/db/
|
||||
- mongo-logs:/var/log/mongodb/
|
||||
networks:
|
||||
- mongodb_network
|
||||
|
||||
redis:
|
||||
image: redis:latest
|
||||
hostname: redis
|
||||
restart: always
|
||||
ports:
|
||||
- "6379:6379"
|
||||
command: redis-server --save 20 1 --loglevel warning
|
||||
environment:
|
||||
- REDIS_PASSWORD=temp-redis-password
|
||||
volumes:
|
||||
- redis-data:/root/redis
|
||||
networks:
|
||||
- redis_network
|
||||
|
||||
networks:
|
||||
mongodb_network:
|
||||
redis_network:
|
||||
|
||||
volumes:
|
||||
mongo-data:
|
||||
mongo-logs:
|
||||
redis-data:
|
|
@ -36,6 +36,10 @@
|
|||
"vite": "^5.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@prisma/client": "^5.22.0",
|
||||
"@types/node": "^22.10.1",
|
||||
"prisma": "^5.22.0",
|
||||
"redis": "^4.7.0",
|
||||
"svelte-radix": "^2.0.1"
|
||||
}
|
||||
}
|
||||
|
|
207
pnpm-lock.yaml
generated
207
pnpm-lock.yaml
generated
|
@ -8,19 +8,31 @@ importers:
|
|||
|
||||
.:
|
||||
dependencies:
|
||||
'@prisma/client':
|
||||
specifier: ^5.22.0
|
||||
version: 5.22.0(prisma@5.22.0)
|
||||
'@types/node':
|
||||
specifier: ^22.10.1
|
||||
version: 22.10.1
|
||||
prisma:
|
||||
specifier: ^5.22.0
|
||||
version: 5.22.0
|
||||
redis:
|
||||
specifier: ^4.7.0
|
||||
version: 4.7.0
|
||||
svelte-radix:
|
||||
specifier: ^2.0.1
|
||||
version: 2.0.1(svelte@5.2.7)
|
||||
devDependencies:
|
||||
'@sveltejs/adapter-auto':
|
||||
specifier: ^3.0.0
|
||||
version: 3.3.1(@sveltejs/kit@2.8.3(@sveltejs/vite-plugin-svelte@4.0.2(svelte@5.2.7)(vite@5.4.11))(svelte@5.2.7)(vite@5.4.11))
|
||||
version: 3.3.1(@sveltejs/kit@2.8.3(@sveltejs/vite-plugin-svelte@4.0.2(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1)))(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1)))
|
||||
'@sveltejs/kit':
|
||||
specifier: ^2.0.0
|
||||
version: 2.8.3(@sveltejs/vite-plugin-svelte@4.0.2(svelte@5.2.7)(vite@5.4.11))(svelte@5.2.7)(vite@5.4.11)
|
||||
version: 2.8.3(@sveltejs/vite-plugin-svelte@4.0.2(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1)))(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1))
|
||||
'@sveltejs/vite-plugin-svelte':
|
||||
specifier: ^4.0.0
|
||||
version: 4.0.2(svelte@5.2.7)(vite@5.4.11)
|
||||
version: 4.0.2(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1))
|
||||
autoprefixer:
|
||||
specifier: ^10.4.20
|
||||
version: 10.4.20(postcss@8.4.49)
|
||||
|
@ -77,7 +89,7 @@ importers:
|
|||
version: 8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.7.2)
|
||||
vite:
|
||||
specifier: ^5.0.3
|
||||
version: 5.4.11
|
||||
version: 5.4.11(@types/node@22.10.1)
|
||||
|
||||
packages:
|
||||
|
||||
|
@ -339,6 +351,59 @@ packages:
|
|||
'@polka/url@1.0.0-next.28':
|
||||
resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==}
|
||||
|
||||
'@prisma/client@5.22.0':
|
||||
resolution: {integrity: sha512-M0SVXfyHnQREBKxCgyo7sffrKttwE6R8PMq330MIUF0pTwjUhLbW84pFDlf06B27XyCR++VtjugEnIHdr07SVA==}
|
||||
engines: {node: '>=16.13'}
|
||||
peerDependencies:
|
||||
prisma: '*'
|
||||
peerDependenciesMeta:
|
||||
prisma:
|
||||
optional: true
|
||||
|
||||
'@prisma/debug@5.22.0':
|
||||
resolution: {integrity: sha512-AUt44v3YJeggO2ZU5BkXI7M4hu9BF2zzH2iF2V5pyXT/lRTyWiElZ7It+bRH1EshoMRxHgpYg4VB6rCM+mG5jQ==}
|
||||
|
||||
'@prisma/engines-version@5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2':
|
||||
resolution: {integrity: sha512-2PTmxFR2yHW/eB3uqWtcgRcgAbG1rwG9ZriSvQw+nnb7c4uCr3RAcGMb6/zfE88SKlC1Nj2ziUvc96Z379mHgQ==}
|
||||
|
||||
'@prisma/engines@5.22.0':
|
||||
resolution: {integrity: sha512-UNjfslWhAt06kVL3CjkuYpHAWSO6L4kDCVPegV6itt7nD1kSJavd3vhgAEhjglLJJKEdJ7oIqDJ+yHk6qO8gPA==}
|
||||
|
||||
'@prisma/fetch-engine@5.22.0':
|
||||
resolution: {integrity: sha512-bkrD/Mc2fSvkQBV5EpoFcZ87AvOgDxbG99488a5cexp5Ccny+UM6MAe/UFkUC0wLYD9+9befNOqGiIJhhq+HbA==}
|
||||
|
||||
'@prisma/get-platform@5.22.0':
|
||||
resolution: {integrity: sha512-pHhpQdr1UPFpt+zFfnPazhulaZYCUqeIcPpJViYoq9R+D/yw4fjE+CtnsnKzPYm0ddUbeXUzjGVGIRVgPDCk4Q==}
|
||||
|
||||
'@redis/bloom@1.2.0':
|
||||
resolution: {integrity: sha512-HG2DFjYKbpNmVXsa0keLHp/3leGJz1mjh09f2RLGGLQZzSHpkmZWuwJbAvo3QcRY8p80m5+ZdXZdYOSBLlp7Cg==}
|
||||
peerDependencies:
|
||||
'@redis/client': ^1.0.0
|
||||
|
||||
'@redis/client@1.6.0':
|
||||
resolution: {integrity: sha512-aR0uffYI700OEEH4gYnitAnv3vzVGXCFvYfdpu/CJKvk4pHfLPEy/JSZyrpQ+15WhXe1yJRXLtfQ84s4mEXnPg==}
|
||||
engines: {node: '>=14'}
|
||||
|
||||
'@redis/graph@1.1.1':
|
||||
resolution: {integrity: sha512-FEMTcTHZozZciLRl6GiiIB4zGm5z5F3F6a6FZCyrfxdKOhFlGkiAqlexWMBzCi4DcRoyiOsuLfW+cjlGWyExOw==}
|
||||
peerDependencies:
|
||||
'@redis/client': ^1.0.0
|
||||
|
||||
'@redis/json@1.0.7':
|
||||
resolution: {integrity: sha512-6UyXfjVaTBTJtKNG4/9Z8PSpKE6XgSyEb8iwaqDcy+uKrd/DGYHTWkUdnQDyzm727V7p21WUMhsqz5oy65kPcQ==}
|
||||
peerDependencies:
|
||||
'@redis/client': ^1.0.0
|
||||
|
||||
'@redis/search@1.2.0':
|
||||
resolution: {integrity: sha512-tYoDBbtqOVigEDMAcTGsRlMycIIjwMCgD8eR2t0NANeQmgK/lvxNAvYyb6bZDD4frHRhIHkJu2TBRvB0ERkOmw==}
|
||||
peerDependencies:
|
||||
'@redis/client': ^1.0.0
|
||||
|
||||
'@redis/time-series@1.1.0':
|
||||
resolution: {integrity: sha512-c1Q99M5ljsIuc4YdaCwfUEXsofakb9c8+Zse2qxTadu8TalLXuAESzLvFAvNVbkmSlvlzIQOLpBCmWI9wTOt+g==}
|
||||
peerDependencies:
|
||||
'@redis/client': ^1.0.0
|
||||
|
||||
'@rollup/rollup-android-arm-eabi@4.27.4':
|
||||
resolution: {integrity: sha512-2Y3JT6f5MrQkICUyRVCw4oa0sutfAsgaSsb0Lmmy1Wi2y7X5vT9Euqw4gOsCyy0YfKURBg35nhUKZS4mDcfULw==}
|
||||
cpu: [arm]
|
||||
|
@ -470,6 +535,9 @@ packages:
|
|||
'@types/json-schema@7.0.15':
|
||||
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
|
||||
|
||||
'@types/node@22.10.1':
|
||||
resolution: {integrity: sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==}
|
||||
|
||||
'@types/unist@2.0.11':
|
||||
resolution: {integrity: sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==}
|
||||
|
||||
|
@ -651,6 +719,10 @@ packages:
|
|||
resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
cluster-key-slot@1.1.2:
|
||||
resolution: {integrity: sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
color-convert@2.0.1:
|
||||
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
|
||||
engines: {node: '>=7.0.0'}
|
||||
|
@ -871,6 +943,10 @@ packages:
|
|||
function-bind@1.1.2:
|
||||
resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
|
||||
|
||||
generic-pool@3.9.0:
|
||||
resolution: {integrity: sha512-hymDOu5B53XvN4QT9dBmZxPX4CWhBPPLguTZ9MMFeFa/Kg0xWVfylOVNlJji/E7yTZWFd/q9GO5TxDLq156D7g==}
|
||||
engines: {node: '>= 4'}
|
||||
|
||||
glob-parent@5.1.2:
|
||||
resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
|
||||
engines: {node: '>= 6'}
|
||||
|
@ -1271,6 +1347,11 @@ packages:
|
|||
prism-svelte@0.4.7:
|
||||
resolution: {integrity: sha512-yABh19CYbM24V7aS7TuPYRNMqthxwbvx6FF/Rw920YbyBWO3tnyPIqRMgHuSVsLmuHkkBS1Akyof463FVdkeDQ==}
|
||||
|
||||
prisma@5.22.0:
|
||||
resolution: {integrity: sha512-vtpjW3XuYCSnMsNVBjLMNkTj6OZbudcPPTPYHqX0CJfpcdWciI1dM8uHETwmDxxiqEwCIE6WvXucWUetJgfu/A==}
|
||||
engines: {node: '>=16.13'}
|
||||
hasBin: true
|
||||
|
||||
prismjs@1.29.0:
|
||||
resolution: {integrity: sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==}
|
||||
engines: {node: '>=6'}
|
||||
|
@ -1293,6 +1374,9 @@ packages:
|
|||
resolution: {integrity: sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA==}
|
||||
engines: {node: '>= 14.16.0'}
|
||||
|
||||
redis@4.7.0:
|
||||
resolution: {integrity: sha512-zvmkHEAdGMn+hMRXuMBtu4Vo5P6rHQjLoHftu+lBqq8ZTA3RCVC/WzD790bkKKiNFp7d5/9PcSD19fJyyRvOdQ==}
|
||||
|
||||
resolve-from@4.0.0:
|
||||
resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
|
||||
engines: {node: '>=4'}
|
||||
|
@ -1471,6 +1555,9 @@ packages:
|
|||
engines: {node: '>=14.17'}
|
||||
hasBin: true
|
||||
|
||||
undici-types@6.20.0:
|
||||
resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==}
|
||||
|
||||
unist-util-stringify-position@2.0.3:
|
||||
resolution: {integrity: sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==}
|
||||
|
||||
|
@ -1545,6 +1632,9 @@ packages:
|
|||
resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
yallist@4.0.0:
|
||||
resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
|
||||
|
||||
yaml@1.10.2:
|
||||
resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==}
|
||||
engines: {node: '>= 6'}
|
||||
|
@ -1759,6 +1849,57 @@ snapshots:
|
|||
|
||||
'@polka/url@1.0.0-next.28': {}
|
||||
|
||||
'@prisma/client@5.22.0(prisma@5.22.0)':
|
||||
optionalDependencies:
|
||||
prisma: 5.22.0
|
||||
|
||||
'@prisma/debug@5.22.0': {}
|
||||
|
||||
'@prisma/engines-version@5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2': {}
|
||||
|
||||
'@prisma/engines@5.22.0':
|
||||
dependencies:
|
||||
'@prisma/debug': 5.22.0
|
||||
'@prisma/engines-version': 5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2
|
||||
'@prisma/fetch-engine': 5.22.0
|
||||
'@prisma/get-platform': 5.22.0
|
||||
|
||||
'@prisma/fetch-engine@5.22.0':
|
||||
dependencies:
|
||||
'@prisma/debug': 5.22.0
|
||||
'@prisma/engines-version': 5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2
|
||||
'@prisma/get-platform': 5.22.0
|
||||
|
||||
'@prisma/get-platform@5.22.0':
|
||||
dependencies:
|
||||
'@prisma/debug': 5.22.0
|
||||
|
||||
'@redis/bloom@1.2.0(@redis/client@1.6.0)':
|
||||
dependencies:
|
||||
'@redis/client': 1.6.0
|
||||
|
||||
'@redis/client@1.6.0':
|
||||
dependencies:
|
||||
cluster-key-slot: 1.1.2
|
||||
generic-pool: 3.9.0
|
||||
yallist: 4.0.0
|
||||
|
||||
'@redis/graph@1.1.1(@redis/client@1.6.0)':
|
||||
dependencies:
|
||||
'@redis/client': 1.6.0
|
||||
|
||||
'@redis/json@1.0.7(@redis/client@1.6.0)':
|
||||
dependencies:
|
||||
'@redis/client': 1.6.0
|
||||
|
||||
'@redis/search@1.2.0(@redis/client@1.6.0)':
|
||||
dependencies:
|
||||
'@redis/client': 1.6.0
|
||||
|
||||
'@redis/time-series@1.1.0(@redis/client@1.6.0)':
|
||||
dependencies:
|
||||
'@redis/client': 1.6.0
|
||||
|
||||
'@rollup/rollup-android-arm-eabi@4.27.4':
|
||||
optional: true
|
||||
|
||||
|
@ -1813,14 +1954,14 @@ snapshots:
|
|||
'@rollup/rollup-win32-x64-msvc@4.27.4':
|
||||
optional: true
|
||||
|
||||
'@sveltejs/adapter-auto@3.3.1(@sveltejs/kit@2.8.3(@sveltejs/vite-plugin-svelte@4.0.2(svelte@5.2.7)(vite@5.4.11))(svelte@5.2.7)(vite@5.4.11))':
|
||||
'@sveltejs/adapter-auto@3.3.1(@sveltejs/kit@2.8.3(@sveltejs/vite-plugin-svelte@4.0.2(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1)))(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1)))':
|
||||
dependencies:
|
||||
'@sveltejs/kit': 2.8.3(@sveltejs/vite-plugin-svelte@4.0.2(svelte@5.2.7)(vite@5.4.11))(svelte@5.2.7)(vite@5.4.11)
|
||||
'@sveltejs/kit': 2.8.3(@sveltejs/vite-plugin-svelte@4.0.2(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1)))(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1))
|
||||
import-meta-resolve: 4.1.0
|
||||
|
||||
'@sveltejs/kit@2.8.3(@sveltejs/vite-plugin-svelte@4.0.2(svelte@5.2.7)(vite@5.4.11))(svelte@5.2.7)(vite@5.4.11)':
|
||||
'@sveltejs/kit@2.8.3(@sveltejs/vite-plugin-svelte@4.0.2(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1)))(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1))':
|
||||
dependencies:
|
||||
'@sveltejs/vite-plugin-svelte': 4.0.2(svelte@5.2.7)(vite@5.4.11)
|
||||
'@sveltejs/vite-plugin-svelte': 4.0.2(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1))
|
||||
'@types/cookie': 0.6.0
|
||||
cookie: 0.6.0
|
||||
devalue: 5.1.1
|
||||
|
@ -1834,27 +1975,27 @@ snapshots:
|
|||
sirv: 3.0.0
|
||||
svelte: 5.2.7
|
||||
tiny-glob: 0.2.9
|
||||
vite: 5.4.11
|
||||
vite: 5.4.11(@types/node@22.10.1)
|
||||
|
||||
'@sveltejs/vite-plugin-svelte-inspector@3.0.1(@sveltejs/vite-plugin-svelte@4.0.2(svelte@5.2.7)(vite@5.4.11))(svelte@5.2.7)(vite@5.4.11)':
|
||||
'@sveltejs/vite-plugin-svelte-inspector@3.0.1(@sveltejs/vite-plugin-svelte@4.0.2(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1)))(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1))':
|
||||
dependencies:
|
||||
'@sveltejs/vite-plugin-svelte': 4.0.2(svelte@5.2.7)(vite@5.4.11)
|
||||
'@sveltejs/vite-plugin-svelte': 4.0.2(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1))
|
||||
debug: 4.3.7
|
||||
svelte: 5.2.7
|
||||
vite: 5.4.11
|
||||
vite: 5.4.11(@types/node@22.10.1)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@sveltejs/vite-plugin-svelte@4.0.2(svelte@5.2.7)(vite@5.4.11)':
|
||||
'@sveltejs/vite-plugin-svelte@4.0.2(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1))':
|
||||
dependencies:
|
||||
'@sveltejs/vite-plugin-svelte-inspector': 3.0.1(@sveltejs/vite-plugin-svelte@4.0.2(svelte@5.2.7)(vite@5.4.11))(svelte@5.2.7)(vite@5.4.11)
|
||||
'@sveltejs/vite-plugin-svelte-inspector': 3.0.1(@sveltejs/vite-plugin-svelte@4.0.2(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1)))(svelte@5.2.7)(vite@5.4.11(@types/node@22.10.1))
|
||||
debug: 4.3.7
|
||||
deepmerge: 4.3.1
|
||||
kleur: 4.1.5
|
||||
magic-string: 0.30.13
|
||||
svelte: 5.2.7
|
||||
vite: 5.4.11
|
||||
vitefu: 1.0.3(vite@5.4.11)
|
||||
vite: 5.4.11(@types/node@22.10.1)
|
||||
vitefu: 1.0.3(vite@5.4.11(@types/node@22.10.1))
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
|
@ -1868,6 +2009,10 @@ snapshots:
|
|||
|
||||
'@types/json-schema@7.0.15': {}
|
||||
|
||||
'@types/node@22.10.1':
|
||||
dependencies:
|
||||
undici-types: 6.20.0
|
||||
|
||||
'@types/unist@2.0.11': {}
|
||||
|
||||
'@typescript-eslint/eslint-plugin@8.15.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.7.2))(eslint@9.15.0(jiti@1.21.6))(typescript@5.7.2)':
|
||||
|
@ -2064,6 +2209,8 @@ snapshots:
|
|||
|
||||
clsx@2.1.1: {}
|
||||
|
||||
cluster-key-slot@1.1.2: {}
|
||||
|
||||
color-convert@2.0.1:
|
||||
dependencies:
|
||||
color-name: 1.1.4
|
||||
|
@ -2308,6 +2455,8 @@ snapshots:
|
|||
|
||||
function-bind@1.1.2: {}
|
||||
|
||||
generic-pool@3.9.0: {}
|
||||
|
||||
glob-parent@5.1.2:
|
||||
dependencies:
|
||||
is-glob: 4.0.3
|
||||
|
@ -2591,6 +2740,12 @@ snapshots:
|
|||
|
||||
prism-svelte@0.4.7: {}
|
||||
|
||||
prisma@5.22.0:
|
||||
dependencies:
|
||||
'@prisma/engines': 5.22.0
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.3
|
||||
|
||||
prismjs@1.29.0: {}
|
||||
|
||||
punycode@2.3.1: {}
|
||||
|
@ -2607,6 +2762,15 @@ snapshots:
|
|||
|
||||
readdirp@4.0.2: {}
|
||||
|
||||
redis@4.7.0:
|
||||
dependencies:
|
||||
'@redis/bloom': 1.2.0(@redis/client@1.6.0)
|
||||
'@redis/client': 1.6.0
|
||||
'@redis/graph': 1.1.1(@redis/client@1.6.0)
|
||||
'@redis/json': 1.0.7(@redis/client@1.6.0)
|
||||
'@redis/search': 1.2.0(@redis/client@1.6.0)
|
||||
'@redis/time-series': 1.1.0(@redis/client@1.6.0)
|
||||
|
||||
resolve-from@4.0.0: {}
|
||||
|
||||
resolve@1.22.8:
|
||||
|
@ -2829,6 +2993,8 @@ snapshots:
|
|||
|
||||
typescript@5.7.2: {}
|
||||
|
||||
undici-types@6.20.0: {}
|
||||
|
||||
unist-util-stringify-position@2.0.3:
|
||||
dependencies:
|
||||
'@types/unist': 2.0.11
|
||||
|
@ -2850,17 +3016,18 @@ snapshots:
|
|||
'@types/unist': 2.0.11
|
||||
unist-util-stringify-position: 2.0.3
|
||||
|
||||
vite@5.4.11:
|
||||
vite@5.4.11(@types/node@22.10.1):
|
||||
dependencies:
|
||||
esbuild: 0.21.5
|
||||
postcss: 8.4.49
|
||||
rollup: 4.27.4
|
||||
optionalDependencies:
|
||||
'@types/node': 22.10.1
|
||||
fsevents: 2.3.3
|
||||
|
||||
vitefu@1.0.3(vite@5.4.11):
|
||||
vitefu@1.0.3(vite@5.4.11(@types/node@22.10.1)):
|
||||
optionalDependencies:
|
||||
vite: 5.4.11
|
||||
vite: 5.4.11(@types/node@22.10.1)
|
||||
|
||||
which@2.0.2:
|
||||
dependencies:
|
||||
|
@ -2880,6 +3047,8 @@ snapshots:
|
|||
string-width: 5.1.2
|
||||
strip-ansi: 7.1.0
|
||||
|
||||
yallist@4.0.0: {}
|
||||
|
||||
yaml@1.10.2: {}
|
||||
|
||||
yaml@2.6.1: {}
|
||||
|
|
51
prisma/schema.prisma
Normal file
51
prisma/schema.prisma
Normal file
|
@ -0,0 +1,51 @@
|
|||
// 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-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "mongodb"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid()) @map("_id") @db.ObjectId
|
||||
username String @unique
|
||||
surname String
|
||||
name String
|
||||
email String @unique
|
||||
password String
|
||||
channels Channel[] @relation(fields: [channelIDs], references: [id])
|
||||
channelIDs String[] @db.ObjectId
|
||||
messages Message[]
|
||||
|
||||
@@map("users") // Table name in DB
|
||||
}
|
||||
|
||||
model Channel {
|
||||
id String @id @default(cuid()) @map("_id") @db.ObjectId
|
||||
name String
|
||||
topic String
|
||||
users User[] @relation(fields: [userIDs], references: [id])
|
||||
userIDs String[] @db.ObjectId
|
||||
messages Message[]
|
||||
|
||||
@@map("channels") // Table name in DB
|
||||
}
|
||||
|
||||
model Message {
|
||||
id String @id @default(cuid()) @map("_id") @db.ObjectId
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId String @db.ObjectId
|
||||
channel Channel @relation(fields: [channelId], references: [id])
|
||||
channelId String @db.ObjectId
|
||||
text String
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@map("messages") // Table name in DB
|
||||
}
|
4
src/lib/prismaClient.ts
Normal file
4
src/lib/prismaClient.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
export default prisma;
|
11
src/lib/redisClient.ts
Normal file
11
src/lib/redisClient.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { createClient } from 'redis';
|
||||
|
||||
const client = await createClient({
|
||||
url: process.env.REDIS_URL || 'redis://localhost:6379'
|
||||
});
|
||||
|
||||
client.on('error', (err) => console.error('Redis Error:', err));
|
||||
|
||||
await client.connect();
|
||||
|
||||
export default client;
|
124
src/routes/api/canal/[id]/+server.ts
Normal file
124
src/routes/api/canal/[id]/+server.ts
Normal file
|
@ -0,0 +1,124 @@
|
|||
import { json } from '@sveltejs/kit';
|
||||
import prisma from '$lib/prismaClient';
|
||||
import redisClient from '$lib/redisClient';
|
||||
|
||||
// Récupérer les informations du canal et le dernier message (avec cache Redis)
|
||||
export async function GET({ params }) {
|
||||
const canalId = parseInt(params.id);
|
||||
|
||||
// Clé cache pour les informations du canal et le dernier message
|
||||
const canalCacheKey = `canal:${canalId}:info`;
|
||||
|
||||
try {
|
||||
// Vérifier si les informations du canal et le dernier message sont dans le cache Redis
|
||||
const cachedCanalData = await redisClient.get(canalCacheKey);
|
||||
if (cachedCanalData) {
|
||||
console.log('✅ Cache hit pour les informations du canal et le dernier message');
|
||||
return json(JSON.parse(cachedCanalData));
|
||||
}
|
||||
|
||||
console.log('❌ Cache miss');
|
||||
// Si non, récupérer les informations du canal et le dernier message depuis Prisma
|
||||
const canal = await prisma.canal.findUnique({
|
||||
where: { id: canalId },
|
||||
include: {
|
||||
users: true, // Inclut les utilisateurs associés au canal
|
||||
},
|
||||
});
|
||||
|
||||
if (!canal) {
|
||||
return json({ error: 'Canal non trouvé' }, { status: 404 });
|
||||
}
|
||||
|
||||
// Récupérer le dernier message
|
||||
const lastMessage = await prisma.message.findFirst({
|
||||
where: { canalId },
|
||||
include: {
|
||||
user: { select: { id: true, pseudo: true } },
|
||||
},
|
||||
orderBy: { createdAt: 'desc' }, // Trie par date décroissante, donc le dernier message est récupéré en premier
|
||||
});
|
||||
|
||||
// Créer un objet combiné pour le canal et le dernier message
|
||||
const canalData = {
|
||||
canal,
|
||||
lastMessage, // Inclure uniquement le dernier message
|
||||
};
|
||||
|
||||
// Mettre en cache les informations du canal et le dernier message pendant 5 minutes
|
||||
await redisClient.set(canalCacheKey, JSON.stringify(canalData), {EX: 300, NX: true}); // Cache pendant 5 minutes
|
||||
|
||||
|
||||
console.log('❌ Cache miss - Mise en cache des résultats');
|
||||
return json(canalData);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return json({ error: 'Erreur lors de la récupération du canal ou du dernier message' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
// Supprimer un canal et invalider le cache associé
|
||||
export async function DELETE({ params }) {
|
||||
const canalId = parseInt(params.id);
|
||||
|
||||
try {
|
||||
// Supprimer le canal de la base de données
|
||||
await prisma.canal.delete({
|
||||
where: { id: canalId },
|
||||
});
|
||||
|
||||
// Invalider le cache
|
||||
await redisClient.del(`canal:${canalId}:info`);
|
||||
|
||||
return json({ message: 'Canal supprimé avec succès' });
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return json({ error: 'Erreur lors de la suppression du canal' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
// Modifier un canal
|
||||
export async function PUT({ params, request }) {
|
||||
const canalId = parseInt(params.id);
|
||||
const { nom, domaine } = await request.json(); // On suppose que ce sont les champs à mettre à jour
|
||||
|
||||
// Clé cache pour les informations du canal et le dernier message
|
||||
const canalCacheKey = `canal:${canalId}:info`;
|
||||
|
||||
try {
|
||||
// Mettre à jour les informations du canal dans la base de données
|
||||
const updatedCanal = await prisma.canal.update({
|
||||
where: { id: canalId },
|
||||
data: {
|
||||
nom, // Nom du canal
|
||||
domaine, // Domaine du canal
|
||||
},
|
||||
include: {
|
||||
users: true, // Inclut les utilisateurs associés au canal
|
||||
},
|
||||
});
|
||||
|
||||
// Récupérer le dernier message associé au canal après mise à jour
|
||||
const lastMessage = await prisma.message.findFirst({
|
||||
where: { canalId },
|
||||
include: {
|
||||
user: { select: { id: true, pseudo: true } },
|
||||
},
|
||||
orderBy: { createdAt: 'desc' },
|
||||
});
|
||||
|
||||
// Créer un objet combiné pour les nouvelles informations du canal et le dernier message
|
||||
const canalData = {
|
||||
canal: updatedCanal,
|
||||
lastMessage, // Inclure uniquement le dernier message
|
||||
};
|
||||
|
||||
// Mettre en cache les nouvelles informations pendant 5 minutes
|
||||
await redisClient.set(canalCacheKey, JSON.stringify(canalData), { EX: 300, NX: true });
|
||||
|
||||
return json(canalData);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return json({ error: 'Erreur lors de la mise à jour du canal' }, { status: 500 });
|
||||
}
|
||||
}
|
149
src/routes/api/canal/[id]/messages/+server.ts
Normal file
149
src/routes/api/canal/[id]/messages/+server.ts
Normal file
|
@ -0,0 +1,149 @@
|
|||
import { json } from '@sveltejs/kit';
|
||||
import prisma from '$lib/prismaClient';
|
||||
import redisClient from '$lib/redisClient'; // Assure-toi d'importer ton client Redis
|
||||
|
||||
export async function GET({ params, url }) {
|
||||
const canalId = parseInt(params.id);
|
||||
|
||||
// Gestion de la pagination avec des paramètres optionnels `page` et `limit`
|
||||
const page = parseInt(url.searchParams.get('page')) || 1;
|
||||
const limit = parseInt(url.searchParams.get('limit')) || 10;
|
||||
const offset = (page - 1) * limit;
|
||||
|
||||
// Générer une clé cache Redis unique en fonction du canal et des paramètres de pagination
|
||||
const cacheKey = `canal:${canalId}:messages:page:${page}:limit:${limit}`;
|
||||
|
||||
try {
|
||||
// 1. Vérifier si les messages sont déjà dans le cache Redis
|
||||
const cachedMessages = await redisClient.get(cacheKey);
|
||||
if (cachedMessages) {
|
||||
console.log('✅ Cache hit');
|
||||
return json(JSON.parse(cachedMessages)); // Si les données sont en cache, les retourner
|
||||
}
|
||||
|
||||
// 2. Si les messages ne sont pas en cache, récupérer depuis la base de données
|
||||
const messages = await prisma.message.findMany({
|
||||
where: { canalId },
|
||||
include: {
|
||||
user: {
|
||||
select: { id: true, pseudo: true }, // Inclut uniquement l’ID et le pseudo de l’utilisateur
|
||||
},
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'asc', // Trie par date croissante
|
||||
},
|
||||
skip: offset,
|
||||
take: limit,
|
||||
});
|
||||
|
||||
// 3. Compter le nombre total de messages pour la pagination
|
||||
const totalMessages = await prisma.message.count({
|
||||
where: { canalId },
|
||||
});
|
||||
|
||||
const response = {
|
||||
messages,
|
||||
pagination: {
|
||||
page,
|
||||
limit,
|
||||
totalMessages,
|
||||
totalPages: Math.ceil(totalMessages / limit),
|
||||
},
|
||||
};
|
||||
|
||||
// 4. Mettre en cache les messages avec une expiration (par exemple 5 minutes)
|
||||
await redisClient.set(cacheKey, JSON.stringify(response), 'EX', 60 * 5); // Cache pendant 5 minutes
|
||||
|
||||
console.log('❌ Cache miss - Mise en cache des résultats');
|
||||
return json(response); // Retourner les données récupérées
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return json({ error: 'Erreur lors de la récupération des messages' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
export async function POST({ params, request }) {
|
||||
const canalId = parseInt(params.id);
|
||||
const { userId, text } = await request.json();
|
||||
|
||||
try {
|
||||
// Créer un nouveau message dans la base de données
|
||||
const newMessage = await prisma.message.create({
|
||||
data: {
|
||||
userId,
|
||||
canalId,
|
||||
text,
|
||||
},
|
||||
include: { user: { select: { id: true, pseudo: true } } },
|
||||
});
|
||||
|
||||
updateCaches(); // Mettre à jour les caches après la création d’un nouveau message
|
||||
|
||||
return json(newMessage, { status: 201 });
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return json({ error: 'Erreur lors de la création du message' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
export async function DELETE({ params }) {
|
||||
const messageId = parseInt(params.id);
|
||||
|
||||
try {
|
||||
// Supprimer le message de la base de données
|
||||
await prisma.message.delete({
|
||||
where: { id: messageId },
|
||||
});
|
||||
|
||||
updateCaches(); // Mettre à jour les caches après la suppression d’un message
|
||||
|
||||
return json({ message: 'Message supprimé avec succès' });
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return json({ error: 'Erreur lors de la suppression du message' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
// Fonction pour mettre à jour tous les caches des messages
|
||||
function updateCaches(canalId) {
|
||||
// Mettre à jour tous les caches
|
||||
// Mettre à jour toutes les pages dans le cache
|
||||
let page : number = 1;
|
||||
let limit : number = 10;
|
||||
let offset : number = (page - 1) * limit;
|
||||
while (true) {
|
||||
const cacheKey = `canal:${canalId}:messages:page:${page}:limit:${limit}`;
|
||||
const cachedMessages = await redisClient.get(cacheKey);
|
||||
if (!cachedMessages) {
|
||||
break;
|
||||
}
|
||||
const totalMessages = await prisma.message.count({
|
||||
where: { canalId },
|
||||
});
|
||||
const messages = await prisma.message.findMany({
|
||||
where: { canalId },
|
||||
include: {
|
||||
user: {
|
||||
select: { id: true, pseudo: true },
|
||||
},
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'asc',
|
||||
},
|
||||
skip: offset,
|
||||
take: limit,
|
||||
});
|
||||
const response = {
|
||||
messages,
|
||||
pagination: {
|
||||
page,
|
||||
limit,
|
||||
totalMessages,
|
||||
totalPages: Math.ceil(totalMessages / limit),
|
||||
},
|
||||
};
|
||||
await redisClient.set(cacheKey, JSON.stringify(response), 'EX', 60 * 5);
|
||||
page++;
|
||||
offset = (page - 1) * limit;
|
||||
}
|
||||
}
|
47
src/routes/api/canals/+server.ts
Normal file
47
src/routes/api/canals/+server.ts
Normal file
|
@ -0,0 +1,47 @@
|
|||
import { json } from '@sveltejs/kit';
|
||||
import prisma from '$lib/prismaClient';
|
||||
import redisClient from '$lib/redisClient';
|
||||
|
||||
// GET: Liste tous les canaux
|
||||
export async function GET() {
|
||||
try {
|
||||
const cachedCanaux = await redisClient.get('canaux');
|
||||
if (cachedCanaux) {
|
||||
console.log('✅ Cache hit');
|
||||
return json(JSON.parse(cachedCanaux));
|
||||
}
|
||||
|
||||
console.log('❌ Cache miss');
|
||||
const canaux = await prisma.canal.findMany({
|
||||
include: { users: true, messages: true }, // Inclut les relations
|
||||
});
|
||||
|
||||
await redisClient.set('canaux', JSON.stringify(canaux), { EX: 600 }); // Met en cache
|
||||
return json(canaux);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return json({ error: 'Erreur serveur' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
export async function POST({ request }) {
|
||||
const { nom, domaine, userIds } = await request.json();
|
||||
|
||||
try {
|
||||
const canal = await prisma.canal.create({
|
||||
data: {
|
||||
nom,
|
||||
domaine,
|
||||
users: {
|
||||
connect: userIds.map((id) => ({ id })), // Associe des utilisateurs au canal
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return json(canal, { status: 201 });
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return json({ error: 'Erreur lors de la création du canal' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
108
src/routes/api/user/[id]/+server.ts
Normal file
108
src/routes/api/user/[id]/+server.ts
Normal file
|
@ -0,0 +1,108 @@
|
|||
import { json } from '@sveltejs/kit';
|
||||
import redisClient from '$lib/redisClient';
|
||||
import prisma from '$lib/prismaClient';
|
||||
|
||||
export async function GET({ params }) {
|
||||
const userId = params.id;
|
||||
|
||||
try {
|
||||
// Vérifier si l'utilisateur est dans le cache Redis
|
||||
const cachedUser = await redisClient.get(`user:${userId}`);
|
||||
if (cachedUser) {
|
||||
console.log('✅ Cache hit');
|
||||
return json(JSON.parse(cachedUser));
|
||||
}
|
||||
|
||||
console.log('❌ Cache miss');
|
||||
// Si non, récupérer depuis MongoDB via Prisma
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { id: parseInt(userId) },
|
||||
});
|
||||
|
||||
if (!user) {
|
||||
return json({ error: 'Utilisateur non trouvé' }, { status: 404 });
|
||||
}
|
||||
|
||||
// Mettre l'utilisateur en cache
|
||||
await redisClient.set(`user:${userId}`, JSON.stringify(user), { EX: 3600 });
|
||||
|
||||
return json(user);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return json({ error: 'Erreur serveur' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
export async function POST({ request }) {
|
||||
const { pseudo, nom, prenom, email, password } = await request.json();
|
||||
|
||||
try {
|
||||
const user = await prisma.user.create({
|
||||
data: {
|
||||
pseudo,
|
||||
nom,
|
||||
prenom,
|
||||
email,
|
||||
password,
|
||||
},
|
||||
});
|
||||
|
||||
// Mettre le nouvel utilisateur dans le cache
|
||||
await redisClient.set(`user:${user.id}`, JSON.stringify(user), { EX: 3600 });
|
||||
|
||||
return json(user, { status: 201 });
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return json({ error: 'Erreur lors de la création de l’utilisateur' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
// Mettre à jour un utilisateur avec PUT
|
||||
export async function PUT({ params, request }) {
|
||||
const userId = parseInt(params.id);
|
||||
const { pseudo, nom, prenom, email, password } = await request.json(); // Assurez-vous d'envoyer tous les champs nécessaires dans le body
|
||||
|
||||
try {
|
||||
// Mettre à jour l'utilisateur dans la base de données
|
||||
const updatedUser = await prisma.user.update({
|
||||
where: { id: userId },
|
||||
data: {
|
||||
pseudo,
|
||||
nom,
|
||||
prenom,
|
||||
email,
|
||||
password, // Attention à ne pas oublier de sécuriser le mot de passe avec bcrypt ou une autre méthode
|
||||
},
|
||||
});
|
||||
|
||||
// Mettre à jour l'utilisateur dans le cache Redis
|
||||
await redisClient.set(`user:${userId}`, JSON.stringify(updatedUser), 'EX', 3600); // Cache pendant 1 heure (3600 secondes)
|
||||
|
||||
return json(updatedUser);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return json({ error: 'Erreur lors de la mise à jour de l’utilisateur' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function DELETE({ params }) {
|
||||
const userId = parseInt(params.id);
|
||||
|
||||
try {
|
||||
await prisma.user.delete({
|
||||
where: { id: userId },
|
||||
});
|
||||
|
||||
// Supprimer l'utilisateur du cache Redis
|
||||
await redisClient.del(`user:${userId}`);
|
||||
|
||||
return json({ message: 'Utilisateur supprimé avec succès' });
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return json({ error: 'Erreur lors de la suppression de l’utilisateur' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
27
src/routes/api/users/+server.ts
Normal file
27
src/routes/api/users/+server.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
// src/routes/api/users/+server.js
|
||||
import { json } from '@sveltejs/kit';
|
||||
import redisClient from '$lib/redisClient';
|
||||
import prisma from '$lib/prismaClient';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
// Vérifier si les utilisateurs sont dans le cache Redis
|
||||
const cachedUsers = await redisClient.get('users');
|
||||
if (cachedUsers) {
|
||||
console.log('✅ Cache hit');
|
||||
return json(JSON.parse(cachedUsers));
|
||||
}
|
||||
|
||||
console.log('❌ Cache miss');
|
||||
// Sinon, récupérer les utilisateurs depuis MongoDB
|
||||
const users = await prisma.user.findMany();
|
||||
|
||||
// Mettre les utilisateurs en cache
|
||||
await redisClient.set('users', JSON.stringify(users), { EX: 600 });
|
||||
|
||||
return json(users);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return json({ error: 'Erreur serveur' }, { status: 500 });
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue