Compare commits
3 Commits
758bb03a26
...
redis
| Author | SHA1 | Date | |
|---|---|---|---|
| d526f6ed2c | |||
| 62b659246f | |||
| c5c522f69c |
@@ -16,6 +16,11 @@ PORT="5002"
|
|||||||
DB_ROOT_PASSWORD="root_password"
|
DB_ROOT_PASSWORD="root_password"
|
||||||
NODE_ENV="production"
|
NODE_ENV="production"
|
||||||
|
|
||||||
|
REDIS_HOST="redis"
|
||||||
|
REDIS_PORT="6379"
|
||||||
|
REDIS_DB="0"
|
||||||
|
REDIS_PASSWORD=""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ARVANCLOUD_ENDPOINT=https://s3.ir-thr-at1.arvanstorage.com
|
ARVANCLOUD_ENDPOINT=https://s3.ir-thr-at1.arvanstorage.com
|
||||||
|
|||||||
@@ -102,3 +102,30 @@ Operational guide for AI/coding agents working in `consumer_api`.
|
|||||||
- Duplicate FK error seen in this repo: `sales_invoices_ref_id_fkey` (MySQL 1826). Recheck migration SQL for repeated `ADD CONSTRAINT` statements before rerun.
|
- Duplicate FK error seen in this repo: `sales_invoices_ref_id_fkey` (MySQL 1826). Recheck migration SQL for repeated `ADD CONSTRAINT` statements before rerun.
|
||||||
- Drift that repeatedly showed in this project: missing FK/unique on `sale_invoice_tsp_attempts.invoice_id`. Validate both schema and migration SQL produce the same final state.
|
- Drift that repeatedly showed in this project: missing FK/unique on `sale_invoice_tsp_attempts.invoice_id`. Validate both schema and migration SQL produce the same final state.
|
||||||
- `prisma migrate status` may show up-to-date while `migrate dev` still detects drift (shadow DB/application history issue); treat `migrate dev` output as source of truth for fixing local history.
|
- `prisma migrate status` may show up-to-date while `migrate dev` still detects drift (shadow DB/application history issue); treat `migrate dev` output as source of truth for fixing local history.
|
||||||
|
|
||||||
|
## Redis Cache Conventions (May 2026)
|
||||||
|
- Use `RedisKeyMaker` in `src/common/utils/redis-key-maker.util.ts` for all cache keys and wildcard patterns; do not inline key strings in services.
|
||||||
|
- Keep invalidation domain-based (for example `src/modules/admin/guilds/cache/*`, `src/modules/admin/partners/cache/*`, `src/modules/pos/cache/*`) and avoid duplicating delete logic across modules.
|
||||||
|
- For list APIs that are expensive or frequently read, prefer read-through cache with TTL and invalidation on every related write path.
|
||||||
|
- For entity endpoints, use list + detail split:
|
||||||
|
- list key(s): invalidated broadly on writes,
|
||||||
|
- detail key(s): invalidated per entity id.
|
||||||
|
- Partner domain rules:
|
||||||
|
- Shared partner cache namespace is `partners:*` (not admin-prefixed) because writes occur in both `admin/partners` and `partners` modules.
|
||||||
|
- Use shared invalidation service `src/modules/partners/cache/partners-cache-invalidation.service.ts` from both admin and partner write paths.
|
||||||
|
- Invalidate `partners:list` and `partners:{id}:detail` on partner create/update/delete and license-affecting writes.
|
||||||
|
- Invalidate partner license caches (activated-licenses list, charge-transactions list/detail) via the shared invalidation service.
|
||||||
|
- POS goods rules:
|
||||||
|
- Cache key shape is BA + guild scoped (`pos:ba:{businessActivityId}:guild:{guildId}:goods:list`) because results combine guild-default and BA-owned goods.
|
||||||
|
- Invalidate POS goods cache by guild when admin guild goods/category/sku changes.
|
||||||
|
- Invalidate POS goods cache by business activity when consumer BA goods create/update/delete.
|
||||||
|
- Consumer/Partner hierarchy rules:
|
||||||
|
- Consumer profile cache key: `consumers:{consumerId}:info`.
|
||||||
|
- Partner-consumer profile cache key: `partners:{partnerId}:consumers:{consumerId}:info`.
|
||||||
|
- On partner-consumer single read, write both keys when practical to share warm cache across modules.
|
||||||
|
- On consumer info update or partner-consumer update, invalidate both consumer and partner-consumer profile keys.
|
||||||
|
- For business activities, invalidate both list and detail layers; child updates may invalidate parent single cache when parent aggregates depend on child state.
|
||||||
|
- Wildcard invalidation implementation:
|
||||||
|
- Use `RedisService.deleteByPattern` / `RedisService.deleteByPatterns` for all pattern deletes.
|
||||||
|
- Do not implement ad-hoc scan/delete loops inside domain services.
|
||||||
|
- Pattern deletion uses `SCAN` + pipelined `DEL`; multi-pattern deletes run in parallel.
|
||||||
|
|||||||
@@ -25,6 +25,24 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- psp_consumer_network
|
- psp_consumer_network
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:7-alpine
|
||||||
|
platform: ${DOCKER_PLATFORM:-linux/amd64}
|
||||||
|
container_name: psp_consumer_api_redis
|
||||||
|
restart: unless-stopped
|
||||||
|
command: redis-server --appendonly yes
|
||||||
|
ports:
|
||||||
|
- "${REDIS_PORT:-6379}:6379"
|
||||||
|
volumes:
|
||||||
|
- redis_data:/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "redis-cli", "ping"]
|
||||||
|
interval: 15s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
networks:
|
||||||
|
- psp_consumer_network
|
||||||
|
|
||||||
api:
|
api:
|
||||||
platform: ${DOCKER_PLATFORM:-linux/amd64}
|
platform: ${DOCKER_PLATFORM:-linux/amd64}
|
||||||
build:
|
build:
|
||||||
@@ -51,6 +69,8 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
database:
|
database:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: ${NODE_ENV:-production}
|
NODE_ENV: ${NODE_ENV:-production}
|
||||||
PORT: ${PORT}
|
PORT: ${PORT}
|
||||||
@@ -65,6 +85,10 @@ services:
|
|||||||
JWT_EXPIRES_IN: ${JWT_EXPIRES_IN}
|
JWT_EXPIRES_IN: ${JWT_EXPIRES_IN}
|
||||||
CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:5000,http://127.0.0.1:5000}
|
CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:5000,http://127.0.0.1:5000}
|
||||||
OTP_STATIC_CODE: ${OTP_STATIC_CODE} # From .env
|
OTP_STATIC_CODE: ${OTP_STATIC_CODE} # From .env
|
||||||
|
REDIS_HOST: ${REDIS_HOST:-redis}
|
||||||
|
REDIS_PORT: ${REDIS_PORT:-6379}
|
||||||
|
REDIS_DB: ${REDIS_DB:-0}
|
||||||
|
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
|
||||||
ports:
|
ports:
|
||||||
- "${PORT:-5002}:5002"
|
- "${PORT:-5002}:5002"
|
||||||
read_only: true
|
read_only: true
|
||||||
@@ -135,6 +159,8 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
db_data:
|
db_data:
|
||||||
driver: local
|
driver: local
|
||||||
|
redis_data:
|
||||||
|
driver: local
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
psp_consumer_network:
|
psp_consumer_network:
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
"mysql2": "^3.22.2",
|
"mysql2": "^3.22.2",
|
||||||
"prisma": "^7.7.0",
|
"prisma": "^7.7.0",
|
||||||
"reflect-metadata": "^0.2.2",
|
"reflect-metadata": "^0.2.2",
|
||||||
|
"ioredis": "^5.8.2",
|
||||||
"rxjs": "^7.8.2",
|
"rxjs": "^7.8.2",
|
||||||
"uuid": "^13.0.0"
|
"uuid": "^13.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
Generated
+130
-61
@@ -59,6 +59,9 @@ importers:
|
|||||||
dotenv:
|
dotenv:
|
||||||
specifier: ^17.4.2
|
specifier: ^17.4.2
|
||||||
version: 17.4.2
|
version: 17.4.2
|
||||||
|
ioredis:
|
||||||
|
specifier: ^5.8.2
|
||||||
|
version: 5.10.1
|
||||||
jalaliday:
|
jalaliday:
|
||||||
specifier: ^3.1.1
|
specifier: ^3.1.1
|
||||||
version: 3.1.1(dayjs@1.11.20)
|
version: 3.1.1(dayjs@1.11.20)
|
||||||
@@ -511,7 +514,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-DDaRehssg1aNrH4+2hnj1B7vnUGEjU6OIlyRdkMd0aUdIUvKXrJfXsy8LVtXAy7DRvYVluWbMspsRhz2lcW0mQ==}
|
resolution: {integrity: sha512-DDaRehssg1aNrH4+2hnj1B7vnUGEjU6OIlyRdkMd0aUdIUvKXrJfXsy8LVtXAy7DRvYVluWbMspsRhz2lcW0mQ==}
|
||||||
|
|
||||||
'@colors/colors@1.5.0':
|
'@colors/colors@1.5.0':
|
||||||
resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==}
|
resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==, tarball: https://hub.megan.ir/repository/npm/@colors/colors/-/colors-1.5.0.tgz}
|
||||||
engines: {node: '>=0.1.90'}
|
engines: {node: '>=0.1.90'}
|
||||||
|
|
||||||
'@cspotcode/source-map-support@0.8.1':
|
'@cspotcode/source-map-support@0.8.1':
|
||||||
@@ -533,166 +536,166 @@ packages:
|
|||||||
resolution: {integrity: sha512-mZ9NzzUSYPOCnxHH1oAHPRzoMFJHY472raDKwXl/+6oPbpdJ7g8LsCN4FSaIIfkiCKHhb3iF/Zqo3NYxaIhU7Q==}
|
resolution: {integrity: sha512-mZ9NzzUSYPOCnxHH1oAHPRzoMFJHY472raDKwXl/+6oPbpdJ7g8LsCN4FSaIIfkiCKHhb3iF/Zqo3NYxaIhU7Q==}
|
||||||
|
|
||||||
'@emnapi/core@1.10.0':
|
'@emnapi/core@1.10.0':
|
||||||
resolution: {integrity: sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==}
|
resolution: {integrity: sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==, tarball: https://hub.megan.ir/repository/npm/@emnapi/core/-/core-1.10.0.tgz}
|
||||||
|
|
||||||
'@emnapi/runtime@1.10.0':
|
'@emnapi/runtime@1.10.0':
|
||||||
resolution: {integrity: sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==}
|
resolution: {integrity: sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==, tarball: https://hub.megan.ir/repository/npm/@emnapi/runtime/-/runtime-1.10.0.tgz}
|
||||||
|
|
||||||
'@emnapi/wasi-threads@1.2.1':
|
'@emnapi/wasi-threads@1.2.1':
|
||||||
resolution: {integrity: sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==}
|
resolution: {integrity: sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==, tarball: https://hub.megan.ir/repository/npm/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz}
|
||||||
|
|
||||||
'@esbuild/aix-ppc64@0.27.7':
|
'@esbuild/aix-ppc64@0.27.7':
|
||||||
resolution: {integrity: sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==}
|
resolution: {integrity: sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==, tarball: https://hub.megan.ir/repository/npm/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [ppc64]
|
cpu: [ppc64]
|
||||||
os: [aix]
|
os: [aix]
|
||||||
|
|
||||||
'@esbuild/android-arm64@0.27.7':
|
'@esbuild/android-arm64@0.27.7':
|
||||||
resolution: {integrity: sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==}
|
resolution: {integrity: sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==, tarball: https://hub.megan.ir/repository/npm/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [android]
|
os: [android]
|
||||||
|
|
||||||
'@esbuild/android-arm@0.27.7':
|
'@esbuild/android-arm@0.27.7':
|
||||||
resolution: {integrity: sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==}
|
resolution: {integrity: sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==, tarball: https://hub.megan.ir/repository/npm/@esbuild/android-arm/-/android-arm-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [arm]
|
cpu: [arm]
|
||||||
os: [android]
|
os: [android]
|
||||||
|
|
||||||
'@esbuild/android-x64@0.27.7':
|
'@esbuild/android-x64@0.27.7':
|
||||||
resolution: {integrity: sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==}
|
resolution: {integrity: sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==, tarball: https://hub.megan.ir/repository/npm/@esbuild/android-x64/-/android-x64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [android]
|
os: [android]
|
||||||
|
|
||||||
'@esbuild/darwin-arm64@0.27.7':
|
'@esbuild/darwin-arm64@0.27.7':
|
||||||
resolution: {integrity: sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==}
|
resolution: {integrity: sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==, tarball: https://hub.megan.ir/repository/npm/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
'@esbuild/darwin-x64@0.27.7':
|
'@esbuild/darwin-x64@0.27.7':
|
||||||
resolution: {integrity: sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==}
|
resolution: {integrity: sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==, tarball: https://hub.megan.ir/repository/npm/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
'@esbuild/freebsd-arm64@0.27.7':
|
'@esbuild/freebsd-arm64@0.27.7':
|
||||||
resolution: {integrity: sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==}
|
resolution: {integrity: sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==, tarball: https://hub.megan.ir/repository/npm/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [freebsd]
|
os: [freebsd]
|
||||||
|
|
||||||
'@esbuild/freebsd-x64@0.27.7':
|
'@esbuild/freebsd-x64@0.27.7':
|
||||||
resolution: {integrity: sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==}
|
resolution: {integrity: sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==, tarball: https://hub.megan.ir/repository/npm/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [freebsd]
|
os: [freebsd]
|
||||||
|
|
||||||
'@esbuild/linux-arm64@0.27.7':
|
'@esbuild/linux-arm64@0.27.7':
|
||||||
resolution: {integrity: sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==}
|
resolution: {integrity: sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==, tarball: https://hub.megan.ir/repository/npm/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@esbuild/linux-arm@0.27.7':
|
'@esbuild/linux-arm@0.27.7':
|
||||||
resolution: {integrity: sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==}
|
resolution: {integrity: sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==, tarball: https://hub.megan.ir/repository/npm/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [arm]
|
cpu: [arm]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@esbuild/linux-ia32@0.27.7':
|
'@esbuild/linux-ia32@0.27.7':
|
||||||
resolution: {integrity: sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==}
|
resolution: {integrity: sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==, tarball: https://hub.megan.ir/repository/npm/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [ia32]
|
cpu: [ia32]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@esbuild/linux-loong64@0.27.7':
|
'@esbuild/linux-loong64@0.27.7':
|
||||||
resolution: {integrity: sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==}
|
resolution: {integrity: sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==, tarball: https://hub.megan.ir/repository/npm/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [loong64]
|
cpu: [loong64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@esbuild/linux-mips64el@0.27.7':
|
'@esbuild/linux-mips64el@0.27.7':
|
||||||
resolution: {integrity: sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==}
|
resolution: {integrity: sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==, tarball: https://hub.megan.ir/repository/npm/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [mips64el]
|
cpu: [mips64el]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@esbuild/linux-ppc64@0.27.7':
|
'@esbuild/linux-ppc64@0.27.7':
|
||||||
resolution: {integrity: sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==}
|
resolution: {integrity: sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==, tarball: https://hub.megan.ir/repository/npm/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [ppc64]
|
cpu: [ppc64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@esbuild/linux-riscv64@0.27.7':
|
'@esbuild/linux-riscv64@0.27.7':
|
||||||
resolution: {integrity: sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==}
|
resolution: {integrity: sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==, tarball: https://hub.megan.ir/repository/npm/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [riscv64]
|
cpu: [riscv64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@esbuild/linux-s390x@0.27.7':
|
'@esbuild/linux-s390x@0.27.7':
|
||||||
resolution: {integrity: sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==}
|
resolution: {integrity: sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==, tarball: https://hub.megan.ir/repository/npm/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [s390x]
|
cpu: [s390x]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@esbuild/linux-x64@0.27.7':
|
'@esbuild/linux-x64@0.27.7':
|
||||||
resolution: {integrity: sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==}
|
resolution: {integrity: sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==, tarball: https://hub.megan.ir/repository/npm/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@esbuild/netbsd-arm64@0.27.7':
|
'@esbuild/netbsd-arm64@0.27.7':
|
||||||
resolution: {integrity: sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==}
|
resolution: {integrity: sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==, tarball: https://hub.megan.ir/repository/npm/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [netbsd]
|
os: [netbsd]
|
||||||
|
|
||||||
'@esbuild/netbsd-x64@0.27.7':
|
'@esbuild/netbsd-x64@0.27.7':
|
||||||
resolution: {integrity: sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==}
|
resolution: {integrity: sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==, tarball: https://hub.megan.ir/repository/npm/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [netbsd]
|
os: [netbsd]
|
||||||
|
|
||||||
'@esbuild/openbsd-arm64@0.27.7':
|
'@esbuild/openbsd-arm64@0.27.7':
|
||||||
resolution: {integrity: sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==}
|
resolution: {integrity: sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==, tarball: https://hub.megan.ir/repository/npm/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [openbsd]
|
os: [openbsd]
|
||||||
|
|
||||||
'@esbuild/openbsd-x64@0.27.7':
|
'@esbuild/openbsd-x64@0.27.7':
|
||||||
resolution: {integrity: sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==}
|
resolution: {integrity: sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==, tarball: https://hub.megan.ir/repository/npm/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [openbsd]
|
os: [openbsd]
|
||||||
|
|
||||||
'@esbuild/openharmony-arm64@0.27.7':
|
'@esbuild/openharmony-arm64@0.27.7':
|
||||||
resolution: {integrity: sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==}
|
resolution: {integrity: sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==, tarball: https://hub.megan.ir/repository/npm/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [openharmony]
|
os: [openharmony]
|
||||||
|
|
||||||
'@esbuild/sunos-x64@0.27.7':
|
'@esbuild/sunos-x64@0.27.7':
|
||||||
resolution: {integrity: sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==}
|
resolution: {integrity: sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==, tarball: https://hub.megan.ir/repository/npm/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [sunos]
|
os: [sunos]
|
||||||
|
|
||||||
'@esbuild/win32-arm64@0.27.7':
|
'@esbuild/win32-arm64@0.27.7':
|
||||||
resolution: {integrity: sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==}
|
resolution: {integrity: sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==, tarball: https://hub.megan.ir/repository/npm/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@esbuild/win32-ia32@0.27.7':
|
'@esbuild/win32-ia32@0.27.7':
|
||||||
resolution: {integrity: sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==}
|
resolution: {integrity: sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==, tarball: https://hub.megan.ir/repository/npm/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [ia32]
|
cpu: [ia32]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@esbuild/win32-x64@0.27.7':
|
'@esbuild/win32-x64@0.27.7':
|
||||||
resolution: {integrity: sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==}
|
resolution: {integrity: sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==, tarball: https://hub.megan.ir/repository/npm/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
@@ -904,6 +907,9 @@ packages:
|
|||||||
'@types/node':
|
'@types/node':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
'@ioredis/commands@1.5.1':
|
||||||
|
resolution: {integrity: sha512-JH8ZL/ywcJyR9MmJ5BNqZllXNZQqQbnVZOqpPQqE1vHiFgAw4NHbvE0FOduNU8IX9babitBT46571OnPTT0Zcw==, tarball: https://hub.megan.ir/repository/npm/@ioredis/commands/-/commands-1.5.1.tgz}
|
||||||
|
|
||||||
'@isaacs/cliui@8.0.2':
|
'@isaacs/cliui@8.0.2':
|
||||||
resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
|
resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
@@ -1031,7 +1037,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-xgAyonlVVS+q7Vc7qLW0UrJU7rSFcETRWsqdXZtjzRU8dF+6CkozTK4V4y1LwOX7j8r/vHphjDeMeGI4tNGeGA==}
|
resolution: {integrity: sha512-xgAyonlVVS+q7Vc7qLW0UrJU7rSFcETRWsqdXZtjzRU8dF+6CkozTK4V4y1LwOX7j8r/vHphjDeMeGI4tNGeGA==}
|
||||||
|
|
||||||
'@napi-rs/wasm-runtime@0.2.12':
|
'@napi-rs/wasm-runtime@0.2.12':
|
||||||
resolution: {integrity: sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ==}
|
resolution: {integrity: sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ==, tarball: https://hub.megan.ir/repository/npm/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.12.tgz}
|
||||||
|
|
||||||
'@nestjs/cli@11.0.21':
|
'@nestjs/cli@11.0.21':
|
||||||
resolution: {integrity: sha512-F8mV0Sj/zVEouzR3NxBuJy08YHTUOmC5Xdcx3qIIaJWzrm8Vw86CHkhkaPBJ5ewRMHPDCShPmhsfwhpCcjts3A==}
|
resolution: {integrity: sha512-F8mV0Sj/zVEouzR3NxBuJy08YHTUOmC5Xdcx3qIIaJWzrm8Vw86CHkhkaPBJ5ewRMHPDCShPmhsfwhpCcjts3A==}
|
||||||
@@ -1159,7 +1165,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-XO7cAxhnTZl0Yggq6jOgjiOHhbgcO4NqFqwSmQpjK3b6TEE6Uj/jfSk6wzYyemh3+I0sHirKSetjQwn5cZktFw==}
|
resolution: {integrity: sha512-XO7cAxhnTZl0Yggq6jOgjiOHhbgcO4NqFqwSmQpjK3b6TEE6Uj/jfSk6wzYyemh3+I0sHirKSetjQwn5cZktFw==}
|
||||||
|
|
||||||
'@pkgjs/parseargs@0.11.0':
|
'@pkgjs/parseargs@0.11.0':
|
||||||
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
|
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==, tarball: https://hub.megan.ir/repository/npm/@pkgjs/parseargs/-/parseargs-0.11.0.tgz}
|
||||||
engines: {node: '>=14'}
|
engines: {node: '>=14'}
|
||||||
|
|
||||||
'@pkgr/core@0.2.9':
|
'@pkgr/core@0.2.9':
|
||||||
@@ -1553,7 +1559,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==}
|
resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==}
|
||||||
|
|
||||||
'@tybys/wasm-util@0.10.1':
|
'@tybys/wasm-util@0.10.1':
|
||||||
resolution: {integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==}
|
resolution: {integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==, tarball: https://hub.megan.ir/repository/npm/@tybys/wasm-util/-/wasm-util-0.10.1.tgz}
|
||||||
|
|
||||||
'@types/babel__core@7.20.5':
|
'@types/babel__core@7.20.5':
|
||||||
resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==}
|
resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==}
|
||||||
@@ -1645,7 +1651,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==}
|
resolution: {integrity: sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==}
|
||||||
|
|
||||||
'@types/react@19.2.7':
|
'@types/react@19.2.7':
|
||||||
resolution: {integrity: sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==}
|
resolution: {integrity: sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==, tarball: https://hub.megan.ir/repository/npm/@types/react/-/react-19.2.7.tgz}
|
||||||
|
|
||||||
'@types/send@1.2.1':
|
'@types/send@1.2.1':
|
||||||
resolution: {integrity: sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ==}
|
resolution: {integrity: sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ==}
|
||||||
@@ -1734,97 +1740,105 @@ packages:
|
|||||||
resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==}
|
resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==}
|
||||||
|
|
||||||
'@unrs/resolver-binding-android-arm-eabi@1.11.1':
|
'@unrs/resolver-binding-android-arm-eabi@1.11.1':
|
||||||
resolution: {integrity: sha512-ppLRUgHVaGRWUx0R0Ut06Mjo9gBaBkg3v/8AxusGLhsIotbBLuRk51rAzqLC8gq6NyyAojEXglNjzf6R948DNw==}
|
resolution: {integrity: sha512-ppLRUgHVaGRWUx0R0Ut06Mjo9gBaBkg3v/8AxusGLhsIotbBLuRk51rAzqLC8gq6NyyAojEXglNjzf6R948DNw==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-android-arm-eabi/-/resolver-binding-android-arm-eabi-1.11.1.tgz}
|
||||||
cpu: [arm]
|
cpu: [arm]
|
||||||
os: [android]
|
os: [android]
|
||||||
|
|
||||||
'@unrs/resolver-binding-android-arm64@1.11.1':
|
'@unrs/resolver-binding-android-arm64@1.11.1':
|
||||||
resolution: {integrity: sha512-lCxkVtb4wp1v+EoN+HjIG9cIIzPkX5OtM03pQYkG+U5O/wL53LC4QbIeazgiKqluGeVEeBlZahHalCaBvU1a2g==}
|
resolution: {integrity: sha512-lCxkVtb4wp1v+EoN+HjIG9cIIzPkX5OtM03pQYkG+U5O/wL53LC4QbIeazgiKqluGeVEeBlZahHalCaBvU1a2g==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-android-arm64/-/resolver-binding-android-arm64-1.11.1.tgz}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [android]
|
os: [android]
|
||||||
|
|
||||||
'@unrs/resolver-binding-darwin-arm64@1.11.1':
|
'@unrs/resolver-binding-darwin-arm64@1.11.1':
|
||||||
resolution: {integrity: sha512-gPVA1UjRu1Y/IsB/dQEsp2V1pm44Of6+LWvbLc9SDk1c2KhhDRDBUkQCYVWe6f26uJb3fOK8saWMgtX8IrMk3g==}
|
resolution: {integrity: sha512-gPVA1UjRu1Y/IsB/dQEsp2V1pm44Of6+LWvbLc9SDk1c2KhhDRDBUkQCYVWe6f26uJb3fOK8saWMgtX8IrMk3g==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-darwin-arm64/-/resolver-binding-darwin-arm64-1.11.1.tgz}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
'@unrs/resolver-binding-darwin-x64@1.11.1':
|
'@unrs/resolver-binding-darwin-x64@1.11.1':
|
||||||
resolution: {integrity: sha512-cFzP7rWKd3lZaCsDze07QX1SC24lO8mPty9vdP+YVa3MGdVgPmFc59317b2ioXtgCMKGiCLxJ4HQs62oz6GfRQ==}
|
resolution: {integrity: sha512-cFzP7rWKd3lZaCsDze07QX1SC24lO8mPty9vdP+YVa3MGdVgPmFc59317b2ioXtgCMKGiCLxJ4HQs62oz6GfRQ==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-darwin-x64/-/resolver-binding-darwin-x64-1.11.1.tgz}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
'@unrs/resolver-binding-freebsd-x64@1.11.1':
|
'@unrs/resolver-binding-freebsd-x64@1.11.1':
|
||||||
resolution: {integrity: sha512-fqtGgak3zX4DCB6PFpsH5+Kmt/8CIi4Bry4rb1ho6Av2QHTREM+47y282Uqiu3ZRF5IQioJQ5qWRV6jduA+iGw==}
|
resolution: {integrity: sha512-fqtGgak3zX4DCB6PFpsH5+Kmt/8CIi4Bry4rb1ho6Av2QHTREM+47y282Uqiu3ZRF5IQioJQ5qWRV6jduA+iGw==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-freebsd-x64/-/resolver-binding-freebsd-x64-1.11.1.tgz}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [freebsd]
|
os: [freebsd]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-arm-gnueabihf@1.11.1':
|
'@unrs/resolver-binding-linux-arm-gnueabihf@1.11.1':
|
||||||
resolution: {integrity: sha512-u92mvlcYtp9MRKmP+ZvMmtPN34+/3lMHlyMj7wXJDeXxuM0Vgzz0+PPJNsro1m3IZPYChIkn944wW8TYgGKFHw==}
|
resolution: {integrity: sha512-u92mvlcYtp9MRKmP+ZvMmtPN34+/3lMHlyMj7wXJDeXxuM0Vgzz0+PPJNsro1m3IZPYChIkn944wW8TYgGKFHw==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-linux-arm-gnueabihf/-/resolver-binding-linux-arm-gnueabihf-1.11.1.tgz}
|
||||||
cpu: [arm]
|
cpu: [arm]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-arm-musleabihf@1.11.1':
|
'@unrs/resolver-binding-linux-arm-musleabihf@1.11.1':
|
||||||
resolution: {integrity: sha512-cINaoY2z7LVCrfHkIcmvj7osTOtm6VVT16b5oQdS4beibX2SYBwgYLmqhBjA1t51CarSaBuX5YNsWLjsqfW5Cw==}
|
resolution: {integrity: sha512-cINaoY2z7LVCrfHkIcmvj7osTOtm6VVT16b5oQdS4beibX2SYBwgYLmqhBjA1t51CarSaBuX5YNsWLjsqfW5Cw==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-linux-arm-musleabihf/-/resolver-binding-linux-arm-musleabihf-1.11.1.tgz}
|
||||||
cpu: [arm]
|
cpu: [arm]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-arm64-gnu@1.11.1':
|
'@unrs/resolver-binding-linux-arm64-gnu@1.11.1':
|
||||||
resolution: {integrity: sha512-34gw7PjDGB9JgePJEmhEqBhWvCiiWCuXsL9hYphDF7crW7UgI05gyBAi6MF58uGcMOiOqSJ2ybEeCvHcq0BCmQ==}
|
resolution: {integrity: sha512-34gw7PjDGB9JgePJEmhEqBhWvCiiWCuXsL9hYphDF7crW7UgI05gyBAi6MF58uGcMOiOqSJ2ybEeCvHcq0BCmQ==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-linux-arm64-gnu/-/resolver-binding-linux-arm64-gnu-1.11.1.tgz}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-arm64-musl@1.11.1':
|
'@unrs/resolver-binding-linux-arm64-musl@1.11.1':
|
||||||
resolution: {integrity: sha512-RyMIx6Uf53hhOtJDIamSbTskA99sPHS96wxVE/bJtePJJtpdKGXO1wY90oRdXuYOGOTuqjT8ACccMc4K6QmT3w==}
|
resolution: {integrity: sha512-RyMIx6Uf53hhOtJDIamSbTskA99sPHS96wxVE/bJtePJJtpdKGXO1wY90oRdXuYOGOTuqjT8ACccMc4K6QmT3w==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-linux-arm64-musl/-/resolver-binding-linux-arm64-musl-1.11.1.tgz}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-ppc64-gnu@1.11.1':
|
'@unrs/resolver-binding-linux-ppc64-gnu@1.11.1':
|
||||||
resolution: {integrity: sha512-D8Vae74A4/a+mZH0FbOkFJL9DSK2R6TFPC9M+jCWYia/q2einCubX10pecpDiTmkJVUH+y8K3BZClycD8nCShA==}
|
resolution: {integrity: sha512-D8Vae74A4/a+mZH0FbOkFJL9DSK2R6TFPC9M+jCWYia/q2einCubX10pecpDiTmkJVUH+y8K3BZClycD8nCShA==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-linux-ppc64-gnu/-/resolver-binding-linux-ppc64-gnu-1.11.1.tgz}
|
||||||
cpu: [ppc64]
|
cpu: [ppc64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-riscv64-gnu@1.11.1':
|
'@unrs/resolver-binding-linux-riscv64-gnu@1.11.1':
|
||||||
resolution: {integrity: sha512-frxL4OrzOWVVsOc96+V3aqTIQl1O2TjgExV4EKgRY09AJ9leZpEg8Ak9phadbuX0BA4k8U5qtvMSQQGGmaJqcQ==}
|
resolution: {integrity: sha512-frxL4OrzOWVVsOc96+V3aqTIQl1O2TjgExV4EKgRY09AJ9leZpEg8Ak9phadbuX0BA4k8U5qtvMSQQGGmaJqcQ==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-linux-riscv64-gnu/-/resolver-binding-linux-riscv64-gnu-1.11.1.tgz}
|
||||||
cpu: [riscv64]
|
cpu: [riscv64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-riscv64-musl@1.11.1':
|
'@unrs/resolver-binding-linux-riscv64-musl@1.11.1':
|
||||||
resolution: {integrity: sha512-mJ5vuDaIZ+l/acv01sHoXfpnyrNKOk/3aDoEdLO/Xtn9HuZlDD6jKxHlkN8ZhWyLJsRBxfv9GYM2utQ1SChKew==}
|
resolution: {integrity: sha512-mJ5vuDaIZ+l/acv01sHoXfpnyrNKOk/3aDoEdLO/Xtn9HuZlDD6jKxHlkN8ZhWyLJsRBxfv9GYM2utQ1SChKew==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-linux-riscv64-musl/-/resolver-binding-linux-riscv64-musl-1.11.1.tgz}
|
||||||
cpu: [riscv64]
|
cpu: [riscv64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-s390x-gnu@1.11.1':
|
'@unrs/resolver-binding-linux-s390x-gnu@1.11.1':
|
||||||
resolution: {integrity: sha512-kELo8ebBVtb9sA7rMe1Cph4QHreByhaZ2QEADd9NzIQsYNQpt9UkM9iqr2lhGr5afh885d/cB5QeTXSbZHTYPg==}
|
resolution: {integrity: sha512-kELo8ebBVtb9sA7rMe1Cph4QHreByhaZ2QEADd9NzIQsYNQpt9UkM9iqr2lhGr5afh885d/cB5QeTXSbZHTYPg==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-linux-s390x-gnu/-/resolver-binding-linux-s390x-gnu-1.11.1.tgz}
|
||||||
cpu: [s390x]
|
cpu: [s390x]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-x64-gnu@1.11.1':
|
'@unrs/resolver-binding-linux-x64-gnu@1.11.1':
|
||||||
resolution: {integrity: sha512-C3ZAHugKgovV5YvAMsxhq0gtXuwESUKc5MhEtjBpLoHPLYM+iuwSj3lflFwK3DPm68660rZ7G8BMcwSro7hD5w==}
|
resolution: {integrity: sha512-C3ZAHugKgovV5YvAMsxhq0gtXuwESUKc5MhEtjBpLoHPLYM+iuwSj3lflFwK3DPm68660rZ7G8BMcwSro7hD5w==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-linux-x64-gnu/-/resolver-binding-linux-x64-gnu-1.11.1.tgz}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-x64-musl@1.11.1':
|
'@unrs/resolver-binding-linux-x64-musl@1.11.1':
|
||||||
resolution: {integrity: sha512-rV0YSoyhK2nZ4vEswT/QwqzqQXw5I6CjoaYMOX0TqBlWhojUf8P94mvI7nuJTeaCkkds3QE4+zS8Ko+GdXuZtA==}
|
resolution: {integrity: sha512-rV0YSoyhK2nZ4vEswT/QwqzqQXw5I6CjoaYMOX0TqBlWhojUf8P94mvI7nuJTeaCkkds3QE4+zS8Ko+GdXuZtA==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-linux-x64-musl/-/resolver-binding-linux-x64-musl-1.11.1.tgz}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@unrs/resolver-binding-wasm32-wasi@1.11.1':
|
'@unrs/resolver-binding-wasm32-wasi@1.11.1':
|
||||||
resolution: {integrity: sha512-5u4RkfxJm+Ng7IWgkzi3qrFOvLvQYnPBmjmZQ8+szTK/b31fQCnleNl1GgEt7nIsZRIf5PLhPwT0WM+q45x/UQ==}
|
resolution: {integrity: sha512-5u4RkfxJm+Ng7IWgkzi3qrFOvLvQYnPBmjmZQ8+szTK/b31fQCnleNl1GgEt7nIsZRIf5PLhPwT0WM+q45x/UQ==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-wasm32-wasi/-/resolver-binding-wasm32-wasi-1.11.1.tgz}
|
||||||
engines: {node: '>=14.0.0'}
|
engines: {node: '>=14.0.0'}
|
||||||
cpu: [wasm32]
|
cpu: [wasm32]
|
||||||
|
|
||||||
'@unrs/resolver-binding-win32-arm64-msvc@1.11.1':
|
'@unrs/resolver-binding-win32-arm64-msvc@1.11.1':
|
||||||
resolution: {integrity: sha512-nRcz5Il4ln0kMhfL8S3hLkxI85BXs3o8EYoattsJNdsX4YUU89iOkVn7g0VHSRxFuVMdM4Q1jEpIId1Ihim/Uw==}
|
resolution: {integrity: sha512-nRcz5Il4ln0kMhfL8S3hLkxI85BXs3o8EYoattsJNdsX4YUU89iOkVn7g0VHSRxFuVMdM4Q1jEpIId1Ihim/Uw==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-win32-arm64-msvc/-/resolver-binding-win32-arm64-msvc-1.11.1.tgz}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@unrs/resolver-binding-win32-ia32-msvc@1.11.1':
|
'@unrs/resolver-binding-win32-ia32-msvc@1.11.1':
|
||||||
resolution: {integrity: sha512-DCEI6t5i1NmAZp6pFonpD5m7i6aFrpofcp4LA2i8IIq60Jyo28hamKBxNrZcyOwVOZkgsRp9O2sXWBWP8MnvIQ==}
|
resolution: {integrity: sha512-DCEI6t5i1NmAZp6pFonpD5m7i6aFrpofcp4LA2i8IIq60Jyo28hamKBxNrZcyOwVOZkgsRp9O2sXWBWP8MnvIQ==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-win32-ia32-msvc/-/resolver-binding-win32-ia32-msvc-1.11.1.tgz}
|
||||||
cpu: [ia32]
|
cpu: [ia32]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@unrs/resolver-binding-win32-x64-msvc@1.11.1':
|
'@unrs/resolver-binding-win32-x64-msvc@1.11.1':
|
||||||
resolution: {integrity: sha512-lrW200hZdbfRtztbygyaq/6jP6AKE8qQN2KvPcJ+x7wiD038YtnYtZ82IMNJ69GJibV7bwL3y9FgK+5w/pYt6g==}
|
resolution: {integrity: sha512-lrW200hZdbfRtztbygyaq/6jP6AKE8qQN2KvPcJ+x7wiD038YtnYtZ82IMNJ69GJibV7bwL3y9FgK+5w/pYt6g==, tarball: https://hub.megan.ir/repository/npm/@unrs/resolver-binding-win32-x64-msvc/-/resolver-binding-win32-x64-msvc-1.11.1.tgz}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
@@ -2193,6 +2207,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==}
|
resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==}
|
||||||
engines: {node: '>=0.8'}
|
engines: {node: '>=0.8'}
|
||||||
|
|
||||||
|
cluster-key-slot@1.1.2:
|
||||||
|
resolution: {integrity: sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==, tarball: https://hub.megan.ir/repository/npm/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz}
|
||||||
|
engines: {node: '>=0.10.0'}
|
||||||
|
|
||||||
co@4.6.0:
|
co@4.6.0:
|
||||||
resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==}
|
resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==}
|
||||||
engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'}
|
engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'}
|
||||||
@@ -2289,13 +2307,13 @@ packages:
|
|||||||
engines: {node: '>= 8'}
|
engines: {node: '>= 8'}
|
||||||
|
|
||||||
csstype@3.2.3:
|
csstype@3.2.3:
|
||||||
resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==}
|
resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==, tarball: https://hub.megan.ir/repository/npm/csstype/-/csstype-3.2.3.tgz}
|
||||||
|
|
||||||
dayjs@1.11.20:
|
dayjs@1.11.20:
|
||||||
resolution: {integrity: sha512-YbwwqR/uYpeoP4pu043q+LTDLFBLApUP6VxRihdfNTqu4ubqMlGDLd6ErXhEgsyvY0K6nCs7nggYumAN+9uEuQ==}
|
resolution: {integrity: sha512-YbwwqR/uYpeoP4pu043q+LTDLFBLApUP6VxRihdfNTqu4ubqMlGDLd6ErXhEgsyvY0K6nCs7nggYumAN+9uEuQ==}
|
||||||
|
|
||||||
debug@4.4.3:
|
debug@4.4.3:
|
||||||
resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==}
|
resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==, tarball: https://hub.megan.ir/repository/npm/debug/-/debug-4.4.3.tgz}
|
||||||
engines: {node: '>=6.0'}
|
engines: {node: '>=6.0'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
supports-color: '*'
|
supports-color: '*'
|
||||||
@@ -2333,7 +2351,7 @@ packages:
|
|||||||
engines: {node: '>=0.4.0'}
|
engines: {node: '>=0.4.0'}
|
||||||
|
|
||||||
denque@2.1.0:
|
denque@2.1.0:
|
||||||
resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==}
|
resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==, tarball: https://hub.megan.ir/repository/npm/denque/-/denque-2.1.0.tgz}
|
||||||
engines: {node: '>=0.10'}
|
engines: {node: '>=0.10'}
|
||||||
|
|
||||||
depd@2.0.0:
|
depd@2.0.0:
|
||||||
@@ -2673,7 +2691,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
|
resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
|
||||||
|
|
||||||
fsevents@2.3.3:
|
fsevents@2.3.3:
|
||||||
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
|
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==, tarball: https://hub.megan.ir/repository/npm/fsevents/-/fsevents-2.3.3.tgz}
|
||||||
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
@@ -2836,6 +2854,10 @@ packages:
|
|||||||
inherits@2.0.4:
|
inherits@2.0.4:
|
||||||
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
|
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
|
||||||
|
|
||||||
|
ioredis@5.10.1:
|
||||||
|
resolution: {integrity: sha512-HuEDBTI70aYdx1v6U97SbNx9F1+svQKBDo30o0b9fw055LMepzpOOd0Ccg9Q6tbqmBSJaMuY0fB7yw9/vjBYCA==, tarball: https://hub.megan.ir/repository/npm/ioredis/-/ioredis-5.10.1.tgz}
|
||||||
|
engines: {node: '>=12.22.0'}
|
||||||
|
|
||||||
ipaddr.js@1.9.1:
|
ipaddr.js@1.9.1:
|
||||||
resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==}
|
resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==}
|
||||||
engines: {node: '>= 0.10'}
|
engines: {node: '>= 0.10'}
|
||||||
@@ -3137,9 +3159,15 @@ packages:
|
|||||||
resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
|
resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
|
lodash.defaults@4.2.0:
|
||||||
|
resolution: {integrity: sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==, tarball: https://hub.megan.ir/repository/npm/lodash.defaults/-/lodash.defaults-4.2.0.tgz}
|
||||||
|
|
||||||
lodash.includes@4.3.0:
|
lodash.includes@4.3.0:
|
||||||
resolution: {integrity: sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==}
|
resolution: {integrity: sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==}
|
||||||
|
|
||||||
|
lodash.isarguments@3.1.0:
|
||||||
|
resolution: {integrity: sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg==, tarball: https://hub.megan.ir/repository/npm/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz}
|
||||||
|
|
||||||
lodash.isboolean@3.0.3:
|
lodash.isboolean@3.0.3:
|
||||||
resolution: {integrity: sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==}
|
resolution: {integrity: sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==}
|
||||||
|
|
||||||
@@ -3556,7 +3584,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg==}
|
resolution: {integrity: sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg==}
|
||||||
|
|
||||||
react-dom@19.2.1:
|
react-dom@19.2.1:
|
||||||
resolution: {integrity: sha512-ibrK8llX2a4eOskq1mXKu/TGZj9qzomO+sNfO98M6d9zIPOEhlBkMkBUBLd1vgS0gQsLDBzA+8jJBVXDnfHmJg==}
|
resolution: {integrity: sha512-ibrK8llX2a4eOskq1mXKu/TGZj9qzomO+sNfO98M6d9zIPOEhlBkMkBUBLd1vgS0gQsLDBzA+8jJBVXDnfHmJg==, tarball: https://hub.megan.ir/repository/npm/react-dom/-/react-dom-19.2.1.tgz}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
react: ^19.2.1
|
react: ^19.2.1
|
||||||
|
|
||||||
@@ -3564,7 +3592,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==}
|
resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==}
|
||||||
|
|
||||||
react@19.2.1:
|
react@19.2.1:
|
||||||
resolution: {integrity: sha512-DGrYcCWK7tvYMnWh79yrPHt+vdx9tY+1gPZa7nJQtO/p8bLTDaHp4dzwEhQB7pZ4Xe3ok4XKuEPrVuc+wlpkmw==}
|
resolution: {integrity: sha512-DGrYcCWK7tvYMnWh79yrPHt+vdx9tY+1gPZa7nJQtO/p8bLTDaHp4dzwEhQB7pZ4Xe3ok4XKuEPrVuc+wlpkmw==, tarball: https://hub.megan.ir/repository/npm/react/-/react-19.2.1.tgz}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
|
|
||||||
readable-stream@3.6.2:
|
readable-stream@3.6.2:
|
||||||
@@ -3575,6 +3603,14 @@ packages:
|
|||||||
resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==}
|
resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==}
|
||||||
engines: {node: '>= 14.18.0'}
|
engines: {node: '>= 14.18.0'}
|
||||||
|
|
||||||
|
redis-errors@1.2.0:
|
||||||
|
resolution: {integrity: sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w==, tarball: https://hub.megan.ir/repository/npm/redis-errors/-/redis-errors-1.2.0.tgz}
|
||||||
|
engines: {node: '>=4'}
|
||||||
|
|
||||||
|
redis-parser@3.0.0:
|
||||||
|
resolution: {integrity: sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A==, tarball: https://hub.megan.ir/repository/npm/redis-parser/-/redis-parser-3.0.0.tgz}
|
||||||
|
engines: {node: '>=4'}
|
||||||
|
|
||||||
reflect-metadata@0.2.2:
|
reflect-metadata@0.2.2:
|
||||||
resolution: {integrity: sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==}
|
resolution: {integrity: sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==}
|
||||||
|
|
||||||
@@ -3629,7 +3665,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
|
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
|
||||||
|
|
||||||
scheduler@0.27.0:
|
scheduler@0.27.0:
|
||||||
resolution: {integrity: sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==}
|
resolution: {integrity: sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==, tarball: https://hub.megan.ir/repository/npm/scheduler/-/scheduler-0.27.0.tgz}
|
||||||
|
|
||||||
schema-utils@3.3.0:
|
schema-utils@3.3.0:
|
||||||
resolution: {integrity: sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==}
|
resolution: {integrity: sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==}
|
||||||
@@ -3730,6 +3766,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==}
|
resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
|
standard-as-callback@2.1.0:
|
||||||
|
resolution: {integrity: sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==, tarball: https://hub.megan.ir/repository/npm/standard-as-callback/-/standard-as-callback-2.1.0.tgz}
|
||||||
|
|
||||||
statuses@2.0.2:
|
statuses@2.0.2:
|
||||||
resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==}
|
resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==}
|
||||||
engines: {node: '>= 0.8'}
|
engines: {node: '>= 0.8'}
|
||||||
@@ -3976,7 +4015,7 @@ packages:
|
|||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
uglify-js@3.19.3:
|
uglify-js@3.19.3:
|
||||||
resolution: {integrity: sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==}
|
resolution: {integrity: sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==, tarball: https://hub.megan.ir/repository/npm/uglify-js/-/uglify-js-3.19.3.tgz}
|
||||||
engines: {node: '>=0.8.0'}
|
engines: {node: '>=0.8.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
@@ -5121,6 +5160,8 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@types/node': 22.19.17
|
'@types/node': 22.19.17
|
||||||
|
|
||||||
|
'@ioredis/commands@1.5.1': {}
|
||||||
|
|
||||||
'@isaacs/cliui@8.0.2':
|
'@isaacs/cliui@8.0.2':
|
||||||
dependencies:
|
dependencies:
|
||||||
string-width: 5.1.2
|
string-width: 5.1.2
|
||||||
@@ -6720,6 +6761,8 @@ snapshots:
|
|||||||
|
|
||||||
clone@1.0.4: {}
|
clone@1.0.4: {}
|
||||||
|
|
||||||
|
cluster-key-slot@1.1.2: {}
|
||||||
|
|
||||||
co@4.6.0: {}
|
co@4.6.0: {}
|
||||||
|
|
||||||
collect-v8-coverage@1.0.3: {}
|
collect-v8-coverage@1.0.3: {}
|
||||||
@@ -7390,6 +7433,20 @@ snapshots:
|
|||||||
|
|
||||||
inherits@2.0.4: {}
|
inherits@2.0.4: {}
|
||||||
|
|
||||||
|
ioredis@5.10.1:
|
||||||
|
dependencies:
|
||||||
|
'@ioredis/commands': 1.5.1
|
||||||
|
cluster-key-slot: 1.1.2
|
||||||
|
debug: 4.4.3
|
||||||
|
denque: 2.1.0
|
||||||
|
lodash.defaults: 4.2.0
|
||||||
|
lodash.isarguments: 3.1.0
|
||||||
|
redis-errors: 1.2.0
|
||||||
|
redis-parser: 3.0.0
|
||||||
|
standard-as-callback: 2.1.0
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
|
||||||
ipaddr.js@1.9.1: {}
|
ipaddr.js@1.9.1: {}
|
||||||
|
|
||||||
is-arrayish@0.2.1: {}
|
is-arrayish@0.2.1: {}
|
||||||
@@ -7864,8 +7921,12 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
p-locate: 5.0.0
|
p-locate: 5.0.0
|
||||||
|
|
||||||
|
lodash.defaults@4.2.0: {}
|
||||||
|
|
||||||
lodash.includes@4.3.0: {}
|
lodash.includes@4.3.0: {}
|
||||||
|
|
||||||
|
lodash.isarguments@3.1.0: {}
|
||||||
|
|
||||||
lodash.isboolean@3.0.3: {}
|
lodash.isboolean@3.0.3: {}
|
||||||
|
|
||||||
lodash.isinteger@4.0.4: {}
|
lodash.isinteger@4.0.4: {}
|
||||||
@@ -8259,6 +8320,12 @@ snapshots:
|
|||||||
|
|
||||||
readdirp@4.1.2: {}
|
readdirp@4.1.2: {}
|
||||||
|
|
||||||
|
redis-errors@1.2.0: {}
|
||||||
|
|
||||||
|
redis-parser@3.0.0:
|
||||||
|
dependencies:
|
||||||
|
redis-errors: 1.2.0
|
||||||
|
|
||||||
reflect-metadata@0.2.2: {}
|
reflect-metadata@0.2.2: {}
|
||||||
|
|
||||||
remeda@2.33.4: {}
|
remeda@2.33.4: {}
|
||||||
@@ -8420,6 +8487,8 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
escape-string-regexp: 2.0.0
|
escape-string-regexp: 2.0.0
|
||||||
|
|
||||||
|
standard-as-callback@2.1.0: {}
|
||||||
|
|
||||||
statuses@2.0.2: {}
|
statuses@2.0.2: {}
|
||||||
|
|
||||||
std-env@3.10.0: {}
|
std-env@3.10.0: {}
|
||||||
|
|||||||
@@ -13,10 +13,12 @@ import { SalesInvoicePaymentsModule } from './modules/pos/sales-invoices/sales-i
|
|||||||
import { TriggerLogsModule } from './modules/trigger-logs/trigger-logs.module'
|
import { TriggerLogsModule } from './modules/trigger-logs/trigger-logs.module'
|
||||||
import { UploaderModule } from './modules/uploader/uploader.module'
|
import { UploaderModule } from './modules/uploader/uploader.module'
|
||||||
import { PrismaModule } from './prisma/prisma.module'
|
import { PrismaModule } from './prisma/prisma.module'
|
||||||
|
import { RedisModule } from './redis/redis.module'
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
PrismaModule,
|
PrismaModule,
|
||||||
|
RedisModule,
|
||||||
EnumsModule,
|
EnumsModule,
|
||||||
AdminModule,
|
AdminModule,
|
||||||
AuthModule,
|
AuthModule,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
export * from './jwt-user.util'
|
|
||||||
export * from './enum-translator.util'
|
export * from './enum-translator.util'
|
||||||
|
export * from './http-client.util'
|
||||||
|
export * from './jwt-user.util'
|
||||||
export * from './mappers/consumer_mappers.util'
|
export * from './mappers/consumer_mappers.util'
|
||||||
export * from './password.util'
|
export * from './password.util'
|
||||||
|
export * from './redisKeyMaker'
|
||||||
export * from './tracking-code-generator.util'
|
export * from './tracking-code-generator.util'
|
||||||
export * from './http-client.util'
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
export class ConsumerKeyMaker {
|
||||||
|
static consumerInfo(consumerId: string): string {
|
||||||
|
return `consumers:${consumerId}:info`
|
||||||
|
}
|
||||||
|
|
||||||
|
static consumerBusinessActivitiesList(consumerId: string): string {
|
||||||
|
return `consumers:${consumerId}:business-activities:list`
|
||||||
|
}
|
||||||
|
|
||||||
|
static consumerBusinessActivityInfo(
|
||||||
|
consumerId: string,
|
||||||
|
businessActivityId: string,
|
||||||
|
): string {
|
||||||
|
return `consumers:${consumerId}:business-activities:${businessActivityId}:info`
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
export class EnumKeyMaker {
|
||||||
|
static enumsAll(buildVersion: string): string {
|
||||||
|
return `enums:${buildVersion}:all`
|
||||||
|
}
|
||||||
|
|
||||||
|
static enumsValues(buildVersion: string, enumName: string): string {
|
||||||
|
return `enums:${buildVersion}:values:${enumName}`
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
export class GuildKeyMaker {
|
||||||
|
static guildStockKeepingUnitsList(guildId: string): string {
|
||||||
|
return `guilds:${guildId}:stock-keeping-units:list`
|
||||||
|
}
|
||||||
|
|
||||||
|
static guildGoodsList(guildId: string): string {
|
||||||
|
return `guilds:${guildId}:goods:list`
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import { ConsumerKeyMaker } from './consumer'
|
||||||
|
import { EnumKeyMaker } from './enum'
|
||||||
|
import { GuildKeyMaker } from './guild'
|
||||||
|
import { PartnerKeyMaker } from './partner'
|
||||||
|
import { PosKeyMaker } from './pos'
|
||||||
|
|
||||||
|
// Keep backward-compatible static methods while separating key builders by domain.
|
||||||
|
export class RedisKeyMaker extends PartnerKeyMaker {
|
||||||
|
static consumer = ConsumerKeyMaker
|
||||||
|
static enums = EnumKeyMaker
|
||||||
|
static guild = GuildKeyMaker
|
||||||
|
static partner = PartnerKeyMaker
|
||||||
|
static pos = PosKeyMaker
|
||||||
|
|
||||||
|
static consumerInfo = ConsumerKeyMaker.consumerInfo
|
||||||
|
static consumerBusinessActivitiesList = ConsumerKeyMaker.consumerBusinessActivitiesList
|
||||||
|
static consumerBusinessActivityInfo = ConsumerKeyMaker.consumerBusinessActivityInfo
|
||||||
|
|
||||||
|
static guildStockKeepingUnitsList = GuildKeyMaker.guildStockKeepingUnitsList
|
||||||
|
static guildGoodsList = GuildKeyMaker.guildGoodsList
|
||||||
|
|
||||||
|
static posInfo = PosKeyMaker.posInfo
|
||||||
|
static posMe = PosKeyMaker.posMe
|
||||||
|
static posGoodsList = PosKeyMaker.posGoodsList
|
||||||
|
|
||||||
|
static enumsAll = EnumKeyMaker.enumsAll
|
||||||
|
static enumsValues = EnumKeyMaker.enumsValues
|
||||||
|
}
|
||||||
|
|
||||||
|
export { ConsumerKeyMaker, EnumKeyMaker, GuildKeyMaker, PartnerKeyMaker, PosKeyMaker }
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
export class PartnerKeyMaker {
|
||||||
|
static partnersList(): string {
|
||||||
|
return 'partners:list'
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerDetail(partnerId: string): string {
|
||||||
|
return `partners:${partnerId}:detail`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerActivatedLicensesList(
|
||||||
|
partnerId: string,
|
||||||
|
page: number,
|
||||||
|
perPage: number,
|
||||||
|
): string {
|
||||||
|
return `partners:${partnerId}:activated-licenses:list:${page}:${perPage}`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerActivatedLicensesListPattern(partnerId: string): string {
|
||||||
|
return `partners:${partnerId}:activated-licenses:list:*`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerLicenseChargeTransactionsList(
|
||||||
|
partnerId: string,
|
||||||
|
page: number,
|
||||||
|
perPage: number,
|
||||||
|
): string {
|
||||||
|
return `partners:${partnerId}:license-charge-transactions:list:${page}:${perPage}`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerLicenseChargeTransactionsListPattern(partnerId: string): string {
|
||||||
|
return `partners:${partnerId}:license-charge-transactions:list:*`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerLicenseChargeTransactionDetail(
|
||||||
|
partnerId: string,
|
||||||
|
transactionId: string,
|
||||||
|
): string {
|
||||||
|
return `partners:${partnerId}:license-charge-transactions:${transactionId}:detail`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerLicenseChargeTransactionDetailPattern(partnerId: string): string {
|
||||||
|
return `partners:${partnerId}:license-charge-transactions:*:detail`
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////// consumers ////////////////////
|
||||||
|
|
||||||
|
static partnerConsumersPattern(partnerId: string): string {
|
||||||
|
return `partners:${partnerId}:consumers:*`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerConsumerPattern(partnerId: string): string {
|
||||||
|
return this.partnerConsumersPattern(partnerId)
|
||||||
|
}
|
||||||
|
static partnerConsumersListPattern(partnerId: string): string {
|
||||||
|
return `partners:${partnerId}:consumers:list:*`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerConsumersList(partnerId: string, page: number, perPage: number): string {
|
||||||
|
return `partners:${partnerId}:consumers:list:${page}:${perPage}`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerConsumerInfo(partnerId: string, consumerId: string): string {
|
||||||
|
return `partners:${partnerId}:consumers:${consumerId}:info`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerConsumerBusinessActivitiesList(
|
||||||
|
partnerId: string,
|
||||||
|
consumerId: string,
|
||||||
|
page: number,
|
||||||
|
perPage: number,
|
||||||
|
): string {
|
||||||
|
return `partners:${partnerId}:consumers:${consumerId}:business-activities:list:${page}:${perPage}`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerConsumerBusinessActivitiesPattern(
|
||||||
|
partnerId: string,
|
||||||
|
consumerId: string,
|
||||||
|
): string {
|
||||||
|
return `partners:${partnerId}:consumers:${consumerId}:business-activities:*`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerConsumerBusinessActivityInfo(
|
||||||
|
partnerId: string,
|
||||||
|
consumerId: string,
|
||||||
|
businessActivityId: string,
|
||||||
|
): string {
|
||||||
|
return `partners:${partnerId}:consumers:${consumerId}:business-activities:${businessActivityId}:info`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerConsumerBusinessActivityComplexesList(
|
||||||
|
partnerId: string,
|
||||||
|
consumerId: string,
|
||||||
|
businessActivityId: string,
|
||||||
|
page: number,
|
||||||
|
perPage: number,
|
||||||
|
): string {
|
||||||
|
return `partners:${partnerId}:consumers:${consumerId}:business-activities:${businessActivityId}:complexes:list:${page}:${perPage}`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerConsumerBusinessActivityComplexesPattern(
|
||||||
|
partnerId: string,
|
||||||
|
consumerId: string,
|
||||||
|
businessActivityId: string,
|
||||||
|
): string {
|
||||||
|
return `partners:${partnerId}:consumers:${consumerId}:business-activities:${businessActivityId}:complexes:*`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerConsumerBusinessActivityComplexInfo(
|
||||||
|
partnerId: string,
|
||||||
|
consumerId: string,
|
||||||
|
businessActivityId: string,
|
||||||
|
complexId: string,
|
||||||
|
): string {
|
||||||
|
return `partners:${partnerId}:consumers:${consumerId}:business-activities:${businessActivityId}:complexes:${complexId}`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerConsumerBusinessActivityComplexPosesPattern(
|
||||||
|
partnerId: string,
|
||||||
|
consumerId: string,
|
||||||
|
businessActivityId: string,
|
||||||
|
complexId: string,
|
||||||
|
): string {
|
||||||
|
return `partners:${partnerId}:consumers:${consumerId}:business-activities:${businessActivityId}:complexes:${complexId}:poses:*`
|
||||||
|
}
|
||||||
|
|
||||||
|
static partnerConsumerBusinessActivityComplexPosInfo(
|
||||||
|
partnerId: string,
|
||||||
|
consumerId: string,
|
||||||
|
businessActivityId: string,
|
||||||
|
complexId: string,
|
||||||
|
posId: string,
|
||||||
|
): string {
|
||||||
|
return `partners:${partnerId}:consumers:${consumerId}:business-activities:${businessActivityId}:complexes:${complexId}:poses:${posId}`
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
export class PosKeyMaker {
|
||||||
|
static posInfo(posId: string): string {
|
||||||
|
return `pos:${posId}:info`
|
||||||
|
}
|
||||||
|
|
||||||
|
static posMe(accountId: string, posId: string): string {
|
||||||
|
return `pos:${posId}:me:${accountId}`
|
||||||
|
}
|
||||||
|
|
||||||
|
static posGoodsList(businessActivityId: string, guildId: string): string {
|
||||||
|
return `pos:ba:${businessActivityId}:guild:${guildId}:goods:list`
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,26 @@ export class AdminConsumersService {
|
|||||||
type: true,
|
type: true,
|
||||||
...QUERY_CONSTANTS.CONSUMER.infoSelect,
|
...QUERY_CONSTANTS.CONSUMER.infoSelect,
|
||||||
...QUERY_CONSTANTS.CONSUMER.activeBusinessCount,
|
...QUERY_CONSTANTS.CONSUMER.activeBusinessCount,
|
||||||
|
individual: {
|
||||||
|
select: {
|
||||||
|
partner: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
name: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
legal: {
|
||||||
|
select: {
|
||||||
|
partner: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
name: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
status: true,
|
status: true,
|
||||||
created_at: true,
|
created_at: true,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { RedisKeyMaker } from '@/common/utils/redisKeyMaker'
|
||||||
|
import { PosCacheInvalidationService } from '@/modules/pos/cache/pos-cache-invalidation.service'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
|
import { Injectable } from '@nestjs/common'
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class AdminGuildCacheInvalidationService {
|
||||||
|
constructor(
|
||||||
|
private readonly redisService: RedisService,
|
||||||
|
private readonly posCacheInvalidationService: PosCacheInvalidationService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
async invalidateGoodsList(guildId: string): Promise<void> {
|
||||||
|
await this.redisService.delete(RedisKeyMaker.guildGoodsList(guildId))
|
||||||
|
await this.posCacheInvalidationService.invalidateGoodsListByGuild(guildId)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { GoodCategoryOmit } from '@/generated/prisma/models'
|
import { GoodCategoryOmit } from '@/generated/prisma/models'
|
||||||
import { PrismaService } from '@/prisma/prisma.service'
|
import { PrismaService } from '@/prisma/prisma.service'
|
||||||
|
import { AdminGuildCacheInvalidationService } from '@/modules/admin/guilds/cache/admin-guild-cache-invalidation.service'
|
||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable } from '@nestjs/common'
|
||||||
import { ResponseMapper } from 'common/response/response-mapper'
|
import { ResponseMapper } from 'common/response/response-mapper'
|
||||||
import {
|
import {
|
||||||
@@ -9,7 +10,10 @@ import {
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GoodCategoriesService {
|
export class GoodCategoriesService {
|
||||||
constructor(private prisma: PrismaService) {}
|
constructor(
|
||||||
|
private prisma: PrismaService,
|
||||||
|
private readonly cacheInvalidationService: AdminGuildCacheInvalidationService,
|
||||||
|
) {}
|
||||||
|
|
||||||
private readonly goodCategoriesOmit = {
|
private readonly goodCategoriesOmit = {
|
||||||
complex_id: true,
|
complex_id: true,
|
||||||
@@ -67,8 +71,8 @@ export class GoodCategoriesService {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
create(guild_id: string, data: CreateGoodCategoryDto) {
|
async create(guild_id: string, data: CreateGoodCategoryDto) {
|
||||||
const category = this.prisma.goodCategory.create({
|
const category = await this.prisma.goodCategory.create({
|
||||||
data: {
|
data: {
|
||||||
guild: {
|
guild: {
|
||||||
connect: {
|
connect: {
|
||||||
@@ -83,6 +87,8 @@ export class GoodCategoriesService {
|
|||||||
omit: this.goodCategoriesOmit,
|
omit: this.goodCategoriesOmit,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await this.cacheInvalidationService.invalidateGoodsList(guild_id)
|
||||||
|
|
||||||
return ResponseMapper.create({ ...category, goods_count: 0 })
|
return ResponseMapper.create({ ...category, goods_count: 0 })
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,6 +119,8 @@ export class GoodCategoriesService {
|
|||||||
omit: this.goodCategoriesOmit,
|
omit: this.goodCategoriesOmit,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await this.cacheInvalidationService.invalidateGoodsList(guild_id)
|
||||||
|
|
||||||
return ResponseMapper.update({
|
return ResponseMapper.update({
|
||||||
...category,
|
...category,
|
||||||
goods_count: Number(category?._count.goods),
|
goods_count: Number(category?._count.goods),
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import { UploadedFileTypes } from '@/common/enums/enums'
|
import { UploadedFileTypes } from '@/common/enums/enums'
|
||||||
|
import { RedisKeyMaker } from '@/common/utils/redisKeyMaker'
|
||||||
import { GoodSelect, GoodWhereInput } from '@/generated/prisma/models'
|
import { GoodSelect, GoodWhereInput } from '@/generated/prisma/models'
|
||||||
|
import { AdminGuildCacheInvalidationService } from '@/modules/admin/guilds/cache/admin-guild-cache-invalidation.service'
|
||||||
import { UploaderService } from '@/modules/uploader/uploader.service'
|
import { UploaderService } from '@/modules/uploader/uploader.service'
|
||||||
import { PrismaService } from '@/prisma/prisma.service'
|
import { PrismaService } from '@/prisma/prisma.service'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable } from '@nestjs/common'
|
||||||
import { ResponseMapper } from 'common/response/response-mapper'
|
import { ResponseMapper } from 'common/response/response-mapper'
|
||||||
import { CreateGuildGoodDto, UpdateGuildGoodDto } from './dto/create-good.dto'
|
import { CreateGuildGoodDto, UpdateGuildGoodDto } from './dto/create-good.dto'
|
||||||
@@ -11,8 +14,12 @@ export class GoodsService {
|
|||||||
constructor(
|
constructor(
|
||||||
private prisma: PrismaService,
|
private prisma: PrismaService,
|
||||||
private readonly uploaderService: UploaderService,
|
private readonly uploaderService: UploaderService,
|
||||||
|
private readonly redisService: RedisService,
|
||||||
|
private readonly cacheInvalidationService: AdminGuildCacheInvalidationService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
private readonly listCacheTtlSeconds = 300
|
||||||
|
|
||||||
private readonly defaultSelect: GoodSelect = {
|
private readonly defaultSelect: GoodSelect = {
|
||||||
id: true,
|
id: true,
|
||||||
name: true,
|
name: true,
|
||||||
@@ -49,6 +56,14 @@ export class GoodsService {
|
|||||||
})
|
})
|
||||||
|
|
||||||
async findAll(guildId: string) {
|
async findAll(guildId: string) {
|
||||||
|
const cacheKey = RedisKeyMaker.guildGoodsList(guildId)
|
||||||
|
const cached = await this.redisService.getJson<{ goods: unknown[]; total: number }>(
|
||||||
|
cacheKey,
|
||||||
|
)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.paginate(cached.goods, { total: cached.total })
|
||||||
|
}
|
||||||
|
|
||||||
const [goods, total] = await this.prisma.$transaction([
|
const [goods, total] = await this.prisma.$transaction([
|
||||||
this.prisma.good.findMany({
|
this.prisma.good.findMany({
|
||||||
where: this.defaultWhere(guildId),
|
where: this.defaultWhere(guildId),
|
||||||
@@ -56,6 +71,9 @@ export class GoodsService {
|
|||||||
}),
|
}),
|
||||||
this.prisma.good.count(),
|
this.prisma.good.count(),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
await this.redisService.setJson(cacheKey, { goods, total }, this.listCacheTtlSeconds)
|
||||||
|
|
||||||
return ResponseMapper.paginate(goods, {
|
return ResponseMapper.paginate(goods, {
|
||||||
total,
|
total,
|
||||||
})
|
})
|
||||||
@@ -75,6 +93,10 @@ export class GoodsService {
|
|||||||
|
|
||||||
async create(data: CreateGuildGoodDto, file: Express.Multer.File) {
|
async create(data: CreateGuildGoodDto, file: Express.Multer.File) {
|
||||||
const { category_id, measure_unit_id, sku_id, ...rest } = data
|
const { category_id, measure_unit_id, sku_id, ...rest } = data
|
||||||
|
const category = await this.prisma.goodCategory.findUnique({
|
||||||
|
where: { id: category_id },
|
||||||
|
select: { guild_id: true },
|
||||||
|
})
|
||||||
|
|
||||||
const good = await this.prisma.$transaction(async tx => {
|
const good = await this.prisma.$transaction(async tx => {
|
||||||
let image_url = ''
|
let image_url = ''
|
||||||
@@ -111,11 +133,25 @@ export class GoodsService {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (category?.guild_id) {
|
||||||
|
await this.cacheInvalidationService.invalidateGoodsList(category.guild_id)
|
||||||
|
}
|
||||||
|
|
||||||
return ResponseMapper.create(good)
|
return ResponseMapper.create(good)
|
||||||
}
|
}
|
||||||
|
|
||||||
async update(id: string, data: UpdateGuildGoodDto, file: Express.Multer.File) {
|
async update(id: string, data: UpdateGuildGoodDto, file: Express.Multer.File) {
|
||||||
const { category_id, measure_unit_id, sku_id, ...rest } = data
|
const { category_id, measure_unit_id, sku_id, ...rest } = data
|
||||||
|
const prevGood = await this.prisma.good.findUnique({
|
||||||
|
where: { id },
|
||||||
|
select: { category: { select: { guild_id: true } } },
|
||||||
|
})
|
||||||
|
const nextCategory = category_id
|
||||||
|
? await this.prisma.goodCategory.findUnique({
|
||||||
|
where: { id: category_id },
|
||||||
|
select: { guild_id: true },
|
||||||
|
})
|
||||||
|
: null
|
||||||
|
|
||||||
const good = await this.prisma.$transaction(async tx => {
|
const good = await this.prisma.$transaction(async tx => {
|
||||||
let image_url = ''
|
let image_url = ''
|
||||||
@@ -162,6 +198,18 @@ export class GoodsService {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const cacheGuildIds = new Set<string>()
|
||||||
|
if (prevGood?.category?.guild_id) {
|
||||||
|
cacheGuildIds.add(prevGood.category.guild_id)
|
||||||
|
}
|
||||||
|
if (nextCategory?.guild_id) {
|
||||||
|
cacheGuildIds.add(nextCategory.guild_id)
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const guildId of cacheGuildIds) {
|
||||||
|
await this.cacheInvalidationService.invalidateGoodsList(guildId)
|
||||||
|
}
|
||||||
|
|
||||||
return ResponseMapper.create(good)
|
return ResponseMapper.create(good)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
|
import { RedisKeyMaker } from '@/common/utils/redisKeyMaker'
|
||||||
|
import { AdminGuildCacheInvalidationService } from '@/modules/admin/guilds/cache/admin-guild-cache-invalidation.service'
|
||||||
import { PrismaService } from '@/prisma/prisma.service'
|
import { PrismaService } from '@/prisma/prisma.service'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable } from '@nestjs/common'
|
||||||
import { ResponseMapper } from 'common/response/response-mapper'
|
import { ResponseMapper } from 'common/response/response-mapper'
|
||||||
import { CreateStockKeepingUnitDto } from './dto/create-stock-keeping-unit.dto'
|
import { CreateStockKeepingUnitDto } from './dto/create-stock-keeping-unit.dto'
|
||||||
@@ -6,7 +9,17 @@ import { UpdateStockKeepingUnitDto } from './dto/update-stock-keeping-unit.dto'
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class StockKeepingUnitsService {
|
export class StockKeepingUnitsService {
|
||||||
constructor(private readonly prisma: PrismaService) {}
|
constructor(
|
||||||
|
private readonly prisma: PrismaService,
|
||||||
|
private readonly redisService: RedisService,
|
||||||
|
private readonly cacheInvalidationService: AdminGuildCacheInvalidationService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
private readonly listCacheTtlSeconds = 300
|
||||||
|
|
||||||
|
private getListCacheKey(guild_id: string): string {
|
||||||
|
return RedisKeyMaker.guildStockKeepingUnitsList(guild_id)
|
||||||
|
}
|
||||||
|
|
||||||
private mapData(data: any) {
|
private mapData(data: any) {
|
||||||
const { name, is_foreign, is_domestic, ...rest } = data
|
const { name, is_foreign, is_domestic, ...rest } = data
|
||||||
@@ -17,12 +30,19 @@ export class StockKeepingUnitsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async findAll(guild_id: string) {
|
async findAll(guild_id: string) {
|
||||||
|
const cacheKey = this.getListCacheKey(guild_id)
|
||||||
|
const cached = await this.redisService.getJson<unknown[]>(cacheKey)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.list(cached)
|
||||||
|
}
|
||||||
|
|
||||||
const items = await this.prisma.stockKeepingUnits.findMany({
|
const items = await this.prisma.stockKeepingUnits.findMany({
|
||||||
where: { guild_id },
|
where: { guild_id },
|
||||||
orderBy: { created_at: 'desc' },
|
orderBy: { created_at: 'desc' },
|
||||||
})
|
})
|
||||||
|
|
||||||
const mappedData = items.map(this.mapData)
|
const mappedData = items.map(this.mapData)
|
||||||
|
await this.redisService.setJson(cacheKey, mappedData, this.listCacheTtlSeconds)
|
||||||
|
|
||||||
return ResponseMapper.list(mappedData)
|
return ResponseMapper.list(mappedData)
|
||||||
}
|
}
|
||||||
@@ -39,6 +59,9 @@ export class StockKeepingUnitsService {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await this.redisService.delete(this.getListCacheKey(guild_id))
|
||||||
|
await this.cacheInvalidationService.invalidateGoodsList(guild_id)
|
||||||
|
|
||||||
const mappedData = this.mapData(item)
|
const mappedData = this.mapData(item)
|
||||||
return ResponseMapper.create(mappedData)
|
return ResponseMapper.create(mappedData)
|
||||||
}
|
}
|
||||||
@@ -48,6 +71,10 @@ export class StockKeepingUnitsService {
|
|||||||
where: { guild_id, id },
|
where: { guild_id, id },
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await this.redisService.delete(this.getListCacheKey(guild_id))
|
||||||
|
await this.cacheInvalidationService.invalidateGoodsList(guild_id)
|
||||||
|
|
||||||
return ResponseMapper.update(item)
|
return ResponseMapper.update(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,30 @@
|
|||||||
import { QUERY_CONSTANTS } from '@/common/queryConstants'
|
import { QUERY_CONSTANTS } from '@/common/queryConstants'
|
||||||
import consumer_mappersUtil from '@/common/utils/mappers/consumer_mappers.util'
|
import consumer_mappersUtil from '@/common/utils/mappers/consumer_mappers.util'
|
||||||
|
import { RedisKeyMaker } from '@/common/utils/redisKeyMaker'
|
||||||
import { LicenseActivationWhereInput } from '@/generated/prisma/models'
|
import { LicenseActivationWhereInput } from '@/generated/prisma/models'
|
||||||
|
import { PartnersCacheInvalidationService } from '@/modules/partners/cache/partners-cache-invalidation.service'
|
||||||
import { PrismaService } from '@/prisma/prisma.service'
|
import { PrismaService } from '@/prisma/prisma.service'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable } from '@nestjs/common'
|
||||||
import { ResponseMapper } from 'common/response/response-mapper'
|
import { ResponseMapper } from 'common/response/response-mapper'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PartnerActivatedLicensesService {
|
export class PartnerActivatedLicensesService {
|
||||||
constructor(private readonly prisma: PrismaService) {}
|
constructor(
|
||||||
|
private readonly prisma: PrismaService,
|
||||||
|
private readonly redisService: RedisService,
|
||||||
|
private readonly cacheInvalidationService: PartnersCacheInvalidationService,
|
||||||
|
) {}
|
||||||
|
|
||||||
async findAll(partner_id: string, page = 1, perPage = 10) {
|
async findAll(partner_id: string, page = 1, perPage = 10) {
|
||||||
|
const cacheKey = RedisKeyMaker.partnerActivatedLicensesList(partner_id, page, perPage)
|
||||||
|
const cached = await this.redisService.getJson<{ data: unknown[]; total: number }>(
|
||||||
|
cacheKey,
|
||||||
|
)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.paginate(cached.data, { page, perPage, total: cached.total })
|
||||||
|
}
|
||||||
|
|
||||||
const defaultWhere: LicenseActivationWhereInput = {
|
const defaultWhere: LicenseActivationWhereInput = {
|
||||||
license: {
|
license: {
|
||||||
charge_transaction: {
|
charge_transaction: {
|
||||||
@@ -73,6 +88,8 @@ export class PartnerActivatedLicensesService {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await this.redisService.setJson(cacheKey, { data: mappedLicenses, total }, 300)
|
||||||
|
|
||||||
return ResponseMapper.paginate(mappedLicenses, {
|
return ResponseMapper.paginate(mappedLicenses, {
|
||||||
page,
|
page,
|
||||||
perPage,
|
perPage,
|
||||||
@@ -90,6 +107,7 @@ export class PartnerActivatedLicensesService {
|
|||||||
|
|
||||||
async delete(partnerId: string, id: string) {
|
async delete(partnerId: string, id: string) {
|
||||||
await this.prisma.license.delete({ where: { id } })
|
await this.prisma.license.delete({ where: { id } })
|
||||||
|
await this.cacheInvalidationService.invalidatePartnerLicenses(partnerId)
|
||||||
return ResponseMapper.delete()
|
return ResponseMapper.delete()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+32
-2
@@ -1,3 +1,4 @@
|
|||||||
|
import { RedisKeyMaker } from '@/common/utils/redisKeyMaker'
|
||||||
import {
|
import {
|
||||||
generateTrackingCode,
|
generateTrackingCode,
|
||||||
isTrackingCodeUniqueViolation,
|
isTrackingCodeUniqueViolation,
|
||||||
@@ -6,14 +7,20 @@ import {
|
|||||||
LicenseChargeTransactionSelect,
|
LicenseChargeTransactionSelect,
|
||||||
LicenseChargeTransactionWhereInput,
|
LicenseChargeTransactionWhereInput,
|
||||||
} from '@/generated/prisma/models'
|
} from '@/generated/prisma/models'
|
||||||
|
import { PartnersCacheInvalidationService } from '@/modules/partners/cache/partners-cache-invalidation.service'
|
||||||
import { PrismaService } from '@/prisma/prisma.service'
|
import { PrismaService } from '@/prisma/prisma.service'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
import { BadRequestException, Injectable } from '@nestjs/common'
|
import { BadRequestException, Injectable } from '@nestjs/common'
|
||||||
import { ResponseMapper } from 'common/response/response-mapper'
|
import { ResponseMapper } from 'common/response/response-mapper'
|
||||||
import { ChargeLicenseDto } from './dto/chargedLicenseTransactions.dto'
|
import { ChargeLicenseDto } from './dto/chargedLicenseTransactions.dto'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PartnerLicenseChargeTransactionService {
|
export class PartnerLicenseChargeTransactionService {
|
||||||
constructor(private readonly prisma: PrismaService) {}
|
constructor(
|
||||||
|
private readonly prisma: PrismaService,
|
||||||
|
private readonly redisService: RedisService,
|
||||||
|
private readonly cacheInvalidationService: PartnersCacheInvalidationService,
|
||||||
|
) {}
|
||||||
|
|
||||||
private readonly TRACKING_CODE_LENGTH = 8
|
private readonly TRACKING_CODE_LENGTH = 8
|
||||||
private readonly TRACKING_CODE_MAX_ATTEMPTS = 5
|
private readonly TRACKING_CODE_MAX_ATTEMPTS = 5
|
||||||
@@ -53,6 +60,18 @@ export class PartnerLicenseChargeTransactionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async findAll(partner_id: string, page = 1, perPage = 10) {
|
async findAll(partner_id: string, page = 1, perPage = 10) {
|
||||||
|
const cacheKey = RedisKeyMaker.partnerLicenseChargeTransactionsList(
|
||||||
|
partner_id,
|
||||||
|
page,
|
||||||
|
perPage,
|
||||||
|
)
|
||||||
|
const cached = await this.redisService.getJson<{ data: unknown[]; total: number }>(
|
||||||
|
cacheKey,
|
||||||
|
)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.paginate(cached.data, { page, perPage, total: cached.total })
|
||||||
|
}
|
||||||
|
|
||||||
const defaultWhere: LicenseChargeTransactionWhereInput = {
|
const defaultWhere: LicenseChargeTransactionWhereInput = {
|
||||||
partner_id,
|
partner_id,
|
||||||
}
|
}
|
||||||
@@ -70,6 +89,7 @@ export class PartnerLicenseChargeTransactionService {
|
|||||||
])
|
])
|
||||||
|
|
||||||
const mappedTransactions = transactions.map(this.mappedTransaction)
|
const mappedTransactions = transactions.map(this.mappedTransaction)
|
||||||
|
await this.redisService.setJson(cacheKey, { data: mappedTransactions, total }, 300)
|
||||||
|
|
||||||
return ResponseMapper.paginate(mappedTransactions, {
|
return ResponseMapper.paginate(mappedTransactions, {
|
||||||
page,
|
page,
|
||||||
@@ -79,6 +99,12 @@ export class PartnerLicenseChargeTransactionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async findOne(partner_id: string, id: string) {
|
async findOne(partner_id: string, id: string) {
|
||||||
|
const cacheKey = RedisKeyMaker.partnerLicenseChargeTransactionDetail(partner_id, id)
|
||||||
|
const cached = await this.redisService.getJson<unknown>(cacheKey)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.single(cached)
|
||||||
|
}
|
||||||
|
|
||||||
const transaction = await this.prisma.licenseChargeTransaction.findUniqueOrThrow({
|
const transaction = await this.prisma.licenseChargeTransaction.findUniqueOrThrow({
|
||||||
where: {
|
where: {
|
||||||
id,
|
id,
|
||||||
@@ -86,7 +112,9 @@ export class PartnerLicenseChargeTransactionService {
|
|||||||
},
|
},
|
||||||
select: this.defaultSelect,
|
select: this.defaultSelect,
|
||||||
})
|
})
|
||||||
return ResponseMapper.single(this.mappedTransaction(transaction))
|
const mappedTransaction = this.mappedTransaction(transaction)
|
||||||
|
await this.redisService.setJson(cacheKey, mappedTransaction, 300)
|
||||||
|
return ResponseMapper.single(mappedTransaction)
|
||||||
}
|
}
|
||||||
|
|
||||||
async create(partner_id: string, data: ChargeLicenseDto) {
|
async create(partner_id: string, data: ChargeLicenseDto) {
|
||||||
@@ -134,6 +162,8 @@ export class PartnerLicenseChargeTransactionService {
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.scheduleLicenseProvisioning(transaction.id, transaction.purchased_count)
|
this.scheduleLicenseProvisioning(transaction.id, transaction.purchased_count)
|
||||||
|
await this.cacheInvalidationService.invalidatePartnersList()
|
||||||
|
await this.cacheInvalidationService.invalidatePartnerLicenses(partner_id)
|
||||||
return ResponseMapper.create({
|
return ResponseMapper.create({
|
||||||
transaction_id: transaction.id,
|
transaction_id: transaction.id,
|
||||||
charged_license_count: transaction.purchased_count,
|
charged_license_count: transaction.purchased_count,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { UploadedFileTypes } from '@/common/enums/enums'
|
import { UploadedFileTypes } from '@/common/enums/enums'
|
||||||
import { translateEnumValue } from '@/common/utils'
|
import { translateEnumValue } from '@/common/utils'
|
||||||
import { PasswordUtil } from '@/common/utils/password.util'
|
import { PasswordUtil } from '@/common/utils/password.util'
|
||||||
|
import { RedisKeyMaker } from '@/common/utils/redisKeyMaker'
|
||||||
import {
|
import {
|
||||||
AccountStatus,
|
AccountStatus,
|
||||||
AccountType,
|
AccountType,
|
||||||
@@ -8,8 +9,10 @@ import {
|
|||||||
PartnerStatus,
|
PartnerStatus,
|
||||||
} from '@/generated/prisma/enums'
|
} from '@/generated/prisma/enums'
|
||||||
import { PartnerSelect } from '@/generated/prisma/models'
|
import { PartnerSelect } from '@/generated/prisma/models'
|
||||||
|
import { PartnersCacheInvalidationService } from '@/modules/partners/cache/partners-cache-invalidation.service'
|
||||||
import { UploaderService } from '@/modules/uploader/uploader.service'
|
import { UploaderService } from '@/modules/uploader/uploader.service'
|
||||||
import { PrismaService } from '@/prisma/prisma.service'
|
import { PrismaService } from '@/prisma/prisma.service'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable } from '@nestjs/common'
|
||||||
import { ResponseMapper } from 'common/response/response-mapper'
|
import { ResponseMapper } from 'common/response/response-mapper'
|
||||||
import { CreatePartnerDto, UpdatePartnerDto } from './dto/partner.dto'
|
import { CreatePartnerDto, UpdatePartnerDto } from './dto/partner.dto'
|
||||||
@@ -20,6 +23,8 @@ export class PartnersService {
|
|||||||
constructor(
|
constructor(
|
||||||
private readonly prisma: PrismaService,
|
private readonly prisma: PrismaService,
|
||||||
private readonly uploaderService: UploaderService,
|
private readonly uploaderService: UploaderService,
|
||||||
|
private readonly redisService: RedisService,
|
||||||
|
private readonly cacheInvalidationService: PartnersCacheInvalidationService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
private readonly defaultSelect: PartnerSelect = {
|
private readonly defaultSelect: PartnerSelect = {
|
||||||
@@ -137,22 +142,40 @@ export class PartnersService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async findAll() {
|
async findAll() {
|
||||||
|
const cacheKey = RedisKeyMaker.partnersList()
|
||||||
|
const cached = await this.redisService.getJson<unknown[]>(cacheKey)
|
||||||
|
if (cached) {
|
||||||
|
console.log('cached', cached)
|
||||||
|
|
||||||
|
return ResponseMapper.list(cached)
|
||||||
|
}
|
||||||
|
|
||||||
const partners = await this.prisma.partner.findMany({
|
const partners = await this.prisma.partner.findMany({
|
||||||
select: this.defaultSelect,
|
select: this.defaultSelect,
|
||||||
})
|
})
|
||||||
|
|
||||||
const mappedPartners = partners.map(this.mapPartner)
|
const mappedPartners = partners.map(this.mapPartner)
|
||||||
|
await this.redisService.setJson(cacheKey, mappedPartners, 300)
|
||||||
|
|
||||||
return ResponseMapper.list(mappedPartners)
|
return ResponseMapper.list(mappedPartners)
|
||||||
}
|
}
|
||||||
|
|
||||||
async findOne(id: string) {
|
async findOne(id: string) {
|
||||||
|
const cacheKey = RedisKeyMaker.partnerDetail(id)
|
||||||
|
const cached = await this.redisService.getJson<unknown>(cacheKey)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.single(cached)
|
||||||
|
}
|
||||||
|
|
||||||
const partner = await this.prisma.partner.findUniqueOrThrow({
|
const partner = await this.prisma.partner.findUniqueOrThrow({
|
||||||
where: { id },
|
where: { id },
|
||||||
select: this.defaultSelect,
|
select: this.defaultSelect,
|
||||||
})
|
})
|
||||||
|
|
||||||
return ResponseMapper.single(this.mapPartner(partner))
|
const mappedPartner = this.mapPartner(partner)
|
||||||
|
await this.redisService.setJson(cacheKey, mappedPartner, 300)
|
||||||
|
|
||||||
|
return ResponseMapper.single(mappedPartner)
|
||||||
}
|
}
|
||||||
|
|
||||||
async create(data: CreatePartnerDto, logo?: any) {
|
async create(data: CreatePartnerDto, logo?: any) {
|
||||||
@@ -184,6 +207,8 @@ export class PartnersService {
|
|||||||
},
|
},
|
||||||
select: this.defaultSelect,
|
select: this.defaultSelect,
|
||||||
})
|
})
|
||||||
|
await this.cacheInvalidationService.invalidatePartnersList()
|
||||||
|
await this.cacheInvalidationService.invalidatePartnerDetail(partner.id)
|
||||||
return ResponseMapper.create(partner)
|
return ResponseMapper.create(partner)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,11 +245,17 @@ export class PartnersService {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await this.cacheInvalidationService.invalidatePartnersList()
|
||||||
|
await this.cacheInvalidationService.invalidatePartnerDetail(id)
|
||||||
|
|
||||||
return ResponseMapper.update(partner)
|
return ResponseMapper.update(partner)
|
||||||
}
|
}
|
||||||
|
|
||||||
async delete(id: string) {
|
async delete(id: string) {
|
||||||
await this.prisma.partner.delete({ where: { id } })
|
await this.prisma.partner.delete({ where: { id } })
|
||||||
|
await this.cacheInvalidationService.invalidatePartnersList()
|
||||||
|
await this.cacheInvalidationService.invalidatePartnerDetail(id)
|
||||||
|
await this.cacheInvalidationService.invalidatePartnerLicenses(id)
|
||||||
return ResponseMapper.delete()
|
return ResponseMapper.delete()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { BusinessActivitiesQueryService } from '@/common/services/businessActivities/business-activities-query.service'
|
import { BusinessActivitiesQueryService } from '@/common/services/businessActivities/business-activities-query.service'
|
||||||
|
import { RedisKeyMaker } from '@/common/utils/redisKeyMaker'
|
||||||
import { BusinessActivitySelect } from '@/generated/prisma/models'
|
import { BusinessActivitySelect } from '@/generated/prisma/models'
|
||||||
import { PrismaService } from '@/prisma/prisma.service'
|
import { PrismaService } from '@/prisma/prisma.service'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable } from '@nestjs/common'
|
||||||
import { ResponseMapper } from 'common/response/response-mapper'
|
import { ResponseMapper } from 'common/response/response-mapper'
|
||||||
|
|
||||||
@@ -10,6 +12,7 @@ export class BusinessActivitiesService {
|
|||||||
constructor(
|
constructor(
|
||||||
private readonly prisma: PrismaService,
|
private readonly prisma: PrismaService,
|
||||||
private readonly businessActivitiesQueryService: BusinessActivitiesQueryService,
|
private readonly businessActivitiesQueryService: BusinessActivitiesQueryService,
|
||||||
|
private readonly redisService: RedisService,
|
||||||
) {
|
) {
|
||||||
this.defaultSelect = {
|
this.defaultSelect = {
|
||||||
...this.businessActivitiesQueryService.baseSelect,
|
...this.businessActivitiesQueryService.baseSelect,
|
||||||
@@ -37,6 +40,7 @@ export class BusinessActivitiesService {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private readonly cacheTtlSeconds = 300
|
||||||
|
|
||||||
private readonly prepareBusinessActivityResponse = (businessActivity: any) => {
|
private readonly prepareBusinessActivityResponse = (businessActivity: any) => {
|
||||||
const { license_activation, complexes, ...rest } = businessActivity
|
const { license_activation, complexes, ...rest } = businessActivity
|
||||||
@@ -56,20 +60,34 @@ export class BusinessActivitiesService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async findAll(consumer_id: string) {
|
async findAll(consumer_id: string) {
|
||||||
|
const cacheKey = RedisKeyMaker.consumerBusinessActivitiesList(consumer_id)
|
||||||
|
const cached = await this.redisService.getJson<unknown[]>(cacheKey)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.list(cached)
|
||||||
|
}
|
||||||
|
|
||||||
const businessActivities =
|
const businessActivities =
|
||||||
await this.businessActivitiesQueryService.findAllByConsumer(
|
await this.businessActivitiesQueryService.findAllByConsumer(
|
||||||
consumer_id,
|
consumer_id,
|
||||||
this.defaultSelect,
|
this.defaultSelect,
|
||||||
)
|
)
|
||||||
|
await this.redisService.setJson(cacheKey, businessActivities, this.cacheTtlSeconds)
|
||||||
return ResponseMapper.list(businessActivities)
|
return ResponseMapper.list(businessActivities)
|
||||||
}
|
}
|
||||||
|
|
||||||
async findOne(consumer_id: string, id: string) {
|
async findOne(consumer_id: string, id: string) {
|
||||||
|
const cacheKey = RedisKeyMaker.consumerBusinessActivityInfo(consumer_id, id)
|
||||||
|
const cached = await this.redisService.getJson<unknown>(cacheKey)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.single(cached)
|
||||||
|
}
|
||||||
|
|
||||||
const businessActivity = await this.businessActivitiesQueryService.findOneByConsumer(
|
const businessActivity = await this.businessActivitiesQueryService.findOneByConsumer(
|
||||||
consumer_id,
|
consumer_id,
|
||||||
id,
|
id,
|
||||||
this.defaultSelect,
|
this.defaultSelect,
|
||||||
)
|
)
|
||||||
|
await this.redisService.setJson(cacheKey, businessActivity, this.cacheTtlSeconds)
|
||||||
return ResponseMapper.single(businessActivity)
|
return ResponseMapper.single(businessActivity)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +97,13 @@ export class BusinessActivitiesService {
|
|||||||
data,
|
data,
|
||||||
select: this.defaultSelect,
|
select: this.defaultSelect,
|
||||||
})
|
})
|
||||||
|
await this.redisService.delete(
|
||||||
|
RedisKeyMaker.consumerBusinessActivityInfo(consumer_id, id),
|
||||||
|
)
|
||||||
|
await this.redisService.delete(
|
||||||
|
RedisKeyMaker.consumerBusinessActivitiesList(consumer_id),
|
||||||
|
)
|
||||||
|
|
||||||
return ResponseMapper.update(this.prepareBusinessActivityResponse(businessActivity))
|
return ResponseMapper.update(this.prepareBusinessActivityResponse(businessActivity))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { UploadedFileTypes } from '@/common/enums/enums'
|
import { UploadedFileTypes } from '@/common/enums/enums'
|
||||||
import { GoodSelect } from '@/generated/prisma/models'
|
import { GoodSelect } from '@/generated/prisma/models'
|
||||||
|
import { PosCacheInvalidationService } from '@/modules/pos/cache/pos-cache-invalidation.service'
|
||||||
import { UploaderService } from '@/modules/uploader/uploader.service'
|
import { UploaderService } from '@/modules/uploader/uploader.service'
|
||||||
import { PrismaService } from '@/prisma/prisma.service'
|
import { PrismaService } from '@/prisma/prisma.service'
|
||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable } from '@nestjs/common'
|
||||||
@@ -11,6 +12,7 @@ export class ConsumerBusinessActivityGoodsService {
|
|||||||
constructor(
|
constructor(
|
||||||
private readonly prisma: PrismaService,
|
private readonly prisma: PrismaService,
|
||||||
private readonly uploaderService: UploaderService,
|
private readonly uploaderService: UploaderService,
|
||||||
|
private readonly posCacheInvalidationService: PosCacheInvalidationService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
defaultSelect: GoodSelect = {
|
defaultSelect: GoodSelect = {
|
||||||
@@ -110,6 +112,9 @@ export class ConsumerBusinessActivityGoodsService {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
await this.posCacheInvalidationService.invalidateGoodsListByBusinessActivity(
|
||||||
|
business_activity_id,
|
||||||
|
)
|
||||||
return ResponseMapper.create(good)
|
return ResponseMapper.create(good)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,6 +179,9 @@ export class ConsumerBusinessActivityGoodsService {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
await this.posCacheInvalidationService.invalidateGoodsListByBusinessActivity(
|
||||||
|
business_activity_id,
|
||||||
|
)
|
||||||
return ResponseMapper.update(good)
|
return ResponseMapper.update(good)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import { QUERY_CONSTANTS } from '@/common/queryConstants'
|
import { QUERY_CONSTANTS } from '@/common/queryConstants'
|
||||||
import { ResponseMapper } from '@/common/response/response-mapper'
|
import { ResponseMapper } from '@/common/response/response-mapper'
|
||||||
import { PasswordUtil } from '@/common/utils'
|
import { PasswordUtil } from '@/common/utils'
|
||||||
|
import { RedisKeyMaker } from '@/common/utils/redisKeyMaker'
|
||||||
import { ConsumerUpdateInput } from '@/generated/prisma/models'
|
import { ConsumerUpdateInput } from '@/generated/prisma/models'
|
||||||
import { PrismaService } from '@/prisma/prisma.service'
|
import { PrismaService } from '@/prisma/prisma.service'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable } from '@nestjs/common'
|
||||||
import consumer_mappersUtil from '../../common/utils/mappers/consumer_mappers.util'
|
import consumer_mappersUtil from '../../common/utils/mappers/consumer_mappers.util'
|
||||||
import { UpdateConsumerInfoDto } from './dto/update-info-request.dto'
|
import { UpdateConsumerInfoDto } from './dto/update-info-request.dto'
|
||||||
@@ -10,9 +12,20 @@ import { UpdateConsumerPasswordDto } from './dto/update-password-request.dto'
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ConsumerService {
|
export class ConsumerService {
|
||||||
constructor(private readonly prisma: PrismaService) {}
|
constructor(
|
||||||
|
private readonly prisma: PrismaService,
|
||||||
|
private readonly redisService: RedisService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
private readonly infoCacheTtlSeconds = 300
|
||||||
|
|
||||||
async getInfo(consumer_id: string) {
|
async getInfo(consumer_id: string) {
|
||||||
|
const cacheKey = RedisKeyMaker.consumerInfo(consumer_id)
|
||||||
|
const cached = await this.redisService.getJson<unknown>(cacheKey)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.single(cached)
|
||||||
|
}
|
||||||
|
|
||||||
const consumer = await this.prisma.consumer.findUniqueOrThrow({
|
const consumer = await this.prisma.consumer.findUniqueOrThrow({
|
||||||
where: {
|
where: {
|
||||||
id: consumer_id,
|
id: consumer_id,
|
||||||
@@ -24,7 +37,9 @@ export class ConsumerService {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
return ResponseMapper.single(consumer_mappersUtil(consumer))
|
const mappedConsumer = consumer_mappersUtil(consumer)
|
||||||
|
await this.redisService.setJson(cacheKey, mappedConsumer, this.infoCacheTtlSeconds)
|
||||||
|
return ResponseMapper.single(mappedConsumer)
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateInfo(consumer_id: string, data: UpdateConsumerInfoDto) {
|
async updateInfo(consumer_id: string, data: UpdateConsumerInfoDto) {
|
||||||
@@ -69,6 +84,22 @@ export class ConsumerService {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await this.redisService.delete(RedisKeyMaker.consumerInfo(consumer_id))
|
||||||
|
const partnerOwner = await this.prisma.consumer.findUnique({
|
||||||
|
where: { id: consumer_id },
|
||||||
|
select: {
|
||||||
|
legal: { select: { partner_id: true } },
|
||||||
|
individual: { select: { partner_id: true } },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const partnerId =
|
||||||
|
partnerOwner?.legal?.partner_id || partnerOwner?.individual?.partner_id || null
|
||||||
|
if (partnerId) {
|
||||||
|
await this.redisService.delete(
|
||||||
|
RedisKeyMaker.partnerConsumerInfo(partnerId, consumer_id),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return ResponseMapper.update(consumer)
|
return ResponseMapper.update(consumer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import translates from '@/common/constants/translates/translates'
|
import translates from '@/common/constants/translates/translates'
|
||||||
import { translateEnumValue } from '@/common/utils/enum-translator.util'
|
import { translateEnumValue } from '@/common/utils/enum-translator.util'
|
||||||
|
import { RedisKeyMaker } from '@/common/utils/redisKeyMaker'
|
||||||
import {
|
import {
|
||||||
AccountStatus,
|
AccountStatus,
|
||||||
AccountType,
|
AccountType,
|
||||||
@@ -26,12 +27,22 @@ import {
|
|||||||
TspProviderResponseStatus,
|
TspProviderResponseStatus,
|
||||||
TspProviderType,
|
TspProviderType,
|
||||||
} from '@/generated/prisma/enums'
|
} from '@/generated/prisma/enums'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable } from '@nestjs/common'
|
||||||
import { GoldKarat, TspProviderCustomerType } from 'common/enums/enums'
|
import { GoldKarat, TspProviderCustomerType } from 'common/enums/enums'
|
||||||
import { ResponseMapper } from 'common/response/response-mapper'
|
import { ResponseMapper } from 'common/response/response-mapper'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class EnumsService {
|
export class EnumsService {
|
||||||
|
constructor(private readonly redisService: RedisService) {}
|
||||||
|
|
||||||
|
private readonly cacheTtlSeconds = 24 * 60 * 60
|
||||||
|
private readonly cacheBuildVersion =
|
||||||
|
process.env.CACHE_BUILD_VERSION ||
|
||||||
|
process.env.APP_BUILD_ID ||
|
||||||
|
process.env.npm_package_version ||
|
||||||
|
'local'
|
||||||
|
|
||||||
private prepareData(
|
private prepareData(
|
||||||
items: Record<string, string>,
|
items: Record<string, string>,
|
||||||
enumName: keyof typeof translates.enums,
|
enumName: keyof typeof translates.enums,
|
||||||
@@ -45,7 +56,7 @@ export class EnumsService {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllEnums() {
|
private buildAllEnums() {
|
||||||
return {
|
return {
|
||||||
PaymentMethodType: this.prepareData(PaymentMethodType, 'PaymentMethodType'),
|
PaymentMethodType: this.prepareData(PaymentMethodType, 'PaymentMethodType'),
|
||||||
GoldKarat: this.prepareData(GoldKarat, 'GoldKarat'),
|
GoldKarat: this.prepareData(GoldKarat, 'GoldKarat'),
|
||||||
@@ -91,8 +102,28 @@ export class EnumsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getEnumValues(enumName: keyof typeof translates.enums) {
|
async getAllEnums() {
|
||||||
const enums = this.getAllEnums()
|
const cacheKey = RedisKeyMaker.enumsAll(this.cacheBuildVersion)
|
||||||
return ResponseMapper.list(enums[enumName] || [])
|
const cached = await this.redisService.getJson<Record<string, unknown[]>>(cacheKey)
|
||||||
|
if (cached) {
|
||||||
|
return cached
|
||||||
|
}
|
||||||
|
|
||||||
|
const enums = this.buildAllEnums()
|
||||||
|
await this.redisService.setJson(cacheKey, enums, this.cacheTtlSeconds)
|
||||||
|
return enums
|
||||||
|
}
|
||||||
|
|
||||||
|
async getEnumValues(enumName: keyof typeof translates.enums) {
|
||||||
|
const cacheKey = RedisKeyMaker.enumsValues(this.cacheBuildVersion, enumName)
|
||||||
|
const cached = await this.redisService.getJson<unknown[]>(cacheKey)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.list(cached)
|
||||||
|
}
|
||||||
|
|
||||||
|
const enums = await this.getAllEnums()
|
||||||
|
const items = enums[enumName] || []
|
||||||
|
await this.redisService.setJson(cacheKey, items, this.cacheTtlSeconds)
|
||||||
|
return ResponseMapper.list(items)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,167 @@
|
|||||||
|
import { RedisKeyMaker } from '@/common/utils'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
|
import { Injectable } from '@nestjs/common'
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class PartnersCacheInvalidationService {
|
||||||
|
constructor(private readonly redisService: RedisService) {}
|
||||||
|
|
||||||
|
async invalidatePartnerSummary(partnerId: string): Promise<void> {
|
||||||
|
await this.invalidatePartnersList()
|
||||||
|
await this.redisService.delete(RedisKeyMaker.partnerDetail(partnerId))
|
||||||
|
}
|
||||||
|
|
||||||
|
async invalidatePartnersList(): Promise<void> {
|
||||||
|
await this.redisService.delete(RedisKeyMaker.partnersList())
|
||||||
|
}
|
||||||
|
|
||||||
|
async invalidatePartnerDetail(partnerId: string): Promise<void> {
|
||||||
|
await this.invalidatePartnerSummary(partnerId)
|
||||||
|
}
|
||||||
|
|
||||||
|
async invalidatePartnerLicenseReadModels(partnerId: string): Promise<void> {
|
||||||
|
await this.redisService.deleteByPatterns([
|
||||||
|
RedisKeyMaker.partnerActivatedLicensesListPattern(partnerId),
|
||||||
|
RedisKeyMaker.partnerLicenseChargeTransactionsListPattern(partnerId),
|
||||||
|
RedisKeyMaker.partnerLicenseChargeTransactionDetailPattern(partnerId),
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
async invalidatePartnerLicenses(partnerId: string): Promise<void> {
|
||||||
|
await this.invalidatePartnerSummary(partnerId)
|
||||||
|
await this.invalidatePartnerLicenseReadModels(partnerId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// consumers //
|
||||||
|
|
||||||
|
async invalidatePartnerConsumers(
|
||||||
|
partnerId: string,
|
||||||
|
page: number,
|
||||||
|
perPage: number,
|
||||||
|
): Promise<void> {
|
||||||
|
await this.redisService.delete(
|
||||||
|
RedisKeyMaker.partnerConsumersList(partnerId, page, perPage),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async invalidatePartnerConsumerReadModels(
|
||||||
|
partnerId: string,
|
||||||
|
consumerId: string,
|
||||||
|
): Promise<void> {
|
||||||
|
await this.redisService.deleteByPatterns([
|
||||||
|
RedisKeyMaker.partnerConsumersListPattern(partnerId),
|
||||||
|
RedisKeyMaker.partnerConsumerInfo(partnerId, consumerId),
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
async invalidatePartnerConsumerBusinessActivitiesReadModels(
|
||||||
|
partnerId: string,
|
||||||
|
consumerId: string,
|
||||||
|
): Promise<void> {
|
||||||
|
await this.invalidatePartnerConsumerReadModels(partnerId, consumerId)
|
||||||
|
await this.redisService.deleteByPattern(
|
||||||
|
RedisKeyMaker.partnerConsumerBusinessActivitiesPattern(partnerId, consumerId),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async invalidatePartnerConsumerBusinessActivityReadModels(
|
||||||
|
partnerId: string,
|
||||||
|
consumerId: string,
|
||||||
|
businessActivityId: string,
|
||||||
|
): Promise<void> {
|
||||||
|
await this.invalidatePartnerConsumerBusinessActivitiesReadModels(
|
||||||
|
partnerId,
|
||||||
|
consumerId,
|
||||||
|
)
|
||||||
|
await this.redisService.delete(
|
||||||
|
RedisKeyMaker.partnerConsumerBusinessActivityInfo(
|
||||||
|
partnerId,
|
||||||
|
consumerId,
|
||||||
|
businessActivityId,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async invalidatePartnerConsumerBusinessActivityComplexesReadModels(
|
||||||
|
partnerId: string,
|
||||||
|
consumerId: string,
|
||||||
|
businessActivityId: string,
|
||||||
|
): Promise<void> {
|
||||||
|
await this.invalidatePartnerConsumerBusinessActivitiesReadModels(
|
||||||
|
partnerId,
|
||||||
|
consumerId,
|
||||||
|
)
|
||||||
|
await this.redisService.deleteByPattern(
|
||||||
|
RedisKeyMaker.partnerConsumerBusinessActivityComplexesPattern(
|
||||||
|
partnerId,
|
||||||
|
consumerId,
|
||||||
|
businessActivityId,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async invalidatePartnerConsumerBusinessActivityComplexReadModels(
|
||||||
|
partnerId: string,
|
||||||
|
consumerId: string,
|
||||||
|
businessActivityId: string,
|
||||||
|
complexId: string,
|
||||||
|
): Promise<void> {
|
||||||
|
await this.invalidatePartnerConsumerBusinessActivityComplexesReadModels(
|
||||||
|
partnerId,
|
||||||
|
consumerId,
|
||||||
|
businessActivityId,
|
||||||
|
)
|
||||||
|
await this.redisService.delete(
|
||||||
|
RedisKeyMaker.partnerConsumerBusinessActivityComplexInfo(
|
||||||
|
partnerId,
|
||||||
|
consumerId,
|
||||||
|
businessActivityId,
|
||||||
|
complexId,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async invalidatePartnerConsumerBusinessActivityComplexPosesReadModels(
|
||||||
|
partnerId: string,
|
||||||
|
consumerId: string,
|
||||||
|
businessActivityId: string,
|
||||||
|
complexId: string,
|
||||||
|
): Promise<void> {
|
||||||
|
await this.invalidatePartnerConsumerBusinessActivitiesReadModels(
|
||||||
|
partnerId,
|
||||||
|
consumerId,
|
||||||
|
)
|
||||||
|
await this.redisService.deleteByPattern(
|
||||||
|
RedisKeyMaker.partnerConsumerBusinessActivityComplexPosesPattern(
|
||||||
|
partnerId,
|
||||||
|
consumerId,
|
||||||
|
businessActivityId,
|
||||||
|
complexId,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async invalidatePartnerConsumerBusinessActivityComplexPosReadModels(
|
||||||
|
partnerId: string,
|
||||||
|
consumerId: string,
|
||||||
|
businessActivityId: string,
|
||||||
|
complexId: string,
|
||||||
|
posId: string,
|
||||||
|
): Promise<void> {
|
||||||
|
await this.invalidatePartnerConsumerBusinessActivityComplexPosesReadModels(
|
||||||
|
partnerId,
|
||||||
|
consumerId,
|
||||||
|
businessActivityId,
|
||||||
|
complexId,
|
||||||
|
)
|
||||||
|
await this.redisService.delete(
|
||||||
|
RedisKeyMaker.partnerConsumerBusinessActivityComplexPosInfo(
|
||||||
|
partnerId,
|
||||||
|
consumerId,
|
||||||
|
businessActivityId,
|
||||||
|
complexId,
|
||||||
|
posId,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,22 @@
|
|||||||
|
import { RedisKeyMaker } from '@/common/utils'
|
||||||
import { BusinessActivitySelect } from '@/generated/prisma/models'
|
import { BusinessActivitySelect } from '@/generated/prisma/models'
|
||||||
import { getPartnerFirstRemainingLicense } from '@/modules/partners/utils/getPartnerRemainingLicenses.util'
|
import { getPartnerFirstRemainingLicense } from '@/modules/partners/utils/getPartnerRemainingLicenses.util'
|
||||||
import { PrismaService } from '@/prisma/prisma.service'
|
import { PrismaService } from '@/prisma/prisma.service'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
import { BadRequestException, Injectable } from '@nestjs/common'
|
import { BadRequestException, Injectable } from '@nestjs/common'
|
||||||
import { ResponseMapper } from 'common/response/response-mapper'
|
import { ResponseMapper } from 'common/response/response-mapper'
|
||||||
|
import { PartnersCacheInvalidationService } from '../../cache/partners-cache-invalidation.service'
|
||||||
import { CreateBusinessActivitiesDto } from './dto/create-business-activities.dto'
|
import { CreateBusinessActivitiesDto } from './dto/create-business-activities.dto'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BusinessActivitiesService {
|
export class BusinessActivitiesService {
|
||||||
constructor(private readonly prisma: PrismaService) {}
|
constructor(
|
||||||
|
private readonly prisma: PrismaService,
|
||||||
|
private readonly redisService: RedisService,
|
||||||
|
private readonly partnersCacheInvalidationService: PartnersCacheInvalidationService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
private readonly cacheTtlSeconds = 300
|
||||||
|
|
||||||
private readonly setExpireDate = (starts_at: Date) => {
|
private readonly setExpireDate = (starts_at: Date) => {
|
||||||
return new Date(
|
return new Date(
|
||||||
@@ -85,6 +94,19 @@ export class BusinessActivitiesService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async findAll(partner_id: string, consumer_id: string, page = 1, perPage = 10) {
|
async findAll(partner_id: string, consumer_id: string, page = 1, perPage = 10) {
|
||||||
|
const cacheKey = RedisKeyMaker.partnerConsumerBusinessActivitiesList(
|
||||||
|
partner_id,
|
||||||
|
consumer_id,
|
||||||
|
page,
|
||||||
|
perPage,
|
||||||
|
)
|
||||||
|
const cached = await this.redisService.getJson<{ items: unknown[]; total: number }>(
|
||||||
|
cacheKey,
|
||||||
|
)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.paginate(cached.items, { total: cached.total, page, perPage })
|
||||||
|
}
|
||||||
|
|
||||||
const where = this.defaultWhere(partner_id, consumer_id)
|
const where = this.defaultWhere(partner_id, consumer_id)
|
||||||
const [businessActivities, total] = await this.prisma.$transaction(async tx => [
|
const [businessActivities, total] = await this.prisma.$transaction(async tx => [
|
||||||
await tx.businessActivity.findMany({
|
await tx.businessActivity.findMany({
|
||||||
@@ -95,13 +117,26 @@ export class BusinessActivitiesService {
|
|||||||
}),
|
}),
|
||||||
await tx.businessActivity.count({ where }),
|
await tx.businessActivity.count({ where }),
|
||||||
])
|
])
|
||||||
return ResponseMapper.paginate(
|
const mappedItems = businessActivities.map(this.prepareBusinessActivityResponse)
|
||||||
businessActivities.map(this.prepareBusinessActivityResponse),
|
await this.redisService.setJson(
|
||||||
{ total, page, perPage },
|
cacheKey,
|
||||||
|
{ items: mappedItems, total },
|
||||||
|
this.cacheTtlSeconds,
|
||||||
)
|
)
|
||||||
|
return ResponseMapper.paginate(mappedItems, { total, page, perPage })
|
||||||
}
|
}
|
||||||
|
|
||||||
async findOne(partner_id: string, consumer_id: string, id: string) {
|
async findOne(partner_id: string, consumer_id: string, id: string) {
|
||||||
|
const cacheKey = RedisKeyMaker.partnerConsumerBusinessActivityInfo(
|
||||||
|
partner_id,
|
||||||
|
consumer_id,
|
||||||
|
id,
|
||||||
|
)
|
||||||
|
const cached = await this.redisService.getJson<unknown>(cacheKey)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.single(cached)
|
||||||
|
}
|
||||||
|
|
||||||
const businessActivity = await this.prisma.businessActivity.findUnique({
|
const businessActivity = await this.prisma.businessActivity.findUnique({
|
||||||
where: {
|
where: {
|
||||||
...this.defaultWhere(partner_id, consumer_id),
|
...this.defaultWhere(partner_id, consumer_id),
|
||||||
@@ -109,7 +144,9 @@ export class BusinessActivitiesService {
|
|||||||
},
|
},
|
||||||
select: this.defaultSelect,
|
select: this.defaultSelect,
|
||||||
})
|
})
|
||||||
return ResponseMapper.single(this.prepareBusinessActivityResponse(businessActivity))
|
const mappedItem = this.prepareBusinessActivityResponse(businessActivity)
|
||||||
|
await this.redisService.setJson(cacheKey, mappedItem, this.cacheTtlSeconds)
|
||||||
|
return ResponseMapper.single(mappedItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
async create(
|
async create(
|
||||||
@@ -187,6 +224,10 @@ export class BusinessActivitiesService {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await this.partnersCacheInvalidationService.invalidatePartnerConsumerBusinessActivitiesReadModels(
|
||||||
|
partner_id,
|
||||||
|
consumer_id,
|
||||||
|
)
|
||||||
return ResponseMapper.create(businessActivity)
|
return ResponseMapper.create(businessActivity)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,6 +237,13 @@ export class BusinessActivitiesService {
|
|||||||
data,
|
data,
|
||||||
select: this.defaultSelect,
|
select: this.defaultSelect,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await this.partnersCacheInvalidationService.invalidatePartnerConsumerBusinessActivityReadModels(
|
||||||
|
partner_id,
|
||||||
|
consumer_id,
|
||||||
|
id,
|
||||||
|
)
|
||||||
|
|
||||||
return ResponseMapper.update(businessActivity)
|
return ResponseMapper.update(businessActivity)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-2
@@ -3,7 +3,12 @@ import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common'
|
|||||||
import { ApiTags } from '@nestjs/swagger'
|
import { ApiTags } from '@nestjs/swagger'
|
||||||
import { BusinessActivityComplexesService } from './complexes.service'
|
import { BusinessActivityComplexesService } from './complexes.service'
|
||||||
import { CreateComplexDto, UpdateComplexDto } from './dto/complex.dto'
|
import { CreateComplexDto, UpdateComplexDto } from './dto/complex.dto'
|
||||||
import type { BusinessActivityComplexesServiceCreateResponseDto, BusinessActivityComplexesServiceFindAllResponseDto, BusinessActivityComplexesServiceFindOneResponseDto, BusinessActivityComplexesServiceUpdateResponseDto } from './dto/complexes-response.dto'
|
import type {
|
||||||
|
BusinessActivityComplexesServiceCreateResponseDto,
|
||||||
|
BusinessActivityComplexesServiceFindAllResponseDto,
|
||||||
|
BusinessActivityComplexesServiceFindOneResponseDto,
|
||||||
|
BusinessActivityComplexesServiceUpdateResponseDto,
|
||||||
|
} from './dto/complexes-response.dto'
|
||||||
|
|
||||||
@ApiTags('PartnerBusinessActivityComplexes')
|
@ApiTags('PartnerBusinessActivityComplexes')
|
||||||
@Controller(
|
@Controller(
|
||||||
@@ -34,10 +39,11 @@ export class BusinessActivityComplexesController {
|
|||||||
@Post()
|
@Post()
|
||||||
async create(
|
async create(
|
||||||
@PartnerInfo('id') partnerId: string,
|
@PartnerInfo('id') partnerId: string,
|
||||||
|
@Param('consumerId') consumerId: string,
|
||||||
@Param('businessActivityId') businessActivityId: string,
|
@Param('businessActivityId') businessActivityId: string,
|
||||||
@Body() data: CreateComplexDto,
|
@Body() data: CreateComplexDto,
|
||||||
): Promise<BusinessActivityComplexesServiceCreateResponseDto> {
|
): Promise<BusinessActivityComplexesServiceCreateResponseDto> {
|
||||||
return this.service.create(partnerId, businessActivityId, data)
|
return this.service.create(partnerId, consumerId, businessActivityId, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Patch(':id')
|
@Patch(':id')
|
||||||
|
|||||||
@@ -1,13 +1,22 @@
|
|||||||
import { QUERY_CONSTANTS } from '@/common/queryConstants'
|
import { QUERY_CONSTANTS } from '@/common/queryConstants'
|
||||||
|
import { RedisKeyMaker } from '@/common/utils'
|
||||||
import { ComplexSelect, ComplexWhereInput } from '@/generated/prisma/models'
|
import { ComplexSelect, ComplexWhereInput } from '@/generated/prisma/models'
|
||||||
|
import { PartnersCacheInvalidationService } from '@/modules/partners/cache/partners-cache-invalidation.service'
|
||||||
import { PrismaService } from '@/prisma/prisma.service'
|
import { PrismaService } from '@/prisma/prisma.service'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
import { BadRequestException, Injectable } from '@nestjs/common'
|
import { BadRequestException, Injectable } from '@nestjs/common'
|
||||||
import { ResponseMapper } from 'common/response/response-mapper'
|
import { ResponseMapper } from 'common/response/response-mapper'
|
||||||
import { CreateComplexDto, UpdateComplexDto } from './dto/complex.dto'
|
import { CreateComplexDto, UpdateComplexDto } from './dto/complex.dto'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BusinessActivityComplexesService {
|
export class BusinessActivityComplexesService {
|
||||||
constructor(private readonly prisma: PrismaService) {}
|
constructor(
|
||||||
|
private readonly prisma: PrismaService,
|
||||||
|
private readonly redisService: RedisService,
|
||||||
|
private readonly partnersCacheInvalidationService: PartnersCacheInvalidationService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
private readonly cacheTtlSeconds = 300
|
||||||
|
|
||||||
private readonly defaultSelect: ComplexSelect = {
|
private readonly defaultSelect: ComplexSelect = {
|
||||||
id: true,
|
id: true,
|
||||||
@@ -49,6 +58,20 @@ export class BusinessActivityComplexesService {
|
|||||||
page = 1,
|
page = 1,
|
||||||
perPage = 10,
|
perPage = 10,
|
||||||
) {
|
) {
|
||||||
|
const cacheKey = RedisKeyMaker.partnerConsumerBusinessActivityComplexesList(
|
||||||
|
partner_id,
|
||||||
|
consumer_id,
|
||||||
|
business_activity_id,
|
||||||
|
page,
|
||||||
|
perPage,
|
||||||
|
)
|
||||||
|
const cached = await this.redisService.getJson<{ items: unknown[]; total: number }>(
|
||||||
|
cacheKey,
|
||||||
|
)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.paginate(cached.items, { total: cached.total, page, perPage })
|
||||||
|
}
|
||||||
|
|
||||||
const where = this.defaultWhere(partner_id, consumer_id, business_activity_id)
|
const where = this.defaultWhere(partner_id, consumer_id, business_activity_id)
|
||||||
const [complexes, total] = await this.prisma.$transaction(async tx => [
|
const [complexes, total] = await this.prisma.$transaction(async tx => [
|
||||||
await tx.complex.findMany({
|
await tx.complex.findMany({
|
||||||
@@ -74,6 +97,11 @@ export class BusinessActivityComplexesService {
|
|||||||
pos_count: _count.pos_list,
|
pos_count: _count.pos_list,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
await this.redisService.setJson(
|
||||||
|
cacheKey,
|
||||||
|
{ items: mappedComplexes, total },
|
||||||
|
this.cacheTtlSeconds,
|
||||||
|
)
|
||||||
return ResponseMapper.paginate(mappedComplexes, { total, page, perPage })
|
return ResponseMapper.paginate(mappedComplexes, { total, page, perPage })
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,18 +111,40 @@ export class BusinessActivityComplexesService {
|
|||||||
business_activity_id: string,
|
business_activity_id: string,
|
||||||
id: string,
|
id: string,
|
||||||
) {
|
) {
|
||||||
const complex = await this.prisma.complex.findUnique({
|
const cacheKey = RedisKeyMaker.partnerConsumerBusinessActivityComplexInfo(
|
||||||
|
partner_id,
|
||||||
|
consumer_id,
|
||||||
|
business_activity_id,
|
||||||
|
id,
|
||||||
|
)
|
||||||
|
const cached = await this.redisService.getJson<unknown>(cacheKey)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.single(cached)
|
||||||
|
}
|
||||||
|
|
||||||
|
const complex = await this.prisma.complex.findFirst({
|
||||||
where: {
|
where: {
|
||||||
...this.defaultWhere(partner_id, consumer_id, business_activity_id),
|
...this.defaultWhere(partner_id, consumer_id, business_activity_id),
|
||||||
id,
|
id,
|
||||||
},
|
},
|
||||||
select: this.defaultSelect,
|
select: this.defaultSelect,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!complex) {
|
||||||
|
throw new BadRequestException('شعبه مورد نظر یافت نشد.')
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.redisService.setJson(cacheKey, complex, this.cacheTtlSeconds)
|
||||||
return ResponseMapper.single(complex)
|
return ResponseMapper.single(complex)
|
||||||
}
|
}
|
||||||
|
|
||||||
async create(partner_id: string, business_id: string, data: CreateComplexDto) {
|
async create(
|
||||||
const complex = this.prisma.$transaction(async tx => {
|
partner_id: string,
|
||||||
|
business_id: string,
|
||||||
|
consumer_id: string,
|
||||||
|
data: CreateComplexDto,
|
||||||
|
) {
|
||||||
|
const complex = await this.prisma.$transaction(async tx => {
|
||||||
const relatedLicense = await tx.licenseAccountAllocation.findFirst({
|
const relatedLicense = await tx.licenseAccountAllocation.findFirst({
|
||||||
where: {
|
where: {
|
||||||
license_activation: {
|
license_activation: {
|
||||||
@@ -121,7 +171,7 @@ export class BusinessActivityComplexesService {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.prisma.complex.create({
|
return await tx.complex.create({
|
||||||
data: {
|
data: {
|
||||||
...data,
|
...data,
|
||||||
business_activity: {
|
business_activity: {
|
||||||
@@ -133,6 +183,12 @@ export class BusinessActivityComplexesService {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await this.partnersCacheInvalidationService.invalidatePartnerConsumerBusinessActivityComplexesReadModels(
|
||||||
|
partner_id,
|
||||||
|
consumer_id,
|
||||||
|
business_id,
|
||||||
|
)
|
||||||
|
|
||||||
return ResponseMapper.create(complex)
|
return ResponseMapper.create(complex)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,6 +203,13 @@ export class BusinessActivityComplexesService {
|
|||||||
where: { ...this.defaultWhere(partner_id, consumer_id, business_activity_id), id },
|
where: { ...this.defaultWhere(partner_id, consumer_id, business_activity_id), id },
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await this.partnersCacheInvalidationService.invalidatePartnerConsumerBusinessActivityComplexReadModels(
|
||||||
|
partner_id,
|
||||||
|
consumer_id,
|
||||||
|
business_activity_id,
|
||||||
|
id,
|
||||||
|
)
|
||||||
return ResponseMapper.update(complex)
|
return ResponseMapper.update(complex)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-2
@@ -1,7 +1,7 @@
|
|||||||
import { QUERY_CONSTANTS } from '@/common/queryConstants'
|
import { QUERY_CONSTANTS } from '@/common/queryConstants'
|
||||||
import { consumerRelatedPartner } from '@/common/queryConstants/consumer'
|
import { consumerRelatedPartner } from '@/common/queryConstants/consumer'
|
||||||
import { PrismaErrorUtil } from '@/common/utils/prisma-error.util'
|
|
||||||
import { PasswordUtil } from '@/common/utils/password.util'
|
import { PasswordUtil } from '@/common/utils/password.util'
|
||||||
|
import { PrismaErrorUtil } from '@/common/utils/prisma-error.util'
|
||||||
import {
|
import {
|
||||||
AccountStatus,
|
AccountStatus,
|
||||||
AccountType,
|
AccountType,
|
||||||
@@ -9,14 +9,22 @@ import {
|
|||||||
POSStatus,
|
POSStatus,
|
||||||
} from '@/generated/prisma/enums'
|
} from '@/generated/prisma/enums'
|
||||||
import { PosSelect } from '@/generated/prisma/models'
|
import { PosSelect } from '@/generated/prisma/models'
|
||||||
|
import { PartnersCacheInvalidationService } from '@/modules/partners/cache/partners-cache-invalidation.service'
|
||||||
import { PrismaService } from '@/prisma/prisma.service'
|
import { PrismaService } from '@/prisma/prisma.service'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
import { BadRequestException, Injectable } from '@nestjs/common'
|
import { BadRequestException, Injectable } from '@nestjs/common'
|
||||||
import { ResponseMapper } from 'common/response/response-mapper'
|
import { ResponseMapper } from 'common/response/response-mapper'
|
||||||
import { CreatePosDto, UpdatePosDto } from './dto/pos.dto'
|
import { CreatePosDto, UpdatePosDto } from './dto/pos.dto'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ComplexPosesService {
|
export class ComplexPosesService {
|
||||||
constructor(private readonly prisma: PrismaService) {}
|
constructor(
|
||||||
|
private readonly prisma: PrismaService,
|
||||||
|
private readonly redisService: RedisService,
|
||||||
|
private readonly partnersCacheInvalidationService: PartnersCacheInvalidationService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
private readonly cacheTtlSeconds = 300
|
||||||
|
|
||||||
private readonly defaultSelect: PosSelect = {
|
private readonly defaultSelect: PosSelect = {
|
||||||
id: true,
|
id: true,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { QUERY_CONSTANTS } from '@/common/queryConstants'
|
import { QUERY_CONSTANTS } from '@/common/queryConstants'
|
||||||
import mapConsumerWithLicenseUtil from '@/common/utils/mappers/consumer_mappers.util'
|
import mapConsumerWithLicenseUtil from '@/common/utils/mappers/consumer_mappers.util'
|
||||||
import { PasswordUtil } from '@/common/utils/password.util'
|
import { PasswordUtil } from '@/common/utils/password.util'
|
||||||
|
import { RedisKeyMaker } from '@/common/utils/redisKeyMaker'
|
||||||
import {
|
import {
|
||||||
AccountStatus,
|
AccountStatus,
|
||||||
AccountType,
|
AccountType,
|
||||||
@@ -15,13 +16,21 @@ import {
|
|||||||
ConsumerWhereInput,
|
ConsumerWhereInput,
|
||||||
} from '@/generated/prisma/models'
|
} from '@/generated/prisma/models'
|
||||||
import { PrismaService } from '@/prisma/prisma.service'
|
import { PrismaService } from '@/prisma/prisma.service'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
import { BadRequestException, Injectable } from '@nestjs/common'
|
import { BadRequestException, Injectable } from '@nestjs/common'
|
||||||
import { ResponseMapper } from 'common/response/response-mapper'
|
import { ResponseMapper } from 'common/response/response-mapper'
|
||||||
|
import { PartnersCacheInvalidationService } from '../cache/partners-cache-invalidation.service'
|
||||||
import { CreateConsumerDto, UpdateConsumerDto } from './dto/create-consumers.dto'
|
import { CreateConsumerDto, UpdateConsumerDto } from './dto/create-consumers.dto'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PartnerConsumersService {
|
export class PartnerConsumersService {
|
||||||
constructor(private readonly prisma: PrismaService) {}
|
constructor(
|
||||||
|
private readonly prisma: PrismaService,
|
||||||
|
private readonly redisService: RedisService,
|
||||||
|
private readonly partnersCacheInvalidationService: PartnersCacheInvalidationService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
private readonly infoCacheTtlSeconds = 300
|
||||||
|
|
||||||
private readonly setExpireDate = (starts_at: Date) => {
|
private readonly setExpireDate = (starts_at: Date) => {
|
||||||
return new Date(
|
return new Date(
|
||||||
@@ -54,6 +63,14 @@ export class PartnerConsumersService {
|
|||||||
})
|
})
|
||||||
|
|
||||||
async findAll(partner_id: string, page = 1, perPage = 10) {
|
async findAll(partner_id: string, page = 1, perPage = 10) {
|
||||||
|
const cacheKey = RedisKeyMaker.partnerConsumersList(partner_id, page, perPage)
|
||||||
|
const cached = await this.redisService.getJson<{ items: unknown[]; total: number }>(
|
||||||
|
cacheKey,
|
||||||
|
)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.paginate(cached.items, { total: cached.total, page, perPage })
|
||||||
|
}
|
||||||
|
|
||||||
const [consumers, total] = await this.prisma.$transaction(async tx => [
|
const [consumers, total] = await this.prisma.$transaction(async tx => [
|
||||||
await tx.consumer.findMany({
|
await tx.consumer.findMany({
|
||||||
where: this.defaultWhere(partner_id),
|
where: this.defaultWhere(partner_id),
|
||||||
@@ -65,7 +82,13 @@ export class PartnerConsumersService {
|
|||||||
where: this.defaultWhere(partner_id),
|
where: this.defaultWhere(partner_id),
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
return ResponseMapper.paginate(consumers.map(mapConsumerWithLicenseUtil), {
|
const mappedItems = consumers.map(mapConsumerWithLicenseUtil)
|
||||||
|
await this.redisService.setJson(
|
||||||
|
cacheKey,
|
||||||
|
{ items: mappedItems, total },
|
||||||
|
this.infoCacheTtlSeconds,
|
||||||
|
)
|
||||||
|
return ResponseMapper.paginate(mappedItems, {
|
||||||
total,
|
total,
|
||||||
page,
|
page,
|
||||||
perPage,
|
perPage,
|
||||||
@@ -73,6 +96,12 @@ export class PartnerConsumersService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async findOne(partner_id: string, consumer_id: string) {
|
async findOne(partner_id: string, consumer_id: string) {
|
||||||
|
const cacheKey = RedisKeyMaker.partnerConsumerInfo(partner_id, consumer_id)
|
||||||
|
const cached = await this.redisService.getJson<unknown>(cacheKey)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.single(cached)
|
||||||
|
}
|
||||||
|
|
||||||
const consumer = await this.prisma.consumer.findUniqueOrThrow({
|
const consumer = await this.prisma.consumer.findUniqueOrThrow({
|
||||||
where: {
|
where: {
|
||||||
...(this.defaultWhere(partner_id) as any),
|
...(this.defaultWhere(partner_id) as any),
|
||||||
@@ -81,7 +110,14 @@ export class PartnerConsumersService {
|
|||||||
select: this.defaultSelect,
|
select: this.defaultSelect,
|
||||||
})
|
})
|
||||||
|
|
||||||
return ResponseMapper.single(mapConsumerWithLicenseUtil(consumer))
|
const mappedConsumer = mapConsumerWithLicenseUtil(consumer)
|
||||||
|
await this.redisService.setJson(
|
||||||
|
RedisKeyMaker.consumerInfo(consumer_id),
|
||||||
|
mappedConsumer,
|
||||||
|
this.infoCacheTtlSeconds,
|
||||||
|
)
|
||||||
|
await this.redisService.setJson(cacheKey, mappedConsumer, this.infoCacheTtlSeconds)
|
||||||
|
return ResponseMapper.single(mappedConsumer)
|
||||||
}
|
}
|
||||||
|
|
||||||
async create(partner_id: string, data: CreateConsumerDto) {
|
async create(partner_id: string, data: CreateConsumerDto) {
|
||||||
@@ -224,11 +260,16 @@ export class PartnerConsumersService {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await this.partnersCacheInvalidationService.invalidatePartnerConsumerReadModels(
|
||||||
|
partner_id,
|
||||||
|
consumer.id,
|
||||||
|
)
|
||||||
|
|
||||||
return ResponseMapper.single(mapConsumerWithLicenseUtil(consumer))
|
return ResponseMapper.single(mapConsumerWithLicenseUtil(consumer))
|
||||||
}
|
}
|
||||||
|
|
||||||
async update(id: string, partner_id: string, data: UpdateConsumerDto) {
|
async update(id: string, partner_id: string, data: UpdateConsumerDto) {
|
||||||
return this.prisma.consumer.update({
|
const updatedConsumer = await this.prisma.consumer.update({
|
||||||
where: {
|
where: {
|
||||||
...(this.defaultWhere(partner_id) as any),
|
...(this.defaultWhere(partner_id) as any),
|
||||||
id,
|
id,
|
||||||
@@ -243,5 +284,13 @@ export class PartnerConsumersService {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await this.partnersCacheInvalidationService.invalidatePartnerConsumerReadModels(
|
||||||
|
partner_id,
|
||||||
|
id,
|
||||||
|
)
|
||||||
|
await this.redisService.delete(RedisKeyMaker.consumerInfo(id))
|
||||||
|
|
||||||
|
return updatedConsumer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { UploadedFileTypes } from '@/common/enums/enums'
|
import { UploadedFileTypes } from '@/common/enums/enums'
|
||||||
import { ResponseMapper } from '@/common/response/response-mapper'
|
import { ResponseMapper } from '@/common/response/response-mapper'
|
||||||
import { PasswordUtil } from '@/common/utils'
|
import { PasswordUtil } from '@/common/utils'
|
||||||
|
import { PartnersCacheInvalidationService } from '@/modules/partners/cache/partners-cache-invalidation.service'
|
||||||
import { UploaderService } from '@/modules/uploader/uploader.service'
|
import { UploaderService } from '@/modules/uploader/uploader.service'
|
||||||
import { PrismaService } from '@/prisma/prisma.service'
|
import { PrismaService } from '@/prisma/prisma.service'
|
||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable } from '@nestjs/common'
|
||||||
@@ -12,6 +13,7 @@ export class PartnerService {
|
|||||||
constructor(
|
constructor(
|
||||||
private readonly prisma: PrismaService,
|
private readonly prisma: PrismaService,
|
||||||
private readonly uploaderService: UploaderService,
|
private readonly uploaderService: UploaderService,
|
||||||
|
private readonly cacheInvalidationService: PartnersCacheInvalidationService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async me(partner_id: string, account_id: string) {
|
async me(partner_id: string, account_id: string) {
|
||||||
@@ -245,6 +247,9 @@ export class PartnerService {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await this.cacheInvalidationService.invalidatePartnersList()
|
||||||
|
await this.cacheInvalidationService.invalidatePartnerDetail(partner_id)
|
||||||
|
|
||||||
return ResponseMapper.single(updatedPartner)
|
return ResponseMapper.single(updatedPartner)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { Injectable } from '@nestjs/common'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class PosCacheInvalidationService {
|
||||||
|
constructor(private readonly redisService: RedisService) {}
|
||||||
|
|
||||||
|
async invalidateGoodsListByGuild(guildId: string): Promise<void> {
|
||||||
|
const client = await this.redisService.getClient()
|
||||||
|
const keys = await client.keys(`pos:ba:*:guild:${guildId}:goods:list`)
|
||||||
|
if (keys.length > 0) {
|
||||||
|
await client.del(keys)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async invalidateGoodsListByBusinessActivity(
|
||||||
|
businessActivityId: string,
|
||||||
|
): Promise<void> {
|
||||||
|
const client = await this.redisService.getClient()
|
||||||
|
const keys = await client.keys(`pos:ba:${businessActivityId}:guild:*:goods:list`)
|
||||||
|
if (keys.length > 0) {
|
||||||
|
await client.del(keys)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import { PartialType } from '@nestjs/swagger'
|
||||||
|
import { CreateGoodDto } from './create-good.dto'
|
||||||
|
|
||||||
|
export class UpdateGoodDto extends PartialType(CreateGoodDto) {}
|
||||||
@@ -1,12 +1,22 @@
|
|||||||
|
import { RedisKeyMaker } from '@/common/utils/redisKeyMaker'
|
||||||
import { GoodSelect } from '@/generated/prisma/models'
|
import { GoodSelect } from '@/generated/prisma/models'
|
||||||
|
import { PosCacheInvalidationService } from '@/modules/pos/cache/pos-cache-invalidation.service'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable } from '@nestjs/common'
|
||||||
import { ResponseMapper } from '../../../common/response/response-mapper'
|
import { ResponseMapper } from '../../../common/response/response-mapper'
|
||||||
import { PrismaService } from '../../../prisma/prisma.service'
|
import { PrismaService } from '../../../prisma/prisma.service'
|
||||||
import { CreateGoodDto } from './dto/create-good.dto'
|
import { CreateGoodDto } from './dto/create-good.dto'
|
||||||
|
import { UpdateGoodDto } from './dto/update-good.dto'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GoodsService {
|
export class GoodsService {
|
||||||
constructor(private prisma: PrismaService) {}
|
constructor(
|
||||||
|
private prisma: PrismaService,
|
||||||
|
private readonly redisService: RedisService,
|
||||||
|
private readonly posCacheInvalidationService: PosCacheInvalidationService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
private readonly listCacheTtlSeconds = 300
|
||||||
|
|
||||||
private readonly defaultSelect: GoodSelect = {
|
private readonly defaultSelect: GoodSelect = {
|
||||||
id: true,
|
id: true,
|
||||||
@@ -42,6 +52,12 @@ export class GoodsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async findAll(business_activity_id: string, guild_id: string) {
|
async findAll(business_activity_id: string, guild_id: string) {
|
||||||
|
const cacheKey = RedisKeyMaker.posGoodsList(business_activity_id, guild_id)
|
||||||
|
const cached = await this.redisService.getJson<unknown[]>(cacheKey)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.list(cached)
|
||||||
|
}
|
||||||
|
|
||||||
const goods = await this.prisma.good.findMany({
|
const goods = await this.prisma.good.findMany({
|
||||||
where: {
|
where: {
|
||||||
OR: [
|
OR: [
|
||||||
@@ -59,6 +75,8 @@ export class GoodsService {
|
|||||||
select: this.defaultSelect,
|
select: this.defaultSelect,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await this.redisService.setJson(cacheKey, goods, this.listCacheTtlSeconds)
|
||||||
|
|
||||||
return ResponseMapper.list(goods)
|
return ResponseMapper.list(goods)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,6 +135,73 @@ export class GoodsService {
|
|||||||
select: this.defaultSelect,
|
select: this.defaultSelect,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await this.posCacheInvalidationService.invalidateGoodsListByBusinessActivity(
|
||||||
|
business_activity_id,
|
||||||
|
)
|
||||||
|
|
||||||
return ResponseMapper.create(good)
|
return ResponseMapper.create(good)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async update(id: string, data: UpdateGoodDto, business_activity_id: string) {
|
||||||
|
const { category_id, sku_id, measure_unit_id, ...rest } = data
|
||||||
|
|
||||||
|
const good = await this.prisma.good.update({
|
||||||
|
where: {
|
||||||
|
id,
|
||||||
|
business_activity_id,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
...rest,
|
||||||
|
...(measure_unit_id
|
||||||
|
? {
|
||||||
|
measure_unit: {
|
||||||
|
connect: {
|
||||||
|
id: measure_unit_id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
...(sku_id
|
||||||
|
? {
|
||||||
|
sku: {
|
||||||
|
connect: {
|
||||||
|
id: sku_id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
...(category_id
|
||||||
|
? {
|
||||||
|
category: {
|
||||||
|
connect: {
|
||||||
|
id: category_id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
},
|
||||||
|
select: this.defaultSelect,
|
||||||
|
})
|
||||||
|
|
||||||
|
await this.posCacheInvalidationService.invalidateGoodsListByBusinessActivity(
|
||||||
|
business_activity_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
return ResponseMapper.update(good)
|
||||||
|
}
|
||||||
|
|
||||||
|
async delete(id: string, business_activity_id: string) {
|
||||||
|
await this.prisma.good.delete({
|
||||||
|
where: {
|
||||||
|
id,
|
||||||
|
business_activity_id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
await this.posCacheInvalidationService.invalidateGoodsListByBusinessActivity(
|
||||||
|
business_activity_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
return ResponseMapper.delete()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,29 @@
|
|||||||
import { QUERY_CONSTANTS } from '@/common/queryConstants'
|
import { QUERY_CONSTANTS } from '@/common/queryConstants'
|
||||||
import consumer_mappersUtil from '@/common/utils/mappers/consumer_mappers.util'
|
import consumer_mappersUtil from '@/common/utils/mappers/consumer_mappers.util'
|
||||||
|
import { RedisKeyMaker } from '@/common/utils/redisKeyMaker'
|
||||||
import { ConsumerStatus } from '@/generated/prisma/enums'
|
import { ConsumerStatus } from '@/generated/prisma/enums'
|
||||||
import { PrismaService } from '@/prisma/prisma.service'
|
import { PrismaService } from '@/prisma/prisma.service'
|
||||||
|
import { RedisService } from '@/redis/redis.service'
|
||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable } from '@nestjs/common'
|
||||||
import { ResponseMapper } from 'common/response/response-mapper'
|
import { ResponseMapper } from 'common/response/response-mapper'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PosService {
|
export class PosService {
|
||||||
constructor(private readonly prisma: PrismaService) {}
|
constructor(
|
||||||
|
private readonly prisma: PrismaService,
|
||||||
|
private readonly redisService: RedisService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
private readonly infoCacheTtlSeconds = 300
|
||||||
|
private readonly meCacheTtlSeconds = 120
|
||||||
|
|
||||||
async getInfo(pos_id: string) {
|
async getInfo(pos_id: string) {
|
||||||
|
const cacheKey = RedisKeyMaker.posInfo(pos_id)
|
||||||
|
const cached = await this.redisService.getJson<unknown>(cacheKey)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.single(cached)
|
||||||
|
}
|
||||||
|
|
||||||
const pos = await this.prisma.pos.findUniqueOrThrow({
|
const pos = await this.prisma.pos.findUniqueOrThrow({
|
||||||
where: {
|
where: {
|
||||||
id: pos_id,
|
id: pos_id,
|
||||||
@@ -71,7 +85,7 @@ export class PosService {
|
|||||||
license_activation,
|
license_activation,
|
||||||
} = business_activity
|
} = business_activity
|
||||||
|
|
||||||
return ResponseMapper.single({
|
const payload = {
|
||||||
name,
|
name,
|
||||||
complex: {
|
complex: {
|
||||||
id: complexId,
|
id: complexId,
|
||||||
@@ -89,7 +103,9 @@ export class PosService {
|
|||||||
license_id: license_activation?.license.id,
|
license_id: license_activation?.license.id,
|
||||||
},
|
},
|
||||||
partner: license_activation?.license.charge_transaction.partner,
|
partner: license_activation?.license.charge_transaction.partner,
|
||||||
})
|
}
|
||||||
|
await this.redisService.setJson(cacheKey, payload, this.infoCacheTtlSeconds)
|
||||||
|
return ResponseMapper.single(payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAccessible(account_id: string) {
|
async getAccessible(account_id: string) {
|
||||||
@@ -136,6 +152,12 @@ export class PosService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getMe(account_id: string, pos_id: string) {
|
async getMe(account_id: string, pos_id: string) {
|
||||||
|
const cacheKey = RedisKeyMaker.posMe(account_id, pos_id)
|
||||||
|
const cached = await this.redisService.getJson<unknown>(cacheKey)
|
||||||
|
if (cached) {
|
||||||
|
return ResponseMapper.single(cached)
|
||||||
|
}
|
||||||
|
|
||||||
const pos = await this.prisma.consumerAccount.findUniqueOrThrow({
|
const pos = await this.prisma.consumerAccount.findUniqueOrThrow({
|
||||||
where: {
|
where: {
|
||||||
id: account_id,
|
id: account_id,
|
||||||
@@ -177,9 +199,11 @@ export class PosService {
|
|||||||
|
|
||||||
const { consumer, ...rest } = pos
|
const { consumer, ...rest } = pos
|
||||||
|
|
||||||
return ResponseMapper.single({
|
const payload = {
|
||||||
...rest,
|
...rest,
|
||||||
consumer: consumer_mappersUtil(consumer),
|
consumer: consumer_mappersUtil(consumer),
|
||||||
})
|
}
|
||||||
|
await this.redisService.setJson(cacheKey, payload, this.meCacheTtlSeconds)
|
||||||
|
return ResponseMapper.single(payload)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { Global, Module } from '@nestjs/common'
|
||||||
|
import { AdminGuildCacheInvalidationService } from '@/modules/admin/guilds/cache/admin-guild-cache-invalidation.service'
|
||||||
|
import { PartnersCacheInvalidationService } from '@/modules/partners/cache/partners-cache-invalidation.service'
|
||||||
|
import { PosCacheInvalidationService } from '@/modules/pos/cache/pos-cache-invalidation.service'
|
||||||
|
import { RedisService } from './redis.service'
|
||||||
|
|
||||||
|
@Global()
|
||||||
|
@Module({
|
||||||
|
providers: [
|
||||||
|
RedisService,
|
||||||
|
AdminGuildCacheInvalidationService,
|
||||||
|
PartnersCacheInvalidationService,
|
||||||
|
PosCacheInvalidationService,
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
RedisService,
|
||||||
|
AdminGuildCacheInvalidationService,
|
||||||
|
PartnersCacheInvalidationService,
|
||||||
|
PosCacheInvalidationService,
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class RedisModule {}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
import { Injectable, Logger, OnModuleDestroy } from '@nestjs/common'
|
||||||
|
import Redis from 'ioredis'
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class RedisService implements OnModuleDestroy {
|
||||||
|
private readonly logger = new Logger(RedisService.name)
|
||||||
|
private readonly client: Redis
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
const host = process.env.REDIS_HOST || 'redis'
|
||||||
|
const port = Number(process.env.REDIS_PORT || 6379)
|
||||||
|
const password = process.env.REDIS_PASSWORD || undefined
|
||||||
|
const db = Number(process.env.REDIS_DB || 0)
|
||||||
|
|
||||||
|
this.client = new Redis({
|
||||||
|
host,
|
||||||
|
port,
|
||||||
|
password,
|
||||||
|
db,
|
||||||
|
lazyConnect: true,
|
||||||
|
maxRetriesPerRequest: 3,
|
||||||
|
})
|
||||||
|
|
||||||
|
this.client.on('error', (error) => {
|
||||||
|
this.logger.error(`Redis error: ${error.message}`)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async getClient(): Promise<Redis> {
|
||||||
|
if (this.client.status !== 'ready') {
|
||||||
|
await this.client.connect()
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.client
|
||||||
|
}
|
||||||
|
|
||||||
|
async get(key: string): Promise<string | null> {
|
||||||
|
const client = await this.getClient()
|
||||||
|
return client.get(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
async getJson<T>(key: string): Promise<T | null> {
|
||||||
|
const value = await this.get(key)
|
||||||
|
if (!value) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return JSON.parse(value) as T
|
||||||
|
} catch {
|
||||||
|
this.logger.warn(`Invalid JSON for key "${key}"`)
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async set(
|
||||||
|
key: string,
|
||||||
|
value: string,
|
||||||
|
ttlSeconds?: number,
|
||||||
|
): Promise<'OK' | null> {
|
||||||
|
const client = await this.getClient()
|
||||||
|
if (ttlSeconds && ttlSeconds > 0) {
|
||||||
|
return client.set(key, value, 'EX', ttlSeconds)
|
||||||
|
}
|
||||||
|
return client.set(key, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
async setJson(
|
||||||
|
key: string,
|
||||||
|
value: unknown,
|
||||||
|
ttlSeconds?: number,
|
||||||
|
): Promise<'OK' | null> {
|
||||||
|
return this.set(key, JSON.stringify(value), ttlSeconds)
|
||||||
|
}
|
||||||
|
|
||||||
|
async delete(key: string): Promise<number> {
|
||||||
|
const client = await this.getClient()
|
||||||
|
return client.del(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
async exists(key: string): Promise<boolean> {
|
||||||
|
const client = await this.getClient()
|
||||||
|
const result = await client.exists(key)
|
||||||
|
return result === 1
|
||||||
|
}
|
||||||
|
|
||||||
|
async expire(key: string, ttlSeconds: number): Promise<boolean> {
|
||||||
|
const client = await this.getClient()
|
||||||
|
const result = await client.expire(key, ttlSeconds)
|
||||||
|
return result === 1
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteByPattern(pattern: string): Promise<number> {
|
||||||
|
const client = await this.getClient()
|
||||||
|
let deletedCount = 0
|
||||||
|
let cursor = '0'
|
||||||
|
|
||||||
|
do {
|
||||||
|
const [nextCursor, keys] = await client.scan(
|
||||||
|
cursor,
|
||||||
|
'MATCH',
|
||||||
|
pattern,
|
||||||
|
'COUNT',
|
||||||
|
100,
|
||||||
|
)
|
||||||
|
cursor = nextCursor
|
||||||
|
|
||||||
|
if (keys.length > 0) {
|
||||||
|
const pipeline = client.pipeline()
|
||||||
|
keys.forEach(k => pipeline.del(k))
|
||||||
|
const results = await pipeline.exec()
|
||||||
|
if (results) {
|
||||||
|
deletedCount += results.reduce((sum, [, value]) => {
|
||||||
|
return sum + (typeof value === 'number' ? value : 0)
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (cursor !== '0')
|
||||||
|
|
||||||
|
return deletedCount
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteByPatterns(patterns: string[]): Promise<number> {
|
||||||
|
const deletedCounts = await Promise.all(
|
||||||
|
patterns.map(pattern => this.deleteByPattern(pattern)),
|
||||||
|
)
|
||||||
|
return deletedCounts.reduce((sum, count) => sum + count, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
async onModuleDestroy() {
|
||||||
|
await this.client.quit()
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user