diff --git a/.env.example b/.env.example index 7b53fa40b9..f9918e3cac 100644 --- a/.env.example +++ b/.env.example @@ -1,12 +1,47 @@ -AUTHORIZED_HOST_STAGING="http://nest.saydao.org/" +NODE_ENV=development +SKIP_PREFLIGHT_CHECK=true -AUTHORIZED_HOST_PRODUCTION="https://s.nest.saydao.org" -AUTHORIZED_PANEL_PRODUCTION='https://panel.saydao.org' -AUTHORIZED_DAPP_PRODUCTION= +AUTHORIZED_DAPP_LOCAL='http://localhost:3000' +AUTHORIZED_PANEL_LOCAL='http://localhost:3001' +AUTHORIZED_DOCS_LOCAL='http://127.0.0.0:8002' + + +ALCHEMY_KEY_SEPOLIA= +ALCHEMY_KEY_MAIN= + +NFT_STORAGE_KEY= + +DB_FLASK_HOST= +DB_FLASK_USER= +DB_FLASK_PASS= +DB_FLASK_NAME= + +DOMAIN_LOCAL=api.sayapp.company +DOMAIN_STAGING=api.s.sayapp.company +DOMAIN_PROD=api.sayapp.company +DOMAIN_DEV=api.sayapp.company + +NEST_SERVER_DEV=localhost:8002 +NEST_SERVER_STAGING=s.nest.saydao.org +NEST_SERVER_PROD=nest.saydao.org + +# email +MAIL_HOST= +MAIL_FROM= +MAIL_PASSWORD= +SAY_ADMIN_EMAIL= + +# sms +SMS_FROM= +SAY_ADMIN_SMS= +SMS_USER= +SMS_PASSWORD= + +# end points +INFURA_KEY= +ALCHEMY_KEY= +QUICK_NODE_KEY= +GET_BLOCK_KEY= -ALCHEMY_GOERLI="https://eth-goerli.g.alchemy.com/v2/>" -NODE_ENV=staging -DB_HOST=say_nest_db -PORT=5000 diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 71fb97f770..a2df33cc4b 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -116,7 +116,7 @@ jobs: - name: Prepare Stack File run: > ENVIRONMENT=${{ env.DEVELOPMENT }} DOMAIN=${{ env.DEV_DOMAIN }} CONTAINER_IMAGE=${IMAGE_ID} STACK_NAME=${{ env.DEV_STACK_NAME }} - docker-compose + docker compose -f ${{ env.DOCKER_STACK_PATH }} config > ${{ env.STACK_FILE }} @@ -164,7 +164,7 @@ jobs: - name: Prepare Stack File run: > ENVIRONMENT=${{ env.STAGING }} DOMAIN=${{ env.STAGING_DOMAIN }} CONTAINER_IMAGE=${IMAGE_ID} STACK_NAME=${{ env.STAGING_STACK_NAME }} - docker-compose + docker compose -f ${{ env.DOCKER_STACK_PATH }} config > ${{ env.STACK_FILE }} @@ -212,10 +212,7 @@ jobs: - name: Prepare Stack File run: > ENVIRONMENT=${{ env.PRODUCTION }} DOMAIN=${{ env.PRODUCTION_DOMAIN }} CONTAINER_IMAGE=${IMAGE_ID} STACK_NAME=${{ env.PRODUCTION_STACK_NAME }} - docker-compose - -f ${{ env.DOCKER_STACK_PATH }} - config - > ${{ env.STACK_FILE }} + docker compose -f ${{ env.DOCKER_STACK_PATH }} config | sed 's/^name:.*/version: "3.9"/' > ${{ env.STACK_FILE }} - name: Move Stack File to Server uses: appleboy/scp-action@v0.1.1 diff --git a/.gitignore b/.gitignore index 3411758d8d..7b9c5ab303 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,16 @@ +build_local +Thumbs.db +.DS_Store +npm-debug.log +yarn-error.log # compiled output +.vscode +.idea /dist -/node_modules +node_modules /data - +/.yarn +yarn.lock # Logs logs *.log @@ -14,6 +22,8 @@ lerna-debug.log* # images /uploads +midjourney.json +src/features/midjourney/bad-images-to-remove.json # OS .DS_Store @@ -21,6 +31,7 @@ lerna-debug.log* # Tests /coverage /.nyc_output +temp.json # IDEs and editors /.idea @@ -36,4 +47,8 @@ lerna-debug.log* !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json -!.vscode/extensions.json \ No newline at end of file +!.vscode/extensions.json +.vscode + +# db +1733732167717-new.ts \ No newline at end of file diff --git a/.nvmrc b/.nvmrc index d7e41a356b..dc5f6a52b1 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v18.0.0 \ No newline at end of file +22.6.0 diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 65941b8cc5..0000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "cSpell.words": ["dtos", "middlewares", "timestamptz", "typeorm"] -} diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 0000000000..3186f3f079 --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/Dockerfile b/Dockerfile index 3e6972c098..81eefb816a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16.18.0-alpine3.15 as builder +FROM node:22.6.0-alpine as builder ENV NODE_ENV build @@ -11,7 +11,7 @@ RUN yarn install --frozen-lockfile \ # --- -FROM node:16.18.0-alpine3.15 as production +FROM node:22.6.0-alpine as production WORKDIR /usr/src/app diff --git a/Dockerfile.dev b/Dockerfile.dev index 4b5f894347..ae3da5b5f6 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM node:16.14.2-alpine AS development +FROM node:22.6.0-alpine AS development ARG NPM_PRIVATE_REGISTRY_URL ARG NPM_PRIVATE_REGISTRY_TOKEN diff --git a/README.md b/README.md index 4d34facd90..eddb87c3e5 100644 --- a/README.md +++ b/README.md @@ -13,67 +13,4 @@

A progressive Node.js framework for building efficient and scalable server-side applications.

-NPM Version -Package License -NPM Downloads -CircleCI -Coverage -Discord -Backers on Open Collective -Sponsors on Open Collective - - Support us - -

- - -## Description - -[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. - -## Installation - -```bash -$ npm install -``` - -## Running the app - -```bash -# development -$ npm run start - -# watch mode -$ npm run start:dev - -# production mode -$ npm run start:prod -``` - -## Test - -```bash -# unit tests -$ npm run test - -# e2e tests -$ npm run test:e2e - -# test coverage -$ npm run test:cov -``` - -## Support - -Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). - -## Stay in touch - -- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com) -- Website - [https://nestjs.com](https://nestjs.com/) -- Twitter - [@nestframework](https://twitter.com/nestframework) - -## License -Nest is [MIT licensed](LICENSE). diff --git a/docker-compose-prod.yml b/docker-compose-prod.yml deleted file mode 100644 index 60dc267a60..0000000000 --- a/docker-compose-prod.yml +++ /dev/null @@ -1,75 +0,0 @@ -version: '3.6' -services: - api: - image: ${CONTAINER_IMAGE:-backend} - volumes: - - uploads_volume:/usr/src/app/uploads - depends_on: - - db - environment: - NODE_ENV: production - PORT: 3000 - DB_HOST: db - DB_USER: postgres - DB_NAME: say_dapp - DB_PASS_FILE: /run/secrets/postgres-password - secrets: - - postgres-password - networks: - - default - - traefik-public - deploy: - replicas: 1 - update_config: - parallelism: 1 - order: start-first - placement: - constraints: - - node.labels.${ENVIRONMENT} == true - mode: replicated - labels: - - traefik.enable=true - - traefik.docker.network=traefik-public - - traefik.constraint-label=traefik-public - - traefik.http.routers.${STACK_NAME}-api-http.entrypoints=http - - traefik.http.routers.${STACK_NAME}-api-http.rule=Host(`${DOMAIN?Variable not set}`) - - traefik.http.routers.${STACK_NAME}-api-http.service=${STACK_NAME}-api - - traefik.http.routers.${STACK_NAME}-api-http.middlewares=https-redirect - - traefik.http.routers.${STACK_NAME}-api.entrypoints=https - - traefik.http.routers.${STACK_NAME}-api.rule=Host(`${DOMAIN?Variable not set}`) - - traefik.http.routers.${STACK_NAME}-api.service=${STACK_NAME}-api - - traefik.http.routers.${STACK_NAME}-api.tls=true - - traefik.http.routers.${STACK_NAME}-api.tls.certresolver=le - - traefik.http.services.${STACK_NAME}-api.loadbalancer.server.port=3000 - - db: - image: postgres:12 - secrets: - - postgres-password - environment: - POSTGRES_DB: say_dapp - POSTGRES_USER: postgres - POSTGRES_PASSWORD_FILE: /run/secrets/postgres-password - volumes: - - postgres_volume:/var/lib/postgresql/data - deploy: - replicas: 1 - update_config: - parallelism: 1 - order: stop-first - placement: - constraints: - - node.labels.${ENVIRONMENT} == true - -volumes: - postgres_volume: - uploads_volume: - -networks: - traefik-public: - external: true - -secrets: - postgres-password: - name: ${STACK_NAME}-postgres-password - external: true diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index fe788bbd03..d8a6811e51 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -1,5 +1,6 @@ version: '3.9' + services: api: build: diff --git a/docker-compose.production.yml b/docker-compose.production.yml index 7dac3f0434..ea69667b2a 100644 --- a/docker-compose.production.yml +++ b/docker-compose.production.yml @@ -1,4 +1,5 @@ -version: '3.6' +version: '3.9' + services: api: image: ${CONTAINER_IMAGE:-backend} @@ -7,7 +8,7 @@ services: environment: PORT: 3000 DB_HOST: db - DB_USER: postgres + DB_USER: nestserver DB_NAME: say_dapp DB_PASS_FILE: /run/secrets/postgres-password secrets: @@ -48,7 +49,7 @@ services: - postgres-password environment: POSTGRES_DB: say_dapp - POSTGRES_USER: postgres + POSTGRES_USER: nestserver POSTGRES_PASSWORD_FILE: /run/secrets/postgres-password volumes: - postgres_volume:/var/lib/postgresql/data @@ -63,7 +64,9 @@ services: volumes: postgres_volume: + name: "${STACK_NAME}_postgres_volume" uploads_volume: + name: "${STACK_NAME}_uploads_volume" networks: traefik-public: @@ -77,4 +80,4 @@ secrets: configs: nest-config: name: ${STACK_NAME}.env - external: true + external: true \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 28f195c984..697529215b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,5 @@ -version: '3.3' +# version: '3.3' services: api: build: diff --git a/mail-templates/.editorconfig b/mail-templates/.editorconfig new file mode 100644 index 0000000000..c6c8b36219 --- /dev/null +++ b/mail-templates/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/mail-templates/LICENSE b/mail-templates/LICENSE new file mode 100644 index 0000000000..978162dfcf --- /dev/null +++ b/mail-templates/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Cosmin Popovici + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/mail-templates/README.md b/mail-templates/README.md new file mode 100644 index 0000000000..fe984ab05e --- /dev/null +++ b/mail-templates/README.md @@ -0,0 +1,68 @@ +
+

+ + + + Maizzle Starter + + +

+

Quickly build HTML emails with utility-first CSS

+
+ + [![Version][npm-version-shield]][npm] + [![Build][github-ci-shield]][github-ci] + [![Downloads][npm-stats-shield]][npm-stats] + [![License][license-shield]][license] + +
+
+ +## Getting Started + +Clone this starter: + +```bash +npx degit maizzle/maizzle my-project +``` + +Install dependencies: + +``` +cd my-project + +npm install +``` + +Start local development: + +``` +npm run dev +``` + +Build emails for production: + +``` +npm run build +``` + +## Documentation + +Maizzle documentation is available at https://maizzle.com + +## Issues + +Please open all issues in the [framework repository](https://github.com/maizzle/framework). + +## License + +The Maizzle framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). + +[npm]: https://www.npmjs.com/package/@maizzle/framework +[npm-stats]: https://npm-stat.com/charts.html?package=%40maizzle%2Fframework&from=2019-03-27 +[npm-version-shield]: https://img.shields.io/npm/v/@maizzle/framework.svg +[npm-stats-shield]: https://img.shields.io/npm/dt/@maizzle/framework.svg?color=6875f5 +[github-ci]: https://github.com/maizzle/framework/actions +[github-ci-shield]: https://github.com/maizzle/framework/actions/workflows/nodejs.yml/badge.svg +[license]: ./LICENSE +[license-shield]: https://img.shields.io/npm/l/@maizzle/framework.svg?color=0e9f6e diff --git a/mail-templates/config.js b/mail-templates/config.js new file mode 100644 index 0000000000..29676d3c58 --- /dev/null +++ b/mail-templates/config.js @@ -0,0 +1,27 @@ +/** @type {import('@maizzle/framework').Config} */ + +/* +|------------------------------------------------------------------------------- +| Development config https://maizzle.com/docs/environments +|------------------------------------------------------------------------------- +| +| The exported object contains the default Maizzle settings for development. +| This is used when you run `maizzle build` or `maizzle serve` and it has +| the fastest build time, since most transformations are disabled. +| +*/ + +module.exports = { + build: { + templates: { + source: 'src/templates', + destination: { + path: 'build_local', + }, + assets: { + source: 'src/images', + destination: 'images', + }, + }, + }, +} diff --git a/mail-templates/config.production.js b/mail-templates/config.production.js new file mode 100644 index 0000000000..1558a8cf2a --- /dev/null +++ b/mail-templates/config.production.js @@ -0,0 +1,27 @@ +/** @type {import('@maizzle/framework').Config} */ + +/* +|------------------------------------------------------------------------------- +| Production config https://maizzle.com/docs/environments +|------------------------------------------------------------------------------- +| +| This is where you define settings that optimize your emails for production. +| These will be merged on top of the base config.js, so you only need to +| specify the options that are changing. +| +*/ + +module.exports = { + build: { + templates: { + destination: { + path: '../src/features/campaign/templates', + extension: 'hbs', + }, + }, + }, + inlineCSS: true, + removeUnusedCSS: true, + shorthandCSS: true, + prettify: true, +}; diff --git a/mail-templates/package.json b/mail-templates/package.json new file mode 100644 index 0000000000..a1797362b3 --- /dev/null +++ b/mail-templates/package.json @@ -0,0 +1,13 @@ +{ + "private": true, + "scripts": { + "dev": "maizzle serve", + "build": "maizzle build production" + }, + "dependencies": { + "@maizzle/framework": "latest", + "tailwindcss-box-shadow": "^2.0.0", + "tailwindcss-email-variants": "^2.0.0", + "tailwindcss-mso": "^1.3.0" + } +} diff --git a/mail-templates/src/components/button.html b/mail-templates/src/components/button.html new file mode 100644 index 0000000000..30a0e87652 --- /dev/null +++ b/mail-templates/src/components/button.html @@ -0,0 +1,38 @@ + + +
+ + + + + + + + + +
diff --git a/mail-templates/src/components/divider.html b/mail-templates/src/components/divider.html new file mode 100644 index 0000000000..dd8629685e --- /dev/null +++ b/mail-templates/src/components/divider.html @@ -0,0 +1,30 @@ + + + diff --git a/mail-templates/src/components/spacer.html b/mail-templates/src/components/spacer.html new file mode 100644 index 0000000000..cbcfac71b5 --- /dev/null +++ b/mail-templates/src/components/spacer.html @@ -0,0 +1,20 @@ + + + +
+
+ +
+
diff --git a/mail-templates/src/components/v-fill.html b/mail-templates/src/components/v-fill.html new file mode 100644 index 0000000000..b2c10435cd --- /dev/null +++ b/mail-templates/src/components/v-fill.html @@ -0,0 +1,13 @@ + + + + + diff --git a/mail-templates/src/components/v-image.html b/mail-templates/src/components/v-image.html new file mode 100644 index 0000000000..1295d37034 --- /dev/null +++ b/mail-templates/src/components/v-image.html @@ -0,0 +1,14 @@ + + + + + diff --git a/mail-templates/src/css/resets.css b/mail-templates/src/css/resets.css new file mode 100644 index 0000000000..c4593425e5 --- /dev/null +++ b/mail-templates/src/css/resets.css @@ -0,0 +1,16 @@ +/* + * Here is where you can add your global email CSS resets. + * + * We use a custom, email-specific CSS reset, instead + * of Tailwind's web-optimized `base` layer. + * + * Styles defined here will be inlined. +*/ +body { + background-color: black !important; +} + +img { + @apply max-w-full leading-none align-middle; + border: 0; +} diff --git a/mail-templates/src/css/tailwind.css b/mail-templates/src/css/tailwind.css new file mode 100644 index 0000000000..d1d8823df0 --- /dev/null +++ b/mail-templates/src/css/tailwind.css @@ -0,0 +1,17 @@ +/* Your custom CSS resets for email */ +@import "resets"; + +/* Tailwind CSS components */ +@import "tailwindcss/components"; + +/** + * @import here any custom CSS components - that is, CSS that + * you'd want loaded before the Tailwind utilities, so the + * utilities can still override them. +*/ + +/* Tailwind CSS utility classes */ +@import "tailwindcss/utilities"; + +/* Your custom utility classes */ +@import "utilities"; diff --git a/mail-templates/src/css/utilities.css b/mail-templates/src/css/utilities.css new file mode 100644 index 0000000000..7b729b79fa --- /dev/null +++ b/mail-templates/src/css/utilities.css @@ -0,0 +1,16 @@ +/* + * Here is where you can define your custom utility classes. + * + * We wrap them in the `utilities` @layer directive, so + * that Tailwind moves them to the correct location. + * + * More info: + * https://tailwindcss.com/docs/functions-and-directives#layer +*/ + +@layer utilities { + .break-word { + word-break: break-word; + } +} + diff --git a/mail-templates/src/layouts/main.html b/mail-templates/src/layouts/main.html new file mode 100644 index 0000000000..298b77ad67 --- /dev/null +++ b/mail-templates/src/layouts/main.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + + {{{ page.title }}} + + + + + + + + + + + + + +
+ +
+ + diff --git a/mail-templates/src/templates/accEmail1.html b/mail-templates/src/templates/accEmail1.html new file mode 100644 index 0000000000..1e31d6eb23 --- /dev/null +++ b/mail-templates/src/templates/accEmail1.html @@ -0,0 +1,958 @@ + + + + + + + SAY Accelerator + + + + + + + + + + +
+ +
+ + +
+ + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ +
+
+
+
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + +
+
+
+

شتابدهنده

+
+
+
+ + +
+
+
+

SAY

+
+
+
+ + +
+
+
+

+ آغاز شتابدهنده SAY برای توانمندسازی
کودکان ساکن روستاها، با

+
+
+
+
+
+
+

+ موضوع محیط زیست.

کسب مقام اول منطقه یک تهران

+
+
+
+ + +
+
+ + + + + +
+ + + + +
+
+
+ + + + + +
+ + + + + + + + +
+

+ سلام @{{userName}}, +

+
+

+ در ماه‌های اخیر مشغول به تکمیل ماژول/بخشی مهم از اکوسیستم SAY بوده‌ایم که برای + توانمندسازی کودکان مدارس روستایی طراحی شده است و اولین دوره آن از دی ماه ۱۴۰۲ + آغاز + شد و تا خرداد ماه ۱۴۰۳ ادامه یافت.

+

+ ماژول نیاز که توسط خانواده‌های مجازی، سمن‌ها و مددکاران ممکن شده است اولین + ماژول در + SAY است و شتابدهنده SAY که در دوره‌های ۳ تا ۶ ماه و در رشته‌ای مختلف اجرا + می‌شود + دومین ماژول است. در اولین دوره این شتابدهنده کودکان با فراگیری روش‌های + استارتاپ‌ها + (شرکت‌های نوپا) و همچنین با شرکت در کارگاه‌های عملی و آشنا شدن با تکنولوژی‌های + روز + دنیا، ایده ابتدای‌شان را به مرحله اجرا رساندن تا در حل مشکلات جامعه‌شان قدم + بردارند + که نتایج آن پایین تر با شما به اشتراک گذاشته شده است.
دیگر مخاطبان این + شتابدهنده + شرکت‌ها، سازمان‌ها، سرمایه‌گذاران خرد و کلان (Angels and Venture Capitals) + هستند. + این سازمان‌ها/اشخاص در راستای انجام مسئولیت اجتماعی‌شان، هم در تکمیل چرخه + تولید + سهام/ارز مجازی SAY مشارکت خواهند داشت (تولید سهام از نیاز امضا شده توسط + خانواده + مجازی) و هم با حمایت مالی‌شان ما را در راه‌اندازی اتاق کامپیوتر در مدارس یاری + خواهند + کرد. در اکوسیستم SAY این سازمان‌ها/اشخاص خویشاوند نام دارند.
قابل ذکر است + نرم + افزار SAY Brain که در حال حاضر از مدل‌های آماده هوش مصنوعی بهره میگیرد بر روی + کامپیوترهای این مدارس نصب می‌شود تا پس از اتمام هر دوره مسیر جستجو و کنجکاوی + ادامه پیدا + کند.
 

+

+ آینده:
ماژول‌ها در SAY با هم مرتبط هستند و از منابع یکدیگر + استفاده می‌کنند،‌ به این معنی که، نیازی که خانواده‌های مجازی برطرف می‌کنند، و + پشتیبانی مالی که خویشاوندان برعهده می‌گیرند در رشد SAY و سرعت این رشد تاثیر + مستقیم + دارد. به زبان ساده تر، همراهی همگانی است که ثبت‌نام کودکان بیشتر در هر دو + ماژول را + فراهم میکند. در انتها هم باید بگوییم که اگر تکمیل زیر ساخت بلاک‌چین کمی به طول + انجامیده، دلیل اصلی آن کارهای میدانی مانند این شتابدهند بوده تا فرآیند تولید + سهام را + نهایی کرده و تبدیل به نرم افزار کنیم. امیدواریم صبورانه ما را همراهی کنید و + عذرخواهی + ما را برای این تاخیر بپذیرید. جزئیات بیشتر تا پاییز ۱۴۰۳ به مستندات وبسایت + اضافه + خواهد شد. 
+

+

+ +

+

+
+

+
+ +
+
+ + + + + +
+ + + + +
+
+ + + + + +
+ + + + + + + +
+

+ در اولین شتابدهنده SAY چه گذشت ...

+
+

+ این دوره در دبستان وحدت روستای ایگل در استان تهران برگزار شد. در ابتدا دانش‌آموزان + با اهالی روستا مصاحبه کردند و از مشکلات روستا پرسش کردند. یکی از مشکلاتی که اهالی با + آن مواجه بودند، باز گذاشتن شیر آب در زمستان بود تا از یخ زدن لوله‌های آب جلوگیری + کنند. + دانش‌آموزان برای جلوگیری از اسراف آب در زمستان، بعد از فرا گیری نگاه سیستمی برای خرد + کردن مسئله، با قطعات الکترونیکی مانند مقاومت، دیود، ماسفت،‌ سنسورها و ... آشنا شدند + و + در ادامه با بهره‌گیری از میکروکنترولرها و پایه‌های کد نویسی، دستگاه کوچک و کم + هزینه‌ای را طراحی کردند که پاسخی به یکی از مشکلات روستا بود. 

+
+
+
+ + + + + + + +
+ + + + + + + +
+

+ ​

+

+ در مسیر برگشت پس از مصاحه با اهالی روستای ایگل

+
+
+
+ +
+
+
+ + + + +
+ + + + + + + +
+

+ ​

+

+ تکمیل MVP یا حداقل محصول قابل ارائه

+
+
+
+
+ + + + +
+ + + + + + + + + + + + + + + + + + +
+

+ بازدید بخش‌دار، دهیار و شورای شهر از پروژه و مدرسه 

+
+

+ ​

+

+ نصب بنر توسط دهیاری و شورا برای کسب مقام اول منطقه یک تهران

+
+

+ ​

+

+ تقدیر از دانش‌آموزان توسط آموزش و پرورش

+
+
+
+
+ + + + + +
+
+ + + \ No newline at end of file diff --git a/mail-templates/src/templates/expandFamilyNoChild.html b/mail-templates/src/templates/expandFamilyNoChild.html new file mode 100644 index 0000000000..1be1b53793 --- /dev/null +++ b/mail-templates/src/templates/expandFamilyNoChild.html @@ -0,0 +1,643 @@ + + + + + + + + + + SAY DAO No Children Template + + + + + + + + + + + +
+ +
+ + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + +
+ Logo +
+ + + + + + + +
+
+
+
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + +
+ +
+
+ شما کودک فعالی ندارید. +
+
+

+ سلام @{{userName}}، +

+

+ در حال حاضر شما کودک فعالی ندارید. شما + می‌توانید با رفتن به صفحه جستجو + اپلیکیشن/دپلیکیشن، کودک دیگری را به + سرپرستی قبول کنید... +

+
+ اپلیکیشن +
+
+
+
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+

+ در صورتی که مایل نیستید این یادآوری ماهانه + را دریافت کنید، لطفا از طریق این + + لینک + به صفحه کاربری بروید و آن را خاموش کنید. +

+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/mail-templates/src/templates/gmail-color-hack.html b/mail-templates/src/templates/gmail-color-hack.html new file mode 100644 index 0000000000..9f5dacf2e7 --- /dev/null +++ b/mail-templates/src/templates/gmail-color-hack.html @@ -0,0 +1,22 @@ + + + + + Fixing Gmail’s dark mode issues with CSS Blend Modes + + + +
+
+
+ + Lorem ipsum dolor, sit amet, consectetur adipisicing elit. + +
+
+
+ + \ No newline at end of file diff --git a/mail-templates/src/templates/monthlyCampaign.html b/mail-templates/src/templates/monthlyCampaign.html new file mode 100644 index 0000000000..40489babfd --- /dev/null +++ b/mail-templates/src/templates/monthlyCampaign.html @@ -0,0 +1,1644 @@ + + + + + + + + + + Campaign Template + + + + + + + + + + + +
+ +
+ + +
+ + + + +
+ + + + +
+ + + + + + + +
+ + + + +
+ + + + +
+ SAY logo +
+
+
+ + + + + +
+ + + + +
+ وبسایت +
+
+ + + + + +
+ + + + +
+ مستندات +
+
+ + + + +
+ + + + +
+ دپلیکیشن +
+
+
+
+ + + + +
+ + + + + + + +
+ + + + +
+ + + + +
+ + + + +
+
+
+
+ + + + +
+ + + + + + + +
+

+   + آخرین + نیاز + کودکان +   +

+
+ +
+
+
+
+ @{{#each myChildren as | child |}} + + + + +
+ + + + + + + +
+ + + + + +
+ + + + + + + +
+

+   @{{child.sayName}} +

+
+ + + + +
+
+
+ + + + + +
+ + + + +
+ +
+
+ +
+ + + + + +
+ + + + + + + + + + +
+

+ آخرین نیازها +

+
+ + + + +
+
+

+   + + دیگر نیاز‌های کودک ... +   +

+
+
+ @{{#each unPaidNeeds as |need|}} + + + + +
+ + + + + + + + + + + + + +
+ @{{need.name}} +
+

+ @{{need.price}} تومان +

+
+

+ @{{need.name}} +

+
+ پرداخت +
+
+ @{{/each}} +
+
+ @{{/each}} + + + + +
+ + + + + + + +
+ + + + +
+ + + + + + + +
+ + تمام کودکان ... +
+ + + + +
+
+
+
+ + + + +
+ + + + + + + + + + + + + +
+

+   + امضای + دیجیتال +   +

+
+

+ نیازی که توسط خانواده مجازی پرداخت شده + باشد و به دست کودک رسیده باشد وارد مرحله + تازه ای می‌شود. در این مرحله امکان امضای + دیجیتال نیاز توسط مددکار، شاهد، میانجی و + خانواده مجازی فراهم می‌شود که خود پیش نیاز + توسعه SAY بر روی بستر بلاک‌چین و تبدیل شدن + به سازمانی غیرمتمرکز و خودمختار است. +

+
+ مطالعه بیشتر ... +
+ +
+
+
+
+ + + + +
+ + @{{#unless readyToSignNeeds}} + + + + @{{/unless}} + + + +
+

+ در میان نیازهای امضا شده توسط مددکاران، نیاز پرداخت + شده شما را پیدا نکردیم، اگر نیازی را پرداخت کرده‌اید و + اینجا نمی‌بینید لطفا در روزهای آتی به صفحه امضاها سر + بزنید. +

+
+ @{{#each readyToSignNeeds as |readyNeed|}} + + + + + + + +
+ + + + +
+ @{{readyNeed.name}} +
+
+ + + + +
+

+ @{{readyNeed.name}} +

+
+
+ @{{/each}} +
+
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ دیگر امضا‌ها ... +
+
+
+
+ + + + +
+ + + + +
+ + + + +
+ + + +
+
+
+
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + +
+

+ در صورتی که با این نشانی ایمیل اقدام به + همراهی ما نکرده‌اید لطفا این ایمیل را + ندیده بگیرید و روی لینک زیر کلیک + کنید +

+
+

+ لغو همراهی +

+
+ +
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/mail-templates/src/templates/swConfirmedChild.html b/mail-templates/src/templates/swConfirmedChild.html new file mode 100644 index 0000000000..62e4c44ab8 --- /dev/null +++ b/mail-templates/src/templates/swConfirmedChild.html @@ -0,0 +1,827 @@ + + + + + + + + + + Social Workers Reminder Template + + + + + + + + + + + + +
+ +
+ + + +
+ + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+

+ View online version +

+
+
+
+
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + +
+ Logo +
+ + + + + + + +
+
+
+
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + +
+ +
+
+ @{{sayName}} +
+ + (@{{firstName}} @{{lastName}}) + +
+

+ سلام @{{userName}}، +

+

+ ​ +

+

+ @{{firstName}} @{{lastName}}، تأیید شده‌ و + به زودی برای او خانواده مجازی پیدا خواهیم + کرد. شما می‌توانید از امروز نیازهای او را + ثبت کنید. +

+

+ ​
با احترام، +

+

+ SAY +

+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/mail-templates/src/templates/swRemindNoNeeds.html b/mail-templates/src/templates/swRemindNoNeeds.html new file mode 100644 index 0000000000..547924366c --- /dev/null +++ b/mail-templates/src/templates/swRemindNoNeeds.html @@ -0,0 +1,871 @@ + + + + + + + + + + Social Workers Reminder Template + + + + + + + + + + + + +
+ +
+ + + +
+ + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+

+ View online version +

+
+
+
+
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + +
+ Logo +
+ + + + + + + +
+
+
+
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + +
+ +
+
+ کودکان بدون نیاز ثبت شده! +
+
+

+ سلام @{{userName}}، +

+

+ ​ +

+

+ در حال حاضر تعدادی از کودکان شما نیاز ثبت + شده‌ای ندارند.  در صورتی که کودک از + تحت پوشش شما خارج شده است یا نیازهای آنها + از  محل دیگری رفع می‌گردد، لطفا از + طریق ایمیل ngo@saydao.org به ما اطلاع + دهید، در غیر این صورت این ایمیل را نادیده + بگیرید. +

+

+ ​
با احترام، +

+

+ SAY +

+

+ ​ +

+

+ کودکان بدون نیاز ثبت شده: +

+

+

    + @{{#each children as | child|}} +
  • + @{{child.firstName_translations.fa}} + @{{child.lastName_translations.fa}} + (@{{child.sayname_translations.fa}}) +
  • + @{{/each}} +
+ +

+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/mail-templates/tailwind.config.js b/mail-templates/tailwind.config.js new file mode 100644 index 0000000000..41a4777923 --- /dev/null +++ b/mail-templates/tailwind.config.js @@ -0,0 +1,138 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + theme: { + screens: { + sm: {max: '600px'}, + xs: {max: '425px'}, + }, + extend: { + spacing: { + screen: '100vw', + full: '100%', + 0: '0', + 0.5: '2px', + 1: '4px', + 1.5: '6px', + 2: '8px', + 2.5: '10px', + 3: '12px', + 3.5: '14px', + 4: '16px', + 4.5: '18px', + 5: '20px', + 5.5: '22px', + 6: '24px', + 6.5: '26px', + 7: '28px', + 7.5: '30px', + 8: '32px', + 8.5: '34px', + 9: '36px', + 9.5: '38px', + 10: '40px', + 11: '44px', + 12: '48px', + 14: '56px', + 16: '64px', + 20: '80px', + 24: '96px', + 28: '112px', + 32: '128px', + 36: '144px', + 40: '160px', + 44: '176px', + 48: '192px', + 52: '208px', + 56: '224px', + 60: '240px', + 64: '256px', + 72: '288px', + 80: '320px', + 96: '384px', + }, + borderRadius: { + none: '0px', + sm: '2px', + DEFAULT: '4px', + md: '6px', + lg: '8px', + xl: '12px', + '2xl': '16px', + '3xl': '24px', + }, + boxShadow: { + sm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)', + DEFAULT: '0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)', + md: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)', + lg: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)', + xl: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)', + '2xl': '0 25px 50px -12px rgba(0, 0, 0, 0.25)', + inner: 'inset 0 2px 4px 0 rgba(0, 0, 0, 0.05)', + }, + fontFamily: { + sans: ['ui-sans-serif', 'system-ui', '-apple-system', '"Segoe UI"', 'sans-serif',], + serif: ['ui-serif', 'Georgia', 'Cambria', '"Times New Roman"', 'Times', 'serif'], + mono: ['ui-monospace', 'Menlo', 'Consolas', 'monospace'], + 'IRANYekan':["'IRANYekan'"] + }, + fontSize: { + 0: '0', + xxs: '11px', + xs: '12px', + '2xs': '13px', + sm: '14px', + '2sm': '15px', + base: '16px', + lg: '18px', + xl: '20px', + '2xl': '24px', + '3xl': '30px', + '4xl': '36px', + '5xl': '48px', + '6xl': '60px', + '7xl': '72px', + '8xl': '96px', + '9xl': '128px', + }, + letterSpacing: theme => ({ + ...theme('width'), + }), + lineHeight: theme => ({ + ...theme('width'), + }), + maxWidth: theme => ({ + ...theme('width'), + xs: '160px', + sm: '192px', + md: '224px', + lg: '256px', + xl: '288px', + '2xl': '336px', + '3xl': '384px', + '4xl': '448px', + '5xl': '512px', + '6xl': '576px', + '7xl': '640px', + }), + minHeight: theme => ({ + ...theme('width'), + }), + minWidth: theme => ({ + ...theme('width'), + }), + }, + }, + corePlugins: { + preflight: false, + backgroundOpacity: false, + borderOpacity: false, + divideOpacity: false, + placeholderOpacity: false, + textOpacity: false, + }, + plugins: [ + require('tailwindcss-mso'), + require('tailwindcss-box-shadow'), + require('tailwindcss-email-variants'), + ], +} diff --git a/nest-cli.json b/nest-cli.json index 256648114a..d92aaf6fae 100644 --- a/nest-cli.json +++ b/nest-cli.json @@ -1,5 +1,13 @@ { "$schema": "https://json.schemastore.org/nest-cli", "collection": "@nestjs/schematics", - "sourceRoot": "src" -} + "sourceRoot": "src", + "compilerOptions": { + "assets": [ + "features/campaign/templates/**/*", + "features/children/**/*", + "features/midjourney/**/*" + ], + "watchAssets": true + } +} \ No newline at end of file diff --git a/package.json b/package.json index b236d9dfc8..f7a623fcf2 100644 --- a/package.json +++ b/package.json @@ -19,60 +19,100 @@ "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "jest --config ./test/jest-e2e.json", - "codegen": "rm -rf src/generated-sources/openapi; openapi-generator-cli generate -i ./openapi.yaml -o src/generated-sources/openapi -g typescript-fetch --additional-properties=supportsES6=true,npmVersion=6.9.0,typescriptThreePlus=true" + "codegen": "rm -rf src/generated-sources/openapi; openapi-generator-cli generate -i ./openapi.yaml -o src/generated-sources/openapi -g typescript-fetch --additional-properties=supportsES6=true,npmVersion=6.9.0,typescriptThreePlus=true", + "typeorm": "npm run build && npx typeorm -d dist/db/data-source.js", + "typeorm:generate": "npm run typeorm -- migration:generate src/db/migrations/new", + "typeorm:run": "npm run typeorm -- migration:run", + "typeorm:revert": "npm run typeorm -- migration:revert" }, "dependencies": { - "@nestjs/axios": "^1.0.1", - "@nestjs/common": "^9.2.1", - "@nestjs/config": "^2.2.0", + "@discord-nestjs/common": "*", + "@discord-nestjs/core": "*", + "@fleekhq/fleek-storage-js": "^1.0.24", + "@getvim/execute": "^1.0.0", + "@nestjs-modules/mailer": "^1.9.1", + "@nestjs/axios": "^3.0.1", + "@nestjs/common": "^10.1.3", + "@nestjs/config": "^3.0.0", "@nestjs/core": "^9.2.1", + "@nestjs/event-emitter": "^1.4.1", "@nestjs/platform-express": "^9.0.0", - "@nestjs/schedule": "^2.1.0", + "@nestjs/platform-socket.io": "^9.3.9", + "@nestjs/schedule": "^3.0.1", + "@nestjs/serve-static": "^4.0.0", "@nestjs/swagger": "^6.1.0", "@nestjs/terminus": "^9.1.1", + "@nestjs/throttler": "^4.2.1", "@nestjs/typeorm": "^9.0.1", + "@nestjs/websockets": "^9.3.9", "@openapitools/openapi-generator-cli": "^2.5.2", "@types/cron": "^2.0.0", "@types/multer": "^1.4.7", + "axios": "^1.3.4", "class-transformer": "^0.5.1", "class-validator": "^0.13.2", + "connect-pg-simple": "^8.0.0", + "cookie-parser": "^1.4.6", + "decimal.js": "^10.4.3", + "discord.js": "14.11.0", "dotenv": "^16.0.1", "es6-promise": "^4.2.8", - "ethers": "^5.0.0", - "nestjs-ethers": "^1.0.3", + "ethers": "^5.7.0", + "express-session": "^1.17.3", + "handlebars": "^4.7.8", + "mathjs": "^11.9.1", + "melipayamak": "^1.0.5", + "mime": "^3.0.0", + "nanoid": "^3.0.0", + "nestjs-ethers": "^2.1.0", + "nestjs-paginate": "^8.1.2", "nestjs-pino": "^3.1.1", - "nestjs-typeorm-paginate": "^4.0.2", + "nft.storage": "^7.0.3", + "nodemailer": "^6.9.6", + "openai": "^3.3.0", "pg": "^8.8.0", "pino-http": "^8.2.0", "portable-fetch": "^3.0.0", - "reflect-metadata": "^0.1.13", - "rimraf": "^3.0.2", - "rxjs": "^7.2.0", - "typeorm": "^0.3.8", + "read-excel-file": "^5.7.1", + "reflect-metadata": "0.1.13", + "rimraf": "^5.0.5", + "rxjs": "^7.8.1", + "siwe": "^2.1.4", + "typeorm": "^0.3.12", "uuidv4": "^6.2.13" }, + "resolutions": { + "wrap-ansi": "7.0.0", + "string-width": "4.1.0" + }, "devDependencies": { - "@nestjs/cli": "^9.0.0", - "@nestjs/schematics": "^9.0.0", + "@nestjs/cli": "^10.2.1", + "@nestjs/schematics": "10.0.1", "@nestjs/testing": "^9.0.0", + "@types/cookie-parser": "^1.4.3", "@types/express": "^4.17.13", + "@types/express-session": "^1.17.6", "@types/jest": "28.1.4", - "@types/node": "^16.0.0", + "@types/mime": "^3.0.1", + "@types/node": "20.3.3", + "@types/node-fetch": "^2.6.9", + "@types/nodemailer": "^6.4.13", + "@types/passport": "^1.0.12", "@types/supertest": "^2.0.11", - "@typescript-eslint/eslint-plugin": "^5.0.0", - "@typescript-eslint/parser": "^5.0.0", - "eslint": "^8.0.1", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-prettier": "^4.0.0", + "@typescript-eslint/eslint-plugin": "5.61.0", + "@typescript-eslint/parser": "5.61.0", + "eslint": "8.44.0", + "eslint-config-prettier": "8.8.0", + "eslint-plugin-prettier": "4.2.1", "jest": "28.1.2", - "prettier": "^2.3.2", + "prettier": "2.8.8", "source-map-support": "^0.5.20", "supertest": "^6.1.3", "ts-jest": "28.0.5", - "ts-loader": "^9.2.3", - "ts-node": "^10.0.0", - "tsconfig-paths": "4.0.0", - "typescript": "^4.8.2" + "ts-loader": "9.4.4", + "ts-node": "10.9.1", + "tsconfig-paths": "4.2.0", + "typescript": "5.1.6" }, "jest": { "moduleFileExtensions": [ diff --git a/scripts/update-env.sh b/scripts/update-env.sh old mode 100755 new mode 100644 diff --git a/src/app.module.ts b/src/app.module.ts index 01a41747cd..b5d30e5a52 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -5,54 +5,89 @@ import { ScheduleModule } from '@nestjs/schedule'; import { TypeOrmModule } from '@nestjs/typeorm'; import { ConfigModule } from '@nestjs/config'; import 'reflect-metadata'; -import { MileStoneEntity } from './entities/milestone.entity'; -import { NeedEntity } from './entities/need.entity'; -import { SignatureModule } from './features/signature/signature.module'; -import { SignatureEntity } from './entities/signature.entity'; -import { ChildrenEntity } from './entities/children.entity'; -import { FamilyEntity, SocialWorkerEntity } from './entities/user.entity'; +import { LocationModule } from './features/location/location.module'; +import { GatewayModule } from './features/gateway/gateway.module'; +import { SocialWorker } from './entities/flaskEntities/user.entity'; +import { StatusModule } from './features/status/status.module'; import { SyncModule } from './features/sync/sync.module'; -import { ChildrenModule } from './features/children/children.module'; -import { NeedModule } from './features/need/need.module'; -import { MilestoneModule } from './features/milestone/milestone.module'; -import { StepEntity } from './entities/step.entity'; import { UserModule } from './features/user/user.module'; -import { StepModule } from './features/step/step.module'; -import { ProviderModule } from './features/provider/provider.module'; -import { ProviderEntity } from './entities/provider.entity'; -import { PaymentEntity } from './entities/payment.entity'; +import { TicketModule } from './features/ticket/ticket.module'; +import { NgoModule } from './features/ngo/ngo.module'; import { PaymentModule } from './features/payment/payment.module'; -import { ReceiptEntity } from './entities/receipt.entity'; import { ReceiptModule } from './features/receipt/receipt.module'; -import { EthereumAccount } from './entities/ethereum.account.entity'; -import { EthereumTransaction } from './entities/ethereum.transaction.entity'; -import { NgoModule } from './features/ngo/ngo.module'; -import { NgoEntity } from './entities/ngo.entity'; +import { ProviderModule } from './features/provider/provider.module'; +import { StepModule } from './features/step/step.module'; +import { ChildrenModule } from './features/children/children.module'; +import { NeedModule } from './features/need/need.module'; +import { MilestoneModule } from './features/milestone/milestone.module'; +import { WalletModule } from './features/wallet/wallet.module'; +import { Need } from './entities/flaskEntities/need.entity'; +import { IpfsModule } from './features/ipfs/ipfs.module'; +import { NGO } from './entities/flaskEntities/ngo.entity'; +import { Cities } from './entities/flaskEntities/cities.entity'; +import { Child } from './entities/flaskEntities/child.entity'; +import { HttpModule } from '@nestjs/axios'; +import { Payment } from './entities/flaskEntities/payment.entity'; +import { AnalyticModule } from './features/analytic/analytic.module'; +import { Family } from './entities/flaskEntities/family.entity'; +import { NeedStatusUpdate } from './entities/flaskEntities/NeedStatusUpdate.entity'; +import { NeedReceipt } from './entities/flaskEntities/needReceipt.entity'; +import { Receipt } from './entities/flaskEntities/receipt.entity'; +import { DownloadModule } from './features/download/download.module'; +import { NeedFamily } from './entities/flaskEntities/needFamily'; +import { ScheduleTaskModule } from './features/schedule/schedule.module'; +import { FamilyModule } from './features/family/family.module'; +import { MidjourneyModule } from './features/midjourney/midjourney.module'; +import { CommentModule } from './features/comment/comment.module'; +import { MineModule } from './features/mine/mine.module'; +import { ContributionModule } from './features/contribution/contribution.module'; +import { ThrottlerModule } from '@nestjs/throttler'; +import { postgresDataSourceOptions } from './db/data-source'; +import { CampaignModule } from './features/campaign/campaign.module'; +import { Countries } from './entities/flaskEntities/countries.entity'; const imports = [ + ThrottlerModule.forRoot({ + ttl: 60, // time to live, + limit: 10, // the maximum number of requests within the ttl + }), + + HttpModule, + ScheduleModule.forRoot(), LoggerModule.forRoot(), ConfigModule.forRoot({ isGlobal: true }), + TypeOrmModule.forRoot(postgresDataSourceOptions), TypeOrmModule.forRoot({ - ...config().db, - dropSchema: false, + ...config().db2, entities: [ - FamilyEntity, - SocialWorkerEntity, - NgoEntity, - PaymentEntity, - ReceiptEntity, - NeedEntity, - ProviderEntity, - MileStoneEntity, - StepEntity, - SignatureEntity, - ChildrenEntity, - EthereumAccount, - EthereumTransaction + Countries, + Need, + SocialWorker, + NGO, + Cities, + Child, + Payment, + Family, + NeedFamily, + NeedStatusUpdate, + Receipt, + NeedReceipt, ], }), + // MulterModule.register({ + // dest: '../../midjourney', + // }), + // ServeStaticModule.forRoot({ + // rootPath: join(__dirname, '..', 'files'), + // }), + CampaignModule, + ScheduleTaskModule, + GatewayModule, + LocationModule, + StatusModule, SyncModule, UserModule, + TicketModule, NgoModule, PaymentModule, ReceiptModule, @@ -61,8 +96,16 @@ const imports = [ ProviderModule, MilestoneModule, StepModule, - SignatureModule, - ScheduleModule.forRoot(), + WalletModule, + IpfsModule, + AnalyticModule, + DownloadModule, + FamilyModule, + MidjourneyModule, + CommentModule, + MineModule, + ContributionModule, + CampaignModule, ]; @Module({ @@ -70,4 +113,4 @@ const imports = [ controllers: [], providers: [], }) -export class AppModule { } +export class AppModule {} diff --git a/src/config.ts b/src/config.ts index a106d3a922..77c1818e7a 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,5 +1,5 @@ import 'dotenv/config'; // see https://github.com/motdotla/dotenv#how-do-i-use-dotenv-with-import -import { readFileSync } from 'fs'; +import DataCache from './utils/dataCache'; let configObject; @@ -11,40 +11,50 @@ const Environments = { }; function loadConfig() { - let dbPassword = undefined; const NODE_ENV = process.env.NODE_ENV ?? Environments.development; - try { - if (process.env.DB_PASS_FILE) - dbPassword = readFileSync(process.env.DB_PASS_FILE, 'utf-8'); - } catch { - console.log(`${process.env.DB_PASS_FILE} DOES NOT EXISTS!`); - } const configs = { serverPort: process.env.PORT || 8002, host: - process.env.NODE_ENV === 'development' || process.env.NODE_ENV === undefined + process.env.NODE_ENV === 'development' || + process.env.NODE_ENV === undefined ? 'localHost' : process.env.NODE_ENV === 'docker-local' - ? 'localHost' - : process.env.NODE_ENV === 'staging' ? process.env.AUTHORIZED_HOST_STAGING : process.env.AUTHORIZED_HOST_PRODUCTION, - logLevel: 'debug', + ? 'localHost' + : process.env.NODE_ENV === 'staging' + ? process.env.AUTHORIZED_HOST_STAGING + : process.env.NEST_SERVER_PROD, documentUrl: '', - db: { + db1: { type: 'postgres' as const, - port: 5432, + port: Number(process.env.DB_PORT), host: NODE_ENV === 'development' ? 'localhost' : process.env.DB_HOST, username: process.env.DB_USER ?? 'postgres', - password: dbPassword ?? process.env.DB_PASS ?? 'postgres', - database: process.env.DB_NAME ?? 'say_dapp', + password: process.env.DB_PASS ?? 'postgres', + database: process.env.DB_NAME ?? 'postgres', + synchronize: NODE_ENV === 'development' ? false : false, // true shouldn't be used in production - otherwise you can lose production data. + logging: false, + dropSchema: false, // Don't use this in production - Drops the schema each time data source is being initialized. + migrationsRun: true, // if migrations should be auto run on every application launch. As an alternative, you can use CLI and run migration:run command. + migrations: [`dist/db/migrations/*.js`], // list of migrations that need to be loaded by TypeORM + }, + db2: { + name: 'flaskPostgres', + type: 'postgres' as const, + port: Number(process.env.DB_FLASK_PORT), + host: process.env.DB_FLASK_HOST, + username: process.env.DB_FLASK_USER, + password: process.env.DB_FLASK_PASS, + database: process.env.DB_FLASK_NAME, enabled: true, - synchronize: true, - logging: true, + synchronize: false, + logging: false, dropSchema: false, autoLoadEntities: true, - entities: [`${__dirname}/entity/*.js`], + // entities: [`${__dirname}/entities/flaskEntities/*.js`], }, - logPretty: 'LOG_PRETTY_PRINT', + // logPretty: 'LOG_PRETTY_PRINT', + dataCache: new DataCache(), }; configs.documentUrl = @@ -54,7 +64,6 @@ function loadConfig() { return configs; } - export type ConfigType = ReturnType; export default function config(): ConfigType { @@ -64,3 +73,5 @@ export default function config(): ConfigType { return configObject; } + +export const PRODUCT_UNPAYABLE_PERIOD = 24; diff --git a/src/context.ts b/src/context.ts index 13fd39d37a..dfa254e724 100644 --- a/src/context.ts +++ b/src/context.ts @@ -1,20 +1,30 @@ import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'; -import { INestApplication } from '@nestjs/common'; import config from './config'; +import { NestExpressApplication } from '@nestjs/platform-express'; -let context: INestApplication = null; +let context: NestExpressApplication export const ApplicationContext = async () => { if (!context) { - context = await NestFactory.create(AppModule); + context = await NestFactory.create(AppModule); const options = new DocumentBuilder() .setTitle('SAY DAO') .setDescription('DAO API') .setVersion('v0.1.0') - // .addTag('Needs') .addServer(config().documentUrl, 'The Server') + .addBearerAuth( + { + description: `[just text field] Please enter token in following format: Bearer `, + name: 'authorization', + bearerFormat: 'Bearer', + scheme: 'Bearer', + type: 'http', + in: 'Header' + }, + 'flask-access-token', // This name here is important for matching up with @ApiBearerAuth() in your controller! + ) .build(); const document = SwaggerModule.createDocument(context, options); SwaggerModule.setup('docs', context, document); diff --git a/src/contracts/Roles.sol/Roles.dbg.json b/src/contracts/Roles.sol/Roles.dbg.json deleted file mode 100644 index 3e212f9dcd..0000000000 --- a/src/contracts/Roles.sol/Roles.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/Roles.sol/Roles.json b/src/contracts/Roles.sol/Roles.json deleted file mode 100644 index 262e9381ca..0000000000 --- a/src/contracts/Roles.sol/Roles.json +++ /dev/null @@ -1,407 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Roles", - "sourceName": "contracts/Roles.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "previousAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "beacon", - "type": "address" - } - ], - "name": "BeaconUpgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "Upgraded", - "type": "event" - }, - { - "inputs": [], - "name": "AUNT_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "FATHER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "FRIEND_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MOTHER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "UNCLE_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "UPGRADER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "proxiableUUID", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "upgradeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "upgradeToAndCall", - "outputs": [], - "stateMutability": "payable", - "type": "function" - } - ], - "bytecode": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100e2565b600054610100900460ff161561008e5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100e0576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516113dc61011960003960008181610491015281816104d101528181610571015281816105b1015261064001526113dc6000f3fe6080604052600436106100fe5760003560e01c8063654f800511610095578063a007a56211610064578063a007a562146102d1578063a217fddf14610305578063d547741f1461031a578063e16ff37a1461033a578063f72c0d8b1461036e57600080fd5b8063654f8005146102345780638129fc1c1461026857806391d148541461027d5780639857188a1461029d57600080fd5b806336568abe116100d157806336568abe146101cc5780633659cfe6146101ec5780634f1ef2861461020c57806352d1902d1461021f57600080fd5b806301ffc9a714610103578063248a9ca3146101385780632f2ff15d14610176578063328114d114610198575b600080fd5b34801561010f57600080fd5b5061012361011e366004610fc6565b6103a2565b60405190151581526020015b60405180910390f35b34801561014457600080fd5b50610168610153366004610ff0565b60009081526065602052604090206001015490565b60405190815260200161012f565b34801561018257600080fd5b50610196610191366004611025565b6103d9565b005b3480156101a457600080fd5b506101687f977f2acfebd3834a66d449816849ad93a02e1051b3a4e427c02822cc5ea215af81565b3480156101d857600080fd5b506101966101e7366004611025565b610403565b3480156101f857600080fd5b50610196610207366004611051565b610486565b61019661021a366004611082565b610566565b34801561022b57600080fd5b50610168610633565b34801561024057600080fd5b506101687f09659a10f6a1970806c3d4bde16e065e0a1a0b4d91510d1b2bf062b44eff230081565b34801561027457600080fd5b506101966106e6565b34801561028957600080fd5b50610123610298366004611025565b610833565b3480156102a957600080fd5b506101687fe812e839baaf5eb2fe88c817bdd20a3d5962aaddac4e81b2d8238cf94fa1590481565b3480156102dd57600080fd5b506101687fdc601cd343c9e7d418b48b40f3a0ff8434a08eca1bd022ca70b09c036310b0aa81565b34801561031157600080fd5b50610168600081565b34801561032657600080fd5b50610196610335366004611025565b61085e565b34801561034657600080fd5b506101687f388a4c2ec5c0e7cc699edbd50c31462c0f4f59a574529060d4e6b02576c110a381565b34801561037a57600080fd5b506101687f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b60006001600160e01b03198216637965db0b60e01b14806103d357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000828152606560205260409020600101546103f481610883565b6103fe838361088d565b505050565b6001600160a01b03811633146104785760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6104828282610913565b5050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156104cf5760405162461bcd60e51b815260040161046f90611144565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610518600080516020611360833981519152546001600160a01b031690565b6001600160a01b03161461053e5760405162461bcd60e51b815260040161046f90611190565b6105478161097a565b60408051600080825260208201909252610563918391906109a4565b50565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156105af5760405162461bcd60e51b815260040161046f90611144565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166105f8600080516020611360833981519152546001600160a01b031690565b6001600160a01b03161461061e5760405162461bcd60e51b815260040161046f90611190565b6106278261097a565b610482828260016109a4565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106d35760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161046f565b5060008051602061136083398151915290565b600054610100900460ff16158080156107065750600054600160ff909116105b806107205750303b158015610720575060005460ff166001145b6107835760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161046f565b6000805460ff1916600117905580156107a6576000805461ff0019166101001790555b6107ae610b1e565b6107b6610b1e565b6107c160003361088d565b6107eb7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e33361088d565b8015610563576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60008281526065602052604090206001015461087981610883565b6103fe8383610913565b6105638133610b8b565b6108978282610833565b6104825760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556108cf3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61091d8282610833565b156104825760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e361048281610883565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156109d7576103fe83610bef565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a1057600080fd5b505afa925050508015610a40575060408051601f3d908101601f19168201909252610a3d918101906111dc565b60015b610aa35760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161046f565b6000805160206113608339815191528114610b125760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161046f565b506103fe838383610c8b565b600054610100900460ff16610b895760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161046f565b565b610b958282610833565b61048257610bad816001600160a01b03166014610cb6565b610bb8836020610cb6565b604051602001610bc9929190611221565b60408051601f198184030181529082905262461bcd60e51b825261046f91600401611296565b6001600160a01b0381163b610c5c5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161046f565b60008051602061136083398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b610c9483610e59565b600082511180610ca15750805b156103fe57610cb08383610e99565b50505050565b60606000610cc58360026112df565b610cd09060026112fe565b67ffffffffffffffff811115610ce857610ce861106c565b6040519080825280601f01601f191660200182016040528015610d12576020820181803683370190505b509050600360fc1b81600081518110610d2d57610d2d611316565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610d5c57610d5c611316565b60200101906001600160f81b031916908160001a9053506000610d808460026112df565b610d8b9060016112fe565b90505b6001811115610e03576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610dbf57610dbf611316565b1a60f81b828281518110610dd557610dd5611316565b60200101906001600160f81b031916908160001a90535060049490941c93610dfc8161132c565b9050610d8e565b508315610e525760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161046f565b9392505050565b610e6281610bef565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b610f015760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161046f565b600080846001600160a01b031684604051610f1c9190611343565b600060405180830381855af49150503d8060008114610f57576040519150601f19603f3d011682016040523d82523d6000602084013e610f5c565b606091505b5091509150610f84828260405180606001604052806027815260200161138060279139610f8d565b95945050505050565b60608315610f9c575081610e52565b825115610fac5782518084602001fd5b8160405162461bcd60e51b815260040161046f9190611296565b600060208284031215610fd857600080fd5b81356001600160e01b031981168114610e5257600080fd5b60006020828403121561100257600080fd5b5035919050565b80356001600160a01b038116811461102057600080fd5b919050565b6000806040838503121561103857600080fd5b8235915061104860208401611009565b90509250929050565b60006020828403121561106357600080fd5b610e5282611009565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561109557600080fd5b61109e83611009565b9150602083013567ffffffffffffffff808211156110bb57600080fd5b818501915085601f8301126110cf57600080fd5b8135818111156110e1576110e161106c565b604051601f8201601f19908116603f011681019083821181831017156111095761110961106c565b8160405282815288602084870101111561112257600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6000602082840312156111ee57600080fd5b5051919050565b60005b838110156112105781810151838201526020016111f8565b83811115610cb05750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516112598160178501602088016111f5565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161128a8160288401602088016111f5565b01602801949350505050565b60208152600082518060208401526112b58160408501602087016111f5565b601f01601f19169190910160400192915050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156112f9576112f96112c9565b500290565b60008219821115611311576113116112c9565b500190565b634e487b7160e01b600052603260045260246000fd5b60008161133b5761133b6112c9565b506000190190565b600082516113558184602087016111f5565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122074a7479d8efd3b53078e57d5df4fc08e5f511bd395895e4cbf60db340a62d84964736f6c63430008090033", - "deployedBytecode": "0x6080604052600436106100fe5760003560e01c8063654f800511610095578063a007a56211610064578063a007a562146102d1578063a217fddf14610305578063d547741f1461031a578063e16ff37a1461033a578063f72c0d8b1461036e57600080fd5b8063654f8005146102345780638129fc1c1461026857806391d148541461027d5780639857188a1461029d57600080fd5b806336568abe116100d157806336568abe146101cc5780633659cfe6146101ec5780634f1ef2861461020c57806352d1902d1461021f57600080fd5b806301ffc9a714610103578063248a9ca3146101385780632f2ff15d14610176578063328114d114610198575b600080fd5b34801561010f57600080fd5b5061012361011e366004610fc6565b6103a2565b60405190151581526020015b60405180910390f35b34801561014457600080fd5b50610168610153366004610ff0565b60009081526065602052604090206001015490565b60405190815260200161012f565b34801561018257600080fd5b50610196610191366004611025565b6103d9565b005b3480156101a457600080fd5b506101687f977f2acfebd3834a66d449816849ad93a02e1051b3a4e427c02822cc5ea215af81565b3480156101d857600080fd5b506101966101e7366004611025565b610403565b3480156101f857600080fd5b50610196610207366004611051565b610486565b61019661021a366004611082565b610566565b34801561022b57600080fd5b50610168610633565b34801561024057600080fd5b506101687f09659a10f6a1970806c3d4bde16e065e0a1a0b4d91510d1b2bf062b44eff230081565b34801561027457600080fd5b506101966106e6565b34801561028957600080fd5b50610123610298366004611025565b610833565b3480156102a957600080fd5b506101687fe812e839baaf5eb2fe88c817bdd20a3d5962aaddac4e81b2d8238cf94fa1590481565b3480156102dd57600080fd5b506101687fdc601cd343c9e7d418b48b40f3a0ff8434a08eca1bd022ca70b09c036310b0aa81565b34801561031157600080fd5b50610168600081565b34801561032657600080fd5b50610196610335366004611025565b61085e565b34801561034657600080fd5b506101687f388a4c2ec5c0e7cc699edbd50c31462c0f4f59a574529060d4e6b02576c110a381565b34801561037a57600080fd5b506101687f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b60006001600160e01b03198216637965db0b60e01b14806103d357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000828152606560205260409020600101546103f481610883565b6103fe838361088d565b505050565b6001600160a01b03811633146104785760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6104828282610913565b5050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156104cf5760405162461bcd60e51b815260040161046f90611144565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610518600080516020611360833981519152546001600160a01b031690565b6001600160a01b03161461053e5760405162461bcd60e51b815260040161046f90611190565b6105478161097a565b60408051600080825260208201909252610563918391906109a4565b50565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156105af5760405162461bcd60e51b815260040161046f90611144565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166105f8600080516020611360833981519152546001600160a01b031690565b6001600160a01b03161461061e5760405162461bcd60e51b815260040161046f90611190565b6106278261097a565b610482828260016109a4565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106d35760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161046f565b5060008051602061136083398151915290565b600054610100900460ff16158080156107065750600054600160ff909116105b806107205750303b158015610720575060005460ff166001145b6107835760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161046f565b6000805460ff1916600117905580156107a6576000805461ff0019166101001790555b6107ae610b1e565b6107b6610b1e565b6107c160003361088d565b6107eb7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e33361088d565b8015610563576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60008281526065602052604090206001015461087981610883565b6103fe8383610913565b6105638133610b8b565b6108978282610833565b6104825760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556108cf3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61091d8282610833565b156104825760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e361048281610883565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156109d7576103fe83610bef565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a1057600080fd5b505afa925050508015610a40575060408051601f3d908101601f19168201909252610a3d918101906111dc565b60015b610aa35760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161046f565b6000805160206113608339815191528114610b125760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161046f565b506103fe838383610c8b565b600054610100900460ff16610b895760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161046f565b565b610b958282610833565b61048257610bad816001600160a01b03166014610cb6565b610bb8836020610cb6565b604051602001610bc9929190611221565b60408051601f198184030181529082905262461bcd60e51b825261046f91600401611296565b6001600160a01b0381163b610c5c5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161046f565b60008051602061136083398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b610c9483610e59565b600082511180610ca15750805b156103fe57610cb08383610e99565b50505050565b60606000610cc58360026112df565b610cd09060026112fe565b67ffffffffffffffff811115610ce857610ce861106c565b6040519080825280601f01601f191660200182016040528015610d12576020820181803683370190505b509050600360fc1b81600081518110610d2d57610d2d611316565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610d5c57610d5c611316565b60200101906001600160f81b031916908160001a9053506000610d808460026112df565b610d8b9060016112fe565b90505b6001811115610e03576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610dbf57610dbf611316565b1a60f81b828281518110610dd557610dd5611316565b60200101906001600160f81b031916908160001a90535060049490941c93610dfc8161132c565b9050610d8e565b508315610e525760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161046f565b9392505050565b610e6281610bef565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b610f015760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161046f565b600080846001600160a01b031684604051610f1c9190611343565b600060405180830381855af49150503d8060008114610f57576040519150601f19603f3d011682016040523d82523d6000602084013e610f5c565b606091505b5091509150610f84828260405180606001604052806027815260200161138060279139610f8d565b95945050505050565b60608315610f9c575081610e52565b825115610fac5782518084602001fd5b8160405162461bcd60e51b815260040161046f9190611296565b600060208284031215610fd857600080fd5b81356001600160e01b031981168114610e5257600080fd5b60006020828403121561100257600080fd5b5035919050565b80356001600160a01b038116811461102057600080fd5b919050565b6000806040838503121561103857600080fd5b8235915061104860208401611009565b90509250929050565b60006020828403121561106357600080fd5b610e5282611009565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561109557600080fd5b61109e83611009565b9150602083013567ffffffffffffffff808211156110bb57600080fd5b818501915085601f8301126110cf57600080fd5b8135818111156110e1576110e161106c565b604051601f8201601f19908116603f011681019083821181831017156111095761110961106c565b8160405282815288602084870101111561112257600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6000602082840312156111ee57600080fd5b5051919050565b60005b838110156112105781810151838201526020016111f8565b83811115610cb05750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516112598160178501602088016111f5565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161128a8160288401602088016111f5565b01602801949350505050565b60208152600082518060208401526112b58160408501602087016111f5565b601f01601f19169190910160400192915050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156112f9576112f96112c9565b500290565b60008219821115611311576113116112c9565b500190565b634e487b7160e01b600052603260045260246000fd5b60008161133b5761133b6112c9565b506000190190565b600082516113558184602087016111f5565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122074a7479d8efd3b53078e57d5df4fc08e5f511bd395895e4cbf60db340a62d84964736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/Treasury.sol/Treasury.dbg.json b/src/contracts/Treasury.sol/Treasury.dbg.json deleted file mode 100644 index 3e212f9dcd..0000000000 --- a/src/contracts/Treasury.sol/Treasury.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/Treasury.sol/Treasury.json b/src/contracts/Treasury.sol/Treasury.json deleted file mode 100644 index 9c2972ad04..0000000000 --- a/src/contracts/Treasury.sol/Treasury.json +++ /dev/null @@ -1,408 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Treasury", - "sourceName": "contracts/Treasury.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "previousAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "beacon", - "type": "address" - } - ], - "name": "BeaconUpgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "Upgraded", - "type": "event" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PAUSER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "UPGRADER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "proxiableUUID", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "upgradeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "upgradeToAndCall", - "outputs": [], - "stateMutability": "payable", - "type": "function" - } - ], - "bytecode": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100e2565b600054610100900460ff161561008e5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100e0576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b608051611538610119600039600081816103e601528181610426015281816104e60152818161052601526105b501526115386000f3fe6080604052600436106100f35760003560e01c80635c975abb1161008a578063a217fddf11610059578063a217fddf1461026c578063d547741f14610281578063e63ab1e9146102a1578063f72c0d8b146102c357600080fd5b80635c975abb1461020a5780638129fc1c146102225780638456cb591461023757806391d148541461024c57600080fd5b80633659cfe6116100c65780633659cfe6146101ad5780633f4ba83a146101cd5780634f1ef286146101e257806352d1902d146101f557600080fd5b806301ffc9a7146100f8578063248a9ca31461012d5780632f2ff15d1461016b57806336568abe1461018d575b600080fd5b34801561010457600080fd5b506101186101133660046110b7565b6102f7565b60405190151581526020015b60405180910390f35b34801561013957600080fd5b5061015d6101483660046110e1565b60009081526097602052604090206001015490565b604051908152602001610124565b34801561017757600080fd5b5061018b610186366004611116565b61032e565b005b34801561019957600080fd5b5061018b6101a8366004611116565b610358565b3480156101b957600080fd5b5061018b6101c8366004611142565b6103db565b3480156101d957600080fd5b5061018b6104bb565b61018b6101f0366004611173565b6104db565b34801561020157600080fd5b5061015d6105a8565b34801561021657600080fd5b5060335460ff16610118565b34801561022e57600080fd5b5061018b61065b565b34801561024357600080fd5b5061018b6107c8565b34801561025857600080fd5b50610118610267366004611116565b6107e8565b34801561027857600080fd5b5061015d600081565b34801561028d57600080fd5b5061018b61029c366004611116565b610813565b3480156102ad57600080fd5b5061015d6000805160206114bc83398151915281565b3480156102cf57600080fd5b5061015d7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b60006001600160e01b03198216637965db0b60e01b148061032857506301ffc9a760e01b6001600160e01b03198316145b92915050565b60008281526097602052604090206001015461034981610838565b6103538383610842565b505050565b6001600160a01b03811633146103cd5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6103d782826108c8565b5050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156104245760405162461bcd60e51b81526004016103c490611235565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661046d60008051602061149c833981519152546001600160a01b031690565b6001600160a01b0316146104935760405162461bcd60e51b81526004016103c490611281565b61049c8161092f565b604080516000808252602082019092526104b891839190610959565b50565b6000805160206114bc8339815191526104d381610838565b6104b8610ad3565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156105245760405162461bcd60e51b81526004016103c490611235565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661056d60008051602061149c833981519152546001600160a01b031690565b6001600160a01b0316146105935760405162461bcd60e51b81526004016103c490611281565b61059c8261092f565b6103d782826001610959565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106485760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016103c4565b5060008051602061149c83398151915290565b600054610100900460ff161580801561067b5750600054600160ff909116105b806106955750303b158015610695575060005460ff166001145b6106f85760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016103c4565b6000805460ff19166001179055801561071b576000805461ff0019166101001790555b610723610b25565b61072b610b56565b610733610b56565b61073e600033610842565b6107566000805160206114bc83398151915233610842565b6107807f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e333610842565b80156104b8576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6000805160206114bc8339815191526107e081610838565b6104b8610b7d565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60008281526097602052604090206001015461082e81610838565b61035383836108c8565b6104b88133610bba565b61084c82826107e8565b6103d75760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556108843390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6108d282826107e8565b156103d75760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e36103d781610838565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561098c5761035383610c1e565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109c557600080fd5b505afa9250505080156109f5575060408051601f3d908101601f191682019092526109f2918101906112cd565b60015b610a585760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016103c4565b60008051602061149c8339815191528114610ac75760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016103c4565b50610353838383610cba565b610adb610ce5565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600054610100900460ff16610b4c5760405162461bcd60e51b81526004016103c4906112e6565b610b54610d2e565b565b600054610100900460ff16610b545760405162461bcd60e51b81526004016103c4906112e6565b610b85610d61565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610b083390565b610bc482826107e8565b6103d757610bdc816001600160a01b03166014610da7565b610be7836020610da7565b604051602001610bf892919061135d565b60408051601f198184030181529082905262461bcd60e51b82526103c4916004016113d2565b6001600160a01b0381163b610c8b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016103c4565b60008051602061149c83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b610cc383610f4a565b600082511180610cd05750805b1561035357610cdf8383610f8a565b50505050565b60335460ff16610b545760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016103c4565b600054610100900460ff16610d555760405162461bcd60e51b81526004016103c4906112e6565b6033805460ff19169055565b60335460ff1615610b545760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016103c4565b60606000610db683600261141b565b610dc190600261143a565b67ffffffffffffffff811115610dd957610dd961115d565b6040519080825280601f01601f191660200182016040528015610e03576020820181803683370190505b509050600360fc1b81600081518110610e1e57610e1e611452565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610e4d57610e4d611452565b60200101906001600160f81b031916908160001a9053506000610e7184600261141b565b610e7c90600161143a565b90505b6001811115610ef4576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610eb057610eb0611452565b1a60f81b828281518110610ec657610ec6611452565b60200101906001600160f81b031916908160001a90535060049490941c93610eed81611468565b9050610e7f565b508315610f435760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016103c4565b9392505050565b610f5381610c1e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b610ff25760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016103c4565b600080846001600160a01b03168460405161100d919061147f565b600060405180830381855af49150503d8060008114611048576040519150601f19603f3d011682016040523d82523d6000602084013e61104d565b606091505b509150915061107582826040518060600160405280602781526020016114dc6027913961107e565b95945050505050565b6060831561108d575081610f43565b82511561109d5782518084602001fd5b8160405162461bcd60e51b81526004016103c491906113d2565b6000602082840312156110c957600080fd5b81356001600160e01b031981168114610f4357600080fd5b6000602082840312156110f357600080fd5b5035919050565b80356001600160a01b038116811461111157600080fd5b919050565b6000806040838503121561112957600080fd5b82359150611139602084016110fa565b90509250929050565b60006020828403121561115457600080fd5b610f43826110fa565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561118657600080fd5b61118f836110fa565b9150602083013567ffffffffffffffff808211156111ac57600080fd5b818501915085601f8301126111c057600080fd5b8135818111156111d2576111d261115d565b604051601f8201601f19908116603f011681019083821181831017156111fa576111fa61115d565b8160405282815288602084870101111561121357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6000602082840312156112df57600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b8381101561134c578181015183820152602001611334565b83811115610cdf5750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611395816017850160208801611331565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516113c6816028840160208801611331565b01602801949350505050565b60208152600082518060208401526113f1816040850160208701611331565b601f01601f19169190910160400192915050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561143557611435611405565b500290565b6000821982111561144d5761144d611405565b500190565b634e487b7160e01b600052603260045260246000fd5b60008161147757611477611405565b506000190190565b60008251611491818460208701611331565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220433ef63230d161708a2e832383eb99c450a94af0fc5b79907deb884ee965dfe464736f6c63430008090033", - "deployedBytecode": "0x6080604052600436106100f35760003560e01c80635c975abb1161008a578063a217fddf11610059578063a217fddf1461026c578063d547741f14610281578063e63ab1e9146102a1578063f72c0d8b146102c357600080fd5b80635c975abb1461020a5780638129fc1c146102225780638456cb591461023757806391d148541461024c57600080fd5b80633659cfe6116100c65780633659cfe6146101ad5780633f4ba83a146101cd5780634f1ef286146101e257806352d1902d146101f557600080fd5b806301ffc9a7146100f8578063248a9ca31461012d5780632f2ff15d1461016b57806336568abe1461018d575b600080fd5b34801561010457600080fd5b506101186101133660046110b7565b6102f7565b60405190151581526020015b60405180910390f35b34801561013957600080fd5b5061015d6101483660046110e1565b60009081526097602052604090206001015490565b604051908152602001610124565b34801561017757600080fd5b5061018b610186366004611116565b61032e565b005b34801561019957600080fd5b5061018b6101a8366004611116565b610358565b3480156101b957600080fd5b5061018b6101c8366004611142565b6103db565b3480156101d957600080fd5b5061018b6104bb565b61018b6101f0366004611173565b6104db565b34801561020157600080fd5b5061015d6105a8565b34801561021657600080fd5b5060335460ff16610118565b34801561022e57600080fd5b5061018b61065b565b34801561024357600080fd5b5061018b6107c8565b34801561025857600080fd5b50610118610267366004611116565b6107e8565b34801561027857600080fd5b5061015d600081565b34801561028d57600080fd5b5061018b61029c366004611116565b610813565b3480156102ad57600080fd5b5061015d6000805160206114bc83398151915281565b3480156102cf57600080fd5b5061015d7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b60006001600160e01b03198216637965db0b60e01b148061032857506301ffc9a760e01b6001600160e01b03198316145b92915050565b60008281526097602052604090206001015461034981610838565b6103538383610842565b505050565b6001600160a01b03811633146103cd5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6103d782826108c8565b5050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156104245760405162461bcd60e51b81526004016103c490611235565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661046d60008051602061149c833981519152546001600160a01b031690565b6001600160a01b0316146104935760405162461bcd60e51b81526004016103c490611281565b61049c8161092f565b604080516000808252602082019092526104b891839190610959565b50565b6000805160206114bc8339815191526104d381610838565b6104b8610ad3565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156105245760405162461bcd60e51b81526004016103c490611235565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661056d60008051602061149c833981519152546001600160a01b031690565b6001600160a01b0316146105935760405162461bcd60e51b81526004016103c490611281565b61059c8261092f565b6103d782826001610959565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106485760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016103c4565b5060008051602061149c83398151915290565b600054610100900460ff161580801561067b5750600054600160ff909116105b806106955750303b158015610695575060005460ff166001145b6106f85760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016103c4565b6000805460ff19166001179055801561071b576000805461ff0019166101001790555b610723610b25565b61072b610b56565b610733610b56565b61073e600033610842565b6107566000805160206114bc83398151915233610842565b6107807f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e333610842565b80156104b8576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6000805160206114bc8339815191526107e081610838565b6104b8610b7d565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60008281526097602052604090206001015461082e81610838565b61035383836108c8565b6104b88133610bba565b61084c82826107e8565b6103d75760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556108843390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6108d282826107e8565b156103d75760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e36103d781610838565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561098c5761035383610c1e565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109c557600080fd5b505afa9250505080156109f5575060408051601f3d908101601f191682019092526109f2918101906112cd565b60015b610a585760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016103c4565b60008051602061149c8339815191528114610ac75760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016103c4565b50610353838383610cba565b610adb610ce5565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600054610100900460ff16610b4c5760405162461bcd60e51b81526004016103c4906112e6565b610b54610d2e565b565b600054610100900460ff16610b545760405162461bcd60e51b81526004016103c4906112e6565b610b85610d61565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610b083390565b610bc482826107e8565b6103d757610bdc816001600160a01b03166014610da7565b610be7836020610da7565b604051602001610bf892919061135d565b60408051601f198184030181529082905262461bcd60e51b82526103c4916004016113d2565b6001600160a01b0381163b610c8b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016103c4565b60008051602061149c83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b610cc383610f4a565b600082511180610cd05750805b1561035357610cdf8383610f8a565b50505050565b60335460ff16610b545760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016103c4565b600054610100900460ff16610d555760405162461bcd60e51b81526004016103c4906112e6565b6033805460ff19169055565b60335460ff1615610b545760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016103c4565b60606000610db683600261141b565b610dc190600261143a565b67ffffffffffffffff811115610dd957610dd961115d565b6040519080825280601f01601f191660200182016040528015610e03576020820181803683370190505b509050600360fc1b81600081518110610e1e57610e1e611452565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610e4d57610e4d611452565b60200101906001600160f81b031916908160001a9053506000610e7184600261141b565b610e7c90600161143a565b90505b6001811115610ef4576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610eb057610eb0611452565b1a60f81b828281518110610ec657610ec6611452565b60200101906001600160f81b031916908160001a90535060049490941c93610eed81611468565b9050610e7f565b508315610f435760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016103c4565b9392505050565b610f5381610c1e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b610ff25760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016103c4565b600080846001600160a01b03168460405161100d919061147f565b600060405180830381855af49150503d8060008114611048576040519150601f19603f3d011682016040523d82523d6000602084013e61104d565b606091505b509150915061107582826040518060600160405280602781526020016114dc6027913961107e565b95945050505050565b6060831561108d575081610f43565b82511561109d5782518084602001fd5b8160405162461bcd60e51b81526004016103c491906113d2565b6000602082840312156110c957600080fd5b81356001600160e01b031981168114610f4357600080fd5b6000602082840312156110f357600080fd5b5035919050565b80356001600160a01b038116811461111157600080fd5b919050565b6000806040838503121561112957600080fd5b82359150611139602084016110fa565b90509250929050565b60006020828403121561115457600080fd5b610f43826110fa565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561118657600080fd5b61118f836110fa565b9150602083013567ffffffffffffffff808211156111ac57600080fd5b818501915085601f8301126111c057600080fd5b8135818111156111d2576111d261115d565b604051601f8201601f19908116603f011681019083821181831017156111fa576111fa61115d565b8160405282815288602084870101111561121357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6000602082840312156112df57600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b8381101561134c578181015183820152602001611334565b83811115610cdf5750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611395816017850160208801611331565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516113c6816028840160208801611331565b01602801949350505050565b60208152600082518060208401526113f1816040850160208701611331565b601f01601f19169190910160400192915050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561143557611435611405565b500290565b6000821982111561144d5761144d611405565b500190565b634e487b7160e01b600052603260045260246000fd5b60008161147757611477611405565b506000190190565b60008251611491818460208701611331565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220433ef63230d161708a2e832383eb99c450a94af0fc5b79907deb884ee965dfe464736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/governance/GovernorContract.sol/GovernorContract.dbg.json b/src/contracts/governance/GovernorContract.sol/GovernorContract.dbg.json deleted file mode 100644 index 306669b5ad..0000000000 --- a/src/contracts/governance/GovernorContract.sol/GovernorContract.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/governance/GovernorContract.sol/GovernorContract.json b/src/contracts/governance/GovernorContract.sol/GovernorContract.json deleted file mode 100644 index 91fa600d6f..0000000000 --- a/src/contracts/governance/GovernorContract.sol/GovernorContract.json +++ /dev/null @@ -1,1404 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "GovernorContract", - "sourceName": "contracts/governance/GovernorContract.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "Empty", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "previousAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "beacon", - "type": "address" - } - ], - "name": "BeaconUpgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - } - ], - "name": "ProposalCanceled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "proposer", - "type": "address" - }, - { - "indexed": false, - "internalType": "address[]", - "name": "targets", - "type": "address[]" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "values", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "string[]", - "name": "signatures", - "type": "string[]" - }, - { - "indexed": false, - "internalType": "bytes[]", - "name": "calldatas", - "type": "bytes[]" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "startBlock", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "endBlock", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "string", - "name": "description", - "type": "string" - } - ], - "name": "ProposalCreated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - } - ], - "name": "ProposalExecuted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "eta", - "type": "uint256" - } - ], - "name": "ProposalQueued", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldProposalThreshold", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newProposalThreshold", - "type": "uint256" - } - ], - "name": "ProposalThresholdSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldQuorumNumerator", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newQuorumNumerator", - "type": "uint256" - } - ], - "name": "QuorumNumeratorUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "oldTimelock", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newTimelock", - "type": "address" - } - ], - "name": "TimelockChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "Upgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "voter", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint8", - "name": "support", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "weight", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - } - ], - "name": "VoteCast", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "voter", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint8", - "name": "support", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "weight", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "params", - "type": "bytes" - } - ], - "name": "VoteCastWithParams", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldVotingDelay", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newVotingDelay", - "type": "uint256" - } - ], - "name": "VotingDelaySet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldVotingPeriod", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newVotingPeriod", - "type": "uint256" - } - ], - "name": "VotingPeriodSet", - "type": "event" - }, - { - "inputs": [], - "name": "BALLOT_TYPEHASH", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "COUNTING_MODE", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "EXTENDED_BALLOT_TYPEHASH", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "support", - "type": "uint8" - } - ], - "name": "castVote", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "support", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "castVoteBySig", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "support", - "type": "uint8" - }, - { - "internalType": "string", - "name": "reason", - "type": "string" - } - ], - "name": "castVoteWithReason", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "support", - "type": "uint8" - }, - { - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "internalType": "bytes", - "name": "params", - "type": "bytes" - } - ], - "name": "castVoteWithReasonAndParams", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "support", - "type": "uint8" - }, - { - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "internalType": "bytes", - "name": "params", - "type": "bytes" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "castVoteWithReasonAndParamsBySig", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "targets", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "values", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "calldatas", - "type": "bytes[]" - }, - { - "internalType": "bytes32", - "name": "descriptionHash", - "type": "bytes32" - } - ], - "name": "execute", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - } - ], - "name": "getVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "params", - "type": "bytes" - } - ], - "name": "getVotesWithParams", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasVoted", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "targets", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "values", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "calldatas", - "type": "bytes[]" - }, - { - "internalType": "bytes32", - "name": "descriptionHash", - "type": "bytes32" - } - ], - "name": "hashProposal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVotesUpgradeable", - "name": "_token", - "type": "address" - }, - { - "internalType": "contract TimelockControllerUpgradeable", - "name": "_timelock", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_votingDelay", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_votingPeriod", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_votingThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_quorumPercentage", - "type": "uint256" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC1155BatchReceived", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC1155Received", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC721Received", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - } - ], - "name": "proposalDeadline", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - } - ], - "name": "proposalEta", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - } - ], - "name": "proposalSnapshot", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "proposalThreshold", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - } - ], - "name": "proposalVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "againstVotes", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "forVotes", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "abstainVotes", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "targets", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "values", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "calldatas", - "type": "bytes[]" - }, - { - "internalType": "string", - "name": "description", - "type": "string" - } - ], - "name": "propose", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "proxiableUUID", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "targets", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "values", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "calldatas", - "type": "bytes[]" - }, - { - "internalType": "bytes32", - "name": "descriptionHash", - "type": "bytes32" - } - ], - "name": "queue", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - } - ], - "name": "quorum", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "quorumDenominator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - } - ], - "name": "quorumNumerator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "quorumNumerator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "relay", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newProposalThreshold", - "type": "uint256" - } - ], - "name": "setProposalThreshold", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newVotingDelay", - "type": "uint256" - } - ], - "name": "setVotingDelay", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newVotingPeriod", - "type": "uint256" - } - ], - "name": "setVotingPeriod", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - } - ], - "name": "state", - "outputs": [ - { - "internalType": "enum IGovernorUpgradeable.ProposalState", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "timelock", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IVotesUpgradeable", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newQuorumNumerator", - "type": "uint256" - } - ], - "name": "updateQuorumNumerator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract TimelockControllerUpgradeable", - "name": "newTimelock", - "type": "address" - } - ], - "name": "updateTimelock", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "upgradeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "upgradeToAndCall", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "version", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "votingDelay", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "votingPeriod", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } - ], - "bytecode": "0x60a0604052306080523480156200001557600080fd5b506200002062000026565b620000e8565b600054610100900460ff1615620000935760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e6576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b608051614ab46200012060003960008181610f4001528181610f80015281816110aa015281816110ea015261117d0152614ab46000f3fe6080604052600436106102975760003560e01c80637b3c71d31161015a578063c28bc2fa116100c1578063eb9019d41161007a578063eb9019d4146108c4578063ece40cc1146108e4578063f23a6e6114610904578063f2fde38b14610930578063f8ce560a14610950578063fc0c546a1461097057600080fd5b8063c28bc2fa146107cb578063c59057e4146107eb578063d33219b41461080b578063dd4e2ba51461082a578063deaaa7cc14610870578063ea0217cf146108a457600080fd5b8063a7713a7011610113578063a7713a7014610715578063a890c9101461072a578063ab58fb8e1461074a578063b58131b01461076a578063bc197c811461077f578063c01f9e37146107ab57600080fd5b80637b3c71d31461064e5780637d5e81e21461066e57806386489ba91461068e5780638da5cb5b146106ae57806397c3d334146106e15780639a802a6d146106f557600080fd5b80633bccf4fd116101fe57806354fd4d50116101b757806354fd4d501461058f57806356781388146105b95780635f398a14146105d957806360c4247f146105f957806370b0f66014610619578063715018a61461063957600080fd5b80633bccf4fd146104795780633e4f49e61461049957806343859632146104c65780634f1ef2861461051157806352d1902d14610524578063544ffc9c1461053957600080fd5b8063160cbed711610250578063160cbed7146103bd5780632656227d146103dd5780632d63f693146103f05780632fe3e261146104105780633659cfe6146104445780633932abb11461046457600080fd5b806301ffc9a7146102bf57806302a251a3146102f4578063034201811461031757806306f3f9e61461033757806306fdde0314610357578063150b7a021461037957600080fd5b366102ba57306102a5610991565b6001600160a01b0316146102b857600080fd5b005b600080fd5b3480156102cb57600080fd5b506102df6102da3660046139f0565b6109ab565b60405190151581526020015b60405180910390f35b34801561030057600080fd5b506103096109bc565b6040519081526020016102eb565b34801561032357600080fd5b50610309610332366004613b2e565b6109c8565b34801561034357600080fd5b506102b8610352366004613bd4565b610ac0565b34801561036357600080fd5b5061036c610b58565b6040516102eb9190613c45565b34801561038557600080fd5b506103a4610394366004613c6d565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020016102eb565b3480156103c957600080fd5b506103096103d8366004613e49565b610bea565b6103096103eb366004613e49565b610e0c565b3480156103fc57600080fd5b5061030961040b366004613bd4565b610efe565b34801561041c57600080fd5b506103097fb3b3f3b703cd84ce352197dcff232b1b5d3cfb2025ce47cf04742d0651f1af8881565b34801561045057600080fd5b506102b861045f366004613ed8565b610f35565b34801561047057600080fd5b50610309611012565b34801561048557600080fd5b50610309610494366004613ef5565b61101e565b3480156104a557600080fd5b506104b96104b4366004613bd4565b611094565b6040516102eb9190613f59565b3480156104d257600080fd5b506102df6104e1366004613f81565b6000828152610161602090815260408083206001600160a01b038516845260030190915290205460ff1692915050565b6102b861051f366004613fb1565b61109f565b34801561053057600080fd5b50610309611170565b34801561054557600080fd5b50610574610554366004613bd4565b600090815261016160205260409020805460018201546002909201549092565b604080519384526020840192909252908201526060016102eb565b34801561059b57600080fd5b506040805180820190915260018152603160f81b602082015261036c565b3480156105c557600080fd5b506103096105d4366004614000565b611223565b3480156105e557600080fd5b506103096105f436600461402c565b61124c565b34801561060557600080fd5b50610309610614366004613bd4565b611296565b34801561062557600080fd5b506102b8610634366004613bd4565b611330565b34801561064557600080fd5b506102b86113bc565b34801561065a57600080fd5b506103096106693660046140af565b6113d0565b34801561067a57600080fd5b50610309610689366004614108565b611422565b34801561069a57600080fd5b506102b86106a93660046141bc565b611439565b3480156106ba57600080fd5b5061022a546001600160a01b03165b6040516001600160a01b0390911681526020016102eb565b3480156106ed57600080fd5b506064610309565b34801561070157600080fd5b50610309610710366004614215565b6115b7565b34801561072157600080fd5b506103096115ce565b34801561073657600080fd5b506102b8610745366004613ed8565b6115ed565b34801561075657600080fd5b50610309610765366004613bd4565b611679565b34801561077657600080fd5b50610309611724565b34801561078b57600080fd5b506103a461079a36600461426d565b63bc197c8160e01b95945050505050565b3480156107b757600080fd5b506103096107c6366004613bd4565b611730565b3480156107d757600080fd5b506102b86107e6366004614300565b61175f565b3480156107f757600080fd5b50610309610806366004613e49565b61182b565b34801561081757600080fd5b506101f8546001600160a01b03166106c9565b34801561083657600080fd5b506040805180820190915260208082527f737570706f72743d627261766f2671756f72756d3d666f722c6162737461696e9082015261036c565b34801561087c57600080fd5b506103097f150214d74d59b7d1e90c73fc22ef3d991dd0a76b046543d4d80ab92d2a50328f81565b3480156108b057600080fd5b506102b86108bf366004613bd4565b611865565b3480156108d057600080fd5b506103096108df366004614343565b6118f1565b3480156108f057600080fd5b506102b86108ff366004613bd4565b611912565b34801561091057600080fd5b506103a461091f36600461436f565b63f23a6e6160e01b95945050505050565b34801561093c57600080fd5b506102b861094b366004613ed8565b61199e565b34801561095c57600080fd5b5061030961096b366004613bd4565b611a14565b34801561097c57600080fd5b50610193546106c9906001600160a01b031681565b60006109a66101f8546001600160a01b031690565b905090565b60006109b682611a1f565b92915050565b60006109a66101305490565b600080610a6c610a647fb3b3f3b703cd84ce352197dcff232b1b5d3cfb2025ce47cf04742d0651f1af888c8c8c8c604051610a049291906143d7565b60405180910390208b80519060200120604051602001610a49959493929190948552602085019390935260ff9190911660408401526060830152608082015260a00190565b60405160208183030381529060405280519060200120611a44565b868686611a92565b9050610ab28a828b8b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d9250611ab0915050565b9a9950505050505050505050565b610ac8610991565b6001600160a01b0316336001600160a01b031614610b015760405162461bcd60e51b8152600401610af8906143e7565b60405180910390fd5b30610b0a610991565b6001600160a01b031614610b4c5760008036604051610b2a9291906143d7565b604051809103902090505b80610b4060ff611c11565b14610b4a57610b35565b505b610b5581611c90565b50565b606060fd8054610b679061441e565b80601f0160208091040260200160405190810160405280929190818152602001828054610b939061441e565b8015610be05780601f10610bb557610100808354040283529160200191610be0565b820191906000526020600020905b815481529060010190602001808311610bc357829003601f168201915b5050505050905090565b600080610bf98686868661182b565b90506004610c0682611094565b6007811115610c1757610c17613f43565b14610c345760405162461bcd60e51b8152600401610af890614459565b6101f8546040805163793d064960e11b815290516000926001600160a01b03169163f27a0c92916004808301926020929190829003018186803b158015610c7a57600080fd5b505afa158015610c8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb2919061449a565b6101f85460405163b1c5f42760e01b81529192506001600160a01b03169063b1c5f42790610ced908a908a908a906000908b9060040161457c565b60206040518083038186803b158015610d0557600080fd5b505afa158015610d19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3d919061449a565b60008381526101f96020526040808220929092556101f85491516308f2a0bb60e41b81526001600160a01b0390921691638f2a0bb091610d8a918b918b918b91908b9089906004016145ca565b600060405180830381600087803b158015610da457600080fd5b505af1158015610db8573d6000803e3d6000fd5b505050507f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda2892828242610dea9190614638565b6040805192835260208301919091520160405180910390a15095945050505050565b600080610e1b8686868661182b565b90506000610e2882611094565b90506004816007811115610e3e57610e3e613f43565b1480610e5b57506005816007811115610e5957610e59613f43565b145b610e775760405162461bcd60e51b8152600401610af890614459565b600082815260fe602052604090819020600201805460ff19166001179055517f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90610ec59084815260200190565b60405180910390a1610eda8288888888611de0565b610ee78288888888611e82565b610ef48288888888611e8f565b5095945050505050565b600081815260fe602090815260408083208151928301909152546001600160401b0316908190525b6001600160401b031692915050565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610f7e5760405162461bcd60e51b8152600401610af890614650565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610fc7600080516020614a0f833981519152546001600160a01b031690565b6001600160a01b031614610fed5760405162461bcd60e51b8152600401610af89061469c565b610ff681611ec8565b60408051600080825260208201909252610b5591839190611ed0565b60006109a661012f5490565b604080517f150214d74d59b7d1e90c73fc22ef3d991dd0a76b046543d4d80ab92d2a50328f602082015290810186905260ff85166060820152600090819061106c90610a6490608001610a49565b90506110898782886040518060200160405280600081525061204f565b979650505050505050565b60006109b682612072565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156110e85760405162461bcd60e51b8152600401610af890614650565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611131600080516020614a0f833981519152546001600160a01b031690565b6001600160a01b0316146111575760405162461bcd60e51b8152600401610af89061469c565b61116082611ec8565b61116c82826001611ed0565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146112105760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610af8565b50600080516020614a0f83398151915290565b6000803390506112448482856040518060200160405280600081525061204f565b949350505050565b60008033905061108987828888888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250611ab0915050565b6101c754600090806112ad5750506101c654919050565b60006101c76112bd6001846146e8565b815481106112cd576112cd6146ff565b60009182526020918290206040805180820190915291015463ffffffff81168083526401000000009091046001600160e01b0316928201929092529150841061132457602001516001600160e01b03169392505050565b6112446101c7856121dd565b611338610991565b6001600160a01b0316336001600160a01b0316146113685760405162461bcd60e51b8152600401610af8906143e7565b30611371610991565b6001600160a01b0316146113b357600080366040516113919291906143d7565b604051809103902090505b806113a760ff611c11565b146113b15761139c565b505b610b55816122ec565b6113c461232f565b6113ce600061238a565b565b60008033905061141886828787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061204f92505050565b9695505050505050565b6000611430858585856123dd565b95945050505050565b600054610100900460ff16158080156114595750600054600160ff909116105b806114735750303b158015611473575060005460ff166001145b6114d65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610af8565b6000805460ff1916600117905580156114f9576000805461ff0019166101001790555b61152a6040518060400160405280601081526020016f11dbdd995c9b9bdc90dbdb9d1c9858dd60821b8152506126a0565b6115358585856126f7565b61153d612729565b61154687612750565b61154f82612780565b611558866127b0565b6115606127e0565b611568612729565b80156115ae576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b60006115c484848461280f565b90505b9392505050565b6101c754600090156115e5576109a66101c7612895565b506101c65490565b6115f5610991565b6001600160a01b0316336001600160a01b0316146116255760405162461bcd60e51b8152600401610af8906143e7565b3061162e610991565b6001600160a01b031614611670576000803660405161164e9291906143d7565b604051809103902090505b8061166460ff611c11565b1461166e57611659565b505b610b55816128f1565b6101f85460008281526101f9602052604080822054905163d45c443560e01b81526004810191909152909182916001600160a01b039091169063d45c44359060240160206040518083038186803b1580156116d357600080fd5b505afa1580156116e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170b919061449a565b90508060011461171b57806115c7565b60009392505050565b60006109a66101315490565b600081815260fe602090815260408083208151928301909152600101546001600160401b031690819052610f26565b611767610991565b6001600160a01b0316336001600160a01b0316146117975760405162461bcd60e51b8152600401610af8906143e7565b306117a0610991565b6001600160a01b0316146117e257600080366040516117c09291906143d7565b604051809103902090505b806117d660ff611c11565b146117e0576117cb565b505b6118248483838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525088925061295c915050565b5050505050565b6000848484846040516020016118449493929190614715565b60408051601f19818403018152919052805160209091012095945050505050565b61186d610991565b6001600160a01b0316336001600160a01b03161461189d5760405162461bcd60e51b8152600401610af8906143e7565b306118a6610991565b6001600160a01b0316146118e857600080366040516118c69291906143d7565b604051809103902090505b806118dc60ff611c11565b146118e6576118d1565b505b610b5581612982565b60006115c7838361190d60408051602081019091526000815290565b61280f565b61191a610991565b6001600160a01b0316336001600160a01b03161461194a5760405162461bcd60e51b8152600401610af8906143e7565b30611953610991565b6001600160a01b03161461199557600080366040516119739291906143d7565b604051809103902090505b8061198960ff611c11565b146119935761197e565b505b610b5581612a25565b6119a661232f565b6001600160a01b038116611a0b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610af8565b610b558161238a565b60006109b682612a68565b60006001600160e01b03198216636e665ced60e01b14806109b657506109b682612b06565b60006109b6611a51612b71565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000611aa387878787612bec565b91509150610ef481612cd9565b600085815260fe602052604081206001611ac988611094565b6007811115611ada57611ada613f43565b14611b335760405162461bcd60e51b815260206004820152602360248201527f476f7665726e6f723a20766f7465206e6f742063757272656e746c792061637460448201526269766560e81b6064820152608401610af8565b604080516020810190915281546001600160401b031690819052600090611b5c9088908661280f565b9050611b6b8888888488612e94565b8351611bbd57866001600160a01b03167fb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda489888489604051611bb09493929190614760565b60405180910390a2611089565b866001600160a01b03167fe2babfbac5889a709b63bb7f598b324e08bc5a4fb9ec647fb3cbc9ec07eb87128988848989604051611bfe959493929190614788565b60405180910390a2979650505050505050565b6000611c2c8254600f81810b600160801b909204900b131590565b15611c4a57604051631ed9509560e11b815260040160405180910390fd5b508054600f0b6000818152600180840160205260408220805492905583546fffffffffffffffffffffffffffffffff191692016001600160801b03169190911790915590565b6064811115611d135760405162461bcd60e51b815260206004820152604360248201527f476f7665726e6f72566f74657351756f72756d4672616374696f6e3a2071756f60448201527f72756d4e756d657261746f72206f7665722071756f72756d44656e6f6d696e616064820152623a37b960e91b608482015260a401610af8565b6000611d1d6115ce565b90508015801590611d2f57506101c754155b15611d955760408051808201909152600081526101c79060208101611d5384613014565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b611da16101c783613081565b505060408051828152602081018490527f0553476bf02ef2726e8ce5ced78d63e26e602e4a2257b1f559418e24b4633997910160405180910390a15050565b30611de9610991565b6001600160a01b0316146118245760005b8451811015611e7a57306001600160a01b0316858281518110611e1f57611e1f6146ff565b60200260200101516001600160a01b03161415611e6a57611e6a838281518110611e4b57611e4b6146ff565b60200260200101518051906020012060ff6131ac90919063ffffffff16565b611e73816147ce565b9050611dfa565b505050505050565b61182485858585856131e8565b30611e98610991565b6001600160a01b0316146118245760ff54600f81810b600160801b909204900b131561182457600060ff55611824565b610b5561232f565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611f0857611f038361325d565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015611f4157600080fd5b505afa925050508015611f71575060408051601f3d908101601f19168201909252611f6e9181019061449a565b60015b611fd45760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610af8565b600080516020614a0f83398151915281146120435760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610af8565b50611f038383836132f9565b60006114308585858561206d60408051602081019091526000815290565b611ab0565b60008061207e83613324565b9050600481600781111561209457612094613f43565b1461209f5792915050565b60008381526101f96020526040902054806120bb575092915050565b6101f854604051632ab0f52960e01b8152600481018390526001600160a01b0390911690632ab0f5299060240160206040518083038186803b15801561210057600080fd5b505afa158015612114573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061213891906147e9565b15612147575060079392505050565b6101f854604051632c258a9f60e11b8152600481018390526001600160a01b039091169063584b153e9060240160206040518083038186803b15801561218c57600080fd5b505afa1580156121a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121c491906147e9565b156121d3575060059392505050565b5060029392505050565b600043821061222e5760405162461bcd60e51b815260206004820181905260248201527f436865636b706f696e74733a20626c6f636b206e6f7420796574206d696e65646044820152606401610af8565b825460005b818110156122935760006122478284613431565b90508486600001828154811061225f5761225f6146ff565b60009182526020909120015463ffffffff16111561227f5780925061228d565b61228a816001614638565b91505b50612233565b81156122d757846122a56001846146e8565b815481106122b5576122b56146ff565b60009182526020909120015464010000000090046001600160e01b03166122da565b60005b6001600160e01b031695945050505050565b61012f5460408051918252602082018390527fc565b045403dc03c2eea82b81a0465edad9e2e7fc4d97e11421c209da93d7a93910160405180910390a161012f55565b61022a546001600160a01b031633146113ce5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af8565b61022a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006123e7611724565b6123f6336108df6001436146e8565b101561245e5760405162461bcd60e51b815260206004820152603160248201527f476f7665726e6f723a2070726f706f73657220766f7465732062656c6f7720706044820152701c9bdc1bdcd85b081d1a1c995cda1bdb19607a1b6064820152608401610af8565b6000612473868686868051906020012061182b565b905084518651146124965760405162461bcd60e51b8152600401610af89061480b565b83518651146124b75760405162461bcd60e51b8152600401610af89061480b565b60008651116125085760405162461bcd60e51b815260206004820152601860248201527f476f7665726e6f723a20656d7074792070726f706f73616c00000000000000006044820152606401610af8565b600081815260fe6020908152604091829020825191820190925281546001600160401b031690819052156125885760405162461bcd60e51b815260206004820152602160248201527f476f7665726e6f723a2070726f706f73616c20616c72656164792065786973746044820152607360f81b6064820152608401610af8565b600061259a612595611012565b61344c565b6125a34361344c565b6125ad919061484c565b905060006125bc6125956109bc565b6125c6908361484c565b835467ffffffffffffffff19166001600160401b038416178455905060018301805467ffffffffffffffff19166001600160401b0383161790557f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e084338b8b8d516001600160401b0381111561263e5761263e613a71565b60405190808252806020026020018201604052801561267157816020015b606081526020019060019003908161265c5790505b508c88888e60405161268b99989796959493929190614877565b60405180910390a15091979650505050505050565b600054610100900460ff166126c75760405162461bcd60e51b8152600401610af890614966565b6126ee816126e96040805180820190915260018152603160f81b602082015290565b6134b4565b610b55816134f5565b600054610100900460ff1661271e5760405162461bcd60e51b8152600401610af890614966565b611f0383838361352f565b600054610100900460ff166113ce5760405162461bcd60e51b8152600401610af890614966565b600054610100900460ff166127775760405162461bcd60e51b8152600401610af890614966565b610b5581613571565b600054610100900460ff166127a75760405162461bcd60e51b8152600401610af890614966565b610b55816135bb565b600054610100900460ff166127d75760405162461bcd60e51b8152600401610af890614966565b610b55816135e2565b600054610100900460ff166128075760405162461bcd60e51b8152600401610af890614966565b6113ce613609565b61019354604051630748d63560e31b81526001600160a01b038581166004830152602482018590526000921690633a46b1a89060440160206040518083038186803b15801561285d57600080fd5b505afa158015612871573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c4919061449a565b805460009080156128de57826128ac6001836146e8565b815481106128bc576128bc6146ff565b60009182526020909120015464010000000090046001600160e01b03166128e1565b60005b6001600160e01b03169392505050565b6101f854604080516001600160a01b03928316815291831660208301527f08f74ea46ef7894f65eabfb5e6e695de773a000b47c529ab559178069b226401910160405180910390a16101f880546001600160a01b0319166001600160a01b0392909216919091179055565b60606115c4848484604051806060016040528060298152602001614a2f60299139613639565b600081116129e25760405162461bcd60e51b815260206004820152602760248201527f476f7665726e6f7253657474696e67733a20766f74696e6720706572696f6420604482015266746f6f206c6f7760c81b6064820152608401610af8565b6101305460408051918252602082018390527f7e3f7f0708a84de9203036abaa450dccc85ad5ff52f78c170f3edb55cf5e8828910160405180910390a161013055565b6101315460408051918252602082018390527fccb45da8d5717e6c4544694297c4ba5cf151d455c9bb0ed4fc7a38411bc05461910160405180910390a161013155565b60006064612a7583611296565b61019354604051632394e7a360e21b8152600481018690526001600160a01b0390911690638e539e8c9060240160206040518083038186803b158015612aba57600080fd5b505afa158015612ace573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612af2919061449a565b612afc91906149b1565b6109b691906149d0565b60006001600160e01b0319821663bf26d89760e01b1480612b3757506001600160e01b031982166379dd796f60e01b145b80612b5257506001600160e01b03198216630271189760e51b145b806109b657506301ffc9a760e01b6001600160e01b03198316146109b6565b60006109a67f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f612ba060655490565b6066546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612c235750600090506003612cd0565b8460ff16601b14158015612c3b57508460ff16601c14155b15612c4c5750600090506004612cd0565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612ca0573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612cc957600060019250925050612cd0565b9150600090505b94509492505050565b6000816004811115612ced57612ced613f43565b1415612cf65750565b6001816004811115612d0a57612d0a613f43565b1415612d585760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610af8565b6002816004811115612d6c57612d6c613f43565b1415612dba5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610af8565b6003816004811115612dce57612dce613f43565b1415612e275760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610af8565b6004816004811115612e3b57612e3b613f43565b1415610b555760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610af8565b6000858152610161602090815260408083206001600160a01b0388168452600381019092529091205460ff1615612f1d5760405162461bcd60e51b815260206004820152602760248201527f476f7665726e6f72566f74696e6753696d706c653a20766f746520616c726561604482015266191e4818d85cdd60ca1b6064820152608401610af8565b6001600160a01b03851660009081526003820160205260408120805460ff1916600117905560ff168460ff161415612f6e5782816000016000828254612f639190614638565b90915550611e7a9050565b60ff841660011415612f8e5782816001016000828254612f639190614638565b60ff841660021415612fae5782816002016000828254612f639190614638565b60405162461bcd60e51b815260206004820152603560248201527f476f7665726e6f72566f74696e6753696d706c653a20696e76616c69642076616044820152746c756520666f7220656e756d20566f74655479706560581b6064820152608401610af8565b60006001600160e01b0382111561307d5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20326044820152663234206269747360c81b6064820152608401610af8565b5090565b815460009081908161309286612895565b90506000821180156130d0575043866130ac6001856146e8565b815481106130bc576130bc6146ff565b60009182526020909120015463ffffffff16145b15613130576130de85613014565b866130ea6001856146e8565b815481106130fa576130fa6146ff565b9060005260206000200160000160046101000a8154816001600160e01b0302191690836001600160e01b0316021790555061319e565b8560000160405180604001604052806131484361375f565b63ffffffff16815260200161315c88613014565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b9250839150505b9250929050565b8154600160801b90819004600f0b6000818152600180860160205260409091209390935583546001600160801b03908116939091011602179055565b6101f85460405163e38335e560e01b81526001600160a01b039091169063e38335e590349061322490889088908890600090899060040161457c565b6000604051808303818588803b15801561323d57600080fd5b505af1158015613251573d6000803e3d6000fd5b50505050505050505050565b6001600160a01b0381163b6132ca5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610af8565b600080516020614a0f83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b613302836137c4565b60008251118061330f5750805b15611f035761331e8383613804565b50505050565b600081815260fe60205260408120600281015460ff16156133485750600792915050565b6002810154610100900460ff16156133635750600292915050565b600061336e84610efe565b9050806133bd5760405162461bcd60e51b815260206004820152601d60248201527f476f7665726e6f723a20756e6b6e6f776e2070726f706f73616c2069640000006044820152606401610af8565b4381106133ce575060009392505050565b60006133d985611730565b90504381106133ed57506001949350505050565b6133f6856138ef565b801561341657506000858152610161602052604090208054600190910154115b1561342657506004949350505050565b506003949350505050565b600061344060028484186149d0565b6115c790848416614638565b60006001600160401b0382111561307d5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201526534206269747360d01b6064820152608401610af8565b600054610100900460ff166134db5760405162461bcd60e51b8152600401610af890614966565b815160209283012081519190920120606591909155606655565b600054610100900460ff1661351c5760405162461bcd60e51b8152600401610af890614966565b805161116c9060fd906020840190613960565b600054610100900460ff166135565760405162461bcd60e51b8152600401610af890614966565b61355f836122ec565b61356882612982565b611f0381612a25565b600054610100900460ff166135985760405162461bcd60e51b8152600401610af890614966565b61019380546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff16610b4c5760405162461bcd60e51b8152600401610af890614966565b600054610100900460ff166116705760405162461bcd60e51b8152600401610af890614966565b600054610100900460ff166136305760405162461bcd60e51b8152600401610af890614966565b6113ce3361238a565b60608247101561369a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610af8565b6001600160a01b0385163b6136f15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610af8565b600080866001600160a01b0316858760405161370d91906149f2565b60006040518083038185875af1925050503d806000811461374a576040519150601f19603f3d011682016040523d82523d6000602084013e61374f565b606091505b5091509150611089828286613927565b600063ffffffff82111561307d5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b6064820152608401610af8565b6137cd8161325d565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b61386c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610af8565b600080846001600160a01b03168460405161388791906149f2565b600060405180830381855af49150503d80600081146138c2576040519150601f19603f3d011682016040523d82523d6000602084013e6138c7565b606091505b50915091506114308282604051806060016040528060278152602001614a5860279139613927565b600081815261016160205260408120600281015460018201546139129190614638565b61391e61096b85610efe565b11159392505050565b606083156139365750816115c7565b8251156139465782518084602001fd5b8160405162461bcd60e51b8152600401610af89190613c45565b82805461396c9061441e565b90600052602060002090601f01602090048101928261398e57600085556139d4565b82601f106139a757805160ff19168380011785556139d4565b828001600101855582156139d4579182015b828111156139d45782518255916020019190600101906139b9565b5061307d9291505b8082111561307d57600081556001016139dc565b600060208284031215613a0257600080fd5b81356001600160e01b0319811681146115c757600080fd5b803560ff81168114613a2b57600080fd5b919050565b60008083601f840112613a4257600080fd5b5081356001600160401b03811115613a5957600080fd5b6020830191508360208285010111156131a557600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613aaf57613aaf613a71565b604052919050565b60006001600160401b03831115613ad057613ad0613a71565b613ae3601f8401601f1916602001613a87565b9050828152838383011115613af757600080fd5b828260208301376000602084830101529392505050565b600082601f830112613b1f57600080fd5b6115c783833560208501613ab7565b60008060008060008060008060e0898b031215613b4a57600080fd5b88359750613b5a60208a01613a1a565b965060408901356001600160401b0380821115613b7657600080fd5b613b828c838d01613a30565b909850965060608b0135915080821115613b9b57600080fd5b50613ba88b828c01613b0e565b945050613bb760808a01613a1a565b925060a0890135915060c089013590509295985092959890939650565b600060208284031215613be657600080fd5b5035919050565b60005b83811015613c08578181015183820152602001613bf0565b8381111561331e5750506000910152565b60008151808452613c31816020860160208601613bed565b601f01601f19169290920160200192915050565b6020815260006115c76020830184613c19565b6001600160a01b0381168114610b5557600080fd5b60008060008060808587031215613c8357600080fd5b8435613c8e81613c58565b93506020850135613c9e81613c58565b92506040850135915060608501356001600160401b03811115613cc057600080fd5b613ccc87828801613b0e565b91505092959194509250565b60006001600160401b03821115613cf157613cf1613a71565b5060051b60200190565b600082601f830112613d0c57600080fd5b81356020613d21613d1c83613cd8565b613a87565b82815260059290921b84018101918181019086841115613d4057600080fd5b8286015b84811015613d64578035613d5781613c58565b8352918301918301613d44565b509695505050505050565b600082601f830112613d8057600080fd5b81356020613d90613d1c83613cd8565b82815260059290921b84018101918181019086841115613daf57600080fd5b8286015b84811015613d645780358352918301918301613db3565b600082601f830112613ddb57600080fd5b81356020613deb613d1c83613cd8565b82815260059290921b84018101918181019086841115613e0a57600080fd5b8286015b84811015613d645780356001600160401b03811115613e2d5760008081fd5b613e3b8986838b0101613b0e565b845250918301918301613e0e565b60008060008060808587031215613e5f57600080fd5b84356001600160401b0380821115613e7657600080fd5b613e8288838901613cfb565b95506020870135915080821115613e9857600080fd5b613ea488838901613d6f565b94506040870135915080821115613eba57600080fd5b50613ec787828801613dca565b949793965093946060013593505050565b600060208284031215613eea57600080fd5b81356115c781613c58565b600080600080600060a08688031215613f0d57600080fd5b85359450613f1d60208701613a1a565b9350613f2b60408701613a1a565b94979396509394606081013594506080013592915050565b634e487b7160e01b600052602160045260246000fd5b6020810160088310613f7b57634e487b7160e01b600052602160045260246000fd5b91905290565b60008060408385031215613f9457600080fd5b823591506020830135613fa681613c58565b809150509250929050565b60008060408385031215613fc457600080fd5b8235613fcf81613c58565b915060208301356001600160401b03811115613fea57600080fd5b613ff685828601613b0e565b9150509250929050565b6000806040838503121561401357600080fd5b8235915061402360208401613a1a565b90509250929050565b60008060008060006080868803121561404457600080fd5b8535945061405460208701613a1a565b935060408601356001600160401b038082111561407057600080fd5b61407c89838a01613a30565b9095509350606088013591508082111561409557600080fd5b506140a288828901613b0e565b9150509295509295909350565b600080600080606085870312156140c557600080fd5b843593506140d560208601613a1a565b925060408501356001600160401b038111156140f057600080fd5b6140fc87828801613a30565b95989497509550505050565b6000806000806080858703121561411e57600080fd5b84356001600160401b038082111561413557600080fd5b61414188838901613cfb565b9550602087013591508082111561415757600080fd5b61416388838901613d6f565b9450604087013591508082111561417957600080fd5b61418588838901613dca565b9350606087013591508082111561419b57600080fd5b508501601f810187136141ad57600080fd5b613ccc87823560208401613ab7565b60008060008060008060c087890312156141d557600080fd5b86356141e081613c58565b955060208701356141f081613c58565b95989597505050506040840135936060810135936080820135935060a0909101359150565b60008060006060848603121561422a57600080fd5b833561423581613c58565b92506020840135915060408401356001600160401b0381111561425757600080fd5b61426386828701613b0e565b9150509250925092565b600080600080600060a0868803121561428557600080fd5b853561429081613c58565b945060208601356142a081613c58565b935060408601356001600160401b03808211156142bc57600080fd5b6142c889838a01613d6f565b945060608801359150808211156142de57600080fd5b6142ea89838a01613d6f565b9350608088013591508082111561409557600080fd5b6000806000806060858703121561431657600080fd5b843561432181613c58565b93506020850135925060408501356001600160401b038111156140f057600080fd5b6000806040838503121561435657600080fd5b823561436181613c58565b946020939093013593505050565b600080600080600060a0868803121561438757600080fd5b853561439281613c58565b945060208601356143a281613c58565b9350604086013592506060860135915060808601356001600160401b038111156143cb57600080fd5b6140a288828901613b0e565b8183823760009101908152919050565b60208082526018908201527f476f7665726e6f723a206f6e6c79476f7665726e616e63650000000000000000604082015260600190565b600181811c9082168061443257607f821691505b6020821081141561445357634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526021908201527f476f7665726e6f723a2070726f706f73616c206e6f74207375636365737366756040820152601b60fa1b606082015260800190565b6000602082840312156144ac57600080fd5b5051919050565b600081518084526020808501945080840160005b838110156144ec5781516001600160a01b0316875295820195908201906001016144c7565b509495945050505050565b600081518084526020808501945080840160005b838110156144ec5781518752958201959082019060010161450b565b600081518084526020808501808196508360051b8101915082860160005b8581101561456f57828403895261455d848351613c19565b98850198935090840190600101614545565b5091979650505050505050565b60a08152600061458f60a08301886144b3565b82810360208401526145a181886144f7565b905082810360408401526145b58187614527565b60608401959095525050608001529392505050565b60c0815260006145dd60c08301896144b3565b82810360208401526145ef81896144f7565b905082810360408401526146038188614527565b60608401969096525050608081019290925260a0909101529392505050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561464b5761464b614622565b500190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6000828210156146fa576146fa614622565b500390565b634e487b7160e01b600052603260045260246000fd5b60808152600061472860808301876144b3565b828103602084015261473a81876144f7565b9050828103604084015261474e8186614527565b91505082606083015295945050505050565b84815260ff841660208201528260408201526080606082015260006114186080830184613c19565b85815260ff8516602082015283604082015260a0606082015260006147b060a0830185613c19565b82810360808401526147c28185613c19565b98975050505050505050565b60006000198214156147e2576147e2614622565b5060010190565b6000602082840312156147fb57600080fd5b815180151581146115c757600080fd5b60208082526021908201527f476f7665726e6f723a20696e76616c69642070726f706f73616c206c656e67746040820152600d60fb1b606082015260800190565b60006001600160401b0380831681851680830382111561486e5761486e614622565b01949350505050565b60006101208b8352602060018060a01b038c16818501528160408501526148a08285018c6144b3565b915083820360608501526148b4828b6144f7565b915083820360808501528189518084528284019150828160051b850101838c0160005b8381101561490557601f198784030185526148f3838351613c19565b948601949250908501906001016148d7565b505086810360a0880152614919818c614527565b94505050505061493460c08401876001600160401b03169052565b6001600160401b03851660e08401528281036101008401526149568185613c19565b9c9b505050505050505050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008160001904831182151516156149cb576149cb614622565b500290565b6000826149ed57634e487b7160e01b600052601260045260246000fd5b500490565b60008251614a04818460208701613bed565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122091629f0f6731e633924d6c153c0ab1a2e5fe1f217db78168137030d4534a92e464736f6c63430008090033", - "deployedBytecode": "0x6080604052600436106102975760003560e01c80637b3c71d31161015a578063c28bc2fa116100c1578063eb9019d41161007a578063eb9019d4146108c4578063ece40cc1146108e4578063f23a6e6114610904578063f2fde38b14610930578063f8ce560a14610950578063fc0c546a1461097057600080fd5b8063c28bc2fa146107cb578063c59057e4146107eb578063d33219b41461080b578063dd4e2ba51461082a578063deaaa7cc14610870578063ea0217cf146108a457600080fd5b8063a7713a7011610113578063a7713a7014610715578063a890c9101461072a578063ab58fb8e1461074a578063b58131b01461076a578063bc197c811461077f578063c01f9e37146107ab57600080fd5b80637b3c71d31461064e5780637d5e81e21461066e57806386489ba91461068e5780638da5cb5b146106ae57806397c3d334146106e15780639a802a6d146106f557600080fd5b80633bccf4fd116101fe57806354fd4d50116101b757806354fd4d501461058f57806356781388146105b95780635f398a14146105d957806360c4247f146105f957806370b0f66014610619578063715018a61461063957600080fd5b80633bccf4fd146104795780633e4f49e61461049957806343859632146104c65780634f1ef2861461051157806352d1902d14610524578063544ffc9c1461053957600080fd5b8063160cbed711610250578063160cbed7146103bd5780632656227d146103dd5780632d63f693146103f05780632fe3e261146104105780633659cfe6146104445780633932abb11461046457600080fd5b806301ffc9a7146102bf57806302a251a3146102f4578063034201811461031757806306f3f9e61461033757806306fdde0314610357578063150b7a021461037957600080fd5b366102ba57306102a5610991565b6001600160a01b0316146102b857600080fd5b005b600080fd5b3480156102cb57600080fd5b506102df6102da3660046139f0565b6109ab565b60405190151581526020015b60405180910390f35b34801561030057600080fd5b506103096109bc565b6040519081526020016102eb565b34801561032357600080fd5b50610309610332366004613b2e565b6109c8565b34801561034357600080fd5b506102b8610352366004613bd4565b610ac0565b34801561036357600080fd5b5061036c610b58565b6040516102eb9190613c45565b34801561038557600080fd5b506103a4610394366004613c6d565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020016102eb565b3480156103c957600080fd5b506103096103d8366004613e49565b610bea565b6103096103eb366004613e49565b610e0c565b3480156103fc57600080fd5b5061030961040b366004613bd4565b610efe565b34801561041c57600080fd5b506103097fb3b3f3b703cd84ce352197dcff232b1b5d3cfb2025ce47cf04742d0651f1af8881565b34801561045057600080fd5b506102b861045f366004613ed8565b610f35565b34801561047057600080fd5b50610309611012565b34801561048557600080fd5b50610309610494366004613ef5565b61101e565b3480156104a557600080fd5b506104b96104b4366004613bd4565b611094565b6040516102eb9190613f59565b3480156104d257600080fd5b506102df6104e1366004613f81565b6000828152610161602090815260408083206001600160a01b038516845260030190915290205460ff1692915050565b6102b861051f366004613fb1565b61109f565b34801561053057600080fd5b50610309611170565b34801561054557600080fd5b50610574610554366004613bd4565b600090815261016160205260409020805460018201546002909201549092565b604080519384526020840192909252908201526060016102eb565b34801561059b57600080fd5b506040805180820190915260018152603160f81b602082015261036c565b3480156105c557600080fd5b506103096105d4366004614000565b611223565b3480156105e557600080fd5b506103096105f436600461402c565b61124c565b34801561060557600080fd5b50610309610614366004613bd4565b611296565b34801561062557600080fd5b506102b8610634366004613bd4565b611330565b34801561064557600080fd5b506102b86113bc565b34801561065a57600080fd5b506103096106693660046140af565b6113d0565b34801561067a57600080fd5b50610309610689366004614108565b611422565b34801561069a57600080fd5b506102b86106a93660046141bc565b611439565b3480156106ba57600080fd5b5061022a546001600160a01b03165b6040516001600160a01b0390911681526020016102eb565b3480156106ed57600080fd5b506064610309565b34801561070157600080fd5b50610309610710366004614215565b6115b7565b34801561072157600080fd5b506103096115ce565b34801561073657600080fd5b506102b8610745366004613ed8565b6115ed565b34801561075657600080fd5b50610309610765366004613bd4565b611679565b34801561077657600080fd5b50610309611724565b34801561078b57600080fd5b506103a461079a36600461426d565b63bc197c8160e01b95945050505050565b3480156107b757600080fd5b506103096107c6366004613bd4565b611730565b3480156107d757600080fd5b506102b86107e6366004614300565b61175f565b3480156107f757600080fd5b50610309610806366004613e49565b61182b565b34801561081757600080fd5b506101f8546001600160a01b03166106c9565b34801561083657600080fd5b506040805180820190915260208082527f737570706f72743d627261766f2671756f72756d3d666f722c6162737461696e9082015261036c565b34801561087c57600080fd5b506103097f150214d74d59b7d1e90c73fc22ef3d991dd0a76b046543d4d80ab92d2a50328f81565b3480156108b057600080fd5b506102b86108bf366004613bd4565b611865565b3480156108d057600080fd5b506103096108df366004614343565b6118f1565b3480156108f057600080fd5b506102b86108ff366004613bd4565b611912565b34801561091057600080fd5b506103a461091f36600461436f565b63f23a6e6160e01b95945050505050565b34801561093c57600080fd5b506102b861094b366004613ed8565b61199e565b34801561095c57600080fd5b5061030961096b366004613bd4565b611a14565b34801561097c57600080fd5b50610193546106c9906001600160a01b031681565b60006109a66101f8546001600160a01b031690565b905090565b60006109b682611a1f565b92915050565b60006109a66101305490565b600080610a6c610a647fb3b3f3b703cd84ce352197dcff232b1b5d3cfb2025ce47cf04742d0651f1af888c8c8c8c604051610a049291906143d7565b60405180910390208b80519060200120604051602001610a49959493929190948552602085019390935260ff9190911660408401526060830152608082015260a00190565b60405160208183030381529060405280519060200120611a44565b868686611a92565b9050610ab28a828b8b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d9250611ab0915050565b9a9950505050505050505050565b610ac8610991565b6001600160a01b0316336001600160a01b031614610b015760405162461bcd60e51b8152600401610af8906143e7565b60405180910390fd5b30610b0a610991565b6001600160a01b031614610b4c5760008036604051610b2a9291906143d7565b604051809103902090505b80610b4060ff611c11565b14610b4a57610b35565b505b610b5581611c90565b50565b606060fd8054610b679061441e565b80601f0160208091040260200160405190810160405280929190818152602001828054610b939061441e565b8015610be05780601f10610bb557610100808354040283529160200191610be0565b820191906000526020600020905b815481529060010190602001808311610bc357829003601f168201915b5050505050905090565b600080610bf98686868661182b565b90506004610c0682611094565b6007811115610c1757610c17613f43565b14610c345760405162461bcd60e51b8152600401610af890614459565b6101f8546040805163793d064960e11b815290516000926001600160a01b03169163f27a0c92916004808301926020929190829003018186803b158015610c7a57600080fd5b505afa158015610c8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb2919061449a565b6101f85460405163b1c5f42760e01b81529192506001600160a01b03169063b1c5f42790610ced908a908a908a906000908b9060040161457c565b60206040518083038186803b158015610d0557600080fd5b505afa158015610d19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3d919061449a565b60008381526101f96020526040808220929092556101f85491516308f2a0bb60e41b81526001600160a01b0390921691638f2a0bb091610d8a918b918b918b91908b9089906004016145ca565b600060405180830381600087803b158015610da457600080fd5b505af1158015610db8573d6000803e3d6000fd5b505050507f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda2892828242610dea9190614638565b6040805192835260208301919091520160405180910390a15095945050505050565b600080610e1b8686868661182b565b90506000610e2882611094565b90506004816007811115610e3e57610e3e613f43565b1480610e5b57506005816007811115610e5957610e59613f43565b145b610e775760405162461bcd60e51b8152600401610af890614459565b600082815260fe602052604090819020600201805460ff19166001179055517f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90610ec59084815260200190565b60405180910390a1610eda8288888888611de0565b610ee78288888888611e82565b610ef48288888888611e8f565b5095945050505050565b600081815260fe602090815260408083208151928301909152546001600160401b0316908190525b6001600160401b031692915050565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610f7e5760405162461bcd60e51b8152600401610af890614650565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610fc7600080516020614a0f833981519152546001600160a01b031690565b6001600160a01b031614610fed5760405162461bcd60e51b8152600401610af89061469c565b610ff681611ec8565b60408051600080825260208201909252610b5591839190611ed0565b60006109a661012f5490565b604080517f150214d74d59b7d1e90c73fc22ef3d991dd0a76b046543d4d80ab92d2a50328f602082015290810186905260ff85166060820152600090819061106c90610a6490608001610a49565b90506110898782886040518060200160405280600081525061204f565b979650505050505050565b60006109b682612072565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156110e85760405162461bcd60e51b8152600401610af890614650565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611131600080516020614a0f833981519152546001600160a01b031690565b6001600160a01b0316146111575760405162461bcd60e51b8152600401610af89061469c565b61116082611ec8565b61116c82826001611ed0565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146112105760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610af8565b50600080516020614a0f83398151915290565b6000803390506112448482856040518060200160405280600081525061204f565b949350505050565b60008033905061108987828888888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250611ab0915050565b6101c754600090806112ad5750506101c654919050565b60006101c76112bd6001846146e8565b815481106112cd576112cd6146ff565b60009182526020918290206040805180820190915291015463ffffffff81168083526401000000009091046001600160e01b0316928201929092529150841061132457602001516001600160e01b03169392505050565b6112446101c7856121dd565b611338610991565b6001600160a01b0316336001600160a01b0316146113685760405162461bcd60e51b8152600401610af8906143e7565b30611371610991565b6001600160a01b0316146113b357600080366040516113919291906143d7565b604051809103902090505b806113a760ff611c11565b146113b15761139c565b505b610b55816122ec565b6113c461232f565b6113ce600061238a565b565b60008033905061141886828787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061204f92505050565b9695505050505050565b6000611430858585856123dd565b95945050505050565b600054610100900460ff16158080156114595750600054600160ff909116105b806114735750303b158015611473575060005460ff166001145b6114d65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610af8565b6000805460ff1916600117905580156114f9576000805461ff0019166101001790555b61152a6040518060400160405280601081526020016f11dbdd995c9b9bdc90dbdb9d1c9858dd60821b8152506126a0565b6115358585856126f7565b61153d612729565b61154687612750565b61154f82612780565b611558866127b0565b6115606127e0565b611568612729565b80156115ae576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b60006115c484848461280f565b90505b9392505050565b6101c754600090156115e5576109a66101c7612895565b506101c65490565b6115f5610991565b6001600160a01b0316336001600160a01b0316146116255760405162461bcd60e51b8152600401610af8906143e7565b3061162e610991565b6001600160a01b031614611670576000803660405161164e9291906143d7565b604051809103902090505b8061166460ff611c11565b1461166e57611659565b505b610b55816128f1565b6101f85460008281526101f9602052604080822054905163d45c443560e01b81526004810191909152909182916001600160a01b039091169063d45c44359060240160206040518083038186803b1580156116d357600080fd5b505afa1580156116e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170b919061449a565b90508060011461171b57806115c7565b60009392505050565b60006109a66101315490565b600081815260fe602090815260408083208151928301909152600101546001600160401b031690819052610f26565b611767610991565b6001600160a01b0316336001600160a01b0316146117975760405162461bcd60e51b8152600401610af8906143e7565b306117a0610991565b6001600160a01b0316146117e257600080366040516117c09291906143d7565b604051809103902090505b806117d660ff611c11565b146117e0576117cb565b505b6118248483838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525088925061295c915050565b5050505050565b6000848484846040516020016118449493929190614715565b60408051601f19818403018152919052805160209091012095945050505050565b61186d610991565b6001600160a01b0316336001600160a01b03161461189d5760405162461bcd60e51b8152600401610af8906143e7565b306118a6610991565b6001600160a01b0316146118e857600080366040516118c69291906143d7565b604051809103902090505b806118dc60ff611c11565b146118e6576118d1565b505b610b5581612982565b60006115c7838361190d60408051602081019091526000815290565b61280f565b61191a610991565b6001600160a01b0316336001600160a01b03161461194a5760405162461bcd60e51b8152600401610af8906143e7565b30611953610991565b6001600160a01b03161461199557600080366040516119739291906143d7565b604051809103902090505b8061198960ff611c11565b146119935761197e565b505b610b5581612a25565b6119a661232f565b6001600160a01b038116611a0b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610af8565b610b558161238a565b60006109b682612a68565b60006001600160e01b03198216636e665ced60e01b14806109b657506109b682612b06565b60006109b6611a51612b71565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000611aa387878787612bec565b91509150610ef481612cd9565b600085815260fe602052604081206001611ac988611094565b6007811115611ada57611ada613f43565b14611b335760405162461bcd60e51b815260206004820152602360248201527f476f7665726e6f723a20766f7465206e6f742063757272656e746c792061637460448201526269766560e81b6064820152608401610af8565b604080516020810190915281546001600160401b031690819052600090611b5c9088908661280f565b9050611b6b8888888488612e94565b8351611bbd57866001600160a01b03167fb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda489888489604051611bb09493929190614760565b60405180910390a2611089565b866001600160a01b03167fe2babfbac5889a709b63bb7f598b324e08bc5a4fb9ec647fb3cbc9ec07eb87128988848989604051611bfe959493929190614788565b60405180910390a2979650505050505050565b6000611c2c8254600f81810b600160801b909204900b131590565b15611c4a57604051631ed9509560e11b815260040160405180910390fd5b508054600f0b6000818152600180840160205260408220805492905583546fffffffffffffffffffffffffffffffff191692016001600160801b03169190911790915590565b6064811115611d135760405162461bcd60e51b815260206004820152604360248201527f476f7665726e6f72566f74657351756f72756d4672616374696f6e3a2071756f60448201527f72756d4e756d657261746f72206f7665722071756f72756d44656e6f6d696e616064820152623a37b960e91b608482015260a401610af8565b6000611d1d6115ce565b90508015801590611d2f57506101c754155b15611d955760408051808201909152600081526101c79060208101611d5384613014565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b611da16101c783613081565b505060408051828152602081018490527f0553476bf02ef2726e8ce5ced78d63e26e602e4a2257b1f559418e24b4633997910160405180910390a15050565b30611de9610991565b6001600160a01b0316146118245760005b8451811015611e7a57306001600160a01b0316858281518110611e1f57611e1f6146ff565b60200260200101516001600160a01b03161415611e6a57611e6a838281518110611e4b57611e4b6146ff565b60200260200101518051906020012060ff6131ac90919063ffffffff16565b611e73816147ce565b9050611dfa565b505050505050565b61182485858585856131e8565b30611e98610991565b6001600160a01b0316146118245760ff54600f81810b600160801b909204900b131561182457600060ff55611824565b610b5561232f565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611f0857611f038361325d565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015611f4157600080fd5b505afa925050508015611f71575060408051601f3d908101601f19168201909252611f6e9181019061449a565b60015b611fd45760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610af8565b600080516020614a0f83398151915281146120435760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610af8565b50611f038383836132f9565b60006114308585858561206d60408051602081019091526000815290565b611ab0565b60008061207e83613324565b9050600481600781111561209457612094613f43565b1461209f5792915050565b60008381526101f96020526040902054806120bb575092915050565b6101f854604051632ab0f52960e01b8152600481018390526001600160a01b0390911690632ab0f5299060240160206040518083038186803b15801561210057600080fd5b505afa158015612114573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061213891906147e9565b15612147575060079392505050565b6101f854604051632c258a9f60e11b8152600481018390526001600160a01b039091169063584b153e9060240160206040518083038186803b15801561218c57600080fd5b505afa1580156121a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121c491906147e9565b156121d3575060059392505050565b5060029392505050565b600043821061222e5760405162461bcd60e51b815260206004820181905260248201527f436865636b706f696e74733a20626c6f636b206e6f7420796574206d696e65646044820152606401610af8565b825460005b818110156122935760006122478284613431565b90508486600001828154811061225f5761225f6146ff565b60009182526020909120015463ffffffff16111561227f5780925061228d565b61228a816001614638565b91505b50612233565b81156122d757846122a56001846146e8565b815481106122b5576122b56146ff565b60009182526020909120015464010000000090046001600160e01b03166122da565b60005b6001600160e01b031695945050505050565b61012f5460408051918252602082018390527fc565b045403dc03c2eea82b81a0465edad9e2e7fc4d97e11421c209da93d7a93910160405180910390a161012f55565b61022a546001600160a01b031633146113ce5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af8565b61022a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006123e7611724565b6123f6336108df6001436146e8565b101561245e5760405162461bcd60e51b815260206004820152603160248201527f476f7665726e6f723a2070726f706f73657220766f7465732062656c6f7720706044820152701c9bdc1bdcd85b081d1a1c995cda1bdb19607a1b6064820152608401610af8565b6000612473868686868051906020012061182b565b905084518651146124965760405162461bcd60e51b8152600401610af89061480b565b83518651146124b75760405162461bcd60e51b8152600401610af89061480b565b60008651116125085760405162461bcd60e51b815260206004820152601860248201527f476f7665726e6f723a20656d7074792070726f706f73616c00000000000000006044820152606401610af8565b600081815260fe6020908152604091829020825191820190925281546001600160401b031690819052156125885760405162461bcd60e51b815260206004820152602160248201527f476f7665726e6f723a2070726f706f73616c20616c72656164792065786973746044820152607360f81b6064820152608401610af8565b600061259a612595611012565b61344c565b6125a34361344c565b6125ad919061484c565b905060006125bc6125956109bc565b6125c6908361484c565b835467ffffffffffffffff19166001600160401b038416178455905060018301805467ffffffffffffffff19166001600160401b0383161790557f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e084338b8b8d516001600160401b0381111561263e5761263e613a71565b60405190808252806020026020018201604052801561267157816020015b606081526020019060019003908161265c5790505b508c88888e60405161268b99989796959493929190614877565b60405180910390a15091979650505050505050565b600054610100900460ff166126c75760405162461bcd60e51b8152600401610af890614966565b6126ee816126e96040805180820190915260018152603160f81b602082015290565b6134b4565b610b55816134f5565b600054610100900460ff1661271e5760405162461bcd60e51b8152600401610af890614966565b611f0383838361352f565b600054610100900460ff166113ce5760405162461bcd60e51b8152600401610af890614966565b600054610100900460ff166127775760405162461bcd60e51b8152600401610af890614966565b610b5581613571565b600054610100900460ff166127a75760405162461bcd60e51b8152600401610af890614966565b610b55816135bb565b600054610100900460ff166127d75760405162461bcd60e51b8152600401610af890614966565b610b55816135e2565b600054610100900460ff166128075760405162461bcd60e51b8152600401610af890614966565b6113ce613609565b61019354604051630748d63560e31b81526001600160a01b038581166004830152602482018590526000921690633a46b1a89060440160206040518083038186803b15801561285d57600080fd5b505afa158015612871573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c4919061449a565b805460009080156128de57826128ac6001836146e8565b815481106128bc576128bc6146ff565b60009182526020909120015464010000000090046001600160e01b03166128e1565b60005b6001600160e01b03169392505050565b6101f854604080516001600160a01b03928316815291831660208301527f08f74ea46ef7894f65eabfb5e6e695de773a000b47c529ab559178069b226401910160405180910390a16101f880546001600160a01b0319166001600160a01b0392909216919091179055565b60606115c4848484604051806060016040528060298152602001614a2f60299139613639565b600081116129e25760405162461bcd60e51b815260206004820152602760248201527f476f7665726e6f7253657474696e67733a20766f74696e6720706572696f6420604482015266746f6f206c6f7760c81b6064820152608401610af8565b6101305460408051918252602082018390527f7e3f7f0708a84de9203036abaa450dccc85ad5ff52f78c170f3edb55cf5e8828910160405180910390a161013055565b6101315460408051918252602082018390527fccb45da8d5717e6c4544694297c4ba5cf151d455c9bb0ed4fc7a38411bc05461910160405180910390a161013155565b60006064612a7583611296565b61019354604051632394e7a360e21b8152600481018690526001600160a01b0390911690638e539e8c9060240160206040518083038186803b158015612aba57600080fd5b505afa158015612ace573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612af2919061449a565b612afc91906149b1565b6109b691906149d0565b60006001600160e01b0319821663bf26d89760e01b1480612b3757506001600160e01b031982166379dd796f60e01b145b80612b5257506001600160e01b03198216630271189760e51b145b806109b657506301ffc9a760e01b6001600160e01b03198316146109b6565b60006109a67f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f612ba060655490565b6066546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612c235750600090506003612cd0565b8460ff16601b14158015612c3b57508460ff16601c14155b15612c4c5750600090506004612cd0565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612ca0573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612cc957600060019250925050612cd0565b9150600090505b94509492505050565b6000816004811115612ced57612ced613f43565b1415612cf65750565b6001816004811115612d0a57612d0a613f43565b1415612d585760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610af8565b6002816004811115612d6c57612d6c613f43565b1415612dba5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610af8565b6003816004811115612dce57612dce613f43565b1415612e275760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610af8565b6004816004811115612e3b57612e3b613f43565b1415610b555760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610af8565b6000858152610161602090815260408083206001600160a01b0388168452600381019092529091205460ff1615612f1d5760405162461bcd60e51b815260206004820152602760248201527f476f7665726e6f72566f74696e6753696d706c653a20766f746520616c726561604482015266191e4818d85cdd60ca1b6064820152608401610af8565b6001600160a01b03851660009081526003820160205260408120805460ff1916600117905560ff168460ff161415612f6e5782816000016000828254612f639190614638565b90915550611e7a9050565b60ff841660011415612f8e5782816001016000828254612f639190614638565b60ff841660021415612fae5782816002016000828254612f639190614638565b60405162461bcd60e51b815260206004820152603560248201527f476f7665726e6f72566f74696e6753696d706c653a20696e76616c69642076616044820152746c756520666f7220656e756d20566f74655479706560581b6064820152608401610af8565b60006001600160e01b0382111561307d5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20326044820152663234206269747360c81b6064820152608401610af8565b5090565b815460009081908161309286612895565b90506000821180156130d0575043866130ac6001856146e8565b815481106130bc576130bc6146ff565b60009182526020909120015463ffffffff16145b15613130576130de85613014565b866130ea6001856146e8565b815481106130fa576130fa6146ff565b9060005260206000200160000160046101000a8154816001600160e01b0302191690836001600160e01b0316021790555061319e565b8560000160405180604001604052806131484361375f565b63ffffffff16815260200161315c88613014565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b9250839150505b9250929050565b8154600160801b90819004600f0b6000818152600180860160205260409091209390935583546001600160801b03908116939091011602179055565b6101f85460405163e38335e560e01b81526001600160a01b039091169063e38335e590349061322490889088908890600090899060040161457c565b6000604051808303818588803b15801561323d57600080fd5b505af1158015613251573d6000803e3d6000fd5b50505050505050505050565b6001600160a01b0381163b6132ca5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610af8565b600080516020614a0f83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b613302836137c4565b60008251118061330f5750805b15611f035761331e8383613804565b50505050565b600081815260fe60205260408120600281015460ff16156133485750600792915050565b6002810154610100900460ff16156133635750600292915050565b600061336e84610efe565b9050806133bd5760405162461bcd60e51b815260206004820152601d60248201527f476f7665726e6f723a20756e6b6e6f776e2070726f706f73616c2069640000006044820152606401610af8565b4381106133ce575060009392505050565b60006133d985611730565b90504381106133ed57506001949350505050565b6133f6856138ef565b801561341657506000858152610161602052604090208054600190910154115b1561342657506004949350505050565b506003949350505050565b600061344060028484186149d0565b6115c790848416614638565b60006001600160401b0382111561307d5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201526534206269747360d01b6064820152608401610af8565b600054610100900460ff166134db5760405162461bcd60e51b8152600401610af890614966565b815160209283012081519190920120606591909155606655565b600054610100900460ff1661351c5760405162461bcd60e51b8152600401610af890614966565b805161116c9060fd906020840190613960565b600054610100900460ff166135565760405162461bcd60e51b8152600401610af890614966565b61355f836122ec565b61356882612982565b611f0381612a25565b600054610100900460ff166135985760405162461bcd60e51b8152600401610af890614966565b61019380546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff16610b4c5760405162461bcd60e51b8152600401610af890614966565b600054610100900460ff166116705760405162461bcd60e51b8152600401610af890614966565b600054610100900460ff166136305760405162461bcd60e51b8152600401610af890614966565b6113ce3361238a565b60608247101561369a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610af8565b6001600160a01b0385163b6136f15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610af8565b600080866001600160a01b0316858760405161370d91906149f2565b60006040518083038185875af1925050503d806000811461374a576040519150601f19603f3d011682016040523d82523d6000602084013e61374f565b606091505b5091509150611089828286613927565b600063ffffffff82111561307d5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b6064820152608401610af8565b6137cd8161325d565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b61386c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610af8565b600080846001600160a01b03168460405161388791906149f2565b600060405180830381855af49150503d80600081146138c2576040519150601f19603f3d011682016040523d82523d6000602084013e6138c7565b606091505b50915091506114308282604051806060016040528060278152602001614a5860279139613927565b600081815261016160205260408120600281015460018201546139129190614638565b61391e61096b85610efe565b11159392505050565b606083156139365750816115c7565b8251156139465782518084602001fd5b8160405162461bcd60e51b8152600401610af89190613c45565b82805461396c9061441e565b90600052602060002090601f01602090048101928261398e57600085556139d4565b82601f106139a757805160ff19168380011785556139d4565b828001600101855582156139d4579182015b828111156139d45782518255916020019190600101906139b9565b5061307d9291505b8082111561307d57600081556001016139dc565b600060208284031215613a0257600080fd5b81356001600160e01b0319811681146115c757600080fd5b803560ff81168114613a2b57600080fd5b919050565b60008083601f840112613a4257600080fd5b5081356001600160401b03811115613a5957600080fd5b6020830191508360208285010111156131a557600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613aaf57613aaf613a71565b604052919050565b60006001600160401b03831115613ad057613ad0613a71565b613ae3601f8401601f1916602001613a87565b9050828152838383011115613af757600080fd5b828260208301376000602084830101529392505050565b600082601f830112613b1f57600080fd5b6115c783833560208501613ab7565b60008060008060008060008060e0898b031215613b4a57600080fd5b88359750613b5a60208a01613a1a565b965060408901356001600160401b0380821115613b7657600080fd5b613b828c838d01613a30565b909850965060608b0135915080821115613b9b57600080fd5b50613ba88b828c01613b0e565b945050613bb760808a01613a1a565b925060a0890135915060c089013590509295985092959890939650565b600060208284031215613be657600080fd5b5035919050565b60005b83811015613c08578181015183820152602001613bf0565b8381111561331e5750506000910152565b60008151808452613c31816020860160208601613bed565b601f01601f19169290920160200192915050565b6020815260006115c76020830184613c19565b6001600160a01b0381168114610b5557600080fd5b60008060008060808587031215613c8357600080fd5b8435613c8e81613c58565b93506020850135613c9e81613c58565b92506040850135915060608501356001600160401b03811115613cc057600080fd5b613ccc87828801613b0e565b91505092959194509250565b60006001600160401b03821115613cf157613cf1613a71565b5060051b60200190565b600082601f830112613d0c57600080fd5b81356020613d21613d1c83613cd8565b613a87565b82815260059290921b84018101918181019086841115613d4057600080fd5b8286015b84811015613d64578035613d5781613c58565b8352918301918301613d44565b509695505050505050565b600082601f830112613d8057600080fd5b81356020613d90613d1c83613cd8565b82815260059290921b84018101918181019086841115613daf57600080fd5b8286015b84811015613d645780358352918301918301613db3565b600082601f830112613ddb57600080fd5b81356020613deb613d1c83613cd8565b82815260059290921b84018101918181019086841115613e0a57600080fd5b8286015b84811015613d645780356001600160401b03811115613e2d5760008081fd5b613e3b8986838b0101613b0e565b845250918301918301613e0e565b60008060008060808587031215613e5f57600080fd5b84356001600160401b0380821115613e7657600080fd5b613e8288838901613cfb565b95506020870135915080821115613e9857600080fd5b613ea488838901613d6f565b94506040870135915080821115613eba57600080fd5b50613ec787828801613dca565b949793965093946060013593505050565b600060208284031215613eea57600080fd5b81356115c781613c58565b600080600080600060a08688031215613f0d57600080fd5b85359450613f1d60208701613a1a565b9350613f2b60408701613a1a565b94979396509394606081013594506080013592915050565b634e487b7160e01b600052602160045260246000fd5b6020810160088310613f7b57634e487b7160e01b600052602160045260246000fd5b91905290565b60008060408385031215613f9457600080fd5b823591506020830135613fa681613c58565b809150509250929050565b60008060408385031215613fc457600080fd5b8235613fcf81613c58565b915060208301356001600160401b03811115613fea57600080fd5b613ff685828601613b0e565b9150509250929050565b6000806040838503121561401357600080fd5b8235915061402360208401613a1a565b90509250929050565b60008060008060006080868803121561404457600080fd5b8535945061405460208701613a1a565b935060408601356001600160401b038082111561407057600080fd5b61407c89838a01613a30565b9095509350606088013591508082111561409557600080fd5b506140a288828901613b0e565b9150509295509295909350565b600080600080606085870312156140c557600080fd5b843593506140d560208601613a1a565b925060408501356001600160401b038111156140f057600080fd5b6140fc87828801613a30565b95989497509550505050565b6000806000806080858703121561411e57600080fd5b84356001600160401b038082111561413557600080fd5b61414188838901613cfb565b9550602087013591508082111561415757600080fd5b61416388838901613d6f565b9450604087013591508082111561417957600080fd5b61418588838901613dca565b9350606087013591508082111561419b57600080fd5b508501601f810187136141ad57600080fd5b613ccc87823560208401613ab7565b60008060008060008060c087890312156141d557600080fd5b86356141e081613c58565b955060208701356141f081613c58565b95989597505050506040840135936060810135936080820135935060a0909101359150565b60008060006060848603121561422a57600080fd5b833561423581613c58565b92506020840135915060408401356001600160401b0381111561425757600080fd5b61426386828701613b0e565b9150509250925092565b600080600080600060a0868803121561428557600080fd5b853561429081613c58565b945060208601356142a081613c58565b935060408601356001600160401b03808211156142bc57600080fd5b6142c889838a01613d6f565b945060608801359150808211156142de57600080fd5b6142ea89838a01613d6f565b9350608088013591508082111561409557600080fd5b6000806000806060858703121561431657600080fd5b843561432181613c58565b93506020850135925060408501356001600160401b038111156140f057600080fd5b6000806040838503121561435657600080fd5b823561436181613c58565b946020939093013593505050565b600080600080600060a0868803121561438757600080fd5b853561439281613c58565b945060208601356143a281613c58565b9350604086013592506060860135915060808601356001600160401b038111156143cb57600080fd5b6140a288828901613b0e565b8183823760009101908152919050565b60208082526018908201527f476f7665726e6f723a206f6e6c79476f7665726e616e63650000000000000000604082015260600190565b600181811c9082168061443257607f821691505b6020821081141561445357634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526021908201527f476f7665726e6f723a2070726f706f73616c206e6f74207375636365737366756040820152601b60fa1b606082015260800190565b6000602082840312156144ac57600080fd5b5051919050565b600081518084526020808501945080840160005b838110156144ec5781516001600160a01b0316875295820195908201906001016144c7565b509495945050505050565b600081518084526020808501945080840160005b838110156144ec5781518752958201959082019060010161450b565b600081518084526020808501808196508360051b8101915082860160005b8581101561456f57828403895261455d848351613c19565b98850198935090840190600101614545565b5091979650505050505050565b60a08152600061458f60a08301886144b3565b82810360208401526145a181886144f7565b905082810360408401526145b58187614527565b60608401959095525050608001529392505050565b60c0815260006145dd60c08301896144b3565b82810360208401526145ef81896144f7565b905082810360408401526146038188614527565b60608401969096525050608081019290925260a0909101529392505050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561464b5761464b614622565b500190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6000828210156146fa576146fa614622565b500390565b634e487b7160e01b600052603260045260246000fd5b60808152600061472860808301876144b3565b828103602084015261473a81876144f7565b9050828103604084015261474e8186614527565b91505082606083015295945050505050565b84815260ff841660208201528260408201526080606082015260006114186080830184613c19565b85815260ff8516602082015283604082015260a0606082015260006147b060a0830185613c19565b82810360808401526147c28185613c19565b98975050505050505050565b60006000198214156147e2576147e2614622565b5060010190565b6000602082840312156147fb57600080fd5b815180151581146115c757600080fd5b60208082526021908201527f476f7665726e6f723a20696e76616c69642070726f706f73616c206c656e67746040820152600d60fb1b606082015260800190565b60006001600160401b0380831681851680830382111561486e5761486e614622565b01949350505050565b60006101208b8352602060018060a01b038c16818501528160408501526148a08285018c6144b3565b915083820360608501526148b4828b6144f7565b915083820360808501528189518084528284019150828160051b850101838c0160005b8381101561490557601f198784030185526148f3838351613c19565b948601949250908501906001016148d7565b505086810360a0880152614919818c614527565b94505050505061493460c08401876001600160401b03169052565b6001600160401b03851660e08401528281036101008401526149568185613c19565b9c9b505050505050505050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008160001904831182151516156149cb576149cb614622565b500290565b6000826149ed57634e487b7160e01b600052601260045260246000fd5b500490565b60008251614a04818460208701613bed565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122091629f0f6731e633924d6c153c0ab1a2e5fe1f217db78168137030d4534a92e464736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/governance/TimeLock.sol/TimeLock.dbg.json b/src/contracts/governance/TimeLock.sol/TimeLock.dbg.json deleted file mode 100644 index 306669b5ad..0000000000 --- a/src/contracts/governance/TimeLock.sol/TimeLock.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/governance/TimeLock.sol/TimeLock.json b/src/contracts/governance/TimeLock.sol/TimeLock.json deleted file mode 100644 index b99b475c15..0000000000 --- a/src/contracts/governance/TimeLock.sol/TimeLock.json +++ /dev/null @@ -1,1037 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "TimeLock", - "sourceName": "contracts/governance/TimeLock.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "previousAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "beacon", - "type": "address" - } - ], - "name": "BeaconUpgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "id", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "CallExecuted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "id", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "predecessor", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "delay", - "type": "uint256" - } - ], - "name": "CallScheduled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "id", - "type": "bytes32" - } - ], - "name": "Cancelled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldDuration", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newDuration", - "type": "uint256" - } - ], - "name": "MinDelayChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "Upgraded", - "type": "event" - }, - { - "inputs": [], - "name": "CANCELLER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "EXECUTOR_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PROPOSER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TIMELOCK_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "id", - "type": "bytes32" - } - ], - "name": "cancel", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "payload", - "type": "bytes" - }, - { - "internalType": "bytes32", - "name": "predecessor", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - } - ], - "name": "execute", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "targets", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "values", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "payloads", - "type": "bytes[]" - }, - { - "internalType": "bytes32", - "name": "predecessor", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - } - ], - "name": "executeBatch", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "getMinDelay", - "outputs": [ - { - "internalType": "uint256", - "name": "duration", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "id", - "type": "bytes32" - } - ], - "name": "getTimestamp", - "outputs": [ - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "bytes32", - "name": "predecessor", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - } - ], - "name": "hashOperation", - "outputs": [ - { - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "targets", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "values", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "payloads", - "type": "bytes[]" - }, - { - "internalType": "bytes32", - "name": "predecessor", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - } - ], - "name": "hashOperationBatch", - "outputs": [ - { - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "minDelay", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "proposers", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "executors", - "type": "address[]" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "id", - "type": "bytes32" - } - ], - "name": "isOperation", - "outputs": [ - { - "internalType": "bool", - "name": "registered", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "id", - "type": "bytes32" - } - ], - "name": "isOperationDone", - "outputs": [ - { - "internalType": "bool", - "name": "done", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "id", - "type": "bytes32" - } - ], - "name": "isOperationPending", - "outputs": [ - { - "internalType": "bool", - "name": "pending", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "id", - "type": "bytes32" - } - ], - "name": "isOperationReady", - "outputs": [ - { - "internalType": "bool", - "name": "ready", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC1155BatchReceived", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC1155Received", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC721Received", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "proxiableUUID", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "bytes32", - "name": "predecessor", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "delay", - "type": "uint256" - } - ], - "name": "schedule", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "targets", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "values", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "payloads", - "type": "bytes[]" - }, - { - "internalType": "bytes32", - "name": "predecessor", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "delay", - "type": "uint256" - } - ], - "name": "scheduleBatch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newDelay", - "type": "uint256" - } - ], - "name": "updateDelay", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "upgradeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "upgradeToAndCall", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } - ], - "bytecode": "0x60a0604052306080523480156200001557600080fd5b506200002062000026565b620000e8565b600054610100900460ff1615620000935760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e6576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b608051612c89620001206000396000818161090701528181610947015281816109e701528181610a270152610ab60152612c896000f3fe6080604052600436106102085760003560e01c8063715018a611610118578063b1c5f427116100a0578063d547741f1161006f578063d547741f1461062b578063e38335e51461064b578063f23a6e611461065e578063f27a0c921461068a578063f2fde38b1461069f57600080fd5b8063b1c5f42714610592578063bc197c81146105b2578063c4d252f5146105de578063d45c4435146105fe57600080fd5b80638f2a0bb0116100e75780638f2a0bb0146104f95780638f61f4f51461051957806391d148541461053b578063a217fddf1461055b578063b08e51c01461057057600080fd5b8063715018a61461047c5780637fbc79c6146104915780638065657f146104b15780638da5cb5b146104d157600080fd5b80632ab0f5291161019b5780633659cfe61161016a5780633659cfe6146103f45780634f1ef2861461041457806352d1902d14610427578063584b153e1461043c57806364d623531461045c57600080fd5b80632ab0f529146103645780632f2ff15d1461039457806331d50750146103b457806336568abe146103d457600080fd5b8063134008d3116101d7578063134008d3146102bd57806313bc9f20146102d0578063150b7a02146102f0578063248a9ca31461033457600080fd5b806301d5062a1461021457806301ffc9a71461023657806307bd02651461026b5780630d3cf6fc1461029b57600080fd5b3661020f57005b600080fd5b34801561022057600080fd5b5061023461022f366004611f7d565b6106bf565b005b34801561024257600080fd5b50610256610251366004611ff1565b610742565b60405190151581526020015b60405180910390f35b34801561027757600080fd5b5061028d600080516020612c1483398151915281565b604051908152602001610262565b3480156102a757600080fd5b5061028d600080516020612bad83398151915281565b6102346102cb36600461201b565b61076d565b3480156102dc57600080fd5b506102566102eb366004612086565b610810565b3480156102fc57600080fd5b5061031b61030b366004612154565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610262565b34801561034057600080fd5b5061028d61034f366004612086565b60009081526065602052604090206001015490565b34801561037057600080fd5b5061025661037f366004612086565b60009081526097602052604090205460011490565b3480156103a057600080fd5b506102346103af3660046121bb565b610836565b3480156103c057600080fd5b506102566103cf366004612086565b610860565b3480156103e057600080fd5b506102346103ef3660046121bb565b610879565b34801561040057600080fd5b5061023461040f3660046121e7565b6108fc565b610234610422366004612202565b6109dc565b34801561043357600080fd5b5061028d610aa9565b34801561044857600080fd5b50610256610457366004612086565b610b5c565b34801561046857600080fd5b50610234610477366004612086565b610b73565b34801561048857600080fd5b50610234610c17565b34801561049d57600080fd5b506102346104ac3660046122e4565b610c2b565b3480156104bd57600080fd5b5061028d6104cc36600461201b565b610d52565b3480156104dd57600080fd5b5060c9546040516001600160a01b039091168152602001610262565b34801561050557600080fd5b50610234610514366004612394565b610d91565b34801561052557600080fd5b5061028d600080516020612bf483398151915281565b34801561054757600080fd5b506102566105563660046121bb565b610ed1565b34801561056757600080fd5b5061028d600081565b34801561057c57600080fd5b5061028d600080516020612c3483398151915281565b34801561059e57600080fd5b5061028d6105ad366004612445565b610efc565b3480156105be57600080fd5b5061031b6105cd366004612548565b63bc197c8160e01b95945050505050565b3480156105ea57600080fd5b506102346105f9366004612086565b610f41565b34801561060a57600080fd5b5061028d610619366004612086565b60009081526097602052604090205490565b34801561063757600080fd5b506102346106463660046121bb565b611004565b610234610659366004612445565b611029565b34801561066a57600080fd5b5061031b6106793660046125f1565b63f23a6e6160e01b95945050505050565b34801561069657600080fd5b5060985461028d565b3480156106ab57600080fd5b506102346106ba3660046121e7565b6111a1565b600080516020612bf48339815191526106d781611217565b60006106e7898989898989610d52565b90506106f38184611221565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a60405161072f9695949392919061267e565b60405180910390a3505050505050505050565b60006001600160e01b03198216630271189760e51b1480610767575061076782611310565b92915050565b600080516020612c14833981519152610787816000610ed1565b610795576107958133611345565b60006107a5888888888888610d52565b90506107b181856113a9565b6107bd88888888611444565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516107f594939291906126bb565b60405180910390a361080681611517565b5050505050505050565b60008181526097602052604081205460018111801561082f5750428111155b9392505050565b60008281526065602052604090206001015461085181611217565b61085b8383611550565b505050565b60008181526097602052604081205481905b1192915050565b6001600160a01b03811633146108ee5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6108f882826115d6565b5050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156109455760405162461bcd60e51b81526004016108e5906126ed565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661098e600080516020612b8d833981519152546001600160a01b031690565b6001600160a01b0316146109b45760405162461bcd60e51b81526004016108e590612739565b6109bd8161163d565b604080516000808252602082019092526109d991839190611645565b50565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610a255760405162461bcd60e51b81526004016108e5906126ed565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610a6e600080516020612b8d833981519152546001600160a01b031690565b6001600160a01b031614610a945760405162461bcd60e51b81526004016108e590612739565b610a9d8261163d565b6108f882826001611645565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610b495760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016108e5565b50600080516020612b8d83398151915290565b600081815260976020526040812054600190610872565b333014610bd65760405162461bcd60e51b815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201526a62652074696d656c6f636b60a81b60648201526084016108e5565b60985460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1609855565b610c1f6117bf565b610c296000611819565b565b600054610100900460ff1615808015610c4b5750600054600160ff909116105b80610c655750303b158015610c65575060005460ff166001145b610cc85760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016108e5565b6000805460ff191660011790558015610ceb576000805461ff0019166101001790555b610cf684848461186b565b610cfe61189d565b610d066118cc565b8015610d4c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b6000868686868686604051602001610d6f9695949392919061267e565b6040516020818303038152906040528051906020012090509695505050505050565b600080516020612bf4833981519152610da981611217565b888714610dc85760405162461bcd60e51b81526004016108e590612785565b888514610de75760405162461bcd60e51b81526004016108e590612785565b6000610df98b8b8b8b8b8b8b8b610efc565b9050610e058184611221565b60005b8a811015610ec35780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610e4557610e456127c8565b9050602002016020810190610e5a91906121e7565b8d8d86818110610e6c57610e6c6127c8565b905060200201358c8c87818110610e8557610e856127c8565b9050602002810190610e9791906127de565b8c8b604051610eab9695949392919061267e565b60405180910390a3610ebc8161283a565b9050610e08565b505050505050505050505050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60008888888888888888604051602001610f1d9897969594939291906128e5565b60405160208183030381529060405280519060200120905098975050505050505050565b600080516020612c34833981519152610f5981611217565b610f6282610b5c565b610fc85760405162461bcd60e51b815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e2063616044820152701b9b9bdd0818994818d85b98d95b1b1959607a1b60648201526084016108e5565b6000828152609760205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b60008281526065602052604090206001015461101f81611217565b61085b83836115d6565b600080516020612c14833981519152611043816000610ed1565b611051576110518133611345565b8786146110705760405162461bcd60e51b81526004016108e590612785565b87841461108f5760405162461bcd60e51b81526004016108e590612785565b60006110a18a8a8a8a8a8a8a8a610efc565b90506110ad81856113a9565b60005b8981101561118b5760008b8b838181106110cc576110cc6127c8565b90506020020160208101906110e191906121e7565b905060008a8a848181106110f7576110f76127c8565b9050602002013590503660008a8a86818110611115576111156127c8565b905060200281019061112791906127de565b9150915061113784848484611444565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161116e94939291906126bb565b60405180910390a350505050806111849061283a565b90506110b0565b5061119581611517565b50505050505050505050565b6111a96117bf565b6001600160a01b03811661120e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108e5565b6109d981611819565b6109d98133611345565b61122a82610860565b1561128f5760405162461bcd60e51b815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201526e1c9958591e481cd8da19591d5b1959608a1b60648201526084016108e5565b6098548110156112f05760405162461bcd60e51b815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e746044820152652064656c617960d01b60648201526084016108e5565b6112fa8142612990565b6000928352609760205260409092209190915550565b60006001600160e01b03198216637965db0b60e01b148061076757506301ffc9a760e01b6001600160e01b0319831614610767565b61134f8282610ed1565b6108f857611367816001600160a01b031660146118f3565b6113728360206118f3565b6040516020016113839291906129d4565b60408051601f198184030181529082905262461bcd60e51b82526108e591600401612a49565b6113b282610810565b6113ce5760405162461bcd60e51b81526004016108e590612a7c565b8015806113e957506000818152609760205260409020546001145b6108f85760405162461bcd60e51b815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e6720646570656044820152656e64656e637960d01b60648201526084016108e5565b6000846001600160a01b0316848484604051611461929190612ac6565b60006040518083038185875af1925050503d806000811461149e576040519150601f19603f3d011682016040523d82523d6000602084013e6114a3565b606091505b50509050806115105760405162461bcd60e51b815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e6720746044820152721c985b9cd858dd1a5bdb881c995d995c9d1959606a1b60648201526084016108e5565b5050505050565b61152081610810565b61153c5760405162461bcd60e51b81526004016108e590612a7c565b600090815260976020526040902060019055565b61155a8282610ed1565b6108f85760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556115923390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6115e08282610ed1565b156108f85760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6109d96117bf565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156116785761085b83611a8e565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116b157600080fd5b505afa9250505080156116e1575060408051601f3d908101601f191682019092526116de91810190612ad6565b60015b6117445760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016108e5565b600080516020612b8d83398151915281146117b35760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016108e5565b5061085b838383611b2a565b60c9546001600160a01b03163314610c295760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108e5565b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166118925760405162461bcd60e51b81526004016108e590612aef565b61085b838383611b4f565b600054610100900460ff166118c45760405162461bcd60e51b81526004016108e590612aef565b610c29611d27565b600054610100900460ff16610c295760405162461bcd60e51b81526004016108e590612aef565b60606000611902836002612b3a565b61190d906002612990565b6001600160401b038111156119245761192461209f565b6040519080825280601f01601f19166020018201604052801561194e576020820181803683370190505b509050600360fc1b81600081518110611969576119696127c8565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611998576119986127c8565b60200101906001600160f81b031916908160001a90535060006119bc846002612b3a565b6119c7906001612990565b90505b6001811115611a3f576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106119fb576119fb6127c8565b1a60f81b828281518110611a1157611a116127c8565b60200101906001600160f81b031916908160001a90535060049490941c93611a3881612b59565b90506119ca565b50831561082f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108e5565b6001600160a01b0381163b611afb5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016108e5565b600080516020612b8d83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b611b3383611d57565b600082511180611b405750805b1561085b57610d4c8383611d97565b600054610100900460ff16611b765760405162461bcd60e51b81526004016108e590612aef565b611b8e600080516020612bad83398151915280611e8b565b611bb4600080516020612bf4833981519152600080516020612bad833981519152611e8b565b611bda600080516020612c14833981519152600080516020612bad833981519152611e8b565b611c00600080516020612c34833981519152600080516020612bad833981519152611e8b565b611c18600080516020612bad83398151915233611ed6565b611c30600080516020612bad83398151915230611ed6565b60005b8251811015611ca157611c6d600080516020612bf4833981519152848381518110611c6057611c606127c8565b6020026020010151611ed6565b611c91600080516020612c34833981519152848381518110611c6057611c606127c8565b611c9a8161283a565b9050611c33565b5060005b8151811015611ce257611cd2600080516020612c14833981519152838381518110611c6057611c606127c8565b611cdb8161283a565b9050611ca5565b5060988390556040805160008152602081018590527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1505050565b600054610100900460ff16611d4e5760405162461bcd60e51b81526004016108e590612aef565b610c2933611819565b611d6081611a8e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b611dff5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016108e5565b600080846001600160a01b031684604051611e1a9190612b70565b600060405180830381855af49150503d8060008114611e55576040519150601f19603f3d011682016040523d82523d6000602084013e611e5a565b606091505b5091509150611e828282604051806060016040528060278152602001612bcd60279139611ee0565b95945050505050565b600082815260656020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6108f88282611550565b60608315611eef57508161082f565b825115611eff5782518084602001fd5b8160405162461bcd60e51b81526004016108e59190612a49565b80356001600160a01b0381168114611f3057600080fd5b919050565b60008083601f840112611f4757600080fd5b5081356001600160401b03811115611f5e57600080fd5b602083019150836020828501011115611f7657600080fd5b9250929050565b600080600080600080600060c0888a031215611f9857600080fd5b611fa188611f19565b96506020880135955060408801356001600160401b03811115611fc357600080fd5b611fcf8a828b01611f35565b989b979a50986060810135976080820135975060a09091013595509350505050565b60006020828403121561200357600080fd5b81356001600160e01b03198116811461082f57600080fd5b60008060008060008060a0878903121561203457600080fd5b61203d87611f19565b95506020870135945060408701356001600160401b0381111561205f57600080fd5b61206b89828a01611f35565b979a9699509760608101359660809091013595509350505050565b60006020828403121561209857600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156120dd576120dd61209f565b604052919050565b600082601f8301126120f657600080fd5b81356001600160401b0381111561210f5761210f61209f565b612122601f8201601f19166020016120b5565b81815284602083860101111561213757600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561216a57600080fd5b61217385611f19565b935061218160208601611f19565b92506040850135915060608501356001600160401b038111156121a357600080fd5b6121af878288016120e5565b91505092959194509250565b600080604083850312156121ce57600080fd5b823591506121de60208401611f19565b90509250929050565b6000602082840312156121f957600080fd5b61082f82611f19565b6000806040838503121561221557600080fd5b61221e83611f19565b915060208301356001600160401b0381111561223957600080fd5b612245858286016120e5565b9150509250929050565b60006001600160401b038211156122685761226861209f565b5060051b60200190565b600082601f83011261228357600080fd5b813560206122986122938361224f565b6120b5565b82815260059290921b840181019181810190868411156122b757600080fd5b8286015b848110156122d9576122cc81611f19565b83529183019183016122bb565b509695505050505050565b6000806000606084860312156122f957600080fd5b8335925060208401356001600160401b038082111561231757600080fd5b61232387838801612272565b9350604086013591508082111561233957600080fd5b5061234686828701612272565b9150509250925092565b60008083601f84011261236257600080fd5b5081356001600160401b0381111561237957600080fd5b6020830191508360208260051b8501011115611f7657600080fd5b600080600080600080600080600060c08a8c0312156123b257600080fd5b89356001600160401b03808211156123c957600080fd5b6123d58d838e01612350565b909b50995060208c01359150808211156123ee57600080fd5b6123fa8d838e01612350565b909950975060408c013591508082111561241357600080fd5b506124208c828d01612350565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561246157600080fd5b88356001600160401b038082111561247857600080fd5b6124848c838d01612350565b909a50985060208b013591508082111561249d57600080fd5b6124a98c838d01612350565b909850965060408b01359150808211156124c257600080fd5b506124cf8b828c01612350565b999c989b509699959896976060870135966080013595509350505050565b600082601f8301126124fe57600080fd5b8135602061250e6122938361224f565b82815260059290921b8401810191818101908684111561252d57600080fd5b8286015b848110156122d95780358352918301918301612531565b600080600080600060a0868803121561256057600080fd5b61256986611f19565b945061257760208701611f19565b935060408601356001600160401b038082111561259357600080fd5b61259f89838a016124ed565b945060608801359150808211156125b557600080fd5b6125c189838a016124ed565b935060808801359150808211156125d757600080fd5b506125e4888289016120e5565b9150509295509295909350565b600080600080600060a0868803121561260957600080fd5b61261286611f19565b945061262060208701611f19565b9350604086013592506060860135915060808601356001600160401b0381111561264957600080fd5b6125e4888289016120e5565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60018060a01b038716815285602082015260a0604082015260006126a660a083018688612655565b60608301949094525060800152949350505050565b60018060a01b03851681528360208201526060604082015260006126e3606083018486612655565b9695505050505050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60208082526023908201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d616040820152620e8c6d60eb1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126127f557600080fd5b8301803591506001600160401b0382111561280f57600080fd5b602001915036819003821315611f7657600080fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561284e5761284e612824565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156128d85782840389528135601e1988360301811261289057600080fd5b870180356001600160401b038111156128a857600080fd5b8036038913156128b757600080fd5b6128c48682898501612655565b9a87019a955050509084019060010161286f565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b811015612926576001600160a01b0361291184611f19565b168252602092830192909101906001016128f8565b5083810360208501528881526001600160fb1b0389111561294657600080fd5b8860051b9150818a60208301378181019150506020810160008152602084830301604085015261297781888a612855565b6060850196909652505050608001529695505050505050565b600082198211156129a3576129a3612824565b500190565b60005b838110156129c35781810151838201526020016129ab565b83811115610d4c5750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612a0c8160178501602088016129a8565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612a3d8160288401602088016129a8565b01602801949350505050565b6020815260008251806020840152612a688160408501602087016129a8565b601f01601f19169190910160400192915050565b6020808252602a908201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e206973604082015269206e6f7420726561647960b01b606082015260800190565b8183823760009101908152919050565b600060208284031215612ae857600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000816000190483118215151615612b5457612b54612824565b500290565b600081612b6857612b68612824565b506000190190565b60008251612b828184602087016129a8565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564b09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1d8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e63fd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783a26469706673582212203acd3841c8e64ab5c9cf22cf5f5e1658c2190b9c1a83a630884e4b7f2728623164736f6c63430008090033", - "deployedBytecode": "0x6080604052600436106102085760003560e01c8063715018a611610118578063b1c5f427116100a0578063d547741f1161006f578063d547741f1461062b578063e38335e51461064b578063f23a6e611461065e578063f27a0c921461068a578063f2fde38b1461069f57600080fd5b8063b1c5f42714610592578063bc197c81146105b2578063c4d252f5146105de578063d45c4435146105fe57600080fd5b80638f2a0bb0116100e75780638f2a0bb0146104f95780638f61f4f51461051957806391d148541461053b578063a217fddf1461055b578063b08e51c01461057057600080fd5b8063715018a61461047c5780637fbc79c6146104915780638065657f146104b15780638da5cb5b146104d157600080fd5b80632ab0f5291161019b5780633659cfe61161016a5780633659cfe6146103f45780634f1ef2861461041457806352d1902d14610427578063584b153e1461043c57806364d623531461045c57600080fd5b80632ab0f529146103645780632f2ff15d1461039457806331d50750146103b457806336568abe146103d457600080fd5b8063134008d3116101d7578063134008d3146102bd57806313bc9f20146102d0578063150b7a02146102f0578063248a9ca31461033457600080fd5b806301d5062a1461021457806301ffc9a71461023657806307bd02651461026b5780630d3cf6fc1461029b57600080fd5b3661020f57005b600080fd5b34801561022057600080fd5b5061023461022f366004611f7d565b6106bf565b005b34801561024257600080fd5b50610256610251366004611ff1565b610742565b60405190151581526020015b60405180910390f35b34801561027757600080fd5b5061028d600080516020612c1483398151915281565b604051908152602001610262565b3480156102a757600080fd5b5061028d600080516020612bad83398151915281565b6102346102cb36600461201b565b61076d565b3480156102dc57600080fd5b506102566102eb366004612086565b610810565b3480156102fc57600080fd5b5061031b61030b366004612154565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610262565b34801561034057600080fd5b5061028d61034f366004612086565b60009081526065602052604090206001015490565b34801561037057600080fd5b5061025661037f366004612086565b60009081526097602052604090205460011490565b3480156103a057600080fd5b506102346103af3660046121bb565b610836565b3480156103c057600080fd5b506102566103cf366004612086565b610860565b3480156103e057600080fd5b506102346103ef3660046121bb565b610879565b34801561040057600080fd5b5061023461040f3660046121e7565b6108fc565b610234610422366004612202565b6109dc565b34801561043357600080fd5b5061028d610aa9565b34801561044857600080fd5b50610256610457366004612086565b610b5c565b34801561046857600080fd5b50610234610477366004612086565b610b73565b34801561048857600080fd5b50610234610c17565b34801561049d57600080fd5b506102346104ac3660046122e4565b610c2b565b3480156104bd57600080fd5b5061028d6104cc36600461201b565b610d52565b3480156104dd57600080fd5b5060c9546040516001600160a01b039091168152602001610262565b34801561050557600080fd5b50610234610514366004612394565b610d91565b34801561052557600080fd5b5061028d600080516020612bf483398151915281565b34801561054757600080fd5b506102566105563660046121bb565b610ed1565b34801561056757600080fd5b5061028d600081565b34801561057c57600080fd5b5061028d600080516020612c3483398151915281565b34801561059e57600080fd5b5061028d6105ad366004612445565b610efc565b3480156105be57600080fd5b5061031b6105cd366004612548565b63bc197c8160e01b95945050505050565b3480156105ea57600080fd5b506102346105f9366004612086565b610f41565b34801561060a57600080fd5b5061028d610619366004612086565b60009081526097602052604090205490565b34801561063757600080fd5b506102346106463660046121bb565b611004565b610234610659366004612445565b611029565b34801561066a57600080fd5b5061031b6106793660046125f1565b63f23a6e6160e01b95945050505050565b34801561069657600080fd5b5060985461028d565b3480156106ab57600080fd5b506102346106ba3660046121e7565b6111a1565b600080516020612bf48339815191526106d781611217565b60006106e7898989898989610d52565b90506106f38184611221565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a60405161072f9695949392919061267e565b60405180910390a3505050505050505050565b60006001600160e01b03198216630271189760e51b1480610767575061076782611310565b92915050565b600080516020612c14833981519152610787816000610ed1565b610795576107958133611345565b60006107a5888888888888610d52565b90506107b181856113a9565b6107bd88888888611444565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516107f594939291906126bb565b60405180910390a361080681611517565b5050505050505050565b60008181526097602052604081205460018111801561082f5750428111155b9392505050565b60008281526065602052604090206001015461085181611217565b61085b8383611550565b505050565b60008181526097602052604081205481905b1192915050565b6001600160a01b03811633146108ee5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6108f882826115d6565b5050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156109455760405162461bcd60e51b81526004016108e5906126ed565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661098e600080516020612b8d833981519152546001600160a01b031690565b6001600160a01b0316146109b45760405162461bcd60e51b81526004016108e590612739565b6109bd8161163d565b604080516000808252602082019092526109d991839190611645565b50565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610a255760405162461bcd60e51b81526004016108e5906126ed565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610a6e600080516020612b8d833981519152546001600160a01b031690565b6001600160a01b031614610a945760405162461bcd60e51b81526004016108e590612739565b610a9d8261163d565b6108f882826001611645565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610b495760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016108e5565b50600080516020612b8d83398151915290565b600081815260976020526040812054600190610872565b333014610bd65760405162461bcd60e51b815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201526a62652074696d656c6f636b60a81b60648201526084016108e5565b60985460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1609855565b610c1f6117bf565b610c296000611819565b565b600054610100900460ff1615808015610c4b5750600054600160ff909116105b80610c655750303b158015610c65575060005460ff166001145b610cc85760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016108e5565b6000805460ff191660011790558015610ceb576000805461ff0019166101001790555b610cf684848461186b565b610cfe61189d565b610d066118cc565b8015610d4c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b6000868686868686604051602001610d6f9695949392919061267e565b6040516020818303038152906040528051906020012090509695505050505050565b600080516020612bf4833981519152610da981611217565b888714610dc85760405162461bcd60e51b81526004016108e590612785565b888514610de75760405162461bcd60e51b81526004016108e590612785565b6000610df98b8b8b8b8b8b8b8b610efc565b9050610e058184611221565b60005b8a811015610ec35780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610e4557610e456127c8565b9050602002016020810190610e5a91906121e7565b8d8d86818110610e6c57610e6c6127c8565b905060200201358c8c87818110610e8557610e856127c8565b9050602002810190610e9791906127de565b8c8b604051610eab9695949392919061267e565b60405180910390a3610ebc8161283a565b9050610e08565b505050505050505050505050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60008888888888888888604051602001610f1d9897969594939291906128e5565b60405160208183030381529060405280519060200120905098975050505050505050565b600080516020612c34833981519152610f5981611217565b610f6282610b5c565b610fc85760405162461bcd60e51b815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e2063616044820152701b9b9bdd0818994818d85b98d95b1b1959607a1b60648201526084016108e5565b6000828152609760205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b60008281526065602052604090206001015461101f81611217565b61085b83836115d6565b600080516020612c14833981519152611043816000610ed1565b611051576110518133611345565b8786146110705760405162461bcd60e51b81526004016108e590612785565b87841461108f5760405162461bcd60e51b81526004016108e590612785565b60006110a18a8a8a8a8a8a8a8a610efc565b90506110ad81856113a9565b60005b8981101561118b5760008b8b838181106110cc576110cc6127c8565b90506020020160208101906110e191906121e7565b905060008a8a848181106110f7576110f76127c8565b9050602002013590503660008a8a86818110611115576111156127c8565b905060200281019061112791906127de565b9150915061113784848484611444565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161116e94939291906126bb565b60405180910390a350505050806111849061283a565b90506110b0565b5061119581611517565b50505050505050505050565b6111a96117bf565b6001600160a01b03811661120e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108e5565b6109d981611819565b6109d98133611345565b61122a82610860565b1561128f5760405162461bcd60e51b815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201526e1c9958591e481cd8da19591d5b1959608a1b60648201526084016108e5565b6098548110156112f05760405162461bcd60e51b815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e746044820152652064656c617960d01b60648201526084016108e5565b6112fa8142612990565b6000928352609760205260409092209190915550565b60006001600160e01b03198216637965db0b60e01b148061076757506301ffc9a760e01b6001600160e01b0319831614610767565b61134f8282610ed1565b6108f857611367816001600160a01b031660146118f3565b6113728360206118f3565b6040516020016113839291906129d4565b60408051601f198184030181529082905262461bcd60e51b82526108e591600401612a49565b6113b282610810565b6113ce5760405162461bcd60e51b81526004016108e590612a7c565b8015806113e957506000818152609760205260409020546001145b6108f85760405162461bcd60e51b815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e6720646570656044820152656e64656e637960d01b60648201526084016108e5565b6000846001600160a01b0316848484604051611461929190612ac6565b60006040518083038185875af1925050503d806000811461149e576040519150601f19603f3d011682016040523d82523d6000602084013e6114a3565b606091505b50509050806115105760405162461bcd60e51b815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e6720746044820152721c985b9cd858dd1a5bdb881c995d995c9d1959606a1b60648201526084016108e5565b5050505050565b61152081610810565b61153c5760405162461bcd60e51b81526004016108e590612a7c565b600090815260976020526040902060019055565b61155a8282610ed1565b6108f85760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556115923390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6115e08282610ed1565b156108f85760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6109d96117bf565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156116785761085b83611a8e565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116b157600080fd5b505afa9250505080156116e1575060408051601f3d908101601f191682019092526116de91810190612ad6565b60015b6117445760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016108e5565b600080516020612b8d83398151915281146117b35760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016108e5565b5061085b838383611b2a565b60c9546001600160a01b03163314610c295760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108e5565b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166118925760405162461bcd60e51b81526004016108e590612aef565b61085b838383611b4f565b600054610100900460ff166118c45760405162461bcd60e51b81526004016108e590612aef565b610c29611d27565b600054610100900460ff16610c295760405162461bcd60e51b81526004016108e590612aef565b60606000611902836002612b3a565b61190d906002612990565b6001600160401b038111156119245761192461209f565b6040519080825280601f01601f19166020018201604052801561194e576020820181803683370190505b509050600360fc1b81600081518110611969576119696127c8565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611998576119986127c8565b60200101906001600160f81b031916908160001a90535060006119bc846002612b3a565b6119c7906001612990565b90505b6001811115611a3f576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106119fb576119fb6127c8565b1a60f81b828281518110611a1157611a116127c8565b60200101906001600160f81b031916908160001a90535060049490941c93611a3881612b59565b90506119ca565b50831561082f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108e5565b6001600160a01b0381163b611afb5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016108e5565b600080516020612b8d83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b611b3383611d57565b600082511180611b405750805b1561085b57610d4c8383611d97565b600054610100900460ff16611b765760405162461bcd60e51b81526004016108e590612aef565b611b8e600080516020612bad83398151915280611e8b565b611bb4600080516020612bf4833981519152600080516020612bad833981519152611e8b565b611bda600080516020612c14833981519152600080516020612bad833981519152611e8b565b611c00600080516020612c34833981519152600080516020612bad833981519152611e8b565b611c18600080516020612bad83398151915233611ed6565b611c30600080516020612bad83398151915230611ed6565b60005b8251811015611ca157611c6d600080516020612bf4833981519152848381518110611c6057611c606127c8565b6020026020010151611ed6565b611c91600080516020612c34833981519152848381518110611c6057611c606127c8565b611c9a8161283a565b9050611c33565b5060005b8151811015611ce257611cd2600080516020612c14833981519152838381518110611c6057611c606127c8565b611cdb8161283a565b9050611ca5565b5060988390556040805160008152602081018590527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1505050565b600054610100900460ff16611d4e5760405162461bcd60e51b81526004016108e590612aef565b610c2933611819565b611d6081611a8e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b611dff5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016108e5565b600080846001600160a01b031684604051611e1a9190612b70565b600060405180830381855af49150503d8060008114611e55576040519150601f19603f3d011682016040523d82523d6000602084013e611e5a565b606091505b5091509150611e828282604051806060016040528060278152602001612bcd60279139611ee0565b95945050505050565b600082815260656020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6108f88282611550565b60608315611eef57508161082f565b825115611eff5782518084602001fd5b8160405162461bcd60e51b81526004016108e59190612a49565b80356001600160a01b0381168114611f3057600080fd5b919050565b60008083601f840112611f4757600080fd5b5081356001600160401b03811115611f5e57600080fd5b602083019150836020828501011115611f7657600080fd5b9250929050565b600080600080600080600060c0888a031215611f9857600080fd5b611fa188611f19565b96506020880135955060408801356001600160401b03811115611fc357600080fd5b611fcf8a828b01611f35565b989b979a50986060810135976080820135975060a09091013595509350505050565b60006020828403121561200357600080fd5b81356001600160e01b03198116811461082f57600080fd5b60008060008060008060a0878903121561203457600080fd5b61203d87611f19565b95506020870135945060408701356001600160401b0381111561205f57600080fd5b61206b89828a01611f35565b979a9699509760608101359660809091013595509350505050565b60006020828403121561209857600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156120dd576120dd61209f565b604052919050565b600082601f8301126120f657600080fd5b81356001600160401b0381111561210f5761210f61209f565b612122601f8201601f19166020016120b5565b81815284602083860101111561213757600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561216a57600080fd5b61217385611f19565b935061218160208601611f19565b92506040850135915060608501356001600160401b038111156121a357600080fd5b6121af878288016120e5565b91505092959194509250565b600080604083850312156121ce57600080fd5b823591506121de60208401611f19565b90509250929050565b6000602082840312156121f957600080fd5b61082f82611f19565b6000806040838503121561221557600080fd5b61221e83611f19565b915060208301356001600160401b0381111561223957600080fd5b612245858286016120e5565b9150509250929050565b60006001600160401b038211156122685761226861209f565b5060051b60200190565b600082601f83011261228357600080fd5b813560206122986122938361224f565b6120b5565b82815260059290921b840181019181810190868411156122b757600080fd5b8286015b848110156122d9576122cc81611f19565b83529183019183016122bb565b509695505050505050565b6000806000606084860312156122f957600080fd5b8335925060208401356001600160401b038082111561231757600080fd5b61232387838801612272565b9350604086013591508082111561233957600080fd5b5061234686828701612272565b9150509250925092565b60008083601f84011261236257600080fd5b5081356001600160401b0381111561237957600080fd5b6020830191508360208260051b8501011115611f7657600080fd5b600080600080600080600080600060c08a8c0312156123b257600080fd5b89356001600160401b03808211156123c957600080fd5b6123d58d838e01612350565b909b50995060208c01359150808211156123ee57600080fd5b6123fa8d838e01612350565b909950975060408c013591508082111561241357600080fd5b506124208c828d01612350565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561246157600080fd5b88356001600160401b038082111561247857600080fd5b6124848c838d01612350565b909a50985060208b013591508082111561249d57600080fd5b6124a98c838d01612350565b909850965060408b01359150808211156124c257600080fd5b506124cf8b828c01612350565b999c989b509699959896976060870135966080013595509350505050565b600082601f8301126124fe57600080fd5b8135602061250e6122938361224f565b82815260059290921b8401810191818101908684111561252d57600080fd5b8286015b848110156122d95780358352918301918301612531565b600080600080600060a0868803121561256057600080fd5b61256986611f19565b945061257760208701611f19565b935060408601356001600160401b038082111561259357600080fd5b61259f89838a016124ed565b945060608801359150808211156125b557600080fd5b6125c189838a016124ed565b935060808801359150808211156125d757600080fd5b506125e4888289016120e5565b9150509295509295909350565b600080600080600060a0868803121561260957600080fd5b61261286611f19565b945061262060208701611f19565b9350604086013592506060860135915060808601356001600160401b0381111561264957600080fd5b6125e4888289016120e5565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60018060a01b038716815285602082015260a0604082015260006126a660a083018688612655565b60608301949094525060800152949350505050565b60018060a01b03851681528360208201526060604082015260006126e3606083018486612655565b9695505050505050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60208082526023908201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d616040820152620e8c6d60eb1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126127f557600080fd5b8301803591506001600160401b0382111561280f57600080fd5b602001915036819003821315611f7657600080fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561284e5761284e612824565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156128d85782840389528135601e1988360301811261289057600080fd5b870180356001600160401b038111156128a857600080fd5b8036038913156128b757600080fd5b6128c48682898501612655565b9a87019a955050509084019060010161286f565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b811015612926576001600160a01b0361291184611f19565b168252602092830192909101906001016128f8565b5083810360208501528881526001600160fb1b0389111561294657600080fd5b8860051b9150818a60208301378181019150506020810160008152602084830301604085015261297781888a612855565b6060850196909652505050608001529695505050505050565b600082198211156129a3576129a3612824565b500190565b60005b838110156129c35781810151838201526020016129ab565b83811115610d4c5750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612a0c8160178501602088016129a8565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612a3d8160288401602088016129a8565b01602801949350505050565b6020815260008251806020840152612a688160408501602087016129a8565b601f01601f19169190910160400192915050565b6020808252602a908201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e206973604082015269206e6f7420726561647960b01b606082015260800190565b8183823760009101908152919050565b600060208284031215612ae857600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000816000190483118215151615612b5457612b54612824565b500290565b600081612b6857612b68612824565b506000190190565b60008251612b828184602087016129a8565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564b09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1d8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e63fd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783a26469706673582212203acd3841c8e64ab5c9cf22cf5f5e1658c2190b9c1a83a630884e4b7f2728623164736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/interfaces/ITheNeed.sol/ITheNeed.dbg.json b/src/contracts/interfaces/ITheNeed.sol/ITheNeed.dbg.json deleted file mode 100644 index 306669b5ad..0000000000 --- a/src/contracts/interfaces/ITheNeed.sol/ITheNeed.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/interfaces/ITheNeed.sol/ITheNeed.json b/src/contracts/interfaces/ITheNeed.sol/ITheNeed.json deleted file mode 100644 index 43528d5bae..0000000000 --- a/src/contracts/interfaces/ITheNeed.sol/ITheNeed.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "ITheNeed", - "sourceName": "contracts/interfaces/ITheNeed.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "_needId", - "type": "uint256" - } - ], - "name": "isNeedMintable", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/interfaces/ITheNeed.sol/InterfaceVoucher.dbg.json b/src/contracts/interfaces/ITheNeed.sol/InterfaceVoucher.dbg.json deleted file mode 100644 index 306669b5ad..0000000000 --- a/src/contracts/interfaces/ITheNeed.sol/InterfaceVoucher.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/interfaces/ITheNeed.sol/InterfaceVoucher.json b/src/contracts/interfaces/ITheNeed.sol/InterfaceVoucher.json deleted file mode 100644 index fa18f31b42..0000000000 --- a/src/contracts/interfaces/ITheNeed.sol/InterfaceVoucher.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "InterfaceVoucher", - "sourceName": "contracts/interfaces/ITheNeed.sol", - "abi": [ - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "needId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "mintValue", - "type": "uint256" - }, - { - "internalType": "string", - "name": "tokenUri", - "type": "string" - }, - { - "internalType": "string", - "name": "content", - "type": "string" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct Voucher", - "name": "voucher", - "type": "tuple" - } - ], - "name": "_verify", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/interfaces/IVoucher.sol/IVoucher.dbg.json b/src/contracts/interfaces/IVoucher.sol/IVoucher.dbg.json deleted file mode 100644 index 9f701ff5f3..0000000000 --- a/src/contracts/interfaces/IVoucher.sol/IVoucher.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../build-info/b6b2d99212a60972d826b69706e35469.json" -} diff --git a/src/contracts/interfaces/IVoucher.sol/IVoucher.json b/src/contracts/interfaces/IVoucher.sol/IVoucher.json deleted file mode 100644 index 2ea1961347..0000000000 --- a/src/contracts/interfaces/IVoucher.sol/IVoucher.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "IVoucher", - "sourceName": "contracts/interfaces/IVoucher.sol", - "abi": [ - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "needId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "mintValue", - "type": "uint256" - }, - { - "internalType": "string", - "name": "tokenUri", - "type": "string" - }, - { - "internalType": "string", - "name": "content", - "type": "string" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct Voucher", - "name": "voucher", - "type": "tuple" - } - ], - "name": "_verify", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/needModule/Need.sol/Need.dbg.json b/src/contracts/needModule/Need.sol/Need.dbg.json deleted file mode 100644 index 306669b5ad..0000000000 --- a/src/contracts/needModule/Need.sol/Need.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/needModule/Need.sol/Need.json b/src/contracts/needModule/Need.sol/Need.json deleted file mode 100644 index 4b11bb46fa..0000000000 --- a/src/contracts/needModule/Need.sol/Need.json +++ /dev/null @@ -1,429 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Need", - "sourceName": "contracts/needModule/Need.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "previousAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "beacon", - "type": "address" - } - ], - "name": "BeaconUpgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "Upgraded", - "type": "event" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TIME_LOCK_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "UPGRADER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fetchNeedRatio", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "ratio", - "type": "string" - }, - { - "internalType": "address", - "name": "timeLock", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_needId", - "type": "uint256" - } - ], - "name": "isNeedMintable", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "proxiableUUID", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_address", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isOperator", - "type": "bool" - } - ], - "name": "setOperator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "newRatio", - "type": "string" - } - ], - "name": "updateNeedRatio", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "upgradeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "upgradeToAndCall", - "outputs": [], - "stateMutability": "payable", - "type": "function" - } - ], - "bytecode": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100e2565b600054610100900460ff161561008e5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100e0576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516116976101196000396000818161043d0152818161047d0152818161051d0152818161055d01526105ec01526116976000f3fe6080604052600436106100fe5760003560e01c80637ab4339d11610095578063cda7e7ba11610064578063cda7e7ba14610296578063cebf5c2e146102ca578063d547741f146102ea578063e2375f231461030a578063f72c0d8b1461032c57600080fd5b80637ab4339d1461022057806391d14854146102405780639e60e75314610260578063a217fddf1461028157600080fd5b80633659cfe6116100d15780633659cfe6146101b85780634f1ef286146101d857806352d1902d146101eb578063558a72971461020057600080fd5b806301ffc9a714610103578063248a9ca3146101385780632f2ff15d1461017657806336568abe14610198575b600080fd5b34801561010f57600080fd5b5061012361011e366004611132565b61034e565b60405190151581526020015b60405180910390f35b34801561014457600080fd5b5061016861015336600461115c565b60009081526065602052604090206001015490565b60405190815260200161012f565b34801561018257600080fd5b50610196610191366004611191565b610385565b005b3480156101a457600080fd5b506101966101b3366004611191565b6103af565b3480156101c457600080fd5b506101966101d33660046111bd565b610432565b6101966101e6366004611264565b610512565b3480156101f757600080fd5b506101686105df565b34801561020c57600080fd5b5061019661021b3660046112c6565b610692565b34801561022c57600080fd5b5061019661023b366004611322565b6106d6565b34801561024c57600080fd5b5061012361025b366004611191565b610849565b34801561026c57600080fd5b5061012361027b36600461115c565b50600190565b34801561028d57600080fd5b50610168600081565b3480156102a257600080fd5b506101687f51f7cbaceb42eeb75cf97e030c803852f4c737abd110974f97c5041520a281fd81565b3480156102d657600080fd5b506101966102e5366004611367565b610874565b3480156102f657600080fd5b50610196610305366004611191565b6108b1565b34801561031657600080fd5b5061031f6108d6565b60405161012f91906113d0565b34801561033857600080fd5b506101686000805160206115fb83398151915281565b60006001600160e01b03198216637965db0b60e01b148061037f57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000828152606560205260409020600101546103a081610968565b6103aa8383610972565b505050565b6001600160a01b03811633146104245760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61042e82826109f8565b5050565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561047b5760405162461bcd60e51b815260040161041b90611403565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166104c460008051602061161b833981519152546001600160a01b031690565b6001600160a01b0316146104ea5760405162461bcd60e51b815260040161041b9061144f565b6104f381610a5f565b6040805160008082526020820190925261050f91839190610a77565b50565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561055b5760405162461bcd60e51b815260040161041b90611403565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166105a460008051602061161b833981519152546001600160a01b031690565b6001600160a01b0316146105ca5760405162461bcd60e51b815260040161041b9061144f565b6105d382610a5f565b61042e82826001610a77565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461067f5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161041b565b5060008051602061161b83398151915290565b6000805160206115fb8339815191526106aa81610968565b506001600160a01b0391909116600090815260fd60205260409020805460ff1916911515919091179055565b600054610100900460ff16158080156106f65750600054600160ff909116105b806107105750303b158015610710575060005460ff166001145b6107735760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161041b565b6000805460ff191660011790558015610796576000805461ff0019166101001790555b61079e610bf1565b6107a9600033610972565b6107c16000805160206115fb83398151915233610972565b6107eb7f51f7cbaceb42eeb75cf97e030c803852f4c737abd110974f97c5041520a281fd83610972565b82516107fe9060fb906020860190611099565b5080156103aa576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b7f51f7cbaceb42eeb75cf97e030c803852f4c737abd110974f97c5041520a281fd61089e81610968565b81516103aa9060fb906020850190611099565b6000828152606560205260409020600101546108cc81610968565b6103aa83836109f8565b606060fb80546108e59061149b565b80601f01602080910402602001604051908101604052809291908181526020018280546109119061149b565b801561095e5780601f106109335761010080835404028352916020019161095e565b820191906000526020600020905b81548152906001019060200180831161094157829003601f168201915b5050505050905090565b61050f8133610c5e565b61097c8282610849565b61042e5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556109b43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610a028282610849565b1561042e5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000805160206115fb83398151915261042e81610968565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610aaa576103aa83610cc2565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ae357600080fd5b505afa925050508015610b13575060408051601f3d908101601f19168201909252610b10918101906114d6565b60015b610b765760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161041b565b60008051602061161b8339815191528114610be55760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161041b565b506103aa838383610d5e565b600054610100900460ff16610c5c5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161041b565b565b610c688282610849565b61042e57610c80816001600160a01b03166014610d89565b610c8b836020610d89565b604051602001610c9c9291906114ef565b60408051601f198184030181529082905262461bcd60e51b825261041b916004016113d0565b6001600160a01b0381163b610d2f5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161041b565b60008051602061161b83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b610d6783610f2c565b600082511180610d745750805b156103aa57610d838383610f6c565b50505050565b60606000610d9883600261157a565b610da3906002611599565b67ffffffffffffffff811115610dbb57610dbb6111d8565b6040519080825280601f01601f191660200182016040528015610de5576020820181803683370190505b509050600360fc1b81600081518110610e0057610e006115b1565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610e2f57610e2f6115b1565b60200101906001600160f81b031916908160001a9053506000610e5384600261157a565b610e5e906001611599565b90505b6001811115610ed6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610e9257610e926115b1565b1a60f81b828281518110610ea857610ea86115b1565b60200101906001600160f81b031916908160001a90535060049490941c93610ecf816115c7565b9050610e61565b508315610f255760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161041b565b9392505050565b610f3581610cc2565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b610fd45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161041b565b600080846001600160a01b031684604051610fef91906115de565b600060405180830381855af49150503d806000811461102a576040519150601f19603f3d011682016040523d82523d6000602084013e61102f565b606091505b5091509150611057828260405180606001604052806027815260200161163b60279139611060565b95945050505050565b6060831561106f575081610f25565b82511561107f5782518084602001fd5b8160405162461bcd60e51b815260040161041b91906113d0565b8280546110a59061149b565b90600052602060002090601f0160209004810192826110c7576000855561110d565b82601f106110e057805160ff191683800117855561110d565b8280016001018555821561110d579182015b8281111561110d5782518255916020019190600101906110f2565b5061111992915061111d565b5090565b5b80821115611119576000815560010161111e565b60006020828403121561114457600080fd5b81356001600160e01b031981168114610f2557600080fd5b60006020828403121561116e57600080fd5b5035919050565b80356001600160a01b038116811461118c57600080fd5b919050565b600080604083850312156111a457600080fd5b823591506111b460208401611175565b90509250929050565b6000602082840312156111cf57600080fd5b610f2582611175565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115611209576112096111d8565b604051601f8501601f19908116603f01168101908282118183101715611231576112316111d8565b8160405280935085815286868601111561124a57600080fd5b858560208301376000602087830101525050509392505050565b6000806040838503121561127757600080fd5b61128083611175565b9150602083013567ffffffffffffffff81111561129c57600080fd5b8301601f810185136112ad57600080fd5b6112bc858235602084016111ee565b9150509250929050565b600080604083850312156112d957600080fd5b6112e283611175565b9150602083013580151581146112f757600080fd5b809150509250929050565b600082601f83011261131357600080fd5b610f25838335602085016111ee565b6000806040838503121561133557600080fd5b823567ffffffffffffffff81111561134c57600080fd5b61135885828601611302565b9250506111b460208401611175565b60006020828403121561137957600080fd5b813567ffffffffffffffff81111561139057600080fd5b61139c84828501611302565b949350505050565b60005b838110156113bf5781810151838201526020016113a7565b83811115610d835750506000910152565b60208152600082518060208401526113ef8160408501602087016113a4565b601f01601f19169190910160400192915050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b600181811c908216806114af57607f821691505b602082108114156114d057634e487b7160e01b600052602260045260246000fd5b50919050565b6000602082840312156114e857600080fd5b5051919050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516115278160178501602088016113a4565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516115588160288401602088016113a4565b01602801949350505050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561159457611594611564565b500290565b600082198211156115ac576115ac611564565b500190565b634e487b7160e01b600052603260045260246000fd5b6000816115d6576115d6611564565b506000190190565b600082516115f08184602087016113a4565b919091019291505056fe189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e3360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122015fadb6195e685c6dcd484af25305e6bbaca6708d40fd99692b95407d60ecd3f64736f6c63430008090033", - "deployedBytecode": "0x6080604052600436106100fe5760003560e01c80637ab4339d11610095578063cda7e7ba11610064578063cda7e7ba14610296578063cebf5c2e146102ca578063d547741f146102ea578063e2375f231461030a578063f72c0d8b1461032c57600080fd5b80637ab4339d1461022057806391d14854146102405780639e60e75314610260578063a217fddf1461028157600080fd5b80633659cfe6116100d15780633659cfe6146101b85780634f1ef286146101d857806352d1902d146101eb578063558a72971461020057600080fd5b806301ffc9a714610103578063248a9ca3146101385780632f2ff15d1461017657806336568abe14610198575b600080fd5b34801561010f57600080fd5b5061012361011e366004611132565b61034e565b60405190151581526020015b60405180910390f35b34801561014457600080fd5b5061016861015336600461115c565b60009081526065602052604090206001015490565b60405190815260200161012f565b34801561018257600080fd5b50610196610191366004611191565b610385565b005b3480156101a457600080fd5b506101966101b3366004611191565b6103af565b3480156101c457600080fd5b506101966101d33660046111bd565b610432565b6101966101e6366004611264565b610512565b3480156101f757600080fd5b506101686105df565b34801561020c57600080fd5b5061019661021b3660046112c6565b610692565b34801561022c57600080fd5b5061019661023b366004611322565b6106d6565b34801561024c57600080fd5b5061012361025b366004611191565b610849565b34801561026c57600080fd5b5061012361027b36600461115c565b50600190565b34801561028d57600080fd5b50610168600081565b3480156102a257600080fd5b506101687f51f7cbaceb42eeb75cf97e030c803852f4c737abd110974f97c5041520a281fd81565b3480156102d657600080fd5b506101966102e5366004611367565b610874565b3480156102f657600080fd5b50610196610305366004611191565b6108b1565b34801561031657600080fd5b5061031f6108d6565b60405161012f91906113d0565b34801561033857600080fd5b506101686000805160206115fb83398151915281565b60006001600160e01b03198216637965db0b60e01b148061037f57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000828152606560205260409020600101546103a081610968565b6103aa8383610972565b505050565b6001600160a01b03811633146104245760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61042e82826109f8565b5050565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561047b5760405162461bcd60e51b815260040161041b90611403565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166104c460008051602061161b833981519152546001600160a01b031690565b6001600160a01b0316146104ea5760405162461bcd60e51b815260040161041b9061144f565b6104f381610a5f565b6040805160008082526020820190925261050f91839190610a77565b50565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561055b5760405162461bcd60e51b815260040161041b90611403565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166105a460008051602061161b833981519152546001600160a01b031690565b6001600160a01b0316146105ca5760405162461bcd60e51b815260040161041b9061144f565b6105d382610a5f565b61042e82826001610a77565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461067f5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161041b565b5060008051602061161b83398151915290565b6000805160206115fb8339815191526106aa81610968565b506001600160a01b0391909116600090815260fd60205260409020805460ff1916911515919091179055565b600054610100900460ff16158080156106f65750600054600160ff909116105b806107105750303b158015610710575060005460ff166001145b6107735760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161041b565b6000805460ff191660011790558015610796576000805461ff0019166101001790555b61079e610bf1565b6107a9600033610972565b6107c16000805160206115fb83398151915233610972565b6107eb7f51f7cbaceb42eeb75cf97e030c803852f4c737abd110974f97c5041520a281fd83610972565b82516107fe9060fb906020860190611099565b5080156103aa576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b7f51f7cbaceb42eeb75cf97e030c803852f4c737abd110974f97c5041520a281fd61089e81610968565b81516103aa9060fb906020850190611099565b6000828152606560205260409020600101546108cc81610968565b6103aa83836109f8565b606060fb80546108e59061149b565b80601f01602080910402602001604051908101604052809291908181526020018280546109119061149b565b801561095e5780601f106109335761010080835404028352916020019161095e565b820191906000526020600020905b81548152906001019060200180831161094157829003601f168201915b5050505050905090565b61050f8133610c5e565b61097c8282610849565b61042e5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556109b43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610a028282610849565b1561042e5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000805160206115fb83398151915261042e81610968565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610aaa576103aa83610cc2565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ae357600080fd5b505afa925050508015610b13575060408051601f3d908101601f19168201909252610b10918101906114d6565b60015b610b765760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161041b565b60008051602061161b8339815191528114610be55760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161041b565b506103aa838383610d5e565b600054610100900460ff16610c5c5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161041b565b565b610c688282610849565b61042e57610c80816001600160a01b03166014610d89565b610c8b836020610d89565b604051602001610c9c9291906114ef565b60408051601f198184030181529082905262461bcd60e51b825261041b916004016113d0565b6001600160a01b0381163b610d2f5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161041b565b60008051602061161b83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b610d6783610f2c565b600082511180610d745750805b156103aa57610d838383610f6c565b50505050565b60606000610d9883600261157a565b610da3906002611599565b67ffffffffffffffff811115610dbb57610dbb6111d8565b6040519080825280601f01601f191660200182016040528015610de5576020820181803683370190505b509050600360fc1b81600081518110610e0057610e006115b1565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610e2f57610e2f6115b1565b60200101906001600160f81b031916908160001a9053506000610e5384600261157a565b610e5e906001611599565b90505b6001811115610ed6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610e9257610e926115b1565b1a60f81b828281518110610ea857610ea86115b1565b60200101906001600160f81b031916908160001a90535060049490941c93610ecf816115c7565b9050610e61565b508315610f255760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161041b565b9392505050565b610f3581610cc2565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b610fd45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161041b565b600080846001600160a01b031684604051610fef91906115de565b600060405180830381855af49150503d806000811461102a576040519150601f19603f3d011682016040523d82523d6000602084013e61102f565b606091505b5091509150611057828260405180606001604052806027815260200161163b60279139611060565b95945050505050565b6060831561106f575081610f25565b82511561107f5782518084602001fd5b8160405162461bcd60e51b815260040161041b91906113d0565b8280546110a59061149b565b90600052602060002090601f0160209004810192826110c7576000855561110d565b82601f106110e057805160ff191683800117855561110d565b8280016001018555821561110d579182015b8281111561110d5782518255916020019190600101906110f2565b5061111992915061111d565b5090565b5b80821115611119576000815560010161111e565b60006020828403121561114457600080fd5b81356001600160e01b031981168114610f2557600080fd5b60006020828403121561116e57600080fd5b5035919050565b80356001600160a01b038116811461118c57600080fd5b919050565b600080604083850312156111a457600080fd5b823591506111b460208401611175565b90509250929050565b6000602082840312156111cf57600080fd5b610f2582611175565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115611209576112096111d8565b604051601f8501601f19908116603f01168101908282118183101715611231576112316111d8565b8160405280935085815286868601111561124a57600080fd5b858560208301376000602087830101525050509392505050565b6000806040838503121561127757600080fd5b61128083611175565b9150602083013567ffffffffffffffff81111561129c57600080fd5b8301601f810185136112ad57600080fd5b6112bc858235602084016111ee565b9150509250929050565b600080604083850312156112d957600080fd5b6112e283611175565b9150602083013580151581146112f757600080fd5b809150509250929050565b600082601f83011261131357600080fd5b610f25838335602085016111ee565b6000806040838503121561133557600080fd5b823567ffffffffffffffff81111561134c57600080fd5b61135885828601611302565b9250506111b460208401611175565b60006020828403121561137957600080fd5b813567ffffffffffffffff81111561139057600080fd5b61139c84828501611302565b949350505050565b60005b838110156113bf5781810151838201526020016113a7565b83811115610d835750506000910152565b60208152600082518060208401526113ef8160408501602087016113a4565b601f01601f19169190910160400192915050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b600181811c908216806114af57607f821691505b602082108114156114d057634e487b7160e01b600052602260045260246000fd5b50919050565b6000602082840312156114e857600080fd5b5051919050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516115278160178501602088016113a4565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516115588160288401602088016113a4565b01602801949350505050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561159457611594611564565b500290565b600082198211156115ac576115ac611564565b500190565b634e487b7160e01b600052603260045260246000fd5b6000816115d6576115d6611564565b506000190190565b600082516115f08184602087016113a4565b919091019291505056fe189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e3360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122015fadb6195e685c6dcd484af25305e6bbaca6708d40fd99692b95407d60ecd3f64736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/needModule/VerifyVoucher.sol/VerifyVoucher.dbg.json b/src/contracts/needModule/VerifyVoucher.sol/VerifyVoucher.dbg.json new file mode 100644 index 0000000000..f698fc8477 --- /dev/null +++ b/src/contracts/needModule/VerifyVoucher.sol/VerifyVoucher.dbg.json @@ -0,0 +1,4 @@ +{ + "_format": "hh-sol-dbg-1", + "buildInfo": "../../../build-info/c517f7870bec43a53aa05f8e650a033c.json" +} diff --git a/src/contracts/needModule/VerifyVoucher.sol/VerifyVoucher.json b/src/contracts/needModule/VerifyVoucher.sol/VerifyVoucher.json new file mode 100644 index 0000000000..9ed3aa1708 --- /dev/null +++ b/src/contracts/needModule/VerifyVoucher.sol/VerifyVoucher.json @@ -0,0 +1,100 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "VerifyVoucher", + "sourceName": "contracts/needModule/VerifyVoucher.sol", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "needId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "title", + "type": "string" + }, + { + "internalType": "string", + "name": "category", + "type": "string" + }, + { + "internalType": "uint256", + "name": "paid", + "type": "uint256" + }, + { + "internalType": "string", + "name": "deliveryCode", + "type": "string" + }, + { + "internalType": "string", + "name": "child", + "type": "string" + }, + { + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "internalType": "bytes", + "name": "swSignature", + "type": "bytes" + }, + { + "internalType": "string", + "name": "role", + "type": "string" + }, + { + "internalType": "string", + "name": "content", + "type": "string" + } + ], + "internalType": "struct INeedStorage.InitialVoucher", + "name": "_voucher", + "type": "tuple" + } + ], + "name": "_verify", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getChainID", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x61014060405234801561001157600080fd5b5060408051808201825260078152665341592d44414f60c81b6020808301918252835180850190945260018452603160f81b908401528151902060e08190527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66101008190524660a0529192917f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6100ee8184846040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b6080523060c052610120525061010392505050565b60805160a05160c05160e051610100516101205161071f61015260003960006104df0152600061052e01526000610509015260006104620152600061048c015260006104b6015261071f6000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063564b81ef1461003b5780635fc2cf721461004e575b600080fd5b6040514681526020015b60405180910390f35b61006161005c366004610640565b610079565b6040516001600160a01b039091168152602001610045565b600080610085836100d9565b90506100d28161009860e086018661067c565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061024792505050565b9392505050565b60006102417f879a2da0e633cdda60fc9c89e94da079f111b4c997c144d4316e52c976073db7833561010e602086018661067c565b60405161011c9291906106c3565b6040518091039020858060400190610134919061067c565b6040516101429291906106c3565b604051908190039020606087013561015d608089018961067c565b60405161016b9291906106c3565b60405190819003902061018160a08a018a61067c565b60405161018f9291906106c3565b6040519081900390206101a66101008b018b61067c565b6040516101b49291906106c3565b6040519081900390206101cb6101208c018c61067c565b6040516101d99291906106c3565b60408051918290038220602083019a909a528101979097526060870195909552608086019390935260a085019190915260c084015260e0830152610100820152610120810191909152610140016040516020818303038152906040528051906020012061026b565b92915050565b600080600061025685856102b9565b91509150610263816102ff565b509392505050565b6000610241610278610455565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000808251604114156102f05760208301516040840151606085015160001a6102e48782858561057c565b945094505050506102f8565b506000905060025b9250929050565b6000816004811115610313576103136106d3565b141561031c5750565b6001816004811115610330576103306106d3565b14156103835760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064015b60405180910390fd5b6002816004811115610397576103976106d3565b14156103e55760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161037a565b60038160048111156103f9576103f96106d3565b14156104525760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161037a565b50565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480156104ae57507f000000000000000000000000000000000000000000000000000000000000000046145b156104d857507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156105b35750600090506003610637565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610607573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661063057600060019250925050610637565b9150600090505b94509492505050565b60006020828403121561065257600080fd5b813567ffffffffffffffff81111561066957600080fd5b820161014081850312156100d257600080fd5b6000808335601e1984360301811261069357600080fd5b83018035915067ffffffffffffffff8211156106ae57600080fd5b6020019150368190038213156102f857600080fd5b8183823760009101908152919050565b634e487b7160e01b600052602160045260246000fdfea264697066735822122003932bea300b06f246bf0260511c5c6897f19cca9b417f1d0bc3771b5e93f47c64736f6c63430008090033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063564b81ef1461003b5780635fc2cf721461004e575b600080fd5b6040514681526020015b60405180910390f35b61006161005c366004610640565b610079565b6040516001600160a01b039091168152602001610045565b600080610085836100d9565b90506100d28161009860e086018661067c565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061024792505050565b9392505050565b60006102417f879a2da0e633cdda60fc9c89e94da079f111b4c997c144d4316e52c976073db7833561010e602086018661067c565b60405161011c9291906106c3565b6040518091039020858060400190610134919061067c565b6040516101429291906106c3565b604051908190039020606087013561015d608089018961067c565b60405161016b9291906106c3565b60405190819003902061018160a08a018a61067c565b60405161018f9291906106c3565b6040519081900390206101a66101008b018b61067c565b6040516101b49291906106c3565b6040519081900390206101cb6101208c018c61067c565b6040516101d99291906106c3565b60408051918290038220602083019a909a528101979097526060870195909552608086019390935260a085019190915260c084015260e0830152610100820152610120810191909152610140016040516020818303038152906040528051906020012061026b565b92915050565b600080600061025685856102b9565b91509150610263816102ff565b509392505050565b6000610241610278610455565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000808251604114156102f05760208301516040840151606085015160001a6102e48782858561057c565b945094505050506102f8565b506000905060025b9250929050565b6000816004811115610313576103136106d3565b141561031c5750565b6001816004811115610330576103306106d3565b14156103835760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064015b60405180910390fd5b6002816004811115610397576103976106d3565b14156103e55760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161037a565b60038160048111156103f9576103f96106d3565b14156104525760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161037a565b50565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480156104ae57507f000000000000000000000000000000000000000000000000000000000000000046145b156104d857507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156105b35750600090506003610637565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610607573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661063057600060019250925050610637565b9150600090505b94509492505050565b60006020828403121561065257600080fd5b813567ffffffffffffffff81111561066957600080fd5b820161014081850312156100d257600080fd5b6000808335601e1984360301811261069357600080fd5b83018035915067ffffffffffffffff8211156106ae57600080fd5b6020019150368190038213156102f857600080fd5b8183823760009101908152919050565b634e487b7160e01b600052602160045260246000fdfea264697066735822122003932bea300b06f246bf0260511c5c6897f19cca9b417f1d0bc3771b5e93f47c64736f6c63430008090033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/src/contracts/network-settings.json b/src/contracts/network-settings.json index 1e231964d7..c542ea78a1 100644 --- a/src/contracts/network-settings.json +++ b/src/contracts/network-settings.json @@ -1,3 +1,4 @@ { - "verifyContractAddress": "0xa2C97eDE74Fac8B8C1D39622E5EA2de180bCB621" -} \ No newline at end of file + "sepolia": { "verifyVoucherAddress": "0x1699378878CF5864E1bc3D88c4eA55E3a8A466FA" }, + "mainnet": { "verifyVoucherAddress": "0xAe9ae5ACdad18927Bd039ebBFDB8E3be4dbf5De3" } +} diff --git a/src/contracts/tokens/ERC20/SayToken.sol/SAY.dbg.json b/src/contracts/tokens/ERC20/SayToken.sol/SAY.dbg.json deleted file mode 100644 index f625e04e2b..0000000000 --- a/src/contracts/tokens/ERC20/SayToken.sol/SAY.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/tokens/ERC20/SayToken.sol/SAY.json b/src/contracts/tokens/ERC20/SayToken.sol/SAY.json deleted file mode 100644 index 4bec604dc3..0000000000 --- a/src/contracts/tokens/ERC20/SayToken.sol/SAY.json +++ /dev/null @@ -1,549 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "SAY", - "sourceName": "contracts/tokens/ERC20/SayToken.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "previousAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "beacon", - "type": "address" - } - ], - "name": "BeaconUpgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "Upgraded", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "burnFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "proxiableUUID", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "upgradeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "upgradeToAndCall", - "outputs": [], - "stateMutability": "payable", - "type": "function" - } - ], - "bytecode": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100e2565b600054610100900460ff161561008e5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100e0576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b608051611c176101196000396000818161050a01528181610553015281816106470152818161068701526107160152611c176000f3fe60806040526004361061014b5760003560e01c80635c975abb116100b65780638da5cb5b1161006f5780638da5cb5b1461037257806395d89b411461039a578063a457c2d7146103af578063a9059cbb146103cf578063dd62ed3e146103ef578063f2fde38b1461040f57600080fd5b80635c975abb146102c557806370a08231146102dd578063715018a61461031357806379cc6790146103285780638129fc1c146103485780638456cb591461035d57600080fd5b8063395093511161010857806339509351146102285780633f4ba83a1461024857806340c10f191461025d57806342966c681461027d5780634f1ef2861461029d57806352d1902d146102b057600080fd5b806306fdde0314610150578063095ea7b31461017b57806318160ddd146101ab57806323b872dd146101ca578063313ce567146101ea5780633659cfe614610206575b600080fd5b34801561015c57600080fd5b5061016561042f565b604051610172919061180e565b60405180910390f35b34801561018757600080fd5b5061019b61019636600461185d565b6104c1565b6040519015158152602001610172565b3480156101b757600080fd5b506035545b604051908152602001610172565b3480156101d657600080fd5b5061019b6101e5366004611887565b6104d9565b3480156101f657600080fd5b5060405160128152602001610172565b34801561021257600080fd5b506102266102213660046118c3565b6104ff565b005b34801561023457600080fd5b5061019b61024336600461185d565b6105e8565b34801561025457600080fd5b5061022661060a565b34801561026957600080fd5b5061022661027836600461185d565b61061c565b34801561028957600080fd5b506102266102983660046118de565b610632565b6102266102ab36600461190d565b61063c565b3480156102bc57600080fd5b506101bc610709565b3480156102d157600080fd5b5060975460ff1661019b565b3480156102e957600080fd5b506101bc6102f83660046118c3565b6001600160a01b031660009081526033602052604090205490565b34801561031f57600080fd5b506102266107bc565b34801561033457600080fd5b5061022661034336600461185d565b6107ce565b34801561035457600080fd5b506102266107e3565b34801561036957600080fd5b5061022661094b565b34801561037e57600080fd5b5060c9546040516001600160a01b039091168152602001610172565b3480156103a657600080fd5b5061016561095b565b3480156103bb57600080fd5b5061019b6103ca36600461185d565b61096a565b3480156103db57600080fd5b5061019b6103ea36600461185d565b6109f0565b3480156103fb57600080fd5b506101bc61040a3660046119cf565b6109fe565b34801561041b57600080fd5b5061022661042a3660046118c3565b610a29565b60606036805461043e90611a02565b80601f016020809104026020016040519081016040528092919081815260200182805461046a90611a02565b80156104b75780601f1061048c576101008083540402835291602001916104b7565b820191906000526020600020905b81548152906001019060200180831161049a57829003601f168201915b5050505050905090565b6000336104cf818585610a9f565b5060019392505050565b6000336104e7858285610bc3565b6104f2858585610c3d565b60019150505b9392505050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156105515760405162461bcd60e51b815260040161054890611a3d565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661059a600080516020611b9b833981519152546001600160a01b031690565b6001600160a01b0316146105c05760405162461bcd60e51b815260040161054890611a89565b6105c981610e16565b604080516000808252602082019092526105e591839190610e1e565b50565b6000336104cf8185856105fb83836109fe565b6106059190611aeb565b610a9f565b610612610f9d565b61061a610ff7565b565b610624610f9d565b61062e8282611049565b5050565b6105e53382611134565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156106855760405162461bcd60e51b815260040161054890611a3d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166106ce600080516020611b9b833981519152546001600160a01b031690565b6001600160a01b0316146106f45760405162461bcd60e51b815260040161054890611a89565b6106fd82610e16565b61062e82826001610e1e565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107a95760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610548565b50600080516020611b9b83398151915290565b6107c4610f9d565b61061a600061128e565b6107d9823383610bc3565b61062e8282611134565b600054610100900460ff16158080156108035750600054600160ff909116105b8061081d5750303b15801561081d575060005460ff166001145b6108805760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610548565b6000805460ff1916600117905580156108a3576000805461ff0019166101001790555b6108e36040518060400160405280600381526020016253415960e81b8152506040518060400160405280600381526020016253415960e81b8152506112e0565b6108eb611311565b6108f3611338565b6108fb611367565b610903611311565b80156105e5576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b610953610f9d565b61061a611396565b60606037805461043e90611a02565b6000338161097882866109fe565b9050838110156109d85760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610548565b6109e58286868403610a9f565b506001949350505050565b6000336104cf818585610c3d565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b610a31610f9d565b6001600160a01b038116610a965760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610548565b6105e58161128e565b6001600160a01b038316610b015760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610548565b6001600160a01b038216610b625760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610548565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610bcf84846109fe565b90506000198114610c375781811015610c2a5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610548565b610c378484848403610a9f565b50505050565b6001600160a01b038316610ca15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610548565b6001600160a01b038216610d035760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610548565b610d0e8383836113d3565b6001600160a01b03831660009081526033602052604090205481811015610d865760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610548565b6001600160a01b03808516600090815260336020526040808220858503905591851681529081208054849290610dbd908490611aeb565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610e0991815260200190565b60405180910390a3610c37565b6105e5610f9d565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610e5657610e51836113db565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e8f57600080fd5b505afa925050508015610ebf575060408051601f3d908101601f19168201909252610ebc91810190611b03565b60015b610f225760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610548565b600080516020611b9b8339815191528114610f915760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610548565b50610e51838383611477565b60c9546001600160a01b0316331461061a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610548565b610fff61149c565b6097805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b03821661109f5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610548565b6110ab600083836113d3565b80603560008282546110bd9190611aeb565b90915550506001600160a01b038216600090815260336020526040812080548392906110ea908490611aeb565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b0382166111945760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610548565b6111a0826000836113d3565b6001600160a01b038216600090815260336020526040902054818110156112145760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610548565b6001600160a01b0383166000908152603360205260408120838303905560358054849290611243908490611b1c565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166113075760405162461bcd60e51b815260040161054890611b33565b61062e82826114e5565b600054610100900460ff1661061a5760405162461bcd60e51b815260040161054890611b33565b600054610100900460ff1661135f5760405162461bcd60e51b815260040161054890611b33565b61061a611533565b600054610100900460ff1661138e5760405162461bcd60e51b815260040161054890611b33565b61061a611566565b61139e611596565b6097805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861102c3390565b610e51611596565b6001600160a01b0381163b6114485760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610548565b600080516020611b9b83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b611480836115dc565b60008251118061148d5750805b15610e5157610c37838361161c565b60975460ff1661061a5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610548565b600054610100900460ff1661150c5760405162461bcd60e51b815260040161054890611b33565b815161151f906036906020850190611749565b508051610e51906037906020840190611749565b600054610100900460ff1661155a5760405162461bcd60e51b815260040161054890611b33565b6097805460ff19169055565b600054610100900460ff1661158d5760405162461bcd60e51b815260040161054890611b33565b61061a3361128e565b60975460ff161561061a5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610548565b6115e5816113db565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6116845760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610548565b600080846001600160a01b03168460405161169f9190611b7e565b600060405180830381855af49150503d80600081146116da576040519150601f19603f3d011682016040523d82523d6000602084013e6116df565b606091505b50915091506117078282604051806060016040528060278152602001611bbb60279139611710565b95945050505050565b6060831561171f5750816104f8565b82511561172f5782518084602001fd5b8160405162461bcd60e51b8152600401610548919061180e565b82805461175590611a02565b90600052602060002090601f01602090048101928261177757600085556117bd565b82601f1061179057805160ff19168380011785556117bd565b828001600101855582156117bd579182015b828111156117bd5782518255916020019190600101906117a2565b506117c99291506117cd565b5090565b5b808211156117c957600081556001016117ce565b60005b838110156117fd5781810151838201526020016117e5565b83811115610c375750506000910152565b602081526000825180602084015261182d8160408501602087016117e2565b601f01601f19169190910160400192915050565b80356001600160a01b038116811461185857600080fd5b919050565b6000806040838503121561187057600080fd5b61187983611841565b946020939093013593505050565b60008060006060848603121561189c57600080fd5b6118a584611841565b92506118b360208501611841565b9150604084013590509250925092565b6000602082840312156118d557600080fd5b6104f882611841565b6000602082840312156118f057600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561192057600080fd5b61192983611841565b9150602083013567ffffffffffffffff8082111561194657600080fd5b818501915085601f83011261195a57600080fd5b81358181111561196c5761196c6118f7565b604051601f8201601f19908116603f01168101908382118183101715611994576119946118f7565b816040528281528860208487010111156119ad57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b600080604083850312156119e257600080fd5b6119eb83611841565b91506119f960208401611841565b90509250929050565b600181811c90821680611a1657607f821691505b60208210811415611a3757634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60008219821115611afe57611afe611ad5565b500190565b600060208284031215611b1557600080fd5b5051919050565b600082821015611b2e57611b2e611ad5565b500390565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251611b908184602087016117e2565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212204b1daafe1e9c601b499afcf4ca2371d34d4a08b662c245711ea273e1887c16f364736f6c63430008090033", - "deployedBytecode": "0x60806040526004361061014b5760003560e01c80635c975abb116100b65780638da5cb5b1161006f5780638da5cb5b1461037257806395d89b411461039a578063a457c2d7146103af578063a9059cbb146103cf578063dd62ed3e146103ef578063f2fde38b1461040f57600080fd5b80635c975abb146102c557806370a08231146102dd578063715018a61461031357806379cc6790146103285780638129fc1c146103485780638456cb591461035d57600080fd5b8063395093511161010857806339509351146102285780633f4ba83a1461024857806340c10f191461025d57806342966c681461027d5780634f1ef2861461029d57806352d1902d146102b057600080fd5b806306fdde0314610150578063095ea7b31461017b57806318160ddd146101ab57806323b872dd146101ca578063313ce567146101ea5780633659cfe614610206575b600080fd5b34801561015c57600080fd5b5061016561042f565b604051610172919061180e565b60405180910390f35b34801561018757600080fd5b5061019b61019636600461185d565b6104c1565b6040519015158152602001610172565b3480156101b757600080fd5b506035545b604051908152602001610172565b3480156101d657600080fd5b5061019b6101e5366004611887565b6104d9565b3480156101f657600080fd5b5060405160128152602001610172565b34801561021257600080fd5b506102266102213660046118c3565b6104ff565b005b34801561023457600080fd5b5061019b61024336600461185d565b6105e8565b34801561025457600080fd5b5061022661060a565b34801561026957600080fd5b5061022661027836600461185d565b61061c565b34801561028957600080fd5b506102266102983660046118de565b610632565b6102266102ab36600461190d565b61063c565b3480156102bc57600080fd5b506101bc610709565b3480156102d157600080fd5b5060975460ff1661019b565b3480156102e957600080fd5b506101bc6102f83660046118c3565b6001600160a01b031660009081526033602052604090205490565b34801561031f57600080fd5b506102266107bc565b34801561033457600080fd5b5061022661034336600461185d565b6107ce565b34801561035457600080fd5b506102266107e3565b34801561036957600080fd5b5061022661094b565b34801561037e57600080fd5b5060c9546040516001600160a01b039091168152602001610172565b3480156103a657600080fd5b5061016561095b565b3480156103bb57600080fd5b5061019b6103ca36600461185d565b61096a565b3480156103db57600080fd5b5061019b6103ea36600461185d565b6109f0565b3480156103fb57600080fd5b506101bc61040a3660046119cf565b6109fe565b34801561041b57600080fd5b5061022661042a3660046118c3565b610a29565b60606036805461043e90611a02565b80601f016020809104026020016040519081016040528092919081815260200182805461046a90611a02565b80156104b75780601f1061048c576101008083540402835291602001916104b7565b820191906000526020600020905b81548152906001019060200180831161049a57829003601f168201915b5050505050905090565b6000336104cf818585610a9f565b5060019392505050565b6000336104e7858285610bc3565b6104f2858585610c3d565b60019150505b9392505050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156105515760405162461bcd60e51b815260040161054890611a3d565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661059a600080516020611b9b833981519152546001600160a01b031690565b6001600160a01b0316146105c05760405162461bcd60e51b815260040161054890611a89565b6105c981610e16565b604080516000808252602082019092526105e591839190610e1e565b50565b6000336104cf8185856105fb83836109fe565b6106059190611aeb565b610a9f565b610612610f9d565b61061a610ff7565b565b610624610f9d565b61062e8282611049565b5050565b6105e53382611134565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156106855760405162461bcd60e51b815260040161054890611a3d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166106ce600080516020611b9b833981519152546001600160a01b031690565b6001600160a01b0316146106f45760405162461bcd60e51b815260040161054890611a89565b6106fd82610e16565b61062e82826001610e1e565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107a95760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610548565b50600080516020611b9b83398151915290565b6107c4610f9d565b61061a600061128e565b6107d9823383610bc3565b61062e8282611134565b600054610100900460ff16158080156108035750600054600160ff909116105b8061081d5750303b15801561081d575060005460ff166001145b6108805760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610548565b6000805460ff1916600117905580156108a3576000805461ff0019166101001790555b6108e36040518060400160405280600381526020016253415960e81b8152506040518060400160405280600381526020016253415960e81b8152506112e0565b6108eb611311565b6108f3611338565b6108fb611367565b610903611311565b80156105e5576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b610953610f9d565b61061a611396565b60606037805461043e90611a02565b6000338161097882866109fe565b9050838110156109d85760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610548565b6109e58286868403610a9f565b506001949350505050565b6000336104cf818585610c3d565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b610a31610f9d565b6001600160a01b038116610a965760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610548565b6105e58161128e565b6001600160a01b038316610b015760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610548565b6001600160a01b038216610b625760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610548565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610bcf84846109fe565b90506000198114610c375781811015610c2a5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610548565b610c378484848403610a9f565b50505050565b6001600160a01b038316610ca15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610548565b6001600160a01b038216610d035760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610548565b610d0e8383836113d3565b6001600160a01b03831660009081526033602052604090205481811015610d865760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610548565b6001600160a01b03808516600090815260336020526040808220858503905591851681529081208054849290610dbd908490611aeb565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610e0991815260200190565b60405180910390a3610c37565b6105e5610f9d565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610e5657610e51836113db565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e8f57600080fd5b505afa925050508015610ebf575060408051601f3d908101601f19168201909252610ebc91810190611b03565b60015b610f225760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610548565b600080516020611b9b8339815191528114610f915760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610548565b50610e51838383611477565b60c9546001600160a01b0316331461061a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610548565b610fff61149c565b6097805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b03821661109f5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610548565b6110ab600083836113d3565b80603560008282546110bd9190611aeb565b90915550506001600160a01b038216600090815260336020526040812080548392906110ea908490611aeb565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b0382166111945760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610548565b6111a0826000836113d3565b6001600160a01b038216600090815260336020526040902054818110156112145760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610548565b6001600160a01b0383166000908152603360205260408120838303905560358054849290611243908490611b1c565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166113075760405162461bcd60e51b815260040161054890611b33565b61062e82826114e5565b600054610100900460ff1661061a5760405162461bcd60e51b815260040161054890611b33565b600054610100900460ff1661135f5760405162461bcd60e51b815260040161054890611b33565b61061a611533565b600054610100900460ff1661138e5760405162461bcd60e51b815260040161054890611b33565b61061a611566565b61139e611596565b6097805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861102c3390565b610e51611596565b6001600160a01b0381163b6114485760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610548565b600080516020611b9b83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b611480836115dc565b60008251118061148d5750805b15610e5157610c37838361161c565b60975460ff1661061a5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610548565b600054610100900460ff1661150c5760405162461bcd60e51b815260040161054890611b33565b815161151f906036906020850190611749565b508051610e51906037906020840190611749565b600054610100900460ff1661155a5760405162461bcd60e51b815260040161054890611b33565b6097805460ff19169055565b600054610100900460ff1661158d5760405162461bcd60e51b815260040161054890611b33565b61061a3361128e565b60975460ff161561061a5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610548565b6115e5816113db565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6116845760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610548565b600080846001600160a01b03168460405161169f9190611b7e565b600060405180830381855af49150503d80600081146116da576040519150601f19603f3d011682016040523d82523d6000602084013e6116df565b606091505b50915091506117078282604051806060016040528060278152602001611bbb60279139611710565b95945050505050565b6060831561171f5750816104f8565b82511561172f5782518084602001fd5b8160405162461bcd60e51b8152600401610548919061180e565b82805461175590611a02565b90600052602060002090601f01602090048101928261177757600085556117bd565b82601f1061179057805160ff19168380011785556117bd565b828001600101855582156117bd579182015b828111156117bd5782518255916020019190600101906117a2565b506117c99291506117cd565b5090565b5b808211156117c957600081556001016117ce565b60005b838110156117fd5781810151838201526020016117e5565b83811115610c375750506000910152565b602081526000825180602084015261182d8160408501602087016117e2565b601f01601f19169190910160400192915050565b80356001600160a01b038116811461185857600080fd5b919050565b6000806040838503121561187057600080fd5b61187983611841565b946020939093013593505050565b60008060006060848603121561189c57600080fd5b6118a584611841565b92506118b360208501611841565b9150604084013590509250925092565b6000602082840312156118d557600080fd5b6104f882611841565b6000602082840312156118f057600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561192057600080fd5b61192983611841565b9150602083013567ffffffffffffffff8082111561194657600080fd5b818501915085601f83011261195a57600080fd5b81358181111561196c5761196c6118f7565b604051601f8201601f19908116603f01168101908382118183101715611994576119946118f7565b816040528281528860208487010111156119ad57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b600080604083850312156119e257600080fd5b6119eb83611841565b91506119f960208401611841565b90509250929050565b600181811c90821680611a1657607f821691505b60208210811415611a3757634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60008219821115611afe57611afe611ad5565b500190565b600060208284031215611b1557600080fd5b5051919050565b600082821015611b2e57611b2e611ad5565b500390565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251611b908184602087016117e2565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212204b1daafe1e9c601b499afcf4ca2371d34d4a08b662c245711ea273e1887c16f364736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/tokens/ERC721/GovernanceToken.sol/GovernanceToken.dbg.json b/src/contracts/tokens/ERC721/GovernanceToken.sol/GovernanceToken.dbg.json deleted file mode 100644 index f625e04e2b..0000000000 --- a/src/contracts/tokens/ERC721/GovernanceToken.sol/GovernanceToken.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/tokens/ERC721/GovernanceToken.sol/GovernanceToken.json b/src/contracts/tokens/ERC721/GovernanceToken.sol/GovernanceToken.json deleted file mode 100644 index fa7ebcd37b..0000000000 --- a/src/contracts/tokens/ERC721/GovernanceToken.sol/GovernanceToken.json +++ /dev/null @@ -1,1011 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "GovernanceToken", - "sourceName": "contracts/tokens/ERC721/GovernanceToken.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "previousAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "beacon", - "type": "address" - } - ], - "name": "BeaconUpgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "fromDelegate", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "toDelegate", - "type": "address" - } - ], - "name": "DelegateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegate", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "previousBalance", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newBalance", - "type": "uint256" - } - ], - "name": "DelegateVotesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "needId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId2", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "familyMember", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "friend", - "type": "address" - } - ], - "name": "Minted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "Upgraded", - "type": "event" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SAY_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "UPGRADER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "delegatee", - "type": "address" - } - ], - "name": "delegate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "delegatee", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiry", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "delegateBySig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "delegates", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - } - ], - "name": "getPastTotalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - } - ], - "name": "getPastVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "getVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sayAdmin", - "type": "address" - }, - { - "internalType": "address", - "name": "voucherContract", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "nonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "proxiableUUID", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_needId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_needContract", - "type": "address" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "needId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "mintValue", - "type": "uint256" - }, - { - "internalType": "string", - "name": "tokenUri", - "type": "string" - }, - { - "internalType": "string", - "name": "content", - "type": "string" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct Voucher", - "name": "_voucher", - "type": "tuple" - } - ], - "name": "safeFamilyMint", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "safeSocialWorkerMint", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAddress", - "type": "address" - } - ], - "name": "setVoucherVerifier", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "upgradeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "upgradeToAndCall", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "voucherAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "bytecode": "0x60a0604052306080523480156200001557600080fd5b506200002062000026565b620000e8565b600054610100900460ff1615620000935760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e6576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b60805161393a62000120600039600081816109ee01528181610a2e01528181610d3601528181610d760152610e05015261393a6000f3fe60806040526004361061021a5760003560e01c80636199719411610123578063a22cb465116100ab578063d547741f1161006f578063d547741f14610642578063d9b6304114610662578063e985e9c514610696578063ea191013146106df578063f72c0d8b146106e757600080fd5b8063a22cb465146105a2578063b88d4fde146105c2578063c3cda520146105e2578063c87b56dd14610602578063d402f02f1461062257600080fd5b80638e539e8c116100f25780638e539e8c1461051857806391d148541461053857806395d89b41146105585780639ab24eb01461056d578063a217fddf1461058d57600080fd5b806361997194146104a55780636352211e146104b857806370a08231146104d85780637ecebe00146104f857600080fd5b806336568abe116101a6578063485cc95511610175578063485cc955146104045780634f1ef2861461042457806352d1902d14610437578063587cde1e1461044c5780635c19a95c1461048557600080fd5b806336568abe146103845780633659cfe6146103a45780633a46b1a8146103c457806342842e0e146103e457600080fd5b8063100575b2116101ed578063100575b2146102d057806323b872dd146102f1578063248a9ca3146103115780632f2ff15d1461034f5780633644e5151461036f57600080fd5b806301ffc9a71461021f57806306fdde0314610254578063081812fc14610276578063095ea7b3146102ae575b600080fd5b34801561022b57600080fd5b5061023f61023a366004612fa4565b61071b565b60405190151581526020015b60405180910390f35b34801561026057600080fd5b5061026961072c565b60405161024b9190613019565b34801561028257600080fd5b5061029661029136600461302c565b6107be565b6040516001600160a01b03909116815260200161024b565b3480156102ba57600080fd5b506102ce6102c936600461305a565b6107e5565b005b3480156102dc57600080fd5b506101c654610296906001600160a01b031681565b3480156102fd57600080fd5b506102ce61030c366004613086565b610900565b34801561031d57600080fd5b5061034161032c36600461302c565b60009081526097602052604090206001015490565b60405190815260200161024b565b34801561035b57600080fd5b506102ce61036a3660046130c7565b610931565b34801561037b57600080fd5b50610341610956565b34801561039057600080fd5b506102ce61039f3660046130c7565b610965565b3480156103b057600080fd5b506102ce6103bf3660046130f7565b6109e3565b3480156103d057600080fd5b506103416103df36600461305a565b610ac3565b3480156103f057600080fd5b506102ce6103ff366004613086565b610aec565b34801561041057600080fd5b506102ce61041f366004613114565b610b07565b6102ce6104323660046131e5565b610d2b565b34801561044357600080fd5b50610341610df8565b34801561045857600080fd5b506102966104673660046130f7565b6001600160a01b03908116600090815260fd60205260409020541690565b34801561049157600080fd5b506102ce6104a03660046130f7565b610eab565b6102ce6104b3366004613235565b610eb6565b3480156104c457600080fd5b506102966104d336600461302c565b61111c565b3480156104e457600080fd5b506103416104f33660046130f7565b61117c565b34801561050457600080fd5b506103416105133660046130f7565b611202565b34801561052457600080fd5b5061034161053336600461302c565b611221565b34801561054457600080fd5b5061023f6105533660046130c7565b61127d565b34801561056457600080fd5b506102696112a8565b34801561057957600080fd5b506103416105883660046130f7565b6112b7565b34801561059957600080fd5b50610341600081565b3480156105ae57600080fd5b506102ce6105bd3660046132a3565b6112d8565b3480156105ce57600080fd5b506102ce6105dd3660046132d1565b6112e3565b3480156105ee57600080fd5b506102ce6105fd36600461333d565b61131b565b34801561060e57600080fd5b5061026961061d36600461302c565b61143f565b34801561062e57600080fd5b506102ce61063d3660046130f7565b61144a565b34801561064e57600080fd5b506102ce61065d3660046130c7565b611498565b34801561066e57600080fd5b506103417ffa4ac835fcfa16c9e62e7bb10d9c714aa0ffb94fecd1dff14e1970e78abf919581565b3480156106a257600080fd5b5061023f6106b1366004613114565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b6102ce6114bd565b3480156106f357600080fd5b506103417f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b6000610726826114d8565b92915050565b60606065805461073b9061339f565b80601f01602080910402602001604051908101604052809291908181526020018280546107679061339f565b80156107b45780601f10610789576101008083540402835291602001916107b4565b820191906000526020600020905b81548152906001019060200180831161079757829003601f168201915b5050505050905090565b60006107c9826114fd565b506000908152606960205260409020546001600160a01b031690565b60006107f08261111c565b9050806001600160a01b0316836001600160a01b031614156108635760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061087f575061087f81336106b1565b6108f15760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161085a565b6108fb838361155c565b505050565b61090a33826115ca565b6109265760405162461bcd60e51b815260040161085a906133d4565b6108fb838383611649565b60008281526097602052604090206001015461094c816117eb565b6108fb83836117f5565b600061096061187b565b905090565b6001600160a01b03811633146109d55760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161085a565b6109df82826118f6565b5050565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610a2c5760405162461bcd60e51b815260040161085a90613422565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610a756000805160206138be833981519152546001600160a01b031690565b6001600160a01b031614610a9b5760405162461bcd60e51b815260040161085a9061346e565b610aa48161195d565b60408051600080825260208201909252610ac091839190611987565b50565b6001600160a01b038216600090815260fe60205260408120610ae59083611b01565b9392505050565b6108fb838383604051806020016040528060008152506112e3565b600054610100900460ff1615808015610b275750600054600160ff909116105b80610b415750303b158015610b41575060005460ff166001145b610ba45760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161085a565b6000805460ff191660011790558015610bc7576000805461ff0019166101001790555b610c146040518060400160405280600f81526020016e23b7bb32b93730b731b2aa37b5b2b760891b815250604051806040016040528060048152602001636753415960e01b815250611c10565b610c56604051806040016040528060078152602001665341592d44414f60c81b815250604051806040016040528060018152602001603160f81b815250611c41565b610c5e611c72565b610c66611c72565b610c716000336117f5565b610c9b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e3336117f5565b610cc57ffa4ac835fcfa16c9e62e7bb10d9c714aa0ffb94fecd1dff14e1970e78abf9195846117f5565b6101c680546001600160a01b0319166001600160a01b03841617905580156108fb576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610d745760405162461bcd60e51b815260040161085a90613422565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610dbd6000805160206138be833981519152546001600160a01b031690565b6001600160a01b031614610de35760405162461bcd60e51b815260040161085a9061346e565b610dec8261195d565b6109df82826001611987565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610e985760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161085a565b506000805160206138be83398151915290565b336109df8183611c9b565b604051639e60e75360e01b8152600481018490528390839081906000906001600160a01b03831690639e60e75390602401602060405180830381600087803b158015610f0157600080fd5b505af1158015610f15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3991906134ba565b905080156110cb576101c65460405163cf1e8fa760e01b81526001600160a01b0390911690600090829063cf1e8fa790610f77908a90600401613546565b60206040518083038186803b158015610f8f57600080fd5b505afa158015610fa3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc791906135da565b9050348760200135111561101d5760405162461bcd60e51b815260206004820152601e60248201527f596f75206d757374207061792074686520766f75636865722076616c75650000604482015260640161085a565b61102c6101c580546001019055565b60006110386101c55490565b90506110448282611d0d565b6110536101c580546001019055565b600061105f6101c55490565b905061106b3382611d0d565b604080518a358152602081018490529081018290526001600160a01b03841660608201523360808201527fc21247e7e8f72b583ed1500f6fb2de4267948d89cd06c59d50a71bef5431c2d79060a00160405180910390a150505050611113565b60405162461bcd60e51b815260206004820152601b60248201527f54686973204e656564206973206e6f74206d696e617461626c65210000000000604482015260640161085a565b50505050505050565b6000818152606760205260408120546001600160a01b0316806107265760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161085a565b60006001600160a01b0382166111e65760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161085a565b506001600160a01b031660009081526068602052604090205490565b6001600160a01b03811660009081526101006020526040812054610726565b60004382106112725760405162461bcd60e51b815260206004820152601a60248201527f566f7465733a20626c6f636b206e6f7420796574206d696e6564000000000000604482015260640161085a565b61072660ff83611b01565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606066805461073b9061339f565b6001600160a01b038116600090815260fe6020526040812061072690611d27565b6109df338383611d83565b6112ed33836115ca565b6113095760405162461bcd60e51b815260040161085a906133d4565b61131584848484611e52565b50505050565b8342111561136b5760405162461bcd60e51b815260206004820152601860248201527f566f7465733a207369676e617475726520657870697265640000000000000000604482015260640161085a565b604080517fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60208201526001600160a01b0388169181019190915260608101869052608081018590526000906113e5906113dd9060a00160405160208183030381529060405280519060200120611e85565b858585611ed3565b90506113f081611efb565b86146114355760405162461bcd60e51b8152602060048201526014602482015273566f7465733a20696e76616c6964206e6f6e636560601b604482015260640161085a565b6111138188611c9b565b606061072682611f24565b7ffa4ac835fcfa16c9e62e7bb10d9c714aa0ffb94fecd1dff14e1970e78abf9195611474816117eb565b506101c680546001600160a01b0319166001600160a01b0392909216919091179055565b6000828152609760205260409020600101546114b3816117eb565b6108fb83836118f6565b6114cc6101c580546001019055565b60006109df6101c55490565b60006001600160e01b03198216637965db0b60e01b1480610726575061072682611f97565b6000818152606760205260409020546001600160a01b0316610ac05760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161085a565b600081815260696020526040902080546001600160a01b0319166001600160a01b03841690811790915581906115918261111c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000806115d68361111c565b9050806001600160a01b0316846001600160a01b0316148061161d57506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b806116415750836001600160a01b0316611636846107be565b6001600160a01b0316145b949350505050565b826001600160a01b031661165c8261111c565b6001600160a01b0316146116c05760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161085a565b6001600160a01b0382166117225760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161085a565b61172d60008261155c565b6001600160a01b038316600090815260686020526040812080546001929061175690849061360d565b90915550506001600160a01b0382166000908152606860205260408120805460019290611784908490613624565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a46108fb838383611fe7565b610ac08133611ff2565b6117ff828261127d565b6109df5760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556118373390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006109607f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6118aa60c95490565b60ca546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b611900828261127d565b156109df5760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e36109df816117eb565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156119ba576108fb83612056565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156119f357600080fd5b505afa925050508015611a23575060408051601f3d908101601f19168201909252611a209181019061363c565b60015b611a865760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161085a565b6000805160206138be8339815191528114611af55760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161085a565b506108fb8383836120f2565b6000438210611b525760405162461bcd60e51b815260206004820181905260248201527f436865636b706f696e74733a20626c6f636b206e6f7420796574206d696e6564604482015260640161085a565b825460005b81811015611bb7576000611b6b8284612117565b905084866000018281548110611b8357611b83613655565b60009182526020909120015463ffffffff161115611ba357809250611bb1565b611bae816001613624565b91505b50611b57565b8115611bfb5784611bc960018461360d565b81548110611bd957611bd9613655565b60009182526020909120015464010000000090046001600160e01b0316611bfe565b60005b6001600160e01b031695945050505050565b600054610100900460ff16611c375760405162461bcd60e51b815260040161085a9061366b565b6109df8282612132565b600054610100900460ff16611c685760405162461bcd60e51b815260040161085a9061366b565b6109df8282612180565b600054610100900460ff16611c995760405162461bcd60e51b815260040161085a9061366b565b565b6001600160a01b03828116600081815260fd602052604080822080548686166001600160a01b0319821681179092559151919094169392849290917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a46108fb8183611d08866121c1565b6121cc565b6109df828260405180602001604052806000815250612309565b80546000908015611d705782611d3e60018361360d565b81548110611d4e57611d4e613655565b60009182526020909120015464010000000090046001600160e01b0316611d73565b60005b6001600160e01b03169392505050565b816001600160a01b0316836001600160a01b03161415611de55760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161085a565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611e5d848484611649565b611e698484848461233c565b6113155760405162461bcd60e51b815260040161085a906136b6565b6000610726611e9261187b565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000611ee487878787612446565b91509150611ef181612533565b5095945050505050565b6001600160a01b0381166000908152610100602052604090208054600181018255905b50919050565b6060611f2f826114fd565b6000611f4660408051602081019091526000815290565b90506000815111611f665760405180602001604052806000815250610ae5565b80611f70846126ee565b604051602001611f81929190613708565b6040516020818303038152906040529392505050565b60006001600160e01b031982166380ac58cd60e01b1480611fc857506001600160e01b03198216635b5e139f60e01b145b8061072657506301ffc9a760e01b6001600160e01b0319831614610726565b6108fb8383836127ec565b611ffc828261127d565b6109df57612014816001600160a01b031660146127f8565b61201f8360206127f8565b604051602001612030929190613737565b60408051601f198184030181529082905262461bcd60e51b825261085a91600401613019565b6001600160a01b0381163b6120c35760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161085a565b6000805160206138be83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6120fb83612994565b6000825111806121085750805b156108fb5761131583836129d4565b600061212660028484186137c2565b610ae590848416613624565b600054610100900460ff166121595760405162461bcd60e51b815260040161085a9061366b565b815161216c906065906020850190612efe565b5080516108fb906066906020840190612efe565b600054610100900460ff166121a75760405162461bcd60e51b815260040161085a9061366b565b81516020928301208151919092012060c99190915560ca55565b60006107268261117c565b816001600160a01b0316836001600160a01b0316141580156121ee5750600081115b156108fb576001600160a01b0383161561227c576001600160a01b038316600090815260fe60205260408120819061222990612ac885612ad4565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051612271929190918252602082015260400190565b60405180910390a250505b6001600160a01b038216156108fb576001600160a01b038216600090815260fe6020526040812081906122b290612b0285612ad4565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72483836040516122fa929190918252602082015260400190565b60405180910390a25050505050565b6123138383612b0e565b612320600084848461233c565b6108fb5760405162461bcd60e51b815260040161085a906136b6565b60006001600160a01b0384163b1561243e57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906123809033908990889088906004016137d6565b602060405180830381600087803b15801561239a57600080fd5b505af19250505080156123ca575060408051601f3d908101601f191682019092526123c791810190613809565b60015b612424573d8080156123f8576040519150601f19603f3d011682016040523d82523d6000602084013e6123fd565b606091505b50805161241c5760405162461bcd60e51b815260040161085a906136b6565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611641565b506001611641565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561247d575060009050600361252a565b8460ff16601b1415801561249557508460ff16601c14155b156124a6575060009050600461252a565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156124fa573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166125235760006001925092505061252a565b9150600090505b94509492505050565b600081600481111561254757612547613826565b14156125505750565b600181600481111561256457612564613826565b14156125b25760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161085a565b60028160048111156125c6576125c6613826565b14156126145760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161085a565b600381600481111561262857612628613826565b14156126815760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161085a565b600481600481111561269557612695613826565b1415610ac05760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161085a565b6060816127125750506040805180820190915260018152600360fc1b602082015290565b8160005b811561273c57806127268161383c565b91506127359050600a836137c2565b9150612716565b60008167ffffffffffffffff81111561275757612757613142565b6040519080825280601f01601f191660200182016040528015612781576020820181803683370190505b5090505b84156116415761279660018361360d565b91506127a3600a86613857565b6127ae906030613624565b60f81b8183815181106127c3576127c3613655565b60200101906001600160f81b031916908160001a9053506127e5600a866137c2565b9450612785565b6108fb83836001612c58565b6060600061280783600261386b565b612812906002613624565b67ffffffffffffffff81111561282a5761282a613142565b6040519080825280601f01601f191660200182016040528015612854576020820181803683370190505b509050600360fc1b8160008151811061286f5761286f613655565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061289e5761289e613655565b60200101906001600160f81b031916908160001a90535060006128c284600261386b565b6128cd906001613624565b90505b6001811115612945576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061290157612901613655565b1a60f81b82828151811061291757612917613655565b60200101906001600160f81b031916908160001a90535060049490941c9361293e8161388a565b90506128d0565b508315610ae55760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161085a565b61299d81612056565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b612a3c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161085a565b600080846001600160a01b031684604051612a5791906138a1565b600060405180830381855af49150503d8060008114612a92576040519150601f19603f3d011682016040523d82523d6000602084013e612a97565b606091505b5091509150612abf82826040518060600160405280602781526020016138de60279139612cc8565b95945050505050565b6000610ae5828461360d565b600080612af685612af1612ae788611d27565b868863ffffffff16565b612d01565b91509150935093915050565b6000610ae58284613624565b6001600160a01b038216612b645760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161085a565b6000818152606760205260409020546001600160a01b031615612bc95760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161085a565b6001600160a01b0382166000908152606860205260408120805460019290612bf2908490613624565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46109df60008383611fe7565b6001600160a01b038316612c7757612c7460ff612b0283612ad4565b50505b6001600160a01b038216612c9657612c9360ff612ac883612ad4565b50505b6001600160a01b03838116600090815260fd60205260408082205485841683529120546108fb929182169116836121cc565b60608315612cd7575081610ae5565b825115612ce75782518084602001fd5b8160405162461bcd60e51b815260040161085a9190613019565b8154600090819081612d1286611d27565b9050600082118015612d5057504386612d2c60018561360d565b81548110612d3c57612d3c613655565b60009182526020909120015463ffffffff16145b15612db057612d5e85612e2c565b86612d6a60018561360d565b81548110612d7a57612d7a613655565b9060005260206000200160000160046101000a8154816001600160e01b0302191690836001600160e01b03160217905550612e1e565b856000016040518060400160405280612dc843612e99565b63ffffffff168152602001612ddc88612e2c565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b9250839150505b9250929050565b60006001600160e01b03821115612e955760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20326044820152663234206269747360c81b606482015260840161085a565b5090565b600063ffffffff821115612e955760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b606482015260840161085a565b828054612f0a9061339f565b90600052602060002090601f016020900481019282612f2c5760008555612f72565b82601f10612f4557805160ff1916838001178555612f72565b82800160010185558215612f72579182015b82811115612f72578251825591602001919060010190612f57565b50612e959291505b80821115612e955760008155600101612f7a565b6001600160e01b031981168114610ac057600080fd5b600060208284031215612fb657600080fd5b8135610ae581612f8e565b60005b83811015612fdc578181015183820152602001612fc4565b838111156113155750506000910152565b60008151808452613005816020860160208601612fc1565b601f01601f19169290920160200192915050565b602081526000610ae56020830184612fed565b60006020828403121561303e57600080fd5b5035919050565b6001600160a01b0381168114610ac057600080fd5b6000806040838503121561306d57600080fd5b823561307881613045565b946020939093013593505050565b60008060006060848603121561309b57600080fd5b83356130a681613045565b925060208401356130b681613045565b929592945050506040919091013590565b600080604083850312156130da57600080fd5b8235915060208301356130ec81613045565b809150509250929050565b60006020828403121561310957600080fd5b8135610ae581613045565b6000806040838503121561312757600080fd5b823561313281613045565b915060208301356130ec81613045565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261316957600080fd5b813567ffffffffffffffff8082111561318457613184613142565b604051601f8301601f19908116603f011681019082821181831017156131ac576131ac613142565b816040528381528660208588010111156131c557600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080604083850312156131f857600080fd5b823561320381613045565b9150602083013567ffffffffffffffff81111561321f57600080fd5b61322b85828601613158565b9150509250929050565b60008060006060848603121561324a57600080fd5b83359250602084013561325c81613045565b9150604084013567ffffffffffffffff81111561327857600080fd5b840160a0818703121561328a57600080fd5b809150509250925092565b8015158114610ac057600080fd5b600080604083850312156132b657600080fd5b82356132c181613045565b915060208301356130ec81613295565b600080600080608085870312156132e757600080fd5b84356132f281613045565b9350602085013561330281613045565b925060408501359150606085013567ffffffffffffffff81111561332557600080fd5b61333187828801613158565b91505092959194509250565b60008060008060008060c0878903121561335657600080fd5b863561336181613045565b95506020870135945060408701359350606087013560ff8116811461338557600080fd5b9598949750929560808101359460a0909101359350915050565b600181811c908216806133b357607f821691505b60208210811415611f1e57634e487b7160e01b600052602260045260246000fd5b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6000602082840312156134cc57600080fd5b8151610ae581613295565b6000808335601e198436030181126134ee57600080fd5b830160208101925035905067ffffffffffffffff81111561350e57600080fd5b803603831315612e2557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b602081528135602082015260208201356040820152600061356a60408401846134d7565b60a0606085015261357f60c08501828461351d565b91505061358f60608501856134d7565b601f19808685030160808701526135a784838561351d565b93506135b660808801886134d7565b93509150808685030160a0870152506135d083838361351d565b9695505050505050565b6000602082840312156135ec57600080fd5b8151610ae581613045565b634e487b7160e01b600052601160045260246000fd5b60008282101561361f5761361f6135f7565b500390565b60008219821115613637576136376135f7565b500190565b60006020828403121561364e57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6000835161371a818460208801612fc1565b83519083019061372e818360208801612fc1565b01949350505050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161376f816017850160208801612fc1565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516137a0816028840160208801612fc1565b01602801949350505050565b634e487b7160e01b600052601260045260246000fd5b6000826137d1576137d16137ac565b500490565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906135d090830184612fed565b60006020828403121561381b57600080fd5b8151610ae581612f8e565b634e487b7160e01b600052602160045260246000fd5b6000600019821415613850576138506135f7565b5060010190565b600082613866576138666137ac565b500690565b6000816000190483118215151615613885576138856135f7565b500290565b600081613899576138996135f7565b506000190190565b600082516138b3818460208701612fc1565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122002fc4a5649f59b294f7c19c769a852bf57d594074c65b2bb3a40d707b8cd732264736f6c63430008090033", - "deployedBytecode": "0x60806040526004361061021a5760003560e01c80636199719411610123578063a22cb465116100ab578063d547741f1161006f578063d547741f14610642578063d9b6304114610662578063e985e9c514610696578063ea191013146106df578063f72c0d8b146106e757600080fd5b8063a22cb465146105a2578063b88d4fde146105c2578063c3cda520146105e2578063c87b56dd14610602578063d402f02f1461062257600080fd5b80638e539e8c116100f25780638e539e8c1461051857806391d148541461053857806395d89b41146105585780639ab24eb01461056d578063a217fddf1461058d57600080fd5b806361997194146104a55780636352211e146104b857806370a08231146104d85780637ecebe00146104f857600080fd5b806336568abe116101a6578063485cc95511610175578063485cc955146104045780634f1ef2861461042457806352d1902d14610437578063587cde1e1461044c5780635c19a95c1461048557600080fd5b806336568abe146103845780633659cfe6146103a45780633a46b1a8146103c457806342842e0e146103e457600080fd5b8063100575b2116101ed578063100575b2146102d057806323b872dd146102f1578063248a9ca3146103115780632f2ff15d1461034f5780633644e5151461036f57600080fd5b806301ffc9a71461021f57806306fdde0314610254578063081812fc14610276578063095ea7b3146102ae575b600080fd5b34801561022b57600080fd5b5061023f61023a366004612fa4565b61071b565b60405190151581526020015b60405180910390f35b34801561026057600080fd5b5061026961072c565b60405161024b9190613019565b34801561028257600080fd5b5061029661029136600461302c565b6107be565b6040516001600160a01b03909116815260200161024b565b3480156102ba57600080fd5b506102ce6102c936600461305a565b6107e5565b005b3480156102dc57600080fd5b506101c654610296906001600160a01b031681565b3480156102fd57600080fd5b506102ce61030c366004613086565b610900565b34801561031d57600080fd5b5061034161032c36600461302c565b60009081526097602052604090206001015490565b60405190815260200161024b565b34801561035b57600080fd5b506102ce61036a3660046130c7565b610931565b34801561037b57600080fd5b50610341610956565b34801561039057600080fd5b506102ce61039f3660046130c7565b610965565b3480156103b057600080fd5b506102ce6103bf3660046130f7565b6109e3565b3480156103d057600080fd5b506103416103df36600461305a565b610ac3565b3480156103f057600080fd5b506102ce6103ff366004613086565b610aec565b34801561041057600080fd5b506102ce61041f366004613114565b610b07565b6102ce6104323660046131e5565b610d2b565b34801561044357600080fd5b50610341610df8565b34801561045857600080fd5b506102966104673660046130f7565b6001600160a01b03908116600090815260fd60205260409020541690565b34801561049157600080fd5b506102ce6104a03660046130f7565b610eab565b6102ce6104b3366004613235565b610eb6565b3480156104c457600080fd5b506102966104d336600461302c565b61111c565b3480156104e457600080fd5b506103416104f33660046130f7565b61117c565b34801561050457600080fd5b506103416105133660046130f7565b611202565b34801561052457600080fd5b5061034161053336600461302c565b611221565b34801561054457600080fd5b5061023f6105533660046130c7565b61127d565b34801561056457600080fd5b506102696112a8565b34801561057957600080fd5b506103416105883660046130f7565b6112b7565b34801561059957600080fd5b50610341600081565b3480156105ae57600080fd5b506102ce6105bd3660046132a3565b6112d8565b3480156105ce57600080fd5b506102ce6105dd3660046132d1565b6112e3565b3480156105ee57600080fd5b506102ce6105fd36600461333d565b61131b565b34801561060e57600080fd5b5061026961061d36600461302c565b61143f565b34801561062e57600080fd5b506102ce61063d3660046130f7565b61144a565b34801561064e57600080fd5b506102ce61065d3660046130c7565b611498565b34801561066e57600080fd5b506103417ffa4ac835fcfa16c9e62e7bb10d9c714aa0ffb94fecd1dff14e1970e78abf919581565b3480156106a257600080fd5b5061023f6106b1366004613114565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b6102ce6114bd565b3480156106f357600080fd5b506103417f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b6000610726826114d8565b92915050565b60606065805461073b9061339f565b80601f01602080910402602001604051908101604052809291908181526020018280546107679061339f565b80156107b45780601f10610789576101008083540402835291602001916107b4565b820191906000526020600020905b81548152906001019060200180831161079757829003601f168201915b5050505050905090565b60006107c9826114fd565b506000908152606960205260409020546001600160a01b031690565b60006107f08261111c565b9050806001600160a01b0316836001600160a01b031614156108635760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061087f575061087f81336106b1565b6108f15760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161085a565b6108fb838361155c565b505050565b61090a33826115ca565b6109265760405162461bcd60e51b815260040161085a906133d4565b6108fb838383611649565b60008281526097602052604090206001015461094c816117eb565b6108fb83836117f5565b600061096061187b565b905090565b6001600160a01b03811633146109d55760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161085a565b6109df82826118f6565b5050565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610a2c5760405162461bcd60e51b815260040161085a90613422565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610a756000805160206138be833981519152546001600160a01b031690565b6001600160a01b031614610a9b5760405162461bcd60e51b815260040161085a9061346e565b610aa48161195d565b60408051600080825260208201909252610ac091839190611987565b50565b6001600160a01b038216600090815260fe60205260408120610ae59083611b01565b9392505050565b6108fb838383604051806020016040528060008152506112e3565b600054610100900460ff1615808015610b275750600054600160ff909116105b80610b415750303b158015610b41575060005460ff166001145b610ba45760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161085a565b6000805460ff191660011790558015610bc7576000805461ff0019166101001790555b610c146040518060400160405280600f81526020016e23b7bb32b93730b731b2aa37b5b2b760891b815250604051806040016040528060048152602001636753415960e01b815250611c10565b610c56604051806040016040528060078152602001665341592d44414f60c81b815250604051806040016040528060018152602001603160f81b815250611c41565b610c5e611c72565b610c66611c72565b610c716000336117f5565b610c9b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e3336117f5565b610cc57ffa4ac835fcfa16c9e62e7bb10d9c714aa0ffb94fecd1dff14e1970e78abf9195846117f5565b6101c680546001600160a01b0319166001600160a01b03841617905580156108fb576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610d745760405162461bcd60e51b815260040161085a90613422565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610dbd6000805160206138be833981519152546001600160a01b031690565b6001600160a01b031614610de35760405162461bcd60e51b815260040161085a9061346e565b610dec8261195d565b6109df82826001611987565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610e985760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161085a565b506000805160206138be83398151915290565b336109df8183611c9b565b604051639e60e75360e01b8152600481018490528390839081906000906001600160a01b03831690639e60e75390602401602060405180830381600087803b158015610f0157600080fd5b505af1158015610f15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3991906134ba565b905080156110cb576101c65460405163cf1e8fa760e01b81526001600160a01b0390911690600090829063cf1e8fa790610f77908a90600401613546565b60206040518083038186803b158015610f8f57600080fd5b505afa158015610fa3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc791906135da565b9050348760200135111561101d5760405162461bcd60e51b815260206004820152601e60248201527f596f75206d757374207061792074686520766f75636865722076616c75650000604482015260640161085a565b61102c6101c580546001019055565b60006110386101c55490565b90506110448282611d0d565b6110536101c580546001019055565b600061105f6101c55490565b905061106b3382611d0d565b604080518a358152602081018490529081018290526001600160a01b03841660608201523360808201527fc21247e7e8f72b583ed1500f6fb2de4267948d89cd06c59d50a71bef5431c2d79060a00160405180910390a150505050611113565b60405162461bcd60e51b815260206004820152601b60248201527f54686973204e656564206973206e6f74206d696e617461626c65210000000000604482015260640161085a565b50505050505050565b6000818152606760205260408120546001600160a01b0316806107265760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161085a565b60006001600160a01b0382166111e65760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161085a565b506001600160a01b031660009081526068602052604090205490565b6001600160a01b03811660009081526101006020526040812054610726565b60004382106112725760405162461bcd60e51b815260206004820152601a60248201527f566f7465733a20626c6f636b206e6f7420796574206d696e6564000000000000604482015260640161085a565b61072660ff83611b01565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606066805461073b9061339f565b6001600160a01b038116600090815260fe6020526040812061072690611d27565b6109df338383611d83565b6112ed33836115ca565b6113095760405162461bcd60e51b815260040161085a906133d4565b61131584848484611e52565b50505050565b8342111561136b5760405162461bcd60e51b815260206004820152601860248201527f566f7465733a207369676e617475726520657870697265640000000000000000604482015260640161085a565b604080517fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60208201526001600160a01b0388169181019190915260608101869052608081018590526000906113e5906113dd9060a00160405160208183030381529060405280519060200120611e85565b858585611ed3565b90506113f081611efb565b86146114355760405162461bcd60e51b8152602060048201526014602482015273566f7465733a20696e76616c6964206e6f6e636560601b604482015260640161085a565b6111138188611c9b565b606061072682611f24565b7ffa4ac835fcfa16c9e62e7bb10d9c714aa0ffb94fecd1dff14e1970e78abf9195611474816117eb565b506101c680546001600160a01b0319166001600160a01b0392909216919091179055565b6000828152609760205260409020600101546114b3816117eb565b6108fb83836118f6565b6114cc6101c580546001019055565b60006109df6101c55490565b60006001600160e01b03198216637965db0b60e01b1480610726575061072682611f97565b6000818152606760205260409020546001600160a01b0316610ac05760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161085a565b600081815260696020526040902080546001600160a01b0319166001600160a01b03841690811790915581906115918261111c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000806115d68361111c565b9050806001600160a01b0316846001600160a01b0316148061161d57506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b806116415750836001600160a01b0316611636846107be565b6001600160a01b0316145b949350505050565b826001600160a01b031661165c8261111c565b6001600160a01b0316146116c05760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161085a565b6001600160a01b0382166117225760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161085a565b61172d60008261155c565b6001600160a01b038316600090815260686020526040812080546001929061175690849061360d565b90915550506001600160a01b0382166000908152606860205260408120805460019290611784908490613624565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a46108fb838383611fe7565b610ac08133611ff2565b6117ff828261127d565b6109df5760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556118373390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006109607f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6118aa60c95490565b60ca546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b611900828261127d565b156109df5760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e36109df816117eb565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156119ba576108fb83612056565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156119f357600080fd5b505afa925050508015611a23575060408051601f3d908101601f19168201909252611a209181019061363c565b60015b611a865760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161085a565b6000805160206138be8339815191528114611af55760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161085a565b506108fb8383836120f2565b6000438210611b525760405162461bcd60e51b815260206004820181905260248201527f436865636b706f696e74733a20626c6f636b206e6f7420796574206d696e6564604482015260640161085a565b825460005b81811015611bb7576000611b6b8284612117565b905084866000018281548110611b8357611b83613655565b60009182526020909120015463ffffffff161115611ba357809250611bb1565b611bae816001613624565b91505b50611b57565b8115611bfb5784611bc960018461360d565b81548110611bd957611bd9613655565b60009182526020909120015464010000000090046001600160e01b0316611bfe565b60005b6001600160e01b031695945050505050565b600054610100900460ff16611c375760405162461bcd60e51b815260040161085a9061366b565b6109df8282612132565b600054610100900460ff16611c685760405162461bcd60e51b815260040161085a9061366b565b6109df8282612180565b600054610100900460ff16611c995760405162461bcd60e51b815260040161085a9061366b565b565b6001600160a01b03828116600081815260fd602052604080822080548686166001600160a01b0319821681179092559151919094169392849290917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a46108fb8183611d08866121c1565b6121cc565b6109df828260405180602001604052806000815250612309565b80546000908015611d705782611d3e60018361360d565b81548110611d4e57611d4e613655565b60009182526020909120015464010000000090046001600160e01b0316611d73565b60005b6001600160e01b03169392505050565b816001600160a01b0316836001600160a01b03161415611de55760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161085a565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611e5d848484611649565b611e698484848461233c565b6113155760405162461bcd60e51b815260040161085a906136b6565b6000610726611e9261187b565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000611ee487878787612446565b91509150611ef181612533565b5095945050505050565b6001600160a01b0381166000908152610100602052604090208054600181018255905b50919050565b6060611f2f826114fd565b6000611f4660408051602081019091526000815290565b90506000815111611f665760405180602001604052806000815250610ae5565b80611f70846126ee565b604051602001611f81929190613708565b6040516020818303038152906040529392505050565b60006001600160e01b031982166380ac58cd60e01b1480611fc857506001600160e01b03198216635b5e139f60e01b145b8061072657506301ffc9a760e01b6001600160e01b0319831614610726565b6108fb8383836127ec565b611ffc828261127d565b6109df57612014816001600160a01b031660146127f8565b61201f8360206127f8565b604051602001612030929190613737565b60408051601f198184030181529082905262461bcd60e51b825261085a91600401613019565b6001600160a01b0381163b6120c35760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161085a565b6000805160206138be83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6120fb83612994565b6000825111806121085750805b156108fb5761131583836129d4565b600061212660028484186137c2565b610ae590848416613624565b600054610100900460ff166121595760405162461bcd60e51b815260040161085a9061366b565b815161216c906065906020850190612efe565b5080516108fb906066906020840190612efe565b600054610100900460ff166121a75760405162461bcd60e51b815260040161085a9061366b565b81516020928301208151919092012060c99190915560ca55565b60006107268261117c565b816001600160a01b0316836001600160a01b0316141580156121ee5750600081115b156108fb576001600160a01b0383161561227c576001600160a01b038316600090815260fe60205260408120819061222990612ac885612ad4565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051612271929190918252602082015260400190565b60405180910390a250505b6001600160a01b038216156108fb576001600160a01b038216600090815260fe6020526040812081906122b290612b0285612ad4565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72483836040516122fa929190918252602082015260400190565b60405180910390a25050505050565b6123138383612b0e565b612320600084848461233c565b6108fb5760405162461bcd60e51b815260040161085a906136b6565b60006001600160a01b0384163b1561243e57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906123809033908990889088906004016137d6565b602060405180830381600087803b15801561239a57600080fd5b505af19250505080156123ca575060408051601f3d908101601f191682019092526123c791810190613809565b60015b612424573d8080156123f8576040519150601f19603f3d011682016040523d82523d6000602084013e6123fd565b606091505b50805161241c5760405162461bcd60e51b815260040161085a906136b6565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611641565b506001611641565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561247d575060009050600361252a565b8460ff16601b1415801561249557508460ff16601c14155b156124a6575060009050600461252a565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156124fa573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166125235760006001925092505061252a565b9150600090505b94509492505050565b600081600481111561254757612547613826565b14156125505750565b600181600481111561256457612564613826565b14156125b25760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161085a565b60028160048111156125c6576125c6613826565b14156126145760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161085a565b600381600481111561262857612628613826565b14156126815760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161085a565b600481600481111561269557612695613826565b1415610ac05760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161085a565b6060816127125750506040805180820190915260018152600360fc1b602082015290565b8160005b811561273c57806127268161383c565b91506127359050600a836137c2565b9150612716565b60008167ffffffffffffffff81111561275757612757613142565b6040519080825280601f01601f191660200182016040528015612781576020820181803683370190505b5090505b84156116415761279660018361360d565b91506127a3600a86613857565b6127ae906030613624565b60f81b8183815181106127c3576127c3613655565b60200101906001600160f81b031916908160001a9053506127e5600a866137c2565b9450612785565b6108fb83836001612c58565b6060600061280783600261386b565b612812906002613624565b67ffffffffffffffff81111561282a5761282a613142565b6040519080825280601f01601f191660200182016040528015612854576020820181803683370190505b509050600360fc1b8160008151811061286f5761286f613655565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061289e5761289e613655565b60200101906001600160f81b031916908160001a90535060006128c284600261386b565b6128cd906001613624565b90505b6001811115612945576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061290157612901613655565b1a60f81b82828151811061291757612917613655565b60200101906001600160f81b031916908160001a90535060049490941c9361293e8161388a565b90506128d0565b508315610ae55760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161085a565b61299d81612056565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b612a3c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161085a565b600080846001600160a01b031684604051612a5791906138a1565b600060405180830381855af49150503d8060008114612a92576040519150601f19603f3d011682016040523d82523d6000602084013e612a97565b606091505b5091509150612abf82826040518060600160405280602781526020016138de60279139612cc8565b95945050505050565b6000610ae5828461360d565b600080612af685612af1612ae788611d27565b868863ffffffff16565b612d01565b91509150935093915050565b6000610ae58284613624565b6001600160a01b038216612b645760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161085a565b6000818152606760205260409020546001600160a01b031615612bc95760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161085a565b6001600160a01b0382166000908152606860205260408120805460019290612bf2908490613624565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46109df60008383611fe7565b6001600160a01b038316612c7757612c7460ff612b0283612ad4565b50505b6001600160a01b038216612c9657612c9360ff612ac883612ad4565b50505b6001600160a01b03838116600090815260fd60205260408082205485841683529120546108fb929182169116836121cc565b60608315612cd7575081610ae5565b825115612ce75782518084602001fd5b8160405162461bcd60e51b815260040161085a9190613019565b8154600090819081612d1286611d27565b9050600082118015612d5057504386612d2c60018561360d565b81548110612d3c57612d3c613655565b60009182526020909120015463ffffffff16145b15612db057612d5e85612e2c565b86612d6a60018561360d565b81548110612d7a57612d7a613655565b9060005260206000200160000160046101000a8154816001600160e01b0302191690836001600160e01b03160217905550612e1e565b856000016040518060400160405280612dc843612e99565b63ffffffff168152602001612ddc88612e2c565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b9250839150505b9250929050565b60006001600160e01b03821115612e955760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20326044820152663234206269747360c81b606482015260840161085a565b5090565b600063ffffffff821115612e955760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b606482015260840161085a565b828054612f0a9061339f565b90600052602060002090601f016020900481019282612f2c5760008555612f72565b82601f10612f4557805160ff1916838001178555612f72565b82800160010185558215612f72579182015b82811115612f72578251825591602001919060010190612f57565b50612e959291505b80821115612e955760008155600101612f7a565b6001600160e01b031981168114610ac057600080fd5b600060208284031215612fb657600080fd5b8135610ae581612f8e565b60005b83811015612fdc578181015183820152602001612fc4565b838111156113155750506000910152565b60008151808452613005816020860160208601612fc1565b601f01601f19169290920160200192915050565b602081526000610ae56020830184612fed565b60006020828403121561303e57600080fd5b5035919050565b6001600160a01b0381168114610ac057600080fd5b6000806040838503121561306d57600080fd5b823561307881613045565b946020939093013593505050565b60008060006060848603121561309b57600080fd5b83356130a681613045565b925060208401356130b681613045565b929592945050506040919091013590565b600080604083850312156130da57600080fd5b8235915060208301356130ec81613045565b809150509250929050565b60006020828403121561310957600080fd5b8135610ae581613045565b6000806040838503121561312757600080fd5b823561313281613045565b915060208301356130ec81613045565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261316957600080fd5b813567ffffffffffffffff8082111561318457613184613142565b604051601f8301601f19908116603f011681019082821181831017156131ac576131ac613142565b816040528381528660208588010111156131c557600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080604083850312156131f857600080fd5b823561320381613045565b9150602083013567ffffffffffffffff81111561321f57600080fd5b61322b85828601613158565b9150509250929050565b60008060006060848603121561324a57600080fd5b83359250602084013561325c81613045565b9150604084013567ffffffffffffffff81111561327857600080fd5b840160a0818703121561328a57600080fd5b809150509250925092565b8015158114610ac057600080fd5b600080604083850312156132b657600080fd5b82356132c181613045565b915060208301356130ec81613295565b600080600080608085870312156132e757600080fd5b84356132f281613045565b9350602085013561330281613045565b925060408501359150606085013567ffffffffffffffff81111561332557600080fd5b61333187828801613158565b91505092959194509250565b60008060008060008060c0878903121561335657600080fd5b863561336181613045565b95506020870135945060408701359350606087013560ff8116811461338557600080fd5b9598949750929560808101359460a0909101359350915050565b600181811c908216806133b357607f821691505b60208210811415611f1e57634e487b7160e01b600052602260045260246000fd5b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6000602082840312156134cc57600080fd5b8151610ae581613295565b6000808335601e198436030181126134ee57600080fd5b830160208101925035905067ffffffffffffffff81111561350e57600080fd5b803603831315612e2557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b602081528135602082015260208201356040820152600061356a60408401846134d7565b60a0606085015261357f60c08501828461351d565b91505061358f60608501856134d7565b601f19808685030160808701526135a784838561351d565b93506135b660808801886134d7565b93509150808685030160a0870152506135d083838361351d565b9695505050505050565b6000602082840312156135ec57600080fd5b8151610ae581613045565b634e487b7160e01b600052601160045260246000fd5b60008282101561361f5761361f6135f7565b500390565b60008219821115613637576136376135f7565b500190565b60006020828403121561364e57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6000835161371a818460208801612fc1565b83519083019061372e818360208801612fc1565b01949350505050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161376f816017850160208801612fc1565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516137a0816028840160208801612fc1565b01602801949350505050565b634e487b7160e01b600052601260045260246000fd5b6000826137d1576137d16137ac565b500490565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906135d090830184612fed565b60006020828403121561381b57600080fd5b8151610ae581612f8e565b634e487b7160e01b600052602160045260246000fd5b6000600019821415613850576138506135f7565b5060010190565b600082613866576138666137ac565b500690565b6000816000190483118215151615613885576138856135f7565b500290565b600081613899576138996135f7565b506000190190565b600082516138b3818460208701612fc1565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122002fc4a5649f59b294f7c19c769a852bf57d594074c65b2bb3a40d707b8cd732264736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/tokens/ERC721/GovernanceTokenV2.sol/GovernanceTokenV2.dbg.json b/src/contracts/tokens/ERC721/GovernanceTokenV2.sol/GovernanceTokenV2.dbg.json deleted file mode 100644 index f625e04e2b..0000000000 --- a/src/contracts/tokens/ERC721/GovernanceTokenV2.sol/GovernanceTokenV2.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/tokens/ERC721/GovernanceTokenV2.sol/GovernanceTokenV2.json b/src/contracts/tokens/ERC721/GovernanceTokenV2.sol/GovernanceTokenV2.json deleted file mode 100644 index 26d6c5a991..0000000000 --- a/src/contracts/tokens/ERC721/GovernanceTokenV2.sol/GovernanceTokenV2.json +++ /dev/null @@ -1,1019 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "GovernanceTokenV2", - "sourceName": "contracts/tokens/ERC721/GovernanceTokenV2.sol", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "previousAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "beacon", - "type": "address" - } - ], - "name": "BeaconUpgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "fromDelegate", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "toDelegate", - "type": "address" - } - ], - "name": "DelegateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegate", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "previousBalance", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newBalance", - "type": "uint256" - } - ], - "name": "DelegateVotesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "needId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId2", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "familyMember", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "friend", - "type": "address" - } - ], - "name": "Minted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "Upgraded", - "type": "event" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SAY_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "UPGRADER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "delegatee", - "type": "address" - } - ], - "name": "delegate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "delegatee", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiry", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "delegateBySig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "delegates", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - } - ], - "name": "getPastTotalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - } - ], - "name": "getPastVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "getVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sayAdmin", - "type": "address" - }, - { - "internalType": "address", - "name": "voucherContract", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "nonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "proxiableUUID", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_needId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_needContract", - "type": "address" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "needId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "mintValue", - "type": "uint256" - }, - { - "internalType": "string", - "name": "tokenUri", - "type": "string" - }, - { - "internalType": "string", - "name": "content", - "type": "string" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct Voucher", - "name": "_voucher", - "type": "tuple" - } - ], - "name": "safeFamilyMint", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "safeSocialWorkerMint", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAddress", - "type": "address" - } - ], - "name": "setVoucherVerifier", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "upgradeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "upgradeToAndCall", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "version", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "voucherAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "bytecode": "0x60a0604052306080523480156200001557600080fd5b506200002062000026565b620000e8565b600054610100900460ff1615620000935760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e6576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516139706200012060003960008181610a2401528181610a6401528181610d6c01528181610dac0152610e3b01526139706000f3fe6080604052600436106102255760003560e01c80636199719411610123578063a22cb465116100ab578063d547741f1161006f578063d547741f14610678578063d9b6304114610698578063e985e9c5146106cc578063ea19101314610715578063f72c0d8b1461071d57600080fd5b8063a22cb465146105d8578063b88d4fde146105f8578063c3cda52014610618578063c87b56dd14610638578063d402f02f1461065857600080fd5b80638e539e8c116100f25780638e539e8c1461054e57806391d148541461056e57806395d89b411461058e5780639ab24eb0146105a3578063a217fddf146105c357600080fd5b806361997194146104db5780636352211e146104ee57806370a082311461050e5780637ecebe001461052e57600080fd5b806336568abe116101b15780634f1ef286116101755780634f1ef2861461042f57806352d1902d1461044257806354fd4d5014610457578063587cde1e146104825780635c19a95c146104bb57600080fd5b806336568abe1461038f5780633659cfe6146103af5780633a46b1a8146103cf57806342842e0e146103ef578063485cc9551461040f57600080fd5b8063100575b2116101f8578063100575b2146102db57806323b872dd146102fc578063248a9ca31461031c5780632f2ff15d1461035a5780633644e5151461037a57600080fd5b806301ffc9a71461022a57806306fdde031461025f578063081812fc14610281578063095ea7b3146102b9575b600080fd5b34801561023657600080fd5b5061024a610245366004612fda565b610751565b60405190151581526020015b60405180910390f35b34801561026b57600080fd5b50610274610762565b604051610256919061304f565b34801561028d57600080fd5b506102a161029c366004613062565b6107f4565b6040516001600160a01b039091168152602001610256565b3480156102c557600080fd5b506102d96102d4366004613090565b61081b565b005b3480156102e757600080fd5b506101c6546102a1906001600160a01b031681565b34801561030857600080fd5b506102d96103173660046130bc565b610936565b34801561032857600080fd5b5061034c610337366004613062565b60009081526097602052604090206001015490565b604051908152602001610256565b34801561036657600080fd5b506102d96103753660046130fd565b610967565b34801561038657600080fd5b5061034c61098c565b34801561039b57600080fd5b506102d96103aa3660046130fd565b61099b565b3480156103bb57600080fd5b506102d96103ca36600461312d565b610a19565b3480156103db57600080fd5b5061034c6103ea366004613090565b610af9565b3480156103fb57600080fd5b506102d961040a3660046130bc565b610b22565b34801561041b57600080fd5b506102d961042a36600461314a565b610b3d565b6102d961043d36600461321b565b610d61565b34801561044e57600080fd5b5061034c610e2e565b34801561046357600080fd5b506040805180820190915260028152613b1960f11b6020820152610274565b34801561048e57600080fd5b506102a161049d36600461312d565b6001600160a01b03908116600090815260fd60205260409020541690565b3480156104c757600080fd5b506102d96104d636600461312d565b610ee1565b6102d96104e936600461326b565b610eec565b3480156104fa57600080fd5b506102a1610509366004613062565b611152565b34801561051a57600080fd5b5061034c61052936600461312d565b6111b2565b34801561053a57600080fd5b5061034c61054936600461312d565b611238565b34801561055a57600080fd5b5061034c610569366004613062565b611257565b34801561057a57600080fd5b5061024a6105893660046130fd565b6112b3565b34801561059a57600080fd5b506102746112de565b3480156105af57600080fd5b5061034c6105be36600461312d565b6112ed565b3480156105cf57600080fd5b5061034c600081565b3480156105e457600080fd5b506102d96105f33660046132d9565b61130e565b34801561060457600080fd5b506102d9610613366004613307565b611319565b34801561062457600080fd5b506102d9610633366004613373565b611351565b34801561064457600080fd5b50610274610653366004613062565b611475565b34801561066457600080fd5b506102d961067336600461312d565b611480565b34801561068457600080fd5b506102d96106933660046130fd565b6114ce565b3480156106a457600080fd5b5061034c7ffa4ac835fcfa16c9e62e7bb10d9c714aa0ffb94fecd1dff14e1970e78abf919581565b3480156106d857600080fd5b5061024a6106e736600461314a565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b6102d96114f3565b34801561072957600080fd5b5061034c7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b600061075c8261150e565b92915050565b606060658054610771906133d5565b80601f016020809104026020016040519081016040528092919081815260200182805461079d906133d5565b80156107ea5780601f106107bf576101008083540402835291602001916107ea565b820191906000526020600020905b8154815290600101906020018083116107cd57829003601f168201915b5050505050905090565b60006107ff82611533565b506000908152606960205260409020546001600160a01b031690565b600061082682611152565b9050806001600160a01b0316836001600160a01b031614156108995760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806108b557506108b581336106e7565b6109275760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c00006064820152608401610890565b6109318383611592565b505050565b6109403382611600565b61095c5760405162461bcd60e51b81526004016108909061340a565b61093183838361167f565b60008281526097602052604090206001015461098281611821565b610931838361182b565b60006109966118b1565b905090565b6001600160a01b0381163314610a0b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610890565b610a15828261192c565b5050565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610a625760405162461bcd60e51b815260040161089090613458565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610aab6000805160206138f4833981519152546001600160a01b031690565b6001600160a01b031614610ad15760405162461bcd60e51b8152600401610890906134a4565b610ada81611993565b60408051600080825260208201909252610af6918391906119bd565b50565b6001600160a01b038216600090815260fe60205260408120610b1b9083611b37565b9392505050565b61093183838360405180602001604052806000815250611319565b600054610100900460ff1615808015610b5d5750600054600160ff909116105b80610b775750303b158015610b77575060005460ff166001145b610bda5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610890565b6000805460ff191660011790558015610bfd576000805461ff0019166101001790555b610c4a6040518060400160405280600f81526020016e23b7bb32b93730b731b2aa37b5b2b760891b815250604051806040016040528060048152602001636753415960e01b815250611c46565b610c8c604051806040016040528060078152602001665341592d44414f60c81b815250604051806040016040528060018152602001603160f81b815250611c77565b610c94611ca8565b610c9c611ca8565b610ca760003361182b565b610cd17f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e33361182b565b610cfb7ffa4ac835fcfa16c9e62e7bb10d9c714aa0ffb94fecd1dff14e1970e78abf91958461182b565b6101c680546001600160a01b0319166001600160a01b0384161790558015610931576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610daa5760405162461bcd60e51b815260040161089090613458565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610df36000805160206138f4833981519152546001600160a01b031690565b6001600160a01b031614610e195760405162461bcd60e51b8152600401610890906134a4565b610e2282611993565b610a15828260016119bd565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610ece5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610890565b506000805160206138f483398151915290565b33610a158183611cd1565b604051639e60e75360e01b8152600481018490528390839081906000906001600160a01b03831690639e60e75390602401602060405180830381600087803b158015610f3757600080fd5b505af1158015610f4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f6f91906134f0565b90508015611101576101c65460405163cf1e8fa760e01b81526001600160a01b0390911690600090829063cf1e8fa790610fad908a9060040161357c565b60206040518083038186803b158015610fc557600080fd5b505afa158015610fd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffd9190613610565b905034876020013511156110535760405162461bcd60e51b815260206004820152601e60248201527f596f75206d757374207061792074686520766f75636865722076616c756500006044820152606401610890565b6110626101c580546001019055565b600061106e6101c55490565b905061107a8282611d43565b6110896101c580546001019055565b60006110956101c55490565b90506110a13382611d43565b604080518a358152602081018490529081018290526001600160a01b03841660608201523360808201527fc21247e7e8f72b583ed1500f6fb2de4267948d89cd06c59d50a71bef5431c2d79060a00160405180910390a150505050611149565b60405162461bcd60e51b815260206004820152601b60248201527f54686973204e656564206973206e6f74206d696e617461626c652100000000006044820152606401610890565b50505050505050565b6000818152606760205260408120546001600160a01b03168061075c5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610890565b60006001600160a01b03821661121c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610890565b506001600160a01b031660009081526068602052604090205490565b6001600160a01b0381166000908152610100602052604081205461075c565b60004382106112a85760405162461bcd60e51b815260206004820152601a60248201527f566f7465733a20626c6f636b206e6f7420796574206d696e65640000000000006044820152606401610890565b61075c60ff83611b37565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060668054610771906133d5565b6001600160a01b038116600090815260fe6020526040812061075c90611d5d565b610a15338383611db9565b6113233383611600565b61133f5760405162461bcd60e51b81526004016108909061340a565b61134b84848484611e88565b50505050565b834211156113a15760405162461bcd60e51b815260206004820152601860248201527f566f7465733a207369676e6174757265206578706972656400000000000000006044820152606401610890565b604080517fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60208201526001600160a01b03881691810191909152606081018690526080810185905260009061141b906114139060a00160405160208183030381529060405280519060200120611ebb565b858585611f09565b905061142681611f31565b861461146b5760405162461bcd60e51b8152602060048201526014602482015273566f7465733a20696e76616c6964206e6f6e636560601b6044820152606401610890565b6111498188611cd1565b606061075c82611f5a565b7ffa4ac835fcfa16c9e62e7bb10d9c714aa0ffb94fecd1dff14e1970e78abf91956114aa81611821565b506101c680546001600160a01b0319166001600160a01b0392909216919091179055565b6000828152609760205260409020600101546114e981611821565b610931838361192c565b6115026101c580546001019055565b6000610a156101c55490565b60006001600160e01b03198216637965db0b60e01b148061075c575061075c82611fcd565b6000818152606760205260409020546001600160a01b0316610af65760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610890565b600081815260696020526040902080546001600160a01b0319166001600160a01b03841690811790915581906115c782611152565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061160c83611152565b9050806001600160a01b0316846001600160a01b0316148061165357506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b806116775750836001600160a01b031661166c846107f4565b6001600160a01b0316145b949350505050565b826001600160a01b031661169282611152565b6001600160a01b0316146116f65760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610890565b6001600160a01b0382166117585760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610890565b611763600082611592565b6001600160a01b038316600090815260686020526040812080546001929061178c908490613643565b90915550506001600160a01b03821660009081526068602052604081208054600192906117ba90849061365a565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a461093183838361201d565b610af68133612028565b61183582826112b3565b610a155760008281526097602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561186d3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006109967f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6118e060c95490565b60ca546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b61193682826112b3565b15610a155760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e3610a1581611821565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156119f0576109318361208c565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015611a2957600080fd5b505afa925050508015611a59575060408051601f3d908101601f19168201909252611a5691810190613672565b60015b611abc5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610890565b6000805160206138f48339815191528114611b2b5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610890565b50610931838383612128565b6000438210611b885760405162461bcd60e51b815260206004820181905260248201527f436865636b706f696e74733a20626c6f636b206e6f7420796574206d696e65646044820152606401610890565b825460005b81811015611bed576000611ba1828461214d565b905084866000018281548110611bb957611bb961368b565b60009182526020909120015463ffffffff161115611bd957809250611be7565b611be481600161365a565b91505b50611b8d565b8115611c315784611bff600184613643565b81548110611c0f57611c0f61368b565b60009182526020909120015464010000000090046001600160e01b0316611c34565b60005b6001600160e01b031695945050505050565b600054610100900460ff16611c6d5760405162461bcd60e51b8152600401610890906136a1565b610a158282612168565b600054610100900460ff16611c9e5760405162461bcd60e51b8152600401610890906136a1565b610a1582826121b6565b600054610100900460ff16611ccf5760405162461bcd60e51b8152600401610890906136a1565b565b6001600160a01b03828116600081815260fd602052604080822080548686166001600160a01b0319821681179092559151919094169392849290917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a46109318183611d3e866121f7565b612202565b610a1582826040518060200160405280600081525061233f565b80546000908015611da65782611d74600183613643565b81548110611d8457611d8461368b565b60009182526020909120015464010000000090046001600160e01b0316611da9565b60005b6001600160e01b03169392505050565b816001600160a01b0316836001600160a01b03161415611e1b5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610890565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611e9384848461167f565b611e9f84848484612372565b61134b5760405162461bcd60e51b8152600401610890906136ec565b600061075c611ec86118b1565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000611f1a8787878761247c565b91509150611f2781612569565b5095945050505050565b6001600160a01b0381166000908152610100602052604090208054600181018255905b50919050565b6060611f6582611533565b6000611f7c60408051602081019091526000815290565b90506000815111611f9c5760405180602001604052806000815250610b1b565b80611fa684612724565b604051602001611fb792919061373e565b6040516020818303038152906040529392505050565b60006001600160e01b031982166380ac58cd60e01b1480611ffe57506001600160e01b03198216635b5e139f60e01b145b8061075c57506301ffc9a760e01b6001600160e01b031983161461075c565b610931838383612822565b61203282826112b3565b610a155761204a816001600160a01b0316601461282e565b61205583602061282e565b60405160200161206692919061376d565b60408051601f198184030181529082905262461bcd60e51b82526108909160040161304f565b6001600160a01b0381163b6120f95760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610890565b6000805160206138f483398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b612131836129ca565b60008251118061213e5750805b156109315761134b8383612a0a565b600061215c60028484186137f8565b610b1b9084841661365a565b600054610100900460ff1661218f5760405162461bcd60e51b8152600401610890906136a1565b81516121a2906065906020850190612f34565b508051610931906066906020840190612f34565b600054610100900460ff166121dd5760405162461bcd60e51b8152600401610890906136a1565b81516020928301208151919092012060c99190915560ca55565b600061075c826111b2565b816001600160a01b0316836001600160a01b0316141580156122245750600081115b15610931576001600160a01b038316156122b2576001600160a01b038316600090815260fe60205260408120819061225f90612afe85612b0a565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72483836040516122a7929190918252602082015260400190565b60405180910390a250505b6001600160a01b03821615610931576001600160a01b038216600090815260fe6020526040812081906122e890612b3885612b0a565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051612330929190918252602082015260400190565b60405180910390a25050505050565b6123498383612b44565b6123566000848484612372565b6109315760405162461bcd60e51b8152600401610890906136ec565b60006001600160a01b0384163b1561247457604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906123b690339089908890889060040161380c565b602060405180830381600087803b1580156123d057600080fd5b505af1925050508015612400575060408051601f3d908101601f191682019092526123fd9181019061383f565b60015b61245a573d80801561242e576040519150601f19603f3d011682016040523d82523d6000602084013e612433565b606091505b5080516124525760405162461bcd60e51b8152600401610890906136ec565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611677565b506001611677565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156124b35750600090506003612560565b8460ff16601b141580156124cb57508460ff16601c14155b156124dc5750600090506004612560565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612530573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661255957600060019250925050612560565b9150600090505b94509492505050565b600081600481111561257d5761257d61385c565b14156125865750565b600181600481111561259a5761259a61385c565b14156125e85760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610890565b60028160048111156125fc576125fc61385c565b141561264a5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610890565b600381600481111561265e5761265e61385c565b14156126b75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610890565b60048160048111156126cb576126cb61385c565b1415610af65760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610890565b6060816127485750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612772578061275c81613872565b915061276b9050600a836137f8565b915061274c565b60008167ffffffffffffffff81111561278d5761278d613178565b6040519080825280601f01601f1916602001820160405280156127b7576020820181803683370190505b5090505b8415611677576127cc600183613643565b91506127d9600a8661388d565b6127e490603061365a565b60f81b8183815181106127f9576127f961368b565b60200101906001600160f81b031916908160001a90535061281b600a866137f8565b94506127bb565b61093183836001612c8e565b6060600061283d8360026138a1565b61284890600261365a565b67ffffffffffffffff81111561286057612860613178565b6040519080825280601f01601f19166020018201604052801561288a576020820181803683370190505b509050600360fc1b816000815181106128a5576128a561368b565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106128d4576128d461368b565b60200101906001600160f81b031916908160001a90535060006128f88460026138a1565b61290390600161365a565b90505b600181111561297b576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106129375761293761368b565b1a60f81b82828151811061294d5761294d61368b565b60200101906001600160f81b031916908160001a90535060049490941c93612974816138c0565b9050612906565b508315610b1b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610890565b6129d38161208c565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b612a725760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610890565b600080846001600160a01b031684604051612a8d91906138d7565b600060405180830381855af49150503d8060008114612ac8576040519150601f19603f3d011682016040523d82523d6000602084013e612acd565b606091505b5091509150612af5828260405180606001604052806027815260200161391460279139612cfe565b95945050505050565b6000610b1b8284613643565b600080612b2c85612b27612b1d88611d5d565b868863ffffffff16565b612d37565b91509150935093915050565b6000610b1b828461365a565b6001600160a01b038216612b9a5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610890565b6000818152606760205260409020546001600160a01b031615612bff5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610890565b6001600160a01b0382166000908152606860205260408120805460019290612c2890849061365a565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4610a156000838361201d565b6001600160a01b038316612cad57612caa60ff612b3883612b0a565b50505b6001600160a01b038216612ccc57612cc960ff612afe83612b0a565b50505b6001600160a01b03838116600090815260fd602052604080822054858416835291205461093192918216911683612202565b60608315612d0d575081610b1b565b825115612d1d5782518084602001fd5b8160405162461bcd60e51b8152600401610890919061304f565b8154600090819081612d4886611d5d565b9050600082118015612d8657504386612d62600185613643565b81548110612d7257612d7261368b565b60009182526020909120015463ffffffff16145b15612de657612d9485612e62565b86612da0600185613643565b81548110612db057612db061368b565b9060005260206000200160000160046101000a8154816001600160e01b0302191690836001600160e01b03160217905550612e54565b856000016040518060400160405280612dfe43612ecf565b63ffffffff168152602001612e1288612e62565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b9250839150505b9250929050565b60006001600160e01b03821115612ecb5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20326044820152663234206269747360c81b6064820152608401610890565b5090565b600063ffffffff821115612ecb5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b6064820152608401610890565b828054612f40906133d5565b90600052602060002090601f016020900481019282612f625760008555612fa8565b82601f10612f7b57805160ff1916838001178555612fa8565b82800160010185558215612fa8579182015b82811115612fa8578251825591602001919060010190612f8d565b50612ecb9291505b80821115612ecb5760008155600101612fb0565b6001600160e01b031981168114610af657600080fd5b600060208284031215612fec57600080fd5b8135610b1b81612fc4565b60005b83811015613012578181015183820152602001612ffa565b8381111561134b5750506000910152565b6000815180845261303b816020860160208601612ff7565b601f01601f19169290920160200192915050565b602081526000610b1b6020830184613023565b60006020828403121561307457600080fd5b5035919050565b6001600160a01b0381168114610af657600080fd5b600080604083850312156130a357600080fd5b82356130ae8161307b565b946020939093013593505050565b6000806000606084860312156130d157600080fd5b83356130dc8161307b565b925060208401356130ec8161307b565b929592945050506040919091013590565b6000806040838503121561311057600080fd5b8235915060208301356131228161307b565b809150509250929050565b60006020828403121561313f57600080fd5b8135610b1b8161307b565b6000806040838503121561315d57600080fd5b82356131688161307b565b915060208301356131228161307b565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261319f57600080fd5b813567ffffffffffffffff808211156131ba576131ba613178565b604051601f8301601f19908116603f011681019082821181831017156131e2576131e2613178565b816040528381528660208588010111156131fb57600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561322e57600080fd5b82356132398161307b565b9150602083013567ffffffffffffffff81111561325557600080fd5b6132618582860161318e565b9150509250929050565b60008060006060848603121561328057600080fd5b8335925060208401356132928161307b565b9150604084013567ffffffffffffffff8111156132ae57600080fd5b840160a081870312156132c057600080fd5b809150509250925092565b8015158114610af657600080fd5b600080604083850312156132ec57600080fd5b82356132f78161307b565b91506020830135613122816132cb565b6000806000806080858703121561331d57600080fd5b84356133288161307b565b935060208501356133388161307b565b925060408501359150606085013567ffffffffffffffff81111561335b57600080fd5b6133678782880161318e565b91505092959194509250565b60008060008060008060c0878903121561338c57600080fd5b86356133978161307b565b95506020870135945060408701359350606087013560ff811681146133bb57600080fd5b9598949750929560808101359460a0909101359350915050565b600181811c908216806133e957607f821691505b60208210811415611f5457634e487b7160e01b600052602260045260246000fd5b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60006020828403121561350257600080fd5b8151610b1b816132cb565b6000808335601e1984360301811261352457600080fd5b830160208101925035905067ffffffffffffffff81111561354457600080fd5b803603831315612e5b57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60208152813560208201526020820135604082015260006135a0604084018461350d565b60a060608501526135b560c085018284613553565b9150506135c5606085018561350d565b601f19808685030160808701526135dd848385613553565b93506135ec608088018861350d565b93509150808685030160a087015250613606838383613553565b9695505050505050565b60006020828403121561362257600080fd5b8151610b1b8161307b565b634e487b7160e01b600052601160045260246000fd5b6000828210156136555761365561362d565b500390565b6000821982111561366d5761366d61362d565b500190565b60006020828403121561368457600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60008351613750818460208801612ff7565b835190830190613764818360208801612ff7565b01949350505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516137a5816017850160208801612ff7565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516137d6816028840160208801612ff7565b01602801949350505050565b634e487b7160e01b600052601260045260246000fd5b600082613807576138076137e2565b500490565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061360690830184613023565b60006020828403121561385157600080fd5b8151610b1b81612fc4565b634e487b7160e01b600052602160045260246000fd5b60006000198214156138865761388661362d565b5060010190565b60008261389c5761389c6137e2565b500690565b60008160001904831182151516156138bb576138bb61362d565b500290565b6000816138cf576138cf61362d565b506000190190565b600082516138e9818460208701612ff7565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220887e80d8265ddc05575802e4b2610d73af5d45ad33da51843d3a7f09bff92a5f64736f6c63430008090033", - "deployedBytecode": "0x6080604052600436106102255760003560e01c80636199719411610123578063a22cb465116100ab578063d547741f1161006f578063d547741f14610678578063d9b6304114610698578063e985e9c5146106cc578063ea19101314610715578063f72c0d8b1461071d57600080fd5b8063a22cb465146105d8578063b88d4fde146105f8578063c3cda52014610618578063c87b56dd14610638578063d402f02f1461065857600080fd5b80638e539e8c116100f25780638e539e8c1461054e57806391d148541461056e57806395d89b411461058e5780639ab24eb0146105a3578063a217fddf146105c357600080fd5b806361997194146104db5780636352211e146104ee57806370a082311461050e5780637ecebe001461052e57600080fd5b806336568abe116101b15780634f1ef286116101755780634f1ef2861461042f57806352d1902d1461044257806354fd4d5014610457578063587cde1e146104825780635c19a95c146104bb57600080fd5b806336568abe1461038f5780633659cfe6146103af5780633a46b1a8146103cf57806342842e0e146103ef578063485cc9551461040f57600080fd5b8063100575b2116101f8578063100575b2146102db57806323b872dd146102fc578063248a9ca31461031c5780632f2ff15d1461035a5780633644e5151461037a57600080fd5b806301ffc9a71461022a57806306fdde031461025f578063081812fc14610281578063095ea7b3146102b9575b600080fd5b34801561023657600080fd5b5061024a610245366004612fda565b610751565b60405190151581526020015b60405180910390f35b34801561026b57600080fd5b50610274610762565b604051610256919061304f565b34801561028d57600080fd5b506102a161029c366004613062565b6107f4565b6040516001600160a01b039091168152602001610256565b3480156102c557600080fd5b506102d96102d4366004613090565b61081b565b005b3480156102e757600080fd5b506101c6546102a1906001600160a01b031681565b34801561030857600080fd5b506102d96103173660046130bc565b610936565b34801561032857600080fd5b5061034c610337366004613062565b60009081526097602052604090206001015490565b604051908152602001610256565b34801561036657600080fd5b506102d96103753660046130fd565b610967565b34801561038657600080fd5b5061034c61098c565b34801561039b57600080fd5b506102d96103aa3660046130fd565b61099b565b3480156103bb57600080fd5b506102d96103ca36600461312d565b610a19565b3480156103db57600080fd5b5061034c6103ea366004613090565b610af9565b3480156103fb57600080fd5b506102d961040a3660046130bc565b610b22565b34801561041b57600080fd5b506102d961042a36600461314a565b610b3d565b6102d961043d36600461321b565b610d61565b34801561044e57600080fd5b5061034c610e2e565b34801561046357600080fd5b506040805180820190915260028152613b1960f11b6020820152610274565b34801561048e57600080fd5b506102a161049d36600461312d565b6001600160a01b03908116600090815260fd60205260409020541690565b3480156104c757600080fd5b506102d96104d636600461312d565b610ee1565b6102d96104e936600461326b565b610eec565b3480156104fa57600080fd5b506102a1610509366004613062565b611152565b34801561051a57600080fd5b5061034c61052936600461312d565b6111b2565b34801561053a57600080fd5b5061034c61054936600461312d565b611238565b34801561055a57600080fd5b5061034c610569366004613062565b611257565b34801561057a57600080fd5b5061024a6105893660046130fd565b6112b3565b34801561059a57600080fd5b506102746112de565b3480156105af57600080fd5b5061034c6105be36600461312d565b6112ed565b3480156105cf57600080fd5b5061034c600081565b3480156105e457600080fd5b506102d96105f33660046132d9565b61130e565b34801561060457600080fd5b506102d9610613366004613307565b611319565b34801561062457600080fd5b506102d9610633366004613373565b611351565b34801561064457600080fd5b50610274610653366004613062565b611475565b34801561066457600080fd5b506102d961067336600461312d565b611480565b34801561068457600080fd5b506102d96106933660046130fd565b6114ce565b3480156106a457600080fd5b5061034c7ffa4ac835fcfa16c9e62e7bb10d9c714aa0ffb94fecd1dff14e1970e78abf919581565b3480156106d857600080fd5b5061024a6106e736600461314a565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b6102d96114f3565b34801561072957600080fd5b5061034c7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b600061075c8261150e565b92915050565b606060658054610771906133d5565b80601f016020809104026020016040519081016040528092919081815260200182805461079d906133d5565b80156107ea5780601f106107bf576101008083540402835291602001916107ea565b820191906000526020600020905b8154815290600101906020018083116107cd57829003601f168201915b5050505050905090565b60006107ff82611533565b506000908152606960205260409020546001600160a01b031690565b600061082682611152565b9050806001600160a01b0316836001600160a01b031614156108995760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806108b557506108b581336106e7565b6109275760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c00006064820152608401610890565b6109318383611592565b505050565b6109403382611600565b61095c5760405162461bcd60e51b81526004016108909061340a565b61093183838361167f565b60008281526097602052604090206001015461098281611821565b610931838361182b565b60006109966118b1565b905090565b6001600160a01b0381163314610a0b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610890565b610a15828261192c565b5050565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610a625760405162461bcd60e51b815260040161089090613458565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610aab6000805160206138f4833981519152546001600160a01b031690565b6001600160a01b031614610ad15760405162461bcd60e51b8152600401610890906134a4565b610ada81611993565b60408051600080825260208201909252610af6918391906119bd565b50565b6001600160a01b038216600090815260fe60205260408120610b1b9083611b37565b9392505050565b61093183838360405180602001604052806000815250611319565b600054610100900460ff1615808015610b5d5750600054600160ff909116105b80610b775750303b158015610b77575060005460ff166001145b610bda5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610890565b6000805460ff191660011790558015610bfd576000805461ff0019166101001790555b610c4a6040518060400160405280600f81526020016e23b7bb32b93730b731b2aa37b5b2b760891b815250604051806040016040528060048152602001636753415960e01b815250611c46565b610c8c604051806040016040528060078152602001665341592d44414f60c81b815250604051806040016040528060018152602001603160f81b815250611c77565b610c94611ca8565b610c9c611ca8565b610ca760003361182b565b610cd17f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e33361182b565b610cfb7ffa4ac835fcfa16c9e62e7bb10d9c714aa0ffb94fecd1dff14e1970e78abf91958461182b565b6101c680546001600160a01b0319166001600160a01b0384161790558015610931576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610daa5760405162461bcd60e51b815260040161089090613458565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610df36000805160206138f4833981519152546001600160a01b031690565b6001600160a01b031614610e195760405162461bcd60e51b8152600401610890906134a4565b610e2282611993565b610a15828260016119bd565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610ece5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610890565b506000805160206138f483398151915290565b33610a158183611cd1565b604051639e60e75360e01b8152600481018490528390839081906000906001600160a01b03831690639e60e75390602401602060405180830381600087803b158015610f3757600080fd5b505af1158015610f4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f6f91906134f0565b90508015611101576101c65460405163cf1e8fa760e01b81526001600160a01b0390911690600090829063cf1e8fa790610fad908a9060040161357c565b60206040518083038186803b158015610fc557600080fd5b505afa158015610fd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffd9190613610565b905034876020013511156110535760405162461bcd60e51b815260206004820152601e60248201527f596f75206d757374207061792074686520766f75636865722076616c756500006044820152606401610890565b6110626101c580546001019055565b600061106e6101c55490565b905061107a8282611d43565b6110896101c580546001019055565b60006110956101c55490565b90506110a13382611d43565b604080518a358152602081018490529081018290526001600160a01b03841660608201523360808201527fc21247e7e8f72b583ed1500f6fb2de4267948d89cd06c59d50a71bef5431c2d79060a00160405180910390a150505050611149565b60405162461bcd60e51b815260206004820152601b60248201527f54686973204e656564206973206e6f74206d696e617461626c652100000000006044820152606401610890565b50505050505050565b6000818152606760205260408120546001600160a01b03168061075c5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610890565b60006001600160a01b03821661121c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610890565b506001600160a01b031660009081526068602052604090205490565b6001600160a01b0381166000908152610100602052604081205461075c565b60004382106112a85760405162461bcd60e51b815260206004820152601a60248201527f566f7465733a20626c6f636b206e6f7420796574206d696e65640000000000006044820152606401610890565b61075c60ff83611b37565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060668054610771906133d5565b6001600160a01b038116600090815260fe6020526040812061075c90611d5d565b610a15338383611db9565b6113233383611600565b61133f5760405162461bcd60e51b81526004016108909061340a565b61134b84848484611e88565b50505050565b834211156113a15760405162461bcd60e51b815260206004820152601860248201527f566f7465733a207369676e6174757265206578706972656400000000000000006044820152606401610890565b604080517fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60208201526001600160a01b03881691810191909152606081018690526080810185905260009061141b906114139060a00160405160208183030381529060405280519060200120611ebb565b858585611f09565b905061142681611f31565b861461146b5760405162461bcd60e51b8152602060048201526014602482015273566f7465733a20696e76616c6964206e6f6e636560601b6044820152606401610890565b6111498188611cd1565b606061075c82611f5a565b7ffa4ac835fcfa16c9e62e7bb10d9c714aa0ffb94fecd1dff14e1970e78abf91956114aa81611821565b506101c680546001600160a01b0319166001600160a01b0392909216919091179055565b6000828152609760205260409020600101546114e981611821565b610931838361192c565b6115026101c580546001019055565b6000610a156101c55490565b60006001600160e01b03198216637965db0b60e01b148061075c575061075c82611fcd565b6000818152606760205260409020546001600160a01b0316610af65760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610890565b600081815260696020526040902080546001600160a01b0319166001600160a01b03841690811790915581906115c782611152565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061160c83611152565b9050806001600160a01b0316846001600160a01b0316148061165357506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b806116775750836001600160a01b031661166c846107f4565b6001600160a01b0316145b949350505050565b826001600160a01b031661169282611152565b6001600160a01b0316146116f65760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610890565b6001600160a01b0382166117585760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610890565b611763600082611592565b6001600160a01b038316600090815260686020526040812080546001929061178c908490613643565b90915550506001600160a01b03821660009081526068602052604081208054600192906117ba90849061365a565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a461093183838361201d565b610af68133612028565b61183582826112b3565b610a155760008281526097602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561186d3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006109967f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6118e060c95490565b60ca546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b61193682826112b3565b15610a155760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e3610a1581611821565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156119f0576109318361208c565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015611a2957600080fd5b505afa925050508015611a59575060408051601f3d908101601f19168201909252611a5691810190613672565b60015b611abc5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610890565b6000805160206138f48339815191528114611b2b5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610890565b50610931838383612128565b6000438210611b885760405162461bcd60e51b815260206004820181905260248201527f436865636b706f696e74733a20626c6f636b206e6f7420796574206d696e65646044820152606401610890565b825460005b81811015611bed576000611ba1828461214d565b905084866000018281548110611bb957611bb961368b565b60009182526020909120015463ffffffff161115611bd957809250611be7565b611be481600161365a565b91505b50611b8d565b8115611c315784611bff600184613643565b81548110611c0f57611c0f61368b565b60009182526020909120015464010000000090046001600160e01b0316611c34565b60005b6001600160e01b031695945050505050565b600054610100900460ff16611c6d5760405162461bcd60e51b8152600401610890906136a1565b610a158282612168565b600054610100900460ff16611c9e5760405162461bcd60e51b8152600401610890906136a1565b610a1582826121b6565b600054610100900460ff16611ccf5760405162461bcd60e51b8152600401610890906136a1565b565b6001600160a01b03828116600081815260fd602052604080822080548686166001600160a01b0319821681179092559151919094169392849290917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a46109318183611d3e866121f7565b612202565b610a1582826040518060200160405280600081525061233f565b80546000908015611da65782611d74600183613643565b81548110611d8457611d8461368b565b60009182526020909120015464010000000090046001600160e01b0316611da9565b60005b6001600160e01b03169392505050565b816001600160a01b0316836001600160a01b03161415611e1b5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610890565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611e9384848461167f565b611e9f84848484612372565b61134b5760405162461bcd60e51b8152600401610890906136ec565b600061075c611ec86118b1565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000611f1a8787878761247c565b91509150611f2781612569565b5095945050505050565b6001600160a01b0381166000908152610100602052604090208054600181018255905b50919050565b6060611f6582611533565b6000611f7c60408051602081019091526000815290565b90506000815111611f9c5760405180602001604052806000815250610b1b565b80611fa684612724565b604051602001611fb792919061373e565b6040516020818303038152906040529392505050565b60006001600160e01b031982166380ac58cd60e01b1480611ffe57506001600160e01b03198216635b5e139f60e01b145b8061075c57506301ffc9a760e01b6001600160e01b031983161461075c565b610931838383612822565b61203282826112b3565b610a155761204a816001600160a01b0316601461282e565b61205583602061282e565b60405160200161206692919061376d565b60408051601f198184030181529082905262461bcd60e51b82526108909160040161304f565b6001600160a01b0381163b6120f95760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610890565b6000805160206138f483398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b612131836129ca565b60008251118061213e5750805b156109315761134b8383612a0a565b600061215c60028484186137f8565b610b1b9084841661365a565b600054610100900460ff1661218f5760405162461bcd60e51b8152600401610890906136a1565b81516121a2906065906020850190612f34565b508051610931906066906020840190612f34565b600054610100900460ff166121dd5760405162461bcd60e51b8152600401610890906136a1565b81516020928301208151919092012060c99190915560ca55565b600061075c826111b2565b816001600160a01b0316836001600160a01b0316141580156122245750600081115b15610931576001600160a01b038316156122b2576001600160a01b038316600090815260fe60205260408120819061225f90612afe85612b0a565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72483836040516122a7929190918252602082015260400190565b60405180910390a250505b6001600160a01b03821615610931576001600160a01b038216600090815260fe6020526040812081906122e890612b3885612b0a565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051612330929190918252602082015260400190565b60405180910390a25050505050565b6123498383612b44565b6123566000848484612372565b6109315760405162461bcd60e51b8152600401610890906136ec565b60006001600160a01b0384163b1561247457604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906123b690339089908890889060040161380c565b602060405180830381600087803b1580156123d057600080fd5b505af1925050508015612400575060408051601f3d908101601f191682019092526123fd9181019061383f565b60015b61245a573d80801561242e576040519150601f19603f3d011682016040523d82523d6000602084013e612433565b606091505b5080516124525760405162461bcd60e51b8152600401610890906136ec565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611677565b506001611677565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156124b35750600090506003612560565b8460ff16601b141580156124cb57508460ff16601c14155b156124dc5750600090506004612560565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612530573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661255957600060019250925050612560565b9150600090505b94509492505050565b600081600481111561257d5761257d61385c565b14156125865750565b600181600481111561259a5761259a61385c565b14156125e85760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610890565b60028160048111156125fc576125fc61385c565b141561264a5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610890565b600381600481111561265e5761265e61385c565b14156126b75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610890565b60048160048111156126cb576126cb61385c565b1415610af65760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610890565b6060816127485750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612772578061275c81613872565b915061276b9050600a836137f8565b915061274c565b60008167ffffffffffffffff81111561278d5761278d613178565b6040519080825280601f01601f1916602001820160405280156127b7576020820181803683370190505b5090505b8415611677576127cc600183613643565b91506127d9600a8661388d565b6127e490603061365a565b60f81b8183815181106127f9576127f961368b565b60200101906001600160f81b031916908160001a90535061281b600a866137f8565b94506127bb565b61093183836001612c8e565b6060600061283d8360026138a1565b61284890600261365a565b67ffffffffffffffff81111561286057612860613178565b6040519080825280601f01601f19166020018201604052801561288a576020820181803683370190505b509050600360fc1b816000815181106128a5576128a561368b565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106128d4576128d461368b565b60200101906001600160f81b031916908160001a90535060006128f88460026138a1565b61290390600161365a565b90505b600181111561297b576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106129375761293761368b565b1a60f81b82828151811061294d5761294d61368b565b60200101906001600160f81b031916908160001a90535060049490941c93612974816138c0565b9050612906565b508315610b1b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610890565b6129d38161208c565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b612a725760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610890565b600080846001600160a01b031684604051612a8d91906138d7565b600060405180830381855af49150503d8060008114612ac8576040519150601f19603f3d011682016040523d82523d6000602084013e612acd565b606091505b5091509150612af5828260405180606001604052806027815260200161391460279139612cfe565b95945050505050565b6000610b1b8284613643565b600080612b2c85612b27612b1d88611d5d565b868863ffffffff16565b612d37565b91509150935093915050565b6000610b1b828461365a565b6001600160a01b038216612b9a5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610890565b6000818152606760205260409020546001600160a01b031615612bff5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610890565b6001600160a01b0382166000908152606860205260408120805460019290612c2890849061365a565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4610a156000838361201d565b6001600160a01b038316612cad57612caa60ff612b3883612b0a565b50505b6001600160a01b038216612ccc57612cc960ff612afe83612b0a565b50505b6001600160a01b03838116600090815260fd602052604080822054858416835291205461093192918216911683612202565b60608315612d0d575081610b1b565b825115612d1d5782518084602001fd5b8160405162461bcd60e51b8152600401610890919061304f565b8154600090819081612d4886611d5d565b9050600082118015612d8657504386612d62600185613643565b81548110612d7257612d7261368b565b60009182526020909120015463ffffffff16145b15612de657612d9485612e62565b86612da0600185613643565b81548110612db057612db061368b565b9060005260206000200160000160046101000a8154816001600160e01b0302191690836001600160e01b03160217905550612e54565b856000016040518060400160405280612dfe43612ecf565b63ffffffff168152602001612e1288612e62565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b9250839150505b9250929050565b60006001600160e01b03821115612ecb5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20326044820152663234206269747360c81b6064820152608401610890565b5090565b600063ffffffff821115612ecb5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b6064820152608401610890565b828054612f40906133d5565b90600052602060002090601f016020900481019282612f625760008555612fa8565b82601f10612f7b57805160ff1916838001178555612fa8565b82800160010185558215612fa8579182015b82811115612fa8578251825591602001919060010190612f8d565b50612ecb9291505b80821115612ecb5760008155600101612fb0565b6001600160e01b031981168114610af657600080fd5b600060208284031215612fec57600080fd5b8135610b1b81612fc4565b60005b83811015613012578181015183820152602001612ffa565b8381111561134b5750506000910152565b6000815180845261303b816020860160208601612ff7565b601f01601f19169290920160200192915050565b602081526000610b1b6020830184613023565b60006020828403121561307457600080fd5b5035919050565b6001600160a01b0381168114610af657600080fd5b600080604083850312156130a357600080fd5b82356130ae8161307b565b946020939093013593505050565b6000806000606084860312156130d157600080fd5b83356130dc8161307b565b925060208401356130ec8161307b565b929592945050506040919091013590565b6000806040838503121561311057600080fd5b8235915060208301356131228161307b565b809150509250929050565b60006020828403121561313f57600080fd5b8135610b1b8161307b565b6000806040838503121561315d57600080fd5b82356131688161307b565b915060208301356131228161307b565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261319f57600080fd5b813567ffffffffffffffff808211156131ba576131ba613178565b604051601f8301601f19908116603f011681019082821181831017156131e2576131e2613178565b816040528381528660208588010111156131fb57600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561322e57600080fd5b82356132398161307b565b9150602083013567ffffffffffffffff81111561325557600080fd5b6132618582860161318e565b9150509250929050565b60008060006060848603121561328057600080fd5b8335925060208401356132928161307b565b9150604084013567ffffffffffffffff8111156132ae57600080fd5b840160a081870312156132c057600080fd5b809150509250925092565b8015158114610af657600080fd5b600080604083850312156132ec57600080fd5b82356132f78161307b565b91506020830135613122816132cb565b6000806000806080858703121561331d57600080fd5b84356133288161307b565b935060208501356133388161307b565b925060408501359150606085013567ffffffffffffffff81111561335b57600080fd5b6133678782880161318e565b91505092959194509250565b60008060008060008060c0878903121561338c57600080fd5b86356133978161307b565b95506020870135945060408701359350606087013560ff811681146133bb57600080fd5b9598949750929560808101359460a0909101359350915050565b600181811c908216806133e957607f821691505b60208210811415611f5457634e487b7160e01b600052602260045260246000fd5b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60006020828403121561350257600080fd5b8151610b1b816132cb565b6000808335601e1984360301811261352457600080fd5b830160208101925035905067ffffffffffffffff81111561354457600080fd5b803603831315612e5b57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60208152813560208201526020820135604082015260006135a0604084018461350d565b60a060608501526135b560c085018284613553565b9150506135c5606085018561350d565b601f19808685030160808701526135dd848385613553565b93506135ec608088018861350d565b93509150808685030160a087015250613606838383613553565b9695505050505050565b60006020828403121561362257600080fd5b8151610b1b8161307b565b634e487b7160e01b600052601160045260246000fd5b6000828210156136555761365561362d565b500390565b6000821982111561366d5761366d61362d565b500190565b60006020828403121561368457600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60008351613750818460208801612ff7565b835190830190613764818360208801612ff7565b01949350505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516137a5816017850160208801612ff7565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516137d6816028840160208801612ff7565b01602801949350505050565b634e487b7160e01b600052601260045260246000fd5b600082613807576138076137e2565b500490565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061360690830184613023565b60006020828403121561385157600080fd5b8151610b1b81612fc4565b634e487b7160e01b600052602160045260246000fd5b60006000198214156138865761388661362d565b5060010190565b60008261389c5761389c6137e2565b500690565b60008160001904831182151516156138bb576138bb61362d565b500290565b6000816138cf576138cf61362d565b506000190190565b600082516138e9818460208701612ff7565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220887e80d8265ddc05575802e4b2610d73af5d45ad33da51843d3a7f09bff92a5f64736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/tokens/ERC721/VerifyVoucher.sol/VerifyVoucher.dbg.json b/src/contracts/tokens/ERC721/VerifyVoucher.sol/VerifyVoucher.dbg.json deleted file mode 100644 index f625e04e2b..0000000000 --- a/src/contracts/tokens/ERC721/VerifyVoucher.sol/VerifyVoucher.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/tokens/ERC721/VerifyVoucher.sol/VerifyVoucher.json b/src/contracts/tokens/ERC721/VerifyVoucher.sol/VerifyVoucher.json deleted file mode 100644 index 8472964818..0000000000 --- a/src/contracts/tokens/ERC721/VerifyVoucher.sol/VerifyVoucher.json +++ /dev/null @@ -1,253 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "VerifyVoucher", - "sourceName": "contracts/tokens/ERC721/VerifyVoucher.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "previousAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "beacon", - "type": "address" - } - ], - "name": "BeaconUpgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "msg", - "type": "string" - } - ], - "name": "FallingBack", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "Upgraded", - "type": "event" - }, - { - "stateMutability": "nonpayable", - "type": "fallback" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "needId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "mintValue", - "type": "uint256" - }, - { - "internalType": "string", - "name": "tokenUri", - "type": "string" - }, - { - "internalType": "string", - "name": "content", - "type": "string" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct VerifyVoucher.Voucher", - "name": "_voucher", - "type": "tuple" - } - ], - "name": "_verify", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getChainID", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "proxiableUUID", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "upgradeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "upgradeToAndCall", - "outputs": [], - "stateMutability": "payable", - "type": "function" - } - ], - "bytecode": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100e2565b600054610100900460ff161561008e5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100e0576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516113bc610119600039600081816102050152818161024e015281816102ee0152818161032e01526103c101526113bc6000f3fe6080604052600436106100865760003560e01c8063715018a611610059578063715018a61461015e5780638129fc1c146101735780638da5cb5b14610188578063cf1e8fa7146101ba578063f2fde38b146101da57610086565b80633659cfe6146100ee5780634f1ef2861461011057806352d1902d14610123578063564b81ef1461014b575b34801561009257600080fd5b507f206c3a4747cc015c67ea08c7121dfc4e67a3fd32aa695153c0be7feadd9b415b6040516100e4906020808252600f908201526e53746f72652046616c6c204261636b60881b604082015260600190565b60405180910390a1005b3480156100fa57600080fd5b5061010e61010936600461102d565b6101fa565b005b61010e61011e36600461105e565b6102e3565b34801561012f57600080fd5b506101386103b4565b6040519081526020015b60405180910390f35b34801561015757600080fd5b5046610138565b34801561016a57600080fd5b5061010e610467565b34801561017f57600080fd5b5061010e61047b565b34801561019457600080fd5b506033546001600160a01b03165b6040516001600160a01b039091168152602001610142565b3480156101c657600080fd5b506101a26101d5366004611120565b6105c5565b3480156101e657600080fd5b5061010e6101f536600461102d565b610625565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561024c5760405162461bcd60e51b81526004016102439061115b565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610295600080516020611340833981519152546001600160a01b031690565b6001600160a01b0316146102bb5760405162461bcd60e51b8152600401610243906111a7565b6102c48161069b565b604080516000808252602082019092526102e0918391906106a3565b50565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561032c5760405162461bcd60e51b81526004016102439061115b565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610375600080516020611340833981519152546001600160a01b031690565b6001600160a01b03161461039b5760405162461bcd60e51b8152600401610243906111a7565b6103a48261069b565b6103b0828260016106a3565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104545760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610243565b5060008051602061134083398151915290565b61046f610822565b610479600061087c565b565b600054610100900460ff161580801561049b5750600054600160ff909116105b806104b55750303b1580156104b5575060005460ff166001145b6105185760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610243565b6000805460ff19166001179055801561053b576000805461ff0019166101001790555b61057d604051806040016040528060078152602001665341592d44414f60c81b815250604051806040016040528060018152602001603160f81b8152506108ce565b80156102e0576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6000806105d1836108ff565b905061061e816105e460808601866111f3565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506109bc92505050565b9392505050565b61062d610822565b6001600160a01b0381166106925760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610243565b6102e08161087c565b6102e0610822565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156106db576106d6836109e0565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561071457600080fd5b505afa925050508015610744575060408051601f3d908101601f191682019092526107419181019061123a565b60015b6107a75760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610243565b60008051602061134083398151915281146108165760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610243565b506106d6838383610a7c565b6033546001600160a01b031633146104795760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610243565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166108f55760405162461bcd60e51b815260040161024390611253565b6103b08282610aa7565b60006109b67f21562a3e2d7df6de947c3fcdff6d90b9e05b1e927f611ce05f9e59162b4f5c188335602085013561093960408701876111f3565b60405161094792919061129e565b60405190819003902061095d60608801886111f3565b60405161096b92919061129e565b6040805191829003822060208301969096528101939093526060830191909152608082015260a081019190915260c00160405160208183030381529060405280519060200120610ae8565b92915050565b60008060006109cb8585610b36565b915091506109d881610b7c565b509392505050565b6001600160a01b0381163b610a4d5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610243565b60008051602061134083398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b610a8583610d37565b600082511180610a925750805b156106d657610aa18383610d77565b50505050565b600054610100900460ff16610ace5760405162461bcd60e51b815260040161024390611253565b815160209283012081519190920120606591909155606655565b60006109b6610af5610e6b565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b600080825160411415610b6d5760208301516040840151606085015160001a610b6187828585610eeb565b94509450505050610b75565b506000905060025b9250929050565b6000816004811115610b9057610b906112ae565b1415610b995750565b6001816004811115610bad57610bad6112ae565b1415610bfb5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610243565b6002816004811115610c0f57610c0f6112ae565b1415610c5d5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610243565b6003816004811115610c7157610c716112ae565b1415610cca5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610243565b6004816004811115610cde57610cde6112ae565b14156102e05760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610243565b610d40816109e0565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b610ddf5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610243565b600080846001600160a01b031684604051610dfa91906112f0565b600060405180830381855af49150503d8060008114610e35576040519150601f19603f3d011682016040523d82523d6000602084013e610e3a565b606091505b5091509150610e62828260405180606001604052806027815260200161136060279139610fd8565b95945050505050565b6000610ee67f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f610e9a60655490565b6066546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b905090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610f225750600090506003610fcf565b8460ff16601b14158015610f3a57508460ff16601c14155b15610f4b5750600090506004610fcf565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610f9f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610fc857600060019250925050610fcf565b9150600090505b94509492505050565b60608315610fe757508161061e565b825115610ff75782518084602001fd5b8160405162461bcd60e51b8152600401610243919061130c565b80356001600160a01b038116811461102857600080fd5b919050565b60006020828403121561103f57600080fd5b61061e82611011565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561107157600080fd5b61107a83611011565b9150602083013567ffffffffffffffff8082111561109757600080fd5b818501915085601f8301126110ab57600080fd5b8135818111156110bd576110bd611048565b604051601f8201601f19908116603f011681019083821181831017156110e5576110e5611048565b816040528281528860208487010111156110fe57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60006020828403121561113257600080fd5b813567ffffffffffffffff81111561114957600080fd5b820160a0818503121561061e57600080fd5b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6000808335601e1984360301811261120a57600080fd5b83018035915067ffffffffffffffff82111561122557600080fd5b602001915036819003821315610b7557600080fd5b60006020828403121561124c57600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b8183823760009101908152919050565b634e487b7160e01b600052602160045260246000fd5b60005b838110156112df5781810151838201526020016112c7565b83811115610aa15750506000910152565b600082516113028184602087016112c4565b9190910192915050565b602081526000825180602084015261132b8160408501602087016112c4565b601f01601f1916919091016040019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220fa58745026775857a6d70256e3cb3f38442d665ab139db419c7758f8efa91e9564736f6c63430008090033", - "deployedBytecode": "0x6080604052600436106100865760003560e01c8063715018a611610059578063715018a61461015e5780638129fc1c146101735780638da5cb5b14610188578063cf1e8fa7146101ba578063f2fde38b146101da57610086565b80633659cfe6146100ee5780634f1ef2861461011057806352d1902d14610123578063564b81ef1461014b575b34801561009257600080fd5b507f206c3a4747cc015c67ea08c7121dfc4e67a3fd32aa695153c0be7feadd9b415b6040516100e4906020808252600f908201526e53746f72652046616c6c204261636b60881b604082015260600190565b60405180910390a1005b3480156100fa57600080fd5b5061010e61010936600461102d565b6101fa565b005b61010e61011e36600461105e565b6102e3565b34801561012f57600080fd5b506101386103b4565b6040519081526020015b60405180910390f35b34801561015757600080fd5b5046610138565b34801561016a57600080fd5b5061010e610467565b34801561017f57600080fd5b5061010e61047b565b34801561019457600080fd5b506033546001600160a01b03165b6040516001600160a01b039091168152602001610142565b3480156101c657600080fd5b506101a26101d5366004611120565b6105c5565b3480156101e657600080fd5b5061010e6101f536600461102d565b610625565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561024c5760405162461bcd60e51b81526004016102439061115b565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610295600080516020611340833981519152546001600160a01b031690565b6001600160a01b0316146102bb5760405162461bcd60e51b8152600401610243906111a7565b6102c48161069b565b604080516000808252602082019092526102e0918391906106a3565b50565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561032c5760405162461bcd60e51b81526004016102439061115b565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610375600080516020611340833981519152546001600160a01b031690565b6001600160a01b03161461039b5760405162461bcd60e51b8152600401610243906111a7565b6103a48261069b565b6103b0828260016106a3565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104545760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610243565b5060008051602061134083398151915290565b61046f610822565b610479600061087c565b565b600054610100900460ff161580801561049b5750600054600160ff909116105b806104b55750303b1580156104b5575060005460ff166001145b6105185760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610243565b6000805460ff19166001179055801561053b576000805461ff0019166101001790555b61057d604051806040016040528060078152602001665341592d44414f60c81b815250604051806040016040528060018152602001603160f81b8152506108ce565b80156102e0576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6000806105d1836108ff565b905061061e816105e460808601866111f3565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506109bc92505050565b9392505050565b61062d610822565b6001600160a01b0381166106925760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610243565b6102e08161087c565b6102e0610822565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156106db576106d6836109e0565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561071457600080fd5b505afa925050508015610744575060408051601f3d908101601f191682019092526107419181019061123a565b60015b6107a75760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610243565b60008051602061134083398151915281146108165760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610243565b506106d6838383610a7c565b6033546001600160a01b031633146104795760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610243565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166108f55760405162461bcd60e51b815260040161024390611253565b6103b08282610aa7565b60006109b67f21562a3e2d7df6de947c3fcdff6d90b9e05b1e927f611ce05f9e59162b4f5c188335602085013561093960408701876111f3565b60405161094792919061129e565b60405190819003902061095d60608801886111f3565b60405161096b92919061129e565b6040805191829003822060208301969096528101939093526060830191909152608082015260a081019190915260c00160405160208183030381529060405280519060200120610ae8565b92915050565b60008060006109cb8585610b36565b915091506109d881610b7c565b509392505050565b6001600160a01b0381163b610a4d5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610243565b60008051602061134083398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b610a8583610d37565b600082511180610a925750805b156106d657610aa18383610d77565b50505050565b600054610100900460ff16610ace5760405162461bcd60e51b815260040161024390611253565b815160209283012081519190920120606591909155606655565b60006109b6610af5610e6b565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b600080825160411415610b6d5760208301516040840151606085015160001a610b6187828585610eeb565b94509450505050610b75565b506000905060025b9250929050565b6000816004811115610b9057610b906112ae565b1415610b995750565b6001816004811115610bad57610bad6112ae565b1415610bfb5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610243565b6002816004811115610c0f57610c0f6112ae565b1415610c5d5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610243565b6003816004811115610c7157610c716112ae565b1415610cca5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610243565b6004816004811115610cde57610cde6112ae565b14156102e05760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610243565b610d40816109e0565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b610ddf5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610243565b600080846001600160a01b031684604051610dfa91906112f0565b600060405180830381855af49150503d8060008114610e35576040519150601f19603f3d011682016040523d82523d6000602084013e610e3a565b606091505b5091509150610e62828260405180606001604052806027815260200161136060279139610fd8565b95945050505050565b6000610ee67f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f610e9a60655490565b6066546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b905090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610f225750600090506003610fcf565b8460ff16601b14158015610f3a57508460ff16601c14155b15610f4b5750600090506004610fcf565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610f9f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610fc857600060019250925050610fcf565b9150600090505b94509492505050565b60608315610fe757508161061e565b825115610ff75782518084602001fd5b8160405162461bcd60e51b8152600401610243919061130c565b80356001600160a01b038116811461102857600080fd5b919050565b60006020828403121561103f57600080fd5b61061e82611011565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561107157600080fd5b61107a83611011565b9150602083013567ffffffffffffffff8082111561109757600080fd5b818501915085601f8301126110ab57600080fd5b8135818111156110bd576110bd611048565b604051601f8201601f19908116603f011681019083821181831017156110e5576110e5611048565b816040528281528860208487010111156110fe57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60006020828403121561113257600080fd5b813567ffffffffffffffff81111561114957600080fd5b820160a0818503121561061e57600080fd5b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6000808335601e1984360301811261120a57600080fd5b83018035915067ffffffffffffffff82111561122557600080fd5b602001915036819003821315610b7557600080fd5b60006020828403121561124c57600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b8183823760009101908152919050565b634e487b7160e01b600052602160045260246000fd5b60005b838110156112df5781810151838201526020016112c7565b83811115610aa15750506000910152565b600082516113028184602087016112c4565b9190910192915050565b602081526000825180602084015261132b8160408501602087016112c4565b601f01601f1916919091016040019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220fa58745026775857a6d70256e3cb3f38442d665ab139db419c7758f8efa91e9564736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/tokens/ERC721/people/Child.sol/Child.dbg.json b/src/contracts/tokens/ERC721/people/Child.sol/Child.dbg.json deleted file mode 100644 index 404e18639b..0000000000 --- a/src/contracts/tokens/ERC721/people/Child.sol/Child.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/tokens/ERC721/people/Child.sol/Child.json b/src/contracts/tokens/ERC721/people/Child.sol/Child.json deleted file mode 100644 index 48af5156c4..0000000000 --- a/src/contracts/tokens/ERC721/people/Child.sol/Child.json +++ /dev/null @@ -1,525 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Child", - "sourceName": "contracts/tokens/ERC721/people/Child.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "previousAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "beacon", - "type": "address" - } - ], - "name": "BeaconUpgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "Upgraded", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "proxiableUUID", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "string", - "name": "uri", - "type": "string" - } - ], - "name": "safeMint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "upgradeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "upgradeToAndCall", - "outputs": [], - "stateMutability": "payable", - "type": "function" - } - ], - "bytecode": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100e2565b600054610100900460ff161561008e5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100e0576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516122fb6200011a6000396000818161065e0152818161069e0152818161075901528181610799015261082c01526122fb6000f3fe60806040526004361061012a5760003560e01c806370a08231116100ab578063a22cb4651161006f578063a22cb46514610313578063b88d4fde14610333578063c87b56dd14610353578063d204c45e14610373578063e985e9c514610393578063f2fde38b146103dc57600080fd5b806370a0823114610296578063715018a6146102b65780638129fc1c146102cb5780638da5cb5b146102e057806395d89b41146102fe57600080fd5b80633659cfe6116100f25780633659cfe61461020057806342842e0e146102205780634f1ef2861461024057806352d1902d146102535780636352211e1461027657600080fd5b806301ffc9a71461012f57806306fdde0314610164578063081812fc14610186578063095ea7b3146101be57806323b872dd146101e0575b600080fd5b34801561013b57600080fd5b5061014f61014a366004611be7565b6103fc565b60405190151581526020015b60405180910390f35b34801561017057600080fd5b5061017961044e565b60405161015b9190611c5c565b34801561019257600080fd5b506101a66101a1366004611c6f565b6104e0565b6040516001600160a01b03909116815260200161015b565b3480156101ca57600080fd5b506101de6101d9366004611ca4565b610507565b005b3480156101ec57600080fd5b506101de6101fb366004611cce565b610622565b34801561020c57600080fd5b506101de61021b366004611d0a565b610653565b34801561022c57600080fd5b506101de61023b366004611cce565b610733565b6101de61024e366004611dd1565b61074e565b34801561025f57600080fd5b5061026861081f565b60405190815260200161015b565b34801561028257600080fd5b506101a6610291366004611c6f565b6108d2565b3480156102a257600080fd5b506102686102b1366004611d0a565b610932565b3480156102c257600080fd5b506101de6109b8565b3480156102d757600080fd5b506101de6109cc565b3480156102ec57600080fd5b5060c9546001600160a01b03166101a6565b34801561030a57600080fd5b50610179610b30565b34801561031f57600080fd5b506101de61032e366004611e1f565b610b3f565b34801561033f57600080fd5b506101de61034e366004611e5b565b610b4a565b34801561035f57600080fd5b5061017961036e366004611c6f565b610b82565b34801561037f57600080fd5b506101de61038e366004611ec3565b610b8d565b34801561039f57600080fd5b5061014f6103ae366004611f1b565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b3480156103e857600080fd5b506101de6103f7366004611d0a565b610bc6565b60006001600160e01b031982166380ac58cd60e01b148061042d57506001600160e01b03198216635b5e139f60e01b145b8061044857506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606065805461045d90611f4e565b80601f016020809104026020016040519081016040528092919081815260200182805461048990611f4e565b80156104d65780601f106104ab576101008083540402835291602001916104d6565b820191906000526020600020905b8154815290600101906020018083116104b957829003601f168201915b5050505050905090565b60006104eb82610c3c565b506000908152606960205260409020546001600160a01b031690565b6000610512826108d2565b9050806001600160a01b0316836001600160a01b031614156105855760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806105a157506105a181336103ae565b6106135760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161057c565b61061d8383610c9b565b505050565b61062c3382610d09565b6106485760405162461bcd60e51b815260040161057c90611f89565b61061d838383610d88565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561069c5760405162461bcd60e51b815260040161057c90611fd7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166106e560008051602061227f833981519152546001600160a01b031690565b6001600160a01b03161461070b5760405162461bcd60e51b815260040161057c90612023565b61071481610f24565b6040805160008082526020820190925261073091839190610f2c565b50565b61061d83838360405180602001604052806000815250610b4a565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156107975760405162461bcd60e51b815260040161057c90611fd7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166107e060008051602061227f833981519152546001600160a01b031690565b6001600160a01b0316146108065760405162461bcd60e51b815260040161057c90612023565b61080f82610f24565b61081b82826001610f2c565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108bf5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161057c565b5060008051602061227f83398151915290565b6000818152606760205260408120546001600160a01b0316806104485760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161057c565b60006001600160a01b03821661099c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161057c565b506001600160a01b031660009081526068602052604090205490565b6109c06110a6565b6109ca6000611100565b565b600054610100900460ff16158080156109ec5750600054600160ff909116105b80610a065750303b158015610a06575060005460ff166001145b610a695760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161057c565b6000805460ff191660011790558015610a8c576000805461ff0019166101001790555b610ad06040518060400160405280600581526020016410da1a5b1960da1b8152506040518060400160405280600581526020016410d212531160da1b815250611152565b610ad8611183565b610ae06111aa565b610ae8611183565b8015610730576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b60606066805461045d90611f4e565b61081b3383836111d9565b610b543383610d09565b610b705760405162461bcd60e51b815260040161057c90611f89565b610b7c848484846112a8565b50505050565b6060610448826112db565b610b956110a6565b6000610ba161015f5490565b9050610bb261015f80546001019055565b610bbc83826113e4565b61061d81836113fe565b610bce6110a6565b6001600160a01b038116610c335760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161057c565b61073081611100565b6000818152606760205260409020546001600160a01b03166107305760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161057c565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190610cd0826108d2565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080610d15836108d2565b9050806001600160a01b0316846001600160a01b03161480610d5c57506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b80610d805750836001600160a01b0316610d75846104e0565b6001600160a01b0316145b949350505050565b826001600160a01b0316610d9b826108d2565b6001600160a01b031614610dff5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161057c565b6001600160a01b038216610e615760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161057c565b610e6c600082610c9b565b6001600160a01b0383166000908152606860205260408120805460019290610e95908490612085565b90915550506001600160a01b0382166000908152606860205260408120805460019290610ec390849061209c565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6107306110a6565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610f5f5761061d83611498565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f9857600080fd5b505afa925050508015610fc8575060408051601f3d908101601f19168201909252610fc5918101906120b4565b60015b61102b5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161057c565b60008051602061227f833981519152811461109a5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161057c565b5061061d838383611534565b60c9546001600160a01b031633146109ca5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057c565b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166111795760405162461bcd60e51b815260040161057c906120cd565b61081b8282611559565b600054610100900460ff166109ca5760405162461bcd60e51b815260040161057c906120cd565b600054610100900460ff166111d15760405162461bcd60e51b815260040161057c906120cd565b6109ca6115a7565b816001600160a01b0316836001600160a01b0316141561123b5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161057c565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6112b3848484610d88565b6112bf848484846115d7565b610b7c5760405162461bcd60e51b815260040161057c90612118565b60606112e682610c3c565b600082815260976020526040812080546112ff90611f4e565b80601f016020809104026020016040519081016040528092919081815260200182805461132b90611f4e565b80156113785780601f1061134d57610100808354040283529160200191611378565b820191906000526020600020905b81548152906001019060200180831161135b57829003601f168201915b50505050509050600061139660408051602081019091526000815290565b90508051600014156113a9575092915050565b8151156113db5780826040516020016113c392919061216a565b60405160208183030381529060405292505050919050565b610d80846116e4565b61081b828260405180602001604052806000815250611758565b6000828152606760205260409020546001600160a01b03166114795760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b606482015260840161057c565b6000828152609760209081526040909120825161061d92840190611b38565b6001600160a01b0381163b6115055760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161057c565b60008051602061227f83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61153d8361178b565b60008251118061154a5750805b1561061d57610b7c83836117cb565b600054610100900460ff166115805760405162461bcd60e51b815260040161057c906120cd565b8151611593906065906020850190611b38565b50805161061d906066906020840190611b38565b600054610100900460ff166115ce5760405162461bcd60e51b815260040161057c906120cd565b6109ca33611100565b60006001600160a01b0384163b156116d957604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061161b903390899088908890600401612199565b602060405180830381600087803b15801561163557600080fd5b505af1925050508015611665575060408051601f3d908101601f19168201909252611662918101906121d6565b60015b6116bf573d808015611693576040519150601f19603f3d011682016040523d82523d6000602084013e611698565b606091505b5080516116b75760405162461bcd60e51b815260040161057c90612118565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610d80565b506001949350505050565b60606116ef82610c3c565b600061170660408051602081019091526000815290565b905060008151116117265760405180602001604052806000815250611751565b80611730846118bf565b60405160200161174192919061216a565b6040516020818303038152906040525b9392505050565b61176283836119bd565b61176f60008484846115d7565b61061d5760405162461bcd60e51b815260040161057c90612118565b61179481611498565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6118335760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161057c565b600080846001600160a01b03168460405161184e91906121f3565b600060405180830381855af49150503d8060008114611889576040519150601f19603f3d011682016040523d82523d6000602084013e61188e565b606091505b50915091506118b6828260405180606001604052806027815260200161229f60279139611aff565b95945050505050565b6060816118e35750506040805180820190915260018152600360fc1b602082015290565b8160005b811561190d57806118f78161220f565b91506119069050600a83612240565b91506118e7565b60008167ffffffffffffffff81111561192857611928611d25565b6040519080825280601f01601f191660200182016040528015611952576020820181803683370190505b5090505b8415610d8057611967600183612085565b9150611974600a86612254565b61197f90603061209c565b60f81b81838151811061199457611994612268565b60200101906001600160f81b031916908160001a9053506119b6600a86612240565b9450611956565b6001600160a01b038216611a135760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161057c565b6000818152606760205260409020546001600160a01b031615611a785760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161057c565b6001600160a01b0382166000908152606860205260408120805460019290611aa190849061209c565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60608315611b0e575081611751565b825115611b1e5782518084602001fd5b8160405162461bcd60e51b815260040161057c9190611c5c565b828054611b4490611f4e565b90600052602060002090601f016020900481019282611b665760008555611bac565b82601f10611b7f57805160ff1916838001178555611bac565b82800160010185558215611bac579182015b82811115611bac578251825591602001919060010190611b91565b50611bb8929150611bbc565b5090565b5b80821115611bb85760008155600101611bbd565b6001600160e01b03198116811461073057600080fd5b600060208284031215611bf957600080fd5b813561175181611bd1565b60005b83811015611c1f578181015183820152602001611c07565b83811115610b7c5750506000910152565b60008151808452611c48816020860160208601611c04565b601f01601f19169290920160200192915050565b6020815260006117516020830184611c30565b600060208284031215611c8157600080fd5b5035919050565b80356001600160a01b0381168114611c9f57600080fd5b919050565b60008060408385031215611cb757600080fd5b611cc083611c88565b946020939093013593505050565b600080600060608486031215611ce357600080fd5b611cec84611c88565b9250611cfa60208501611c88565b9150604084013590509250925092565b600060208284031215611d1c57600080fd5b61175182611c88565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115611d5657611d56611d25565b604051601f8501601f19908116603f01168101908282118183101715611d7e57611d7e611d25565b81604052809350858152868686011115611d9757600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112611dc257600080fd5b61175183833560208501611d3b565b60008060408385031215611de457600080fd5b611ded83611c88565b9150602083013567ffffffffffffffff811115611e0957600080fd5b611e1585828601611db1565b9150509250929050565b60008060408385031215611e3257600080fd5b611e3b83611c88565b915060208301358015158114611e5057600080fd5b809150509250929050565b60008060008060808587031215611e7157600080fd5b611e7a85611c88565b9350611e8860208601611c88565b925060408501359150606085013567ffffffffffffffff811115611eab57600080fd5b611eb787828801611db1565b91505092959194509250565b60008060408385031215611ed657600080fd5b611edf83611c88565b9150602083013567ffffffffffffffff811115611efb57600080fd5b8301601f81018513611f0c57600080fd5b611e1585823560208401611d3b565b60008060408385031215611f2e57600080fd5b611f3783611c88565b9150611f4560208401611c88565b90509250929050565b600181811c90821680611f6257607f821691505b60208210811415611f8357634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b6000828210156120975761209761206f565b500390565b600082198211156120af576120af61206f565b500190565b6000602082840312156120c657600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6000835161217c818460208801611c04565b835190830190612190818360208801611c04565b01949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906121cc90830184611c30565b9695505050505050565b6000602082840312156121e857600080fd5b815161175181611bd1565b60008251612205818460208701611c04565b9190910192915050565b60006000198214156122235761222361206f565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261224f5761224f61222a565b500490565b6000826122635761226361222a565b500690565b634e487b7160e01b600052603260045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208f246d2788ea7f74789ebf7d6b10702efcf4fcbb98eeed6eb126ff058aa293e664736f6c63430008090033", - "deployedBytecode": "0x60806040526004361061012a5760003560e01c806370a08231116100ab578063a22cb4651161006f578063a22cb46514610313578063b88d4fde14610333578063c87b56dd14610353578063d204c45e14610373578063e985e9c514610393578063f2fde38b146103dc57600080fd5b806370a0823114610296578063715018a6146102b65780638129fc1c146102cb5780638da5cb5b146102e057806395d89b41146102fe57600080fd5b80633659cfe6116100f25780633659cfe61461020057806342842e0e146102205780634f1ef2861461024057806352d1902d146102535780636352211e1461027657600080fd5b806301ffc9a71461012f57806306fdde0314610164578063081812fc14610186578063095ea7b3146101be57806323b872dd146101e0575b600080fd5b34801561013b57600080fd5b5061014f61014a366004611be7565b6103fc565b60405190151581526020015b60405180910390f35b34801561017057600080fd5b5061017961044e565b60405161015b9190611c5c565b34801561019257600080fd5b506101a66101a1366004611c6f565b6104e0565b6040516001600160a01b03909116815260200161015b565b3480156101ca57600080fd5b506101de6101d9366004611ca4565b610507565b005b3480156101ec57600080fd5b506101de6101fb366004611cce565b610622565b34801561020c57600080fd5b506101de61021b366004611d0a565b610653565b34801561022c57600080fd5b506101de61023b366004611cce565b610733565b6101de61024e366004611dd1565b61074e565b34801561025f57600080fd5b5061026861081f565b60405190815260200161015b565b34801561028257600080fd5b506101a6610291366004611c6f565b6108d2565b3480156102a257600080fd5b506102686102b1366004611d0a565b610932565b3480156102c257600080fd5b506101de6109b8565b3480156102d757600080fd5b506101de6109cc565b3480156102ec57600080fd5b5060c9546001600160a01b03166101a6565b34801561030a57600080fd5b50610179610b30565b34801561031f57600080fd5b506101de61032e366004611e1f565b610b3f565b34801561033f57600080fd5b506101de61034e366004611e5b565b610b4a565b34801561035f57600080fd5b5061017961036e366004611c6f565b610b82565b34801561037f57600080fd5b506101de61038e366004611ec3565b610b8d565b34801561039f57600080fd5b5061014f6103ae366004611f1b565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b3480156103e857600080fd5b506101de6103f7366004611d0a565b610bc6565b60006001600160e01b031982166380ac58cd60e01b148061042d57506001600160e01b03198216635b5e139f60e01b145b8061044857506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606065805461045d90611f4e565b80601f016020809104026020016040519081016040528092919081815260200182805461048990611f4e565b80156104d65780601f106104ab576101008083540402835291602001916104d6565b820191906000526020600020905b8154815290600101906020018083116104b957829003601f168201915b5050505050905090565b60006104eb82610c3c565b506000908152606960205260409020546001600160a01b031690565b6000610512826108d2565b9050806001600160a01b0316836001600160a01b031614156105855760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806105a157506105a181336103ae565b6106135760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161057c565b61061d8383610c9b565b505050565b61062c3382610d09565b6106485760405162461bcd60e51b815260040161057c90611f89565b61061d838383610d88565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561069c5760405162461bcd60e51b815260040161057c90611fd7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166106e560008051602061227f833981519152546001600160a01b031690565b6001600160a01b03161461070b5760405162461bcd60e51b815260040161057c90612023565b61071481610f24565b6040805160008082526020820190925261073091839190610f2c565b50565b61061d83838360405180602001604052806000815250610b4a565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156107975760405162461bcd60e51b815260040161057c90611fd7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166107e060008051602061227f833981519152546001600160a01b031690565b6001600160a01b0316146108065760405162461bcd60e51b815260040161057c90612023565b61080f82610f24565b61081b82826001610f2c565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108bf5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161057c565b5060008051602061227f83398151915290565b6000818152606760205260408120546001600160a01b0316806104485760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161057c565b60006001600160a01b03821661099c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161057c565b506001600160a01b031660009081526068602052604090205490565b6109c06110a6565b6109ca6000611100565b565b600054610100900460ff16158080156109ec5750600054600160ff909116105b80610a065750303b158015610a06575060005460ff166001145b610a695760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161057c565b6000805460ff191660011790558015610a8c576000805461ff0019166101001790555b610ad06040518060400160405280600581526020016410da1a5b1960da1b8152506040518060400160405280600581526020016410d212531160da1b815250611152565b610ad8611183565b610ae06111aa565b610ae8611183565b8015610730576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b60606066805461045d90611f4e565b61081b3383836111d9565b610b543383610d09565b610b705760405162461bcd60e51b815260040161057c90611f89565b610b7c848484846112a8565b50505050565b6060610448826112db565b610b956110a6565b6000610ba161015f5490565b9050610bb261015f80546001019055565b610bbc83826113e4565b61061d81836113fe565b610bce6110a6565b6001600160a01b038116610c335760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161057c565b61073081611100565b6000818152606760205260409020546001600160a01b03166107305760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161057c565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190610cd0826108d2565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080610d15836108d2565b9050806001600160a01b0316846001600160a01b03161480610d5c57506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b80610d805750836001600160a01b0316610d75846104e0565b6001600160a01b0316145b949350505050565b826001600160a01b0316610d9b826108d2565b6001600160a01b031614610dff5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161057c565b6001600160a01b038216610e615760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161057c565b610e6c600082610c9b565b6001600160a01b0383166000908152606860205260408120805460019290610e95908490612085565b90915550506001600160a01b0382166000908152606860205260408120805460019290610ec390849061209c565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6107306110a6565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610f5f5761061d83611498565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f9857600080fd5b505afa925050508015610fc8575060408051601f3d908101601f19168201909252610fc5918101906120b4565b60015b61102b5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161057c565b60008051602061227f833981519152811461109a5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161057c565b5061061d838383611534565b60c9546001600160a01b031633146109ca5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057c565b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166111795760405162461bcd60e51b815260040161057c906120cd565b61081b8282611559565b600054610100900460ff166109ca5760405162461bcd60e51b815260040161057c906120cd565b600054610100900460ff166111d15760405162461bcd60e51b815260040161057c906120cd565b6109ca6115a7565b816001600160a01b0316836001600160a01b0316141561123b5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161057c565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6112b3848484610d88565b6112bf848484846115d7565b610b7c5760405162461bcd60e51b815260040161057c90612118565b60606112e682610c3c565b600082815260976020526040812080546112ff90611f4e565b80601f016020809104026020016040519081016040528092919081815260200182805461132b90611f4e565b80156113785780601f1061134d57610100808354040283529160200191611378565b820191906000526020600020905b81548152906001019060200180831161135b57829003601f168201915b50505050509050600061139660408051602081019091526000815290565b90508051600014156113a9575092915050565b8151156113db5780826040516020016113c392919061216a565b60405160208183030381529060405292505050919050565b610d80846116e4565b61081b828260405180602001604052806000815250611758565b6000828152606760205260409020546001600160a01b03166114795760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b606482015260840161057c565b6000828152609760209081526040909120825161061d92840190611b38565b6001600160a01b0381163b6115055760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161057c565b60008051602061227f83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61153d8361178b565b60008251118061154a5750805b1561061d57610b7c83836117cb565b600054610100900460ff166115805760405162461bcd60e51b815260040161057c906120cd565b8151611593906065906020850190611b38565b50805161061d906066906020840190611b38565b600054610100900460ff166115ce5760405162461bcd60e51b815260040161057c906120cd565b6109ca33611100565b60006001600160a01b0384163b156116d957604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061161b903390899088908890600401612199565b602060405180830381600087803b15801561163557600080fd5b505af1925050508015611665575060408051601f3d908101601f19168201909252611662918101906121d6565b60015b6116bf573d808015611693576040519150601f19603f3d011682016040523d82523d6000602084013e611698565b606091505b5080516116b75760405162461bcd60e51b815260040161057c90612118565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610d80565b506001949350505050565b60606116ef82610c3c565b600061170660408051602081019091526000815290565b905060008151116117265760405180602001604052806000815250611751565b80611730846118bf565b60405160200161174192919061216a565b6040516020818303038152906040525b9392505050565b61176283836119bd565b61176f60008484846115d7565b61061d5760405162461bcd60e51b815260040161057c90612118565b61179481611498565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6118335760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161057c565b600080846001600160a01b03168460405161184e91906121f3565b600060405180830381855af49150503d8060008114611889576040519150601f19603f3d011682016040523d82523d6000602084013e61188e565b606091505b50915091506118b6828260405180606001604052806027815260200161229f60279139611aff565b95945050505050565b6060816118e35750506040805180820190915260018152600360fc1b602082015290565b8160005b811561190d57806118f78161220f565b91506119069050600a83612240565b91506118e7565b60008167ffffffffffffffff81111561192857611928611d25565b6040519080825280601f01601f191660200182016040528015611952576020820181803683370190505b5090505b8415610d8057611967600183612085565b9150611974600a86612254565b61197f90603061209c565b60f81b81838151811061199457611994612268565b60200101906001600160f81b031916908160001a9053506119b6600a86612240565b9450611956565b6001600160a01b038216611a135760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161057c565b6000818152606760205260409020546001600160a01b031615611a785760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161057c565b6001600160a01b0382166000908152606860205260408120805460019290611aa190849061209c565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60608315611b0e575081611751565b825115611b1e5782518084602001fd5b8160405162461bcd60e51b815260040161057c9190611c5c565b828054611b4490611f4e565b90600052602060002090601f016020900481019282611b665760008555611bac565b82601f10611b7f57805160ff1916838001178555611bac565b82800160010185558215611bac579182015b82811115611bac578251825591602001919060010190611b91565b50611bb8929150611bbc565b5090565b5b80821115611bb85760008155600101611bbd565b6001600160e01b03198116811461073057600080fd5b600060208284031215611bf957600080fd5b813561175181611bd1565b60005b83811015611c1f578181015183820152602001611c07565b83811115610b7c5750506000910152565b60008151808452611c48816020860160208601611c04565b601f01601f19169290920160200192915050565b6020815260006117516020830184611c30565b600060208284031215611c8157600080fd5b5035919050565b80356001600160a01b0381168114611c9f57600080fd5b919050565b60008060408385031215611cb757600080fd5b611cc083611c88565b946020939093013593505050565b600080600060608486031215611ce357600080fd5b611cec84611c88565b9250611cfa60208501611c88565b9150604084013590509250925092565b600060208284031215611d1c57600080fd5b61175182611c88565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115611d5657611d56611d25565b604051601f8501601f19908116603f01168101908282118183101715611d7e57611d7e611d25565b81604052809350858152868686011115611d9757600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112611dc257600080fd5b61175183833560208501611d3b565b60008060408385031215611de457600080fd5b611ded83611c88565b9150602083013567ffffffffffffffff811115611e0957600080fd5b611e1585828601611db1565b9150509250929050565b60008060408385031215611e3257600080fd5b611e3b83611c88565b915060208301358015158114611e5057600080fd5b809150509250929050565b60008060008060808587031215611e7157600080fd5b611e7a85611c88565b9350611e8860208601611c88565b925060408501359150606085013567ffffffffffffffff811115611eab57600080fd5b611eb787828801611db1565b91505092959194509250565b60008060408385031215611ed657600080fd5b611edf83611c88565b9150602083013567ffffffffffffffff811115611efb57600080fd5b8301601f81018513611f0c57600080fd5b611e1585823560208401611d3b565b60008060408385031215611f2e57600080fd5b611f3783611c88565b9150611f4560208401611c88565b90509250929050565b600181811c90821680611f6257607f821691505b60208210811415611f8357634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b6000828210156120975761209761206f565b500390565b600082198211156120af576120af61206f565b500190565b6000602082840312156120c657600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6000835161217c818460208801611c04565b835190830190612190818360208801611c04565b01949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906121cc90830184611c30565b9695505050505050565b6000602082840312156121e857600080fd5b815161175181611bd1565b60008251612205818460208701611c04565b9190910192915050565b60006000198214156122235761222361206f565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261224f5761224f61222a565b500490565b6000826122635761226361222a565b500690565b634e487b7160e01b600052603260045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208f246d2788ea7f74789ebf7d6b10702efcf4fcbb98eeed6eb126ff058aa293e664736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/tokens/ERC721/people/Family.sol/Family.dbg.json b/src/contracts/tokens/ERC721/people/Family.sol/Family.dbg.json deleted file mode 100644 index 404e18639b..0000000000 --- a/src/contracts/tokens/ERC721/people/Family.sol/Family.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/tokens/ERC721/people/Family.sol/Family.json b/src/contracts/tokens/ERC721/people/Family.sol/Family.json deleted file mode 100644 index f3cedfef12..0000000000 --- a/src/contracts/tokens/ERC721/people/Family.sol/Family.json +++ /dev/null @@ -1,578 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Family", - "sourceName": "contracts/tokens/ERC721/people/Family.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "previousAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "beacon", - "type": "address" - } - ], - "name": "BeaconUpgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "Upgraded", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "member", - "type": "address" - }, - { - "internalType": "address", - "name": "childNFT", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "familyImpact", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "proxiableUUID", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "string", - "name": "uri", - "type": "string" - } - ], - "name": "safeMint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "upgradeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "upgradeToAndCall", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "member", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "verifyFamily", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - } - ], - "bytecode": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100e2565b600054610100900460ff161561008e5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100e0576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516123576200011a600039600081816106bb015281816106fb015281816107b6015281816107f6015261088901526123576000f3fe6080604052600436106101405760003560e01c80636352211e116100b6578063a22cb4651161006f578063a22cb46514610370578063b88d4fde14610390578063c87b56dd146103b0578063d204c45e146103d0578063e985e9c5146103f0578063f2fde38b1461043957600080fd5b80636352211e146102d357806370a08231146102f3578063715018a6146103135780638129fc1c146103285780638da5cb5b1461033d57806395d89b411461035b57600080fd5b80632568eaca116101085780632568eaca146102165780633659cfe61461024857806342842e0e146102685780634b9f8fe0146102885780634f1ef286146102ab57806352d1902d146102be57600080fd5b806301ffc9a71461014557806306fdde031461017a578063081812fc1461019c578063095ea7b3146101d457806323b872dd146101f6575b600080fd5b34801561015157600080fd5b50610165610160366004611c43565b610459565b60405190151581526020015b60405180910390f35b34801561018657600080fd5b5061018f6104ab565b6040516101719190611cb8565b3480156101a857600080fd5b506101bc6101b7366004611ccb565b61053d565b6040516001600160a01b039091168152602001610171565b3480156101e057600080fd5b506101f46101ef366004611d00565b610564565b005b34801561020257600080fd5b506101f4610211366004611d2a565b61067f565b34801561022257600080fd5b5061023a610231366004611d2a565b60009392505050565b604051908152602001610171565b34801561025457600080fd5b506101f4610263366004611d66565b6106b0565b34801561027457600080fd5b506101f4610283366004611d2a565b610790565b34801561029457600080fd5b506101656102a3366004611d81565b600192915050565b6101f46102b9366004611e60565b6107ab565b3480156102ca57600080fd5b5061023a61087c565b3480156102df57600080fd5b506101bc6102ee366004611ccb565b61092f565b3480156102ff57600080fd5b5061023a61030e366004611d66565b61098f565b34801561031f57600080fd5b506101f4610a15565b34801561033457600080fd5b506101f4610a29565b34801561034957600080fd5b5060c9546001600160a01b03166101bc565b34801561036757600080fd5b5061018f610b8c565b34801561037c57600080fd5b506101f461038b366004611eae565b610b9b565b34801561039c57600080fd5b506101f46103ab366004611eea565b610ba6565b3480156103bc57600080fd5b5061018f6103cb366004611ccb565b610bde565b3480156103dc57600080fd5b506101f46103eb366004611f52565b610be9565b3480156103fc57600080fd5b5061016561040b366004611d81565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b34801561044557600080fd5b506101f4610454366004611d66565b610c22565b60006001600160e01b031982166380ac58cd60e01b148061048a57506001600160e01b03198216635b5e139f60e01b145b806104a557506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060606580546104ba90611faa565b80601f01602080910402602001604051908101604052809291908181526020018280546104e690611faa565b80156105335780601f1061050857610100808354040283529160200191610533565b820191906000526020600020905b81548152906001019060200180831161051657829003601f168201915b5050505050905090565b600061054882610c98565b506000908152606960205260409020546001600160a01b031690565b600061056f8261092f565b9050806001600160a01b0316836001600160a01b031614156105e25760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806105fe57506105fe813361040b565b6106705760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c000060648201526084016105d9565b61067a8383610cf7565b505050565b6106893382610d65565b6106a55760405162461bcd60e51b81526004016105d990611fe5565b61067a838383610de4565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156106f95760405162461bcd60e51b81526004016105d990612033565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166107426000805160206122db833981519152546001600160a01b031690565b6001600160a01b0316146107685760405162461bcd60e51b81526004016105d99061207f565b61077181610f80565b6040805160008082526020820190925261078d91839190610f88565b50565b61067a83838360405180602001604052806000815250610ba6565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156107f45760405162461bcd60e51b81526004016105d990612033565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661083d6000805160206122db833981519152546001600160a01b031690565b6001600160a01b0316146108635760405162461bcd60e51b81526004016105d99061207f565b61086c82610f80565b61087882826001610f88565b5050565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461091c5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016105d9565b506000805160206122db83398151915290565b6000818152606760205260408120546001600160a01b0316806104a55760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016105d9565b60006001600160a01b0382166109f95760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016105d9565b506001600160a01b031660009081526068602052604090205490565b610a1d611102565b610a27600061115c565b565b600054610100900460ff1615808015610a495750600054600160ff909116105b80610a635750303b158015610a63575060005460ff166001145b610ac65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105d9565b6000805460ff191660011790558015610ae9576000805461ff0019166101001790555b610b2c6040518060400160405280600681526020016546616d696c7960d01b8152506040518060400160405280600381526020016246414d60e81b8152506111ae565b610b346111df565b610b3c611206565b610b446111df565b801561078d576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6060606680546104ba90611faa565b610878338383611235565b610bb03383610d65565b610bcc5760405162461bcd60e51b81526004016105d990611fe5565b610bd884848484611304565b50505050565b60606104a582611337565b610bf1611102565b6000610bfd61015f5490565b9050610c0e61015f80546001019055565b610c188382611440565b61067a818361145a565b610c2a611102565b6001600160a01b038116610c8f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105d9565b61078d8161115c565b6000818152606760205260409020546001600160a01b031661078d5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016105d9565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190610d2c8261092f565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080610d718361092f565b9050806001600160a01b0316846001600160a01b03161480610db857506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b80610ddc5750836001600160a01b0316610dd18461053d565b6001600160a01b0316145b949350505050565b826001600160a01b0316610df78261092f565b6001600160a01b031614610e5b5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016105d9565b6001600160a01b038216610ebd5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016105d9565b610ec8600082610cf7565b6001600160a01b0383166000908152606860205260408120805460019290610ef19084906120e1565b90915550506001600160a01b0382166000908152606860205260408120805460019290610f1f9084906120f8565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b61078d611102565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610fbb5761067a836114f4565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff457600080fd5b505afa925050508015611024575060408051601f3d908101601f1916820190925261102191810190612110565b60015b6110875760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016105d9565b6000805160206122db83398151915281146110f65760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016105d9565b5061067a838383611590565b60c9546001600160a01b03163314610a275760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105d9565b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166111d55760405162461bcd60e51b81526004016105d990612129565b61087882826115b5565b600054610100900460ff16610a275760405162461bcd60e51b81526004016105d990612129565b600054610100900460ff1661122d5760405162461bcd60e51b81526004016105d990612129565b610a27611603565b816001600160a01b0316836001600160a01b031614156112975760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016105d9565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61130f848484610de4565b61131b84848484611633565b610bd85760405162461bcd60e51b81526004016105d990612174565b606061134282610c98565b6000828152609760205260408120805461135b90611faa565b80601f016020809104026020016040519081016040528092919081815260200182805461138790611faa565b80156113d45780601f106113a9576101008083540402835291602001916113d4565b820191906000526020600020905b8154815290600101906020018083116113b757829003601f168201915b5050505050905060006113f260408051602081019091526000815290565b9050805160001415611405575092915050565b81511561143757808260405160200161141f9291906121c6565b60405160208183030381529060405292505050919050565b610ddc84611740565b6108788282604051806020016040528060008152506117b4565b6000828152606760205260409020546001600160a01b03166114d55760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b60648201526084016105d9565b6000828152609760209081526040909120825161067a92840190611b94565b6001600160a01b0381163b6115615760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016105d9565b6000805160206122db83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b611599836117e7565b6000825111806115a65750805b1561067a57610bd88383611827565b600054610100900460ff166115dc5760405162461bcd60e51b81526004016105d990612129565b81516115ef906065906020850190611b94565b50805161067a906066906020840190611b94565b600054610100900460ff1661162a5760405162461bcd60e51b81526004016105d990612129565b610a273361115c565b60006001600160a01b0384163b1561173557604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906116779033908990889088906004016121f5565b602060405180830381600087803b15801561169157600080fd5b505af19250505080156116c1575060408051601f3d908101601f191682019092526116be91810190612232565b60015b61171b573d8080156116ef576040519150601f19603f3d011682016040523d82523d6000602084013e6116f4565b606091505b5080516117135760405162461bcd60e51b81526004016105d990612174565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610ddc565b506001949350505050565b606061174b82610c98565b600061176260408051602081019091526000815290565b9050600081511161178257604051806020016040528060008152506117ad565b8061178c8461191b565b60405160200161179d9291906121c6565b6040516020818303038152906040525b9392505050565b6117be8383611a19565b6117cb6000848484611633565b61067a5760405162461bcd60e51b81526004016105d990612174565b6117f0816114f4565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b61188f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016105d9565b600080846001600160a01b0316846040516118aa919061224f565b600060405180830381855af49150503d80600081146118e5576040519150601f19603f3d011682016040523d82523d6000602084013e6118ea565b606091505b509150915061191282826040518060600160405280602781526020016122fb60279139611b5b565b95945050505050565b60608161193f5750506040805180820190915260018152600360fc1b602082015290565b8160005b811561196957806119538161226b565b91506119629050600a8361229c565b9150611943565b60008167ffffffffffffffff81111561198457611984611db4565b6040519080825280601f01601f1916602001820160405280156119ae576020820181803683370190505b5090505b8415610ddc576119c36001836120e1565b91506119d0600a866122b0565b6119db9060306120f8565b60f81b8183815181106119f0576119f06122c4565b60200101906001600160f81b031916908160001a905350611a12600a8661229c565b94506119b2565b6001600160a01b038216611a6f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016105d9565b6000818152606760205260409020546001600160a01b031615611ad45760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016105d9565b6001600160a01b0382166000908152606860205260408120805460019290611afd9084906120f8565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60608315611b6a5750816117ad565b825115611b7a5782518084602001fd5b8160405162461bcd60e51b81526004016105d99190611cb8565b828054611ba090611faa565b90600052602060002090601f016020900481019282611bc25760008555611c08565b82601f10611bdb57805160ff1916838001178555611c08565b82800160010185558215611c08579182015b82811115611c08578251825591602001919060010190611bed565b50611c14929150611c18565b5090565b5b80821115611c145760008155600101611c19565b6001600160e01b03198116811461078d57600080fd5b600060208284031215611c5557600080fd5b81356117ad81611c2d565b60005b83811015611c7b578181015183820152602001611c63565b83811115610bd85750506000910152565b60008151808452611ca4816020860160208601611c60565b601f01601f19169290920160200192915050565b6020815260006117ad6020830184611c8c565b600060208284031215611cdd57600080fd5b5035919050565b80356001600160a01b0381168114611cfb57600080fd5b919050565b60008060408385031215611d1357600080fd5b611d1c83611ce4565b946020939093013593505050565b600080600060608486031215611d3f57600080fd5b611d4884611ce4565b9250611d5660208501611ce4565b9150604084013590509250925092565b600060208284031215611d7857600080fd5b6117ad82611ce4565b60008060408385031215611d9457600080fd5b611d9d83611ce4565b9150611dab60208401611ce4565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115611de557611de5611db4565b604051601f8501601f19908116603f01168101908282118183101715611e0d57611e0d611db4565b81604052809350858152868686011115611e2657600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112611e5157600080fd5b6117ad83833560208501611dca565b60008060408385031215611e7357600080fd5b611e7c83611ce4565b9150602083013567ffffffffffffffff811115611e9857600080fd5b611ea485828601611e40565b9150509250929050565b60008060408385031215611ec157600080fd5b611eca83611ce4565b915060208301358015158114611edf57600080fd5b809150509250929050565b60008060008060808587031215611f0057600080fd5b611f0985611ce4565b9350611f1760208601611ce4565b925060408501359150606085013567ffffffffffffffff811115611f3a57600080fd5b611f4687828801611e40565b91505092959194509250565b60008060408385031215611f6557600080fd5b611f6e83611ce4565b9150602083013567ffffffffffffffff811115611f8a57600080fd5b8301601f81018513611f9b57600080fd5b611ea485823560208401611dca565b600181811c90821680611fbe57607f821691505b60208210811415611fdf57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b6000828210156120f3576120f36120cb565b500390565b6000821982111561210b5761210b6120cb565b500190565b60006020828403121561212257600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600083516121d8818460208801611c60565b8351908301906121ec818360208801611c60565b01949350505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061222890830184611c8c565b9695505050505050565b60006020828403121561224457600080fd5b81516117ad81611c2d565b60008251612261818460208701611c60565b9190910192915050565b600060001982141561227f5761227f6120cb565b5060010190565b634e487b7160e01b600052601260045260246000fd5b6000826122ab576122ab612286565b500490565b6000826122bf576122bf612286565b500690565b634e487b7160e01b600052603260045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220e0942f5ca1dd8e20ad7193615fb11b528030525edbed2fbde45a392465b1121f64736f6c63430008090033", - "deployedBytecode": "0x6080604052600436106101405760003560e01c80636352211e116100b6578063a22cb4651161006f578063a22cb46514610370578063b88d4fde14610390578063c87b56dd146103b0578063d204c45e146103d0578063e985e9c5146103f0578063f2fde38b1461043957600080fd5b80636352211e146102d357806370a08231146102f3578063715018a6146103135780638129fc1c146103285780638da5cb5b1461033d57806395d89b411461035b57600080fd5b80632568eaca116101085780632568eaca146102165780633659cfe61461024857806342842e0e146102685780634b9f8fe0146102885780634f1ef286146102ab57806352d1902d146102be57600080fd5b806301ffc9a71461014557806306fdde031461017a578063081812fc1461019c578063095ea7b3146101d457806323b872dd146101f6575b600080fd5b34801561015157600080fd5b50610165610160366004611c43565b610459565b60405190151581526020015b60405180910390f35b34801561018657600080fd5b5061018f6104ab565b6040516101719190611cb8565b3480156101a857600080fd5b506101bc6101b7366004611ccb565b61053d565b6040516001600160a01b039091168152602001610171565b3480156101e057600080fd5b506101f46101ef366004611d00565b610564565b005b34801561020257600080fd5b506101f4610211366004611d2a565b61067f565b34801561022257600080fd5b5061023a610231366004611d2a565b60009392505050565b604051908152602001610171565b34801561025457600080fd5b506101f4610263366004611d66565b6106b0565b34801561027457600080fd5b506101f4610283366004611d2a565b610790565b34801561029457600080fd5b506101656102a3366004611d81565b600192915050565b6101f46102b9366004611e60565b6107ab565b3480156102ca57600080fd5b5061023a61087c565b3480156102df57600080fd5b506101bc6102ee366004611ccb565b61092f565b3480156102ff57600080fd5b5061023a61030e366004611d66565b61098f565b34801561031f57600080fd5b506101f4610a15565b34801561033457600080fd5b506101f4610a29565b34801561034957600080fd5b5060c9546001600160a01b03166101bc565b34801561036757600080fd5b5061018f610b8c565b34801561037c57600080fd5b506101f461038b366004611eae565b610b9b565b34801561039c57600080fd5b506101f46103ab366004611eea565b610ba6565b3480156103bc57600080fd5b5061018f6103cb366004611ccb565b610bde565b3480156103dc57600080fd5b506101f46103eb366004611f52565b610be9565b3480156103fc57600080fd5b5061016561040b366004611d81565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b34801561044557600080fd5b506101f4610454366004611d66565b610c22565b60006001600160e01b031982166380ac58cd60e01b148061048a57506001600160e01b03198216635b5e139f60e01b145b806104a557506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060606580546104ba90611faa565b80601f01602080910402602001604051908101604052809291908181526020018280546104e690611faa565b80156105335780601f1061050857610100808354040283529160200191610533565b820191906000526020600020905b81548152906001019060200180831161051657829003601f168201915b5050505050905090565b600061054882610c98565b506000908152606960205260409020546001600160a01b031690565b600061056f8261092f565b9050806001600160a01b0316836001600160a01b031614156105e25760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806105fe57506105fe813361040b565b6106705760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c000060648201526084016105d9565b61067a8383610cf7565b505050565b6106893382610d65565b6106a55760405162461bcd60e51b81526004016105d990611fe5565b61067a838383610de4565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156106f95760405162461bcd60e51b81526004016105d990612033565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166107426000805160206122db833981519152546001600160a01b031690565b6001600160a01b0316146107685760405162461bcd60e51b81526004016105d99061207f565b61077181610f80565b6040805160008082526020820190925261078d91839190610f88565b50565b61067a83838360405180602001604052806000815250610ba6565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156107f45760405162461bcd60e51b81526004016105d990612033565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661083d6000805160206122db833981519152546001600160a01b031690565b6001600160a01b0316146108635760405162461bcd60e51b81526004016105d99061207f565b61086c82610f80565b61087882826001610f88565b5050565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461091c5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016105d9565b506000805160206122db83398151915290565b6000818152606760205260408120546001600160a01b0316806104a55760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016105d9565b60006001600160a01b0382166109f95760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016105d9565b506001600160a01b031660009081526068602052604090205490565b610a1d611102565b610a27600061115c565b565b600054610100900460ff1615808015610a495750600054600160ff909116105b80610a635750303b158015610a63575060005460ff166001145b610ac65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105d9565b6000805460ff191660011790558015610ae9576000805461ff0019166101001790555b610b2c6040518060400160405280600681526020016546616d696c7960d01b8152506040518060400160405280600381526020016246414d60e81b8152506111ae565b610b346111df565b610b3c611206565b610b446111df565b801561078d576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6060606680546104ba90611faa565b610878338383611235565b610bb03383610d65565b610bcc5760405162461bcd60e51b81526004016105d990611fe5565b610bd884848484611304565b50505050565b60606104a582611337565b610bf1611102565b6000610bfd61015f5490565b9050610c0e61015f80546001019055565b610c188382611440565b61067a818361145a565b610c2a611102565b6001600160a01b038116610c8f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105d9565b61078d8161115c565b6000818152606760205260409020546001600160a01b031661078d5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016105d9565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190610d2c8261092f565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080610d718361092f565b9050806001600160a01b0316846001600160a01b03161480610db857506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b80610ddc5750836001600160a01b0316610dd18461053d565b6001600160a01b0316145b949350505050565b826001600160a01b0316610df78261092f565b6001600160a01b031614610e5b5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016105d9565b6001600160a01b038216610ebd5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016105d9565b610ec8600082610cf7565b6001600160a01b0383166000908152606860205260408120805460019290610ef19084906120e1565b90915550506001600160a01b0382166000908152606860205260408120805460019290610f1f9084906120f8565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b61078d611102565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610fbb5761067a836114f4565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff457600080fd5b505afa925050508015611024575060408051601f3d908101601f1916820190925261102191810190612110565b60015b6110875760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016105d9565b6000805160206122db83398151915281146110f65760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016105d9565b5061067a838383611590565b60c9546001600160a01b03163314610a275760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105d9565b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166111d55760405162461bcd60e51b81526004016105d990612129565b61087882826115b5565b600054610100900460ff16610a275760405162461bcd60e51b81526004016105d990612129565b600054610100900460ff1661122d5760405162461bcd60e51b81526004016105d990612129565b610a27611603565b816001600160a01b0316836001600160a01b031614156112975760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016105d9565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61130f848484610de4565b61131b84848484611633565b610bd85760405162461bcd60e51b81526004016105d990612174565b606061134282610c98565b6000828152609760205260408120805461135b90611faa565b80601f016020809104026020016040519081016040528092919081815260200182805461138790611faa565b80156113d45780601f106113a9576101008083540402835291602001916113d4565b820191906000526020600020905b8154815290600101906020018083116113b757829003601f168201915b5050505050905060006113f260408051602081019091526000815290565b9050805160001415611405575092915050565b81511561143757808260405160200161141f9291906121c6565b60405160208183030381529060405292505050919050565b610ddc84611740565b6108788282604051806020016040528060008152506117b4565b6000828152606760205260409020546001600160a01b03166114d55760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b60648201526084016105d9565b6000828152609760209081526040909120825161067a92840190611b94565b6001600160a01b0381163b6115615760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016105d9565b6000805160206122db83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b611599836117e7565b6000825111806115a65750805b1561067a57610bd88383611827565b600054610100900460ff166115dc5760405162461bcd60e51b81526004016105d990612129565b81516115ef906065906020850190611b94565b50805161067a906066906020840190611b94565b600054610100900460ff1661162a5760405162461bcd60e51b81526004016105d990612129565b610a273361115c565b60006001600160a01b0384163b1561173557604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906116779033908990889088906004016121f5565b602060405180830381600087803b15801561169157600080fd5b505af19250505080156116c1575060408051601f3d908101601f191682019092526116be91810190612232565b60015b61171b573d8080156116ef576040519150601f19603f3d011682016040523d82523d6000602084013e6116f4565b606091505b5080516117135760405162461bcd60e51b81526004016105d990612174565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610ddc565b506001949350505050565b606061174b82610c98565b600061176260408051602081019091526000815290565b9050600081511161178257604051806020016040528060008152506117ad565b8061178c8461191b565b60405160200161179d9291906121c6565b6040516020818303038152906040525b9392505050565b6117be8383611a19565b6117cb6000848484611633565b61067a5760405162461bcd60e51b81526004016105d990612174565b6117f0816114f4565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b61188f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016105d9565b600080846001600160a01b0316846040516118aa919061224f565b600060405180830381855af49150503d80600081146118e5576040519150601f19603f3d011682016040523d82523d6000602084013e6118ea565b606091505b509150915061191282826040518060600160405280602781526020016122fb60279139611b5b565b95945050505050565b60608161193f5750506040805180820190915260018152600360fc1b602082015290565b8160005b811561196957806119538161226b565b91506119629050600a8361229c565b9150611943565b60008167ffffffffffffffff81111561198457611984611db4565b6040519080825280601f01601f1916602001820160405280156119ae576020820181803683370190505b5090505b8415610ddc576119c36001836120e1565b91506119d0600a866122b0565b6119db9060306120f8565b60f81b8183815181106119f0576119f06122c4565b60200101906001600160f81b031916908160001a905350611a12600a8661229c565b94506119b2565b6001600160a01b038216611a6f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016105d9565b6000818152606760205260409020546001600160a01b031615611ad45760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016105d9565b6001600160a01b0382166000908152606860205260408120805460019290611afd9084906120f8565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60608315611b6a5750816117ad565b825115611b7a5782518084602001fd5b8160405162461bcd60e51b81526004016105d99190611cb8565b828054611ba090611faa565b90600052602060002090601f016020900481019282611bc25760008555611c08565b82601f10611bdb57805160ff1916838001178555611c08565b82800160010185558215611c08579182015b82811115611c08578251825591602001919060010190611bed565b50611c14929150611c18565b5090565b5b80821115611c145760008155600101611c19565b6001600160e01b03198116811461078d57600080fd5b600060208284031215611c5557600080fd5b81356117ad81611c2d565b60005b83811015611c7b578181015183820152602001611c63565b83811115610bd85750506000910152565b60008151808452611ca4816020860160208601611c60565b601f01601f19169290920160200192915050565b6020815260006117ad6020830184611c8c565b600060208284031215611cdd57600080fd5b5035919050565b80356001600160a01b0381168114611cfb57600080fd5b919050565b60008060408385031215611d1357600080fd5b611d1c83611ce4565b946020939093013593505050565b600080600060608486031215611d3f57600080fd5b611d4884611ce4565b9250611d5660208501611ce4565b9150604084013590509250925092565b600060208284031215611d7857600080fd5b6117ad82611ce4565b60008060408385031215611d9457600080fd5b611d9d83611ce4565b9150611dab60208401611ce4565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115611de557611de5611db4565b604051601f8501601f19908116603f01168101908282118183101715611e0d57611e0d611db4565b81604052809350858152868686011115611e2657600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112611e5157600080fd5b6117ad83833560208501611dca565b60008060408385031215611e7357600080fd5b611e7c83611ce4565b9150602083013567ffffffffffffffff811115611e9857600080fd5b611ea485828601611e40565b9150509250929050565b60008060408385031215611ec157600080fd5b611eca83611ce4565b915060208301358015158114611edf57600080fd5b809150509250929050565b60008060008060808587031215611f0057600080fd5b611f0985611ce4565b9350611f1760208601611ce4565b925060408501359150606085013567ffffffffffffffff811115611f3a57600080fd5b611f4687828801611e40565b91505092959194509250565b60008060408385031215611f6557600080fd5b611f6e83611ce4565b9150602083013567ffffffffffffffff811115611f8a57600080fd5b8301601f81018513611f9b57600080fd5b611ea485823560208401611dca565b600181811c90821680611fbe57607f821691505b60208210811415611fdf57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b6000828210156120f3576120f36120cb565b500390565b6000821982111561210b5761210b6120cb565b500190565b60006020828403121561212257600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600083516121d8818460208801611c60565b8351908301906121ec818360208801611c60565b01949350505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061222890830184611c8c565b9695505050505050565b60006020828403121561224457600080fd5b81516117ad81611c2d565b60008251612261818460208701611c60565b9190910192915050565b600060001982141561227f5761227f6120cb565b5060010190565b634e487b7160e01b600052601260045260246000fd5b6000826122ab576122ab612286565b500490565b6000826122bf576122bf612286565b500690565b634e487b7160e01b600052603260045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220e0942f5ca1dd8e20ad7193615fb11b528030525edbed2fbde45a392465b1121f64736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/tokens/ERC721/people/NGO.sol/NGO.dbg.json b/src/contracts/tokens/ERC721/people/NGO.sol/NGO.dbg.json deleted file mode 100644 index 404e18639b..0000000000 --- a/src/contracts/tokens/ERC721/people/NGO.sol/NGO.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/tokens/ERC721/people/NGO.sol/NGO.json b/src/contracts/tokens/ERC721/people/NGO.sol/NGO.json deleted file mode 100644 index 972bc4859b..0000000000 --- a/src/contracts/tokens/ERC721/people/NGO.sol/NGO.json +++ /dev/null @@ -1,525 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "NGO", - "sourceName": "contracts/tokens/ERC721/people/NGO.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "previousAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "beacon", - "type": "address" - } - ], - "name": "BeaconUpgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "Upgraded", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "proxiableUUID", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "string", - "name": "uri", - "type": "string" - } - ], - "name": "safeMint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "upgradeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "upgradeToAndCall", - "outputs": [], - "stateMutability": "payable", - "type": "function" - } - ], - "bytecode": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100e2565b600054610100900460ff161561008e5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100e0576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516123006200011a6000396000818161065e0152818161069e0152818161075901528181610799015261082c01526123006000f3fe60806040526004361061012a5760003560e01c806370a08231116100ab578063a22cb4651161006f578063a22cb46514610313578063b88d4fde14610333578063c87b56dd14610353578063d204c45e14610373578063e985e9c514610393578063f2fde38b146103dc57600080fd5b806370a0823114610296578063715018a6146102b65780638129fc1c146102cb5780638da5cb5b146102e057806395d89b41146102fe57600080fd5b80633659cfe6116100f25780633659cfe61461020057806342842e0e146102205780634f1ef2861461024057806352d1902d146102535780636352211e1461027657600080fd5b806301ffc9a71461012f57806306fdde0314610164578063081812fc14610186578063095ea7b3146101be57806323b872dd146101e0575b600080fd5b34801561013b57600080fd5b5061014f61014a366004611bec565b6103fc565b60405190151581526020015b60405180910390f35b34801561017057600080fd5b5061017961044e565b60405161015b9190611c61565b34801561019257600080fd5b506101a66101a1366004611c74565b6104e0565b6040516001600160a01b03909116815260200161015b565b3480156101ca57600080fd5b506101de6101d9366004611ca9565b610507565b005b3480156101ec57600080fd5b506101de6101fb366004611cd3565b610622565b34801561020c57600080fd5b506101de61021b366004611d0f565b610653565b34801561022c57600080fd5b506101de61023b366004611cd3565b610733565b6101de61024e366004611dd6565b61074e565b34801561025f57600080fd5b5061026861081f565b60405190815260200161015b565b34801561028257600080fd5b506101a6610291366004611c74565b6108d2565b3480156102a257600080fd5b506102686102b1366004611d0f565b610932565b3480156102c257600080fd5b506101de6109b8565b3480156102d757600080fd5b506101de6109cc565b3480156102ec57600080fd5b5060c9546001600160a01b03166101a6565b34801561030a57600080fd5b50610179610b35565b34801561031f57600080fd5b506101de61032e366004611e24565b610b44565b34801561033f57600080fd5b506101de61034e366004611e60565b610b4f565b34801561035f57600080fd5b5061017961036e366004611c74565b610b87565b34801561037f57600080fd5b506101de61038e366004611ec8565b610b92565b34801561039f57600080fd5b5061014f6103ae366004611f20565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b3480156103e857600080fd5b506101de6103f7366004611d0f565b610bcb565b60006001600160e01b031982166380ac58cd60e01b148061042d57506001600160e01b03198216635b5e139f60e01b145b8061044857506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606065805461045d90611f53565b80601f016020809104026020016040519081016040528092919081815260200182805461048990611f53565b80156104d65780601f106104ab576101008083540402835291602001916104d6565b820191906000526020600020905b8154815290600101906020018083116104b957829003601f168201915b5050505050905090565b60006104eb82610c41565b506000908152606960205260409020546001600160a01b031690565b6000610512826108d2565b9050806001600160a01b0316836001600160a01b031614156105855760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806105a157506105a181336103ae565b6106135760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161057c565b61061d8383610ca0565b505050565b61062c3382610d0e565b6106485760405162461bcd60e51b815260040161057c90611f8e565b61061d838383610d8d565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561069c5760405162461bcd60e51b815260040161057c90611fdc565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166106e5600080516020612284833981519152546001600160a01b031690565b6001600160a01b03161461070b5760405162461bcd60e51b815260040161057c90612028565b61071481610f29565b6040805160008082526020820190925261073091839190610f31565b50565b61061d83838360405180602001604052806000815250610b4f565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156107975760405162461bcd60e51b815260040161057c90611fdc565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166107e0600080516020612284833981519152546001600160a01b031690565b6001600160a01b0316146108065760405162461bcd60e51b815260040161057c90612028565b61080f82610f29565b61081b82826001610f31565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108bf5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161057c565b5060008051602061228483398151915290565b6000818152606760205260408120546001600160a01b0316806104485760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161057c565b60006001600160a01b03821661099c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161057c565b506001600160a01b031660009081526068602052604090205490565b6109c06110ab565b6109ca6000611105565b565b600054610100900460ff16158080156109ec5750600054600160ff909116105b80610a065750303b158015610a06575060005460ff166001145b610a695760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161057c565b6000805460ff191660011790558015610a8c576000805461ff0019166101001790555b610ad56040518060400160405280600c81526020016b139bdb919bdc941c9bd99a5d60a21b815250604051806040016040528060038152602001624e474f60e81b815250611157565b610add611188565b610ae56111af565b610aed611188565b8015610730576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b60606066805461045d90611f53565b61081b3383836111de565b610b593383610d0e565b610b755760405162461bcd60e51b815260040161057c90611f8e565b610b81848484846112ad565b50505050565b6060610448826112e0565b610b9a6110ab565b6000610ba661015f5490565b9050610bb761015f80546001019055565b610bc183826113e9565b61061d8183611403565b610bd36110ab565b6001600160a01b038116610c385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161057c565b61073081611105565b6000818152606760205260409020546001600160a01b03166107305760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161057c565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190610cd5826108d2565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080610d1a836108d2565b9050806001600160a01b0316846001600160a01b03161480610d6157506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b80610d855750836001600160a01b0316610d7a846104e0565b6001600160a01b0316145b949350505050565b826001600160a01b0316610da0826108d2565b6001600160a01b031614610e045760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161057c565b6001600160a01b038216610e665760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161057c565b610e71600082610ca0565b6001600160a01b0383166000908152606860205260408120805460019290610e9a90849061208a565b90915550506001600160a01b0382166000908152606860205260408120805460019290610ec89084906120a1565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6107306110ab565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610f645761061d8361149d565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f9d57600080fd5b505afa925050508015610fcd575060408051601f3d908101601f19168201909252610fca918101906120b9565b60015b6110305760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161057c565b600080516020612284833981519152811461109f5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161057c565b5061061d838383611539565b60c9546001600160a01b031633146109ca5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057c565b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661117e5760405162461bcd60e51b815260040161057c906120d2565b61081b828261155e565b600054610100900460ff166109ca5760405162461bcd60e51b815260040161057c906120d2565b600054610100900460ff166111d65760405162461bcd60e51b815260040161057c906120d2565b6109ca6115ac565b816001600160a01b0316836001600160a01b031614156112405760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161057c565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6112b8848484610d8d565b6112c4848484846115dc565b610b815760405162461bcd60e51b815260040161057c9061211d565b60606112eb82610c41565b6000828152609760205260408120805461130490611f53565b80601f016020809104026020016040519081016040528092919081815260200182805461133090611f53565b801561137d5780601f106113525761010080835404028352916020019161137d565b820191906000526020600020905b81548152906001019060200180831161136057829003601f168201915b50505050509050600061139b60408051602081019091526000815290565b90508051600014156113ae575092915050565b8151156113e05780826040516020016113c892919061216f565b60405160208183030381529060405292505050919050565b610d85846116e9565b61081b82826040518060200160405280600081525061175d565b6000828152606760205260409020546001600160a01b031661147e5760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b606482015260840161057c565b6000828152609760209081526040909120825161061d92840190611b3d565b6001600160a01b0381163b61150a5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161057c565b60008051602061228483398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61154283611790565b60008251118061154f5750805b1561061d57610b8183836117d0565b600054610100900460ff166115855760405162461bcd60e51b815260040161057c906120d2565b8151611598906065906020850190611b3d565b50805161061d906066906020840190611b3d565b600054610100900460ff166115d35760405162461bcd60e51b815260040161057c906120d2565b6109ca33611105565b60006001600160a01b0384163b156116de57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061162090339089908890889060040161219e565b602060405180830381600087803b15801561163a57600080fd5b505af192505050801561166a575060408051601f3d908101601f19168201909252611667918101906121db565b60015b6116c4573d808015611698576040519150601f19603f3d011682016040523d82523d6000602084013e61169d565b606091505b5080516116bc5760405162461bcd60e51b815260040161057c9061211d565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610d85565b506001949350505050565b60606116f482610c41565b600061170b60408051602081019091526000815290565b9050600081511161172b5760405180602001604052806000815250611756565b80611735846118c4565b60405160200161174692919061216f565b6040516020818303038152906040525b9392505050565b61176783836119c2565b61177460008484846115dc565b61061d5760405162461bcd60e51b815260040161057c9061211d565b6117998161149d565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6118385760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161057c565b600080846001600160a01b03168460405161185391906121f8565b600060405180830381855af49150503d806000811461188e576040519150601f19603f3d011682016040523d82523d6000602084013e611893565b606091505b50915091506118bb82826040518060600160405280602781526020016122a460279139611b04565b95945050505050565b6060816118e85750506040805180820190915260018152600360fc1b602082015290565b8160005b811561191257806118fc81612214565b915061190b9050600a83612245565b91506118ec565b60008167ffffffffffffffff81111561192d5761192d611d2a565b6040519080825280601f01601f191660200182016040528015611957576020820181803683370190505b5090505b8415610d855761196c60018361208a565b9150611979600a86612259565b6119849060306120a1565b60f81b8183815181106119995761199961226d565b60200101906001600160f81b031916908160001a9053506119bb600a86612245565b945061195b565b6001600160a01b038216611a185760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161057c565b6000818152606760205260409020546001600160a01b031615611a7d5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161057c565b6001600160a01b0382166000908152606860205260408120805460019290611aa69084906120a1565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60608315611b13575081611756565b825115611b235782518084602001fd5b8160405162461bcd60e51b815260040161057c9190611c61565b828054611b4990611f53565b90600052602060002090601f016020900481019282611b6b5760008555611bb1565b82601f10611b8457805160ff1916838001178555611bb1565b82800160010185558215611bb1579182015b82811115611bb1578251825591602001919060010190611b96565b50611bbd929150611bc1565b5090565b5b80821115611bbd5760008155600101611bc2565b6001600160e01b03198116811461073057600080fd5b600060208284031215611bfe57600080fd5b813561175681611bd6565b60005b83811015611c24578181015183820152602001611c0c565b83811115610b815750506000910152565b60008151808452611c4d816020860160208601611c09565b601f01601f19169290920160200192915050565b6020815260006117566020830184611c35565b600060208284031215611c8657600080fd5b5035919050565b80356001600160a01b0381168114611ca457600080fd5b919050565b60008060408385031215611cbc57600080fd5b611cc583611c8d565b946020939093013593505050565b600080600060608486031215611ce857600080fd5b611cf184611c8d565b9250611cff60208501611c8d565b9150604084013590509250925092565b600060208284031215611d2157600080fd5b61175682611c8d565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115611d5b57611d5b611d2a565b604051601f8501601f19908116603f01168101908282118183101715611d8357611d83611d2a565b81604052809350858152868686011115611d9c57600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112611dc757600080fd5b61175683833560208501611d40565b60008060408385031215611de957600080fd5b611df283611c8d565b9150602083013567ffffffffffffffff811115611e0e57600080fd5b611e1a85828601611db6565b9150509250929050565b60008060408385031215611e3757600080fd5b611e4083611c8d565b915060208301358015158114611e5557600080fd5b809150509250929050565b60008060008060808587031215611e7657600080fd5b611e7f85611c8d565b9350611e8d60208601611c8d565b925060408501359150606085013567ffffffffffffffff811115611eb057600080fd5b611ebc87828801611db6565b91505092959194509250565b60008060408385031215611edb57600080fd5b611ee483611c8d565b9150602083013567ffffffffffffffff811115611f0057600080fd5b8301601f81018513611f1157600080fd5b611e1a85823560208401611d40565b60008060408385031215611f3357600080fd5b611f3c83611c8d565b9150611f4a60208401611c8d565b90509250929050565b600181811c90821680611f6757607f821691505b60208210811415611f8857634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60008282101561209c5761209c612074565b500390565b600082198211156120b4576120b4612074565b500190565b6000602082840312156120cb57600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60008351612181818460208801611c09565b835190830190612195818360208801611c09565b01949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906121d190830184611c35565b9695505050505050565b6000602082840312156121ed57600080fd5b815161175681611bd6565b6000825161220a818460208701611c09565b9190910192915050565b600060001982141561222857612228612074565b5060010190565b634e487b7160e01b600052601260045260246000fd5b6000826122545761225461222f565b500490565b6000826122685761226861222f565b500690565b634e487b7160e01b600052603260045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220d64383e387727636b149cb6d76c88b8dbababc2064888c9a91c853f69df80d4e64736f6c63430008090033", - "deployedBytecode": "0x60806040526004361061012a5760003560e01c806370a08231116100ab578063a22cb4651161006f578063a22cb46514610313578063b88d4fde14610333578063c87b56dd14610353578063d204c45e14610373578063e985e9c514610393578063f2fde38b146103dc57600080fd5b806370a0823114610296578063715018a6146102b65780638129fc1c146102cb5780638da5cb5b146102e057806395d89b41146102fe57600080fd5b80633659cfe6116100f25780633659cfe61461020057806342842e0e146102205780634f1ef2861461024057806352d1902d146102535780636352211e1461027657600080fd5b806301ffc9a71461012f57806306fdde0314610164578063081812fc14610186578063095ea7b3146101be57806323b872dd146101e0575b600080fd5b34801561013b57600080fd5b5061014f61014a366004611bec565b6103fc565b60405190151581526020015b60405180910390f35b34801561017057600080fd5b5061017961044e565b60405161015b9190611c61565b34801561019257600080fd5b506101a66101a1366004611c74565b6104e0565b6040516001600160a01b03909116815260200161015b565b3480156101ca57600080fd5b506101de6101d9366004611ca9565b610507565b005b3480156101ec57600080fd5b506101de6101fb366004611cd3565b610622565b34801561020c57600080fd5b506101de61021b366004611d0f565b610653565b34801561022c57600080fd5b506101de61023b366004611cd3565b610733565b6101de61024e366004611dd6565b61074e565b34801561025f57600080fd5b5061026861081f565b60405190815260200161015b565b34801561028257600080fd5b506101a6610291366004611c74565b6108d2565b3480156102a257600080fd5b506102686102b1366004611d0f565b610932565b3480156102c257600080fd5b506101de6109b8565b3480156102d757600080fd5b506101de6109cc565b3480156102ec57600080fd5b5060c9546001600160a01b03166101a6565b34801561030a57600080fd5b50610179610b35565b34801561031f57600080fd5b506101de61032e366004611e24565b610b44565b34801561033f57600080fd5b506101de61034e366004611e60565b610b4f565b34801561035f57600080fd5b5061017961036e366004611c74565b610b87565b34801561037f57600080fd5b506101de61038e366004611ec8565b610b92565b34801561039f57600080fd5b5061014f6103ae366004611f20565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b3480156103e857600080fd5b506101de6103f7366004611d0f565b610bcb565b60006001600160e01b031982166380ac58cd60e01b148061042d57506001600160e01b03198216635b5e139f60e01b145b8061044857506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606065805461045d90611f53565b80601f016020809104026020016040519081016040528092919081815260200182805461048990611f53565b80156104d65780601f106104ab576101008083540402835291602001916104d6565b820191906000526020600020905b8154815290600101906020018083116104b957829003601f168201915b5050505050905090565b60006104eb82610c41565b506000908152606960205260409020546001600160a01b031690565b6000610512826108d2565b9050806001600160a01b0316836001600160a01b031614156105855760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806105a157506105a181336103ae565b6106135760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161057c565b61061d8383610ca0565b505050565b61062c3382610d0e565b6106485760405162461bcd60e51b815260040161057c90611f8e565b61061d838383610d8d565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561069c5760405162461bcd60e51b815260040161057c90611fdc565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166106e5600080516020612284833981519152546001600160a01b031690565b6001600160a01b03161461070b5760405162461bcd60e51b815260040161057c90612028565b61071481610f29565b6040805160008082526020820190925261073091839190610f31565b50565b61061d83838360405180602001604052806000815250610b4f565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156107975760405162461bcd60e51b815260040161057c90611fdc565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166107e0600080516020612284833981519152546001600160a01b031690565b6001600160a01b0316146108065760405162461bcd60e51b815260040161057c90612028565b61080f82610f29565b61081b82826001610f31565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108bf5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161057c565b5060008051602061228483398151915290565b6000818152606760205260408120546001600160a01b0316806104485760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161057c565b60006001600160a01b03821661099c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161057c565b506001600160a01b031660009081526068602052604090205490565b6109c06110ab565b6109ca6000611105565b565b600054610100900460ff16158080156109ec5750600054600160ff909116105b80610a065750303b158015610a06575060005460ff166001145b610a695760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161057c565b6000805460ff191660011790558015610a8c576000805461ff0019166101001790555b610ad56040518060400160405280600c81526020016b139bdb919bdc941c9bd99a5d60a21b815250604051806040016040528060038152602001624e474f60e81b815250611157565b610add611188565b610ae56111af565b610aed611188565b8015610730576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b60606066805461045d90611f53565b61081b3383836111de565b610b593383610d0e565b610b755760405162461bcd60e51b815260040161057c90611f8e565b610b81848484846112ad565b50505050565b6060610448826112e0565b610b9a6110ab565b6000610ba661015f5490565b9050610bb761015f80546001019055565b610bc183826113e9565b61061d8183611403565b610bd36110ab565b6001600160a01b038116610c385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161057c565b61073081611105565b6000818152606760205260409020546001600160a01b03166107305760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161057c565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190610cd5826108d2565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080610d1a836108d2565b9050806001600160a01b0316846001600160a01b03161480610d6157506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b80610d855750836001600160a01b0316610d7a846104e0565b6001600160a01b0316145b949350505050565b826001600160a01b0316610da0826108d2565b6001600160a01b031614610e045760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161057c565b6001600160a01b038216610e665760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161057c565b610e71600082610ca0565b6001600160a01b0383166000908152606860205260408120805460019290610e9a90849061208a565b90915550506001600160a01b0382166000908152606860205260408120805460019290610ec89084906120a1565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6107306110ab565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610f645761061d8361149d565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f9d57600080fd5b505afa925050508015610fcd575060408051601f3d908101601f19168201909252610fca918101906120b9565b60015b6110305760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161057c565b600080516020612284833981519152811461109f5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161057c565b5061061d838383611539565b60c9546001600160a01b031633146109ca5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057c565b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661117e5760405162461bcd60e51b815260040161057c906120d2565b61081b828261155e565b600054610100900460ff166109ca5760405162461bcd60e51b815260040161057c906120d2565b600054610100900460ff166111d65760405162461bcd60e51b815260040161057c906120d2565b6109ca6115ac565b816001600160a01b0316836001600160a01b031614156112405760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161057c565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6112b8848484610d8d565b6112c4848484846115dc565b610b815760405162461bcd60e51b815260040161057c9061211d565b60606112eb82610c41565b6000828152609760205260408120805461130490611f53565b80601f016020809104026020016040519081016040528092919081815260200182805461133090611f53565b801561137d5780601f106113525761010080835404028352916020019161137d565b820191906000526020600020905b81548152906001019060200180831161136057829003601f168201915b50505050509050600061139b60408051602081019091526000815290565b90508051600014156113ae575092915050565b8151156113e05780826040516020016113c892919061216f565b60405160208183030381529060405292505050919050565b610d85846116e9565b61081b82826040518060200160405280600081525061175d565b6000828152606760205260409020546001600160a01b031661147e5760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b606482015260840161057c565b6000828152609760209081526040909120825161061d92840190611b3d565b6001600160a01b0381163b61150a5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161057c565b60008051602061228483398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61154283611790565b60008251118061154f5750805b1561061d57610b8183836117d0565b600054610100900460ff166115855760405162461bcd60e51b815260040161057c906120d2565b8151611598906065906020850190611b3d565b50805161061d906066906020840190611b3d565b600054610100900460ff166115d35760405162461bcd60e51b815260040161057c906120d2565b6109ca33611105565b60006001600160a01b0384163b156116de57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061162090339089908890889060040161219e565b602060405180830381600087803b15801561163a57600080fd5b505af192505050801561166a575060408051601f3d908101601f19168201909252611667918101906121db565b60015b6116c4573d808015611698576040519150601f19603f3d011682016040523d82523d6000602084013e61169d565b606091505b5080516116bc5760405162461bcd60e51b815260040161057c9061211d565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610d85565b506001949350505050565b60606116f482610c41565b600061170b60408051602081019091526000815290565b9050600081511161172b5760405180602001604052806000815250611756565b80611735846118c4565b60405160200161174692919061216f565b6040516020818303038152906040525b9392505050565b61176783836119c2565b61177460008484846115dc565b61061d5760405162461bcd60e51b815260040161057c9061211d565b6117998161149d565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6118385760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161057c565b600080846001600160a01b03168460405161185391906121f8565b600060405180830381855af49150503d806000811461188e576040519150601f19603f3d011682016040523d82523d6000602084013e611893565b606091505b50915091506118bb82826040518060600160405280602781526020016122a460279139611b04565b95945050505050565b6060816118e85750506040805180820190915260018152600360fc1b602082015290565b8160005b811561191257806118fc81612214565b915061190b9050600a83612245565b91506118ec565b60008167ffffffffffffffff81111561192d5761192d611d2a565b6040519080825280601f01601f191660200182016040528015611957576020820181803683370190505b5090505b8415610d855761196c60018361208a565b9150611979600a86612259565b6119849060306120a1565b60f81b8183815181106119995761199961226d565b60200101906001600160f81b031916908160001a9053506119bb600a86612245565b945061195b565b6001600160a01b038216611a185760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161057c565b6000818152606760205260409020546001600160a01b031615611a7d5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161057c565b6001600160a01b0382166000908152606860205260408120805460019290611aa69084906120a1565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60608315611b13575081611756565b825115611b235782518084602001fd5b8160405162461bcd60e51b815260040161057c9190611c61565b828054611b4990611f53565b90600052602060002090601f016020900481019282611b6b5760008555611bb1565b82601f10611b8457805160ff1916838001178555611bb1565b82800160010185558215611bb1579182015b82811115611bb1578251825591602001919060010190611b96565b50611bbd929150611bc1565b5090565b5b80821115611bbd5760008155600101611bc2565b6001600160e01b03198116811461073057600080fd5b600060208284031215611bfe57600080fd5b813561175681611bd6565b60005b83811015611c24578181015183820152602001611c0c565b83811115610b815750506000910152565b60008151808452611c4d816020860160208601611c09565b601f01601f19169290920160200192915050565b6020815260006117566020830184611c35565b600060208284031215611c8657600080fd5b5035919050565b80356001600160a01b0381168114611ca457600080fd5b919050565b60008060408385031215611cbc57600080fd5b611cc583611c8d565b946020939093013593505050565b600080600060608486031215611ce857600080fd5b611cf184611c8d565b9250611cff60208501611c8d565b9150604084013590509250925092565b600060208284031215611d2157600080fd5b61175682611c8d565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115611d5b57611d5b611d2a565b604051601f8501601f19908116603f01168101908282118183101715611d8357611d83611d2a565b81604052809350858152868686011115611d9c57600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112611dc757600080fd5b61175683833560208501611d40565b60008060408385031215611de957600080fd5b611df283611c8d565b9150602083013567ffffffffffffffff811115611e0e57600080fd5b611e1a85828601611db6565b9150509250929050565b60008060408385031215611e3757600080fd5b611e4083611c8d565b915060208301358015158114611e5557600080fd5b809150509250929050565b60008060008060808587031215611e7657600080fd5b611e7f85611c8d565b9350611e8d60208601611c8d565b925060408501359150606085013567ffffffffffffffff811115611eb057600080fd5b611ebc87828801611db6565b91505092959194509250565b60008060408385031215611edb57600080fd5b611ee483611c8d565b9150602083013567ffffffffffffffff811115611f0057600080fd5b8301601f81018513611f1157600080fd5b611e1a85823560208401611d40565b60008060408385031215611f3357600080fd5b611f3c83611c8d565b9150611f4a60208401611c8d565b90509250929050565b600181811c90821680611f6757607f821691505b60208210811415611f8857634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60008282101561209c5761209c612074565b500390565b600082198211156120b4576120b4612074565b500190565b6000602082840312156120cb57600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60008351612181818460208801611c09565b835190830190612195818360208801611c09565b01949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906121d190830184611c35565b9695505050505050565b6000602082840312156121ed57600080fd5b815161175681611bd6565b6000825161220a818460208701611c09565b9190910192915050565b600060001982141561222857612228612074565b5060010190565b634e487b7160e01b600052601260045260246000fd5b6000826122545761225461222f565b500490565b6000826122685761226861222f565b500690565b634e487b7160e01b600052603260045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220d64383e387727636b149cb6d76c88b8dbababc2064888c9a91c853f69df80d4e64736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/utils/CheckPoints.sol/CheckPoints.dbg.json b/src/contracts/utils/CheckPoints.sol/CheckPoints.dbg.json deleted file mode 100644 index 306669b5ad..0000000000 --- a/src/contracts/utils/CheckPoints.sol/CheckPoints.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/utils/CheckPoints.sol/CheckPoints.json b/src/contracts/utils/CheckPoints.sol/CheckPoints.json deleted file mode 100644 index f6b04ec15a..0000000000 --- a/src/contracts/utils/CheckPoints.sol/CheckPoints.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "CheckPoints", - "sourceName": "contracts/utils/CheckPoints.sol", - "abi": [], - "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212200fe82f4dd53d3994943eeefd8a6a64859988f1831814fd0a116af1a1a7fae9ba64736f6c63430008090033", - "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212200fe82f4dd53d3994943eeefd8a6a64859988f1831814fd0a116af1a1a7fae9ba64736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/utils/ECDSA.sol/ECDSA.dbg.json b/src/contracts/utils/ECDSA.sol/ECDSA.dbg.json deleted file mode 100644 index 940ca3008d..0000000000 --- a/src/contracts/utils/ECDSA.sol/ECDSA.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../build-info/a81a1069074ad242a5c07b467cbeaabf.json" -} diff --git a/src/contracts/utils/ECDSA.sol/ECDSA.json b/src/contracts/utils/ECDSA.sol/ECDSA.json deleted file mode 100644 index b19191fe86..0000000000 --- a/src/contracts/utils/ECDSA.sol/ECDSA.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "ECDSA", - "sourceName": "contracts/utils/ECDSA.sol", - "abi": [], - "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212204f9770fe006bab8168d81cf9b72270351114d370065f74bb860da1d7fb5f277b64736f6c63430008090033", - "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212204f9770fe006bab8168d81cf9b72270351114d370065f74bb860da1d7fb5f277b64736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/utils/Math.sol/Math.dbg.json b/src/contracts/utils/Math.sol/Math.dbg.json deleted file mode 100644 index 306669b5ad..0000000000 --- a/src/contracts/utils/Math.sol/Math.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/utils/Math.sol/Math.json b/src/contracts/utils/Math.sol/Math.json deleted file mode 100644 index f01da05cdd..0000000000 --- a/src/contracts/utils/Math.sol/Math.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Math", - "sourceName": "contracts/utils/Math.sol", - "abi": [], - "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212200241f27eb5ddaa682cd36dc7c40d09e78f350311b1097f32ab9ef56370efaf9b64736f6c63430008090033", - "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212200241f27eb5ddaa682cd36dc7c40d09e78f350311b1097f32ab9ef56370efaf9b64736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/utils/SafeCast.sol/SafeCast.dbg.json b/src/contracts/utils/SafeCast.sol/SafeCast.dbg.json deleted file mode 100644 index 306669b5ad..0000000000 --- a/src/contracts/utils/SafeCast.sol/SafeCast.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../build-info/4c6f43ed982c22167257fa3c2fb93c29.json" -} diff --git a/src/contracts/utils/SafeCast.sol/SafeCast.json b/src/contracts/utils/SafeCast.sol/SafeCast.json deleted file mode 100644 index 3cb7347c90..0000000000 --- a/src/contracts/utils/SafeCast.sol/SafeCast.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "SafeCast", - "sourceName": "contracts/utils/SafeCast.sol", - "abi": [], - "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ce120e4dd6207578bd2a6aeb1f4343d84dbf7141dcd99050cc3bdef7b5a0654464736f6c63430008090033", - "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ce120e4dd6207578bd2a6aeb1f4343d84dbf7141dcd99050cc3bdef7b5a0654464736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/contracts/utils/Strings.sol/Strings.dbg.json b/src/contracts/utils/Strings.sol/Strings.dbg.json deleted file mode 100644 index 940ca3008d..0000000000 --- a/src/contracts/utils/Strings.sol/Strings.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../build-info/a81a1069074ad242a5c07b467cbeaabf.json" -} diff --git a/src/contracts/utils/Strings.sol/Strings.json b/src/contracts/utils/Strings.sol/Strings.json deleted file mode 100644 index 1b735f3640..0000000000 --- a/src/contracts/utils/Strings.sol/Strings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Strings", - "sourceName": "contracts/utils/Strings.sol", - "abi": [], - "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220de23e4d2bf174d3fd856e021e680790a1e954cfe3966546694675a2b63c4f9bb64736f6c63430008090033", - "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220de23e4d2bf174d3fd856e021e680790a1e954cfe3966546694675a2b63c4f9bb64736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/db/data-source.ts b/src/db/data-source.ts new file mode 100644 index 0000000000..7b8fd55803 --- /dev/null +++ b/src/db/data-source.ts @@ -0,0 +1,77 @@ +import { DataSource, DataSourceOptions } from 'typeorm'; +import { MileStoneEntity } from '../entities/milestone.entity'; +import { NeedEntity } from '../entities/need.entity'; +import { SignatureEntity } from '../entities/signature.entity'; +import { ChildrenEntity } from '../entities/children.entity'; +import { StepEntity } from '../entities/step.entity'; +import { ProviderEntity } from '../entities/provider.entity'; +import { PaymentEntity } from '../entities/payment.entity'; +import { ReceiptEntity } from '../entities/receipt.entity'; +import { NgoArrivalEntity, NgoEntity } from '../entities/ngo.entity'; +import { TicketEntity } from '../entities/ticket.entity'; +import { TicketContentEntity } from '../entities/ticketContent.entity'; +import { StatusEntity } from '../entities/status.entity'; +import { LocationEntity } from '../entities/location.entity'; +import { TicketViewEntity } from '../entities/ticketView.entity'; +import { IpfsEntity } from '../entities/ipfs.entity'; +import { ContributorEntity } from '../entities/contributor.entity'; +import { ProviderJoinNeedEntity } from '../entities/provider.Join.need..entity'; +import { MidjourneyEntity } from '../entities/midjourney.entity'; +import { Session } from '../entities/session.entity'; +import { CommentEntity } from '../entities/comment.entity'; +import { VariableEntity } from '../entities/variable.entity'; +import { EthereumTransaction } from '../entities/ethereum.transaction.entity'; +import { EthereumAccountEntity } from '../entities/ethereum.account.entity'; +import config from '../config'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { ContributionEntity } from 'src/entities/contribution.entity'; +import { CampaignEntity } from 'src/entities/campaign.entity'; +import { UrlEntity } from 'src/entities/url.entity'; + +export const postgresDataSourceOptions: DataSourceOptions = { + ...config().db1, + entities: [ + Session, + AllUserEntity, + CampaignEntity, + LocationEntity, + StatusEntity, + ContributorEntity, + TicketEntity, + TicketViewEntity, + TicketContentEntity, + NgoEntity, + NgoArrivalEntity, + PaymentEntity, + ReceiptEntity, + NeedEntity, + VariableEntity, + ProviderJoinNeedEntity, + ProviderEntity, + MileStoneEntity, + StepEntity, + SignatureEntity, + ChildrenEntity, + EthereumAccountEntity, + EthereumTransaction, + IpfsEntity, + MidjourneyEntity, + CommentEntity, + ChildrenPreRegisterEntity, + ContributionEntity, + UrlEntity, + ], +}; + +const dataSource = new DataSource(postgresDataSourceOptions); +dataSource + .initialize() + .then(() => { + console.log('Data Source has been initialized!'); + }) + .catch((err) => { + console.error('Error during Data Source initialization', err); + }); + +export default dataSource; diff --git a/src/entities/campaign.entity.ts b/src/entities/campaign.entity.ts new file mode 100644 index 0000000000..4720bbb045 --- /dev/null +++ b/src/entities/campaign.entity.ts @@ -0,0 +1,28 @@ +import { Entity, Column, ManyToOne, ManyToMany, JoinTable } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; +import { AllUserEntity } from './user.entity'; +import { + CampaignNameEnum, + CampaignTypeEnum, +} from 'src/types/interfaces/interface'; + +@Entity() +export class CampaignEntity extends BaseEntity { + @Column({ nullable: false }) + title: string; + + @Column({ nullable: false }) + campaignName: CampaignNameEnum; + + @Column({ nullable: false }) + type: CampaignTypeEnum; + + @Column({ nullable: false, unique: true }) + campaignCode: string; + + @ManyToMany(() => AllUserEntity, (u) => u.campaigns, { + eager: true, + }) + @JoinTable() + receivers: AllUserEntity[]; +} diff --git a/src/entities/children.entity.ts b/src/entities/children.entity.ts index 9c3125d125..1891828483 100644 --- a/src/entities/children.entity.ts +++ b/src/entities/children.entity.ts @@ -1,44 +1,33 @@ -import { - Entity, - Column, - Index, - OneToMany, - JoinColumn, - OneToOne, - ManyToOne, -} from 'typeorm'; +import { Entity, Column, Index, OneToMany, ManyToOne } from 'typeorm'; import { NeedEntity } from './need.entity'; import { BaseEntity } from './BaseEntity'; -import { EducationEnum, HousingEnum } from '../types/interface'; +import { + EducationEnum, + HousingEnum, + SchoolTypeEnum, +} from '../types/interfaces/interface'; import { NgoEntity } from './ngo.entity'; -import { SocialWorkerEntity } from './user.entity'; +import { ContributorEntity } from './contributor.entity'; @Entity() export class ChildrenEntity extends BaseEntity { - @Index({ unique: true }) @Column() - flaskChildId: number; + flaskId: number; @Column({ nullable: true }) - flaskSupervisorId?: number; //confirmUser from flask - - @Column({ nullable: true }) - address: string; + flaskConfirmUser?: number; //confirmUser from flask @Column({ nullable: true }) awakeAvatarUrl: string; @Column({ nullable: true }) - bio: string; - - @Column({ nullable: true }) - bioSummary: string; + adultAvatarUrl: string; - @Column("simple-json", { nullable: true }) - bioSummaryTranslations: { en: string; fa: string }; + @Column({ type: 'hstore', hstoreType: 'object' }) + bioSummaryTranslations: Record; - @Column("simple-json", { nullable: true }) - bioTranslations: { en: string; fa: string }; + @Column({ type: 'hstore', hstoreType: 'object' }) + bioTranslations: Record; @Column({ type: 'timestamptz', nullable: true }) birthDate: Date; @@ -49,6 +38,9 @@ export class ChildrenEntity extends BaseEntity { @Column({ nullable: true }) city: number; + @Column({ nullable: true }) + state: number; + @Column({ type: 'timestamptz', nullable: true }) confirmDate: Date; @@ -58,17 +50,14 @@ export class ChildrenEntity extends BaseEntity { @Column({ type: 'timestamptz', nullable: true }) created: Date; - @Column({ nullable: true }) - doneNeedsCount: number; - @Column({ nullable: true }) education: EducationEnum; @Column({ nullable: true }) - existenceStatus: number; + schoolType: SchoolTypeEnum; @Column({ nullable: true }) - familyCount: number; + existenceStatus: number; @Column({ nullable: true }) generatedCode: string; @@ -88,9 +77,6 @@ export class ChildrenEntity extends BaseEntity { @Column({ nullable: true }) isMigrated: boolean; - @Column({ nullable: true }) - isGone: boolean; - @Column({ type: 'timestamptz', nullable: true }) migrateDate: Date; @@ -98,22 +84,25 @@ export class ChildrenEntity extends BaseEntity { migratedId: number; @Column({ nullable: true }) - nationality: string; + nationality: number; @Column({ nullable: true }) sayFamilyCount: number; + @Column({ nullable: true }) + familyCount: number; + @Column({ nullable: true }) sayName: string; - @Column("simple-json", { nullable: true }) - sayNameTranslations: { en: string; fa: string }; + @Column({ type: 'hstore', hstoreType: 'object' }) + sayNameTranslations: Record; @Column({ nullable: true }) sleptAvatarUrl: string; @Column({ nullable: true }) - status: number; + flaskNgoId: number; @Column({ type: 'timestamptz', nullable: true }) updated: Date; @@ -122,15 +111,14 @@ export class ChildrenEntity extends BaseEntity { voiceUrl: string; @OneToMany(() => NeedEntity, (need) => need.child) - needs?: NeedEntity[] + needs?: NeedEntity[]; - @ManyToOne(() => NgoEntity, (n) => n.children, { eager: false }) + @ManyToOne(() => NgoEntity, (n) => n.children, { + eager: true, + nullable: false, + }) ngo: NgoEntity; - @ManyToOne(() => SocialWorkerEntity, (s) => s.children, { eager: false }) - socialWorker: SocialWorkerEntity; - - @ManyToOne(() => SocialWorkerEntity, (s) => s.children, { eager: false }) - supervisor: SocialWorkerEntity; + @ManyToOne(() => ContributorEntity, (s) => s.children, { eager: true }) + socialWorker: ContributorEntity; } - diff --git a/src/entities/childrenPreRegister.entity.ts b/src/entities/childrenPreRegister.entity.ts new file mode 100644 index 0000000000..45ef74af90 --- /dev/null +++ b/src/entities/childrenPreRegister.entity.ts @@ -0,0 +1,97 @@ +import { Entity, Column, ManyToOne, Index } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; +import { + EducationEnum, + HousingEnum, + PreRegisterStatusEnum, + SchoolTypeEnum, + SexEnum, +} from '../types/interfaces/interface'; +import { LocationEntity } from './location.entity'; +import { ContributorEntity } from './contributor.entity'; +import { NgoEntity } from './ngo.entity'; + +@Entity() +export class ChildrenPreRegisterEntity extends BaseEntity { + @Column({ nullable: false }) + awakeUrl: string; + + @Column({ nullable: false }) + sleptUrl: string; + + @Column({ type: 'hstore', hstoreType: 'object', nullable: false }) + sayName: Record; + + @Column({ type: 'hstore', hstoreType: 'object', nullable: true }) + firstName: Record; + + @Column({ type: 'hstore', hstoreType: 'object', nullable: true }) + lastName: Record; + + @Column({ type: 'hstore', hstoreType: 'object', nullable: true }) + bio: Record; + + @Column({ type: 'timestamptz', nullable: true }) + birthDate: Date; + + @Column({ nullable: true }) + birthPlaceId: number; + + @Index({ unique: true }) + @Column({ nullable: true }) + flaskChildId: number; + + @Column({ nullable: true }) + birthPlaceName: string; + + @Column({ nullable: true }) + city: number; + + @Column({ nullable: true }) + state: number; + + @Column({ nullable: true }) + country: number; + + @Column({ nullable: false }) + sex: SexEnum; + + @Column({ nullable: true }) + educationLevel: EducationEnum; + + @Column({ nullable: true }) + schoolType: SchoolTypeEnum; + + @Column({ nullable: true }) + housingStatus: HousingEnum; + + @Column({ nullable: true }) + flaskSwId: number; + + @Column({ nullable: true }) + address: string; + + @Column({ nullable: true }) + familyCount: number; + + @Column({ nullable: true }) + phoneNumber: string; + + @Column({ nullable: true }) + flaskNgoId: number; + + @Column({ nullable: true }) + voiceUrl: string; + + @Column({ nullable: true, default: PreRegisterStatusEnum.NOT_REGISTERED }) + status: PreRegisterStatusEnum; + + @ManyToOne(() => LocationEntity, (n) => n.preRegisters, { eager: true }) + location: LocationEntity; + + @ManyToOne(() => ContributorEntity, (s) => s.preRegisters, { eager: true }) + socialWorker: ContributorEntity; + + @ManyToOne(() => NgoEntity, (n) => n.preRegisters, { eager: true }) + ngo: NgoEntity; +} diff --git a/src/entities/comment.entity.ts b/src/entities/comment.entity.ts new file mode 100644 index 0000000000..1e42f8b6ec --- /dev/null +++ b/src/entities/comment.entity.ts @@ -0,0 +1,31 @@ +import { VirtualFamilyRole } from 'src/types/interfaces/interface'; +import { Column, Entity, ManyToOne } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; +import { NeedEntity } from './need.entity'; +import { AllUserEntity } from './user.entity'; +@Entity() +export class CommentEntity extends BaseEntity { + @Column({ nullable: true }) + vRole: VirtualFamilyRole; + + @Column({ nullable: true }) + content: string; + + @Column() + flaskUserId: number; + + @Column() + flaskNeedId: number; + + @ManyToOne(() => NeedEntity, (n) => n.comments, { + eager: false, + nullable: false, + }) + need: NeedEntity; + + @ManyToOne(() => AllUserEntity, (n) => n.comments, { + eager: false, + nullable: false, + }) + user: AllUserEntity; +} diff --git a/src/entities/contribution.entity.ts b/src/entities/contribution.entity.ts new file mode 100644 index 0000000000..8110d128b7 --- /dev/null +++ b/src/entities/contribution.entity.ts @@ -0,0 +1,11 @@ +import { Column, Entity } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; + +@Entity() +export class ContributionEntity extends BaseEntity { + @Column({ nullable: true }) + title: string; + + @Column({ nullable: true }) + description: string; +} diff --git a/src/entities/contributor.entity.ts b/src/entities/contributor.entity.ts new file mode 100644 index 0000000000..5d33a0a137 --- /dev/null +++ b/src/entities/contributor.entity.ts @@ -0,0 +1,36 @@ +import { Entity, Column, OneToMany, ManyToOne } from 'typeorm'; +import { ChildrenEntity } from './children.entity'; +import { NgoEntity } from './ngo.entity'; +import { BaseEntity } from './BaseEntity'; +import { AllUserEntity } from './user.entity'; +import { PanelContributors } from 'src/types/interfaces/interface'; +import { ChildrenPreRegisterEntity } from './childrenPreRegister.entity'; + +@Entity() // panel admin, sw, auditor, ... +export class ContributorEntity extends BaseEntity { + @Column({ nullable: false }) + flaskUserId: number; + + @Column({ nullable: false }) + flaskNgoId: number; + + @OneToMany(() => ChildrenEntity, (c) => c.socialWorker, { eager: false }) + children?: ChildrenEntity[]; + + @OneToMany(() => ChildrenPreRegisterEntity, (c) => c.socialWorker, { + eager: false, + }) + preRegisters?: ChildrenPreRegisterEntity[]; + + @ManyToOne(() => NgoEntity, (n) => n.socialWorkers, { eager: false }) + ngo?: NgoEntity; + + @ManyToOne(() => AllUserEntity, (n) => n.contributions, { eager: false }) + user?: AllUserEntity; + + @Column({ type: 'enum', enum: PanelContributors, nullable: false }) + panelRole: PanelContributors; + + @Column({ nullable: false }) + panelRoleName: string; +} diff --git a/src/entities/ethereum.account.entity.ts b/src/entities/ethereum.account.entity.ts index 322b9f4dfb..492fd1ead1 100644 --- a/src/entities/ethereum.account.entity.ts +++ b/src/entities/ethereum.account.entity.ts @@ -1,21 +1,19 @@ -import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from 'typeorm' -import { BaseEntity } from './BaseEntity' -import { EthereumTransaction } from './ethereum.transaction.entity' +import { Entity, Column, OneToMany, ManyToOne } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; +import { EthereumTransaction } from './ethereum.transaction.entity'; +import { AllUserEntity } from './user.entity'; @Entity() -export class EthereumAccount extends BaseEntity { - @PrimaryGeneratedColumn('uuid') - id: string - +export class EthereumAccountEntity extends BaseEntity { @Column() - address: string - - @Column({ nullable: true }) - label: string + address: string; @Column({ nullable: true }) - chainId: number + chainId: number; @OneToMany(() => EthereumTransaction, (tx) => tx.ethereumAccount) - ethereumTransactions: EthereumTransaction + ethereumTransactions: EthereumTransaction; + + @ManyToOne(() => AllUserEntity, (user) => user.wallets, { eager: false }) + user: AllUserEntity; } diff --git a/src/entities/ethereum.transaction.entity.ts b/src/entities/ethereum.transaction.entity.ts index 1e22466547..69e065e91d 100644 --- a/src/entities/ethereum.transaction.entity.ts +++ b/src/entities/ethereum.transaction.entity.ts @@ -1,83 +1,96 @@ -import { Entity, Column, ManyToOne } from 'typeorm' -import { BaseEntity } from './BaseEntity' -import { EthereumAccount } from './ethereum.account.entity' +import { Entity, Column, ManyToOne } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; +import { NeedEntity } from './need.entity'; @Entity() export class EthereumTransaction extends BaseEntity { @Column({ nullable: true }) - transactionHash: string + transactionHash: string; @Column({ nullable: true }) - transactionStatus: string + transactionStatus: string; @Column({ nullable: true }) - createdTimestamp: Date + createdTimestamp: Date; @Column({ nullable: true }) - submittedTimestamp: Date + submittedTimestamp: Date; @Column({ nullable: true }) - signedTimestamp: Date + signedTimestamp: Date; @Column({ nullable: true }) - abortedTimestamp: Date + abortedTimestamp: Date; @Column({ nullable: true }) - failedTimestamp: Date + failedTimestamp: Date; @Column({ nullable: true }) - minedTimestamp: Date + minedTimestamp: Date; @Column({ nullable: true }) - failureReason: string + failureReason: string; @Column({ nullable: true }) - to: string + to: string; @Column({ nullable: true }) - from: string + from: string; @Column({ nullable: true }) - value: string + value: string; @Column({ nullable: true }) - data: string + data: string; @Column({ nullable: true }) - gasUsed: string + gasUsed: string; @Column({ nullable: true }) - fees: string + fees: string; @Column({ nullable: true }) - gasLimit: string + gasLimit: string; @Column({ nullable: true }) - gasPrice?: string + gasPrice?: string; @Column({ nullable: true }) - maxPriorityFeePerGas?: string + maxPriorityFeePerGas?: string; @Column({ nullable: true }) - maxFeePerGas?: string + maxFeePerGas?: string; @Column({ nullable: true }) - network: string + network: string; @Column({ nullable: true }) - nonce: string + nonce: string; @Column({ nullable: true }) - signedRawTransaction: string + signedRawTransaction: string; - @ManyToOne(() => EthereumAccount, (account) => account.ethereumTransactions, { - eager: true, - }) - ethereumAccount: EthereumAccount + @Column({ nullable: true }) + userId: string; @Column({ nullable: true }) - userId: string + needId: string; + + @ManyToOne( + () => EthereumAccountEntity, + (account) => account.ethereumTransactions, + { + eager: true, + }, + ) + ethereumAccount: EthereumAccountEntity; + + @ManyToOne(() => NeedEntity, (n) => n.ethereumTransactions, { + eager: false, + }) + need: NeedEntity; @Column({ nullable: true }) - type: string -} \ No newline at end of file + type: string; +} diff --git a/src/entities/flaskEntities/BaseEntity.ts b/src/entities/flaskEntities/BaseEntity.ts new file mode 100644 index 0000000000..13d4ea088f --- /dev/null +++ b/src/entities/flaskEntities/BaseEntity.ts @@ -0,0 +1,13 @@ +import { + Entity, + PrimaryColumn, +} from 'typeorm' +import { ApiProperty } from '@nestjs/swagger' + +@Entity() +export class BaseEntity { + @ApiProperty() + @PrimaryColumn('uuid') + id: number + +} diff --git a/src/entities/flaskEntities/NeedStatusUpdate.entity.ts b/src/entities/flaskEntities/NeedStatusUpdate.entity.ts new file mode 100644 index 0000000000..fa01f9a7ab --- /dev/null +++ b/src/entities/flaskEntities/NeedStatusUpdate.entity.ts @@ -0,0 +1,21 @@ +import { + Entity, + Column, +} from 'typeorm'; +import { BaseEntity } from './BaseEntity'; + +@Entity({ name: 'need_status_updates' }) +export class NeedStatusUpdate extends BaseEntity { + @Column() + need_id: number + + @Column() + sw_id: number + + @Column() + old_status: number + + @Column() + new_status: number + +} diff --git a/src/entities/flaskEntities/child.entity.ts b/src/entities/flaskEntities/child.entity.ts new file mode 100644 index 0000000000..75315c7b78 --- /dev/null +++ b/src/entities/flaskEntities/child.entity.ts @@ -0,0 +1,113 @@ +import { ChildExistence } from 'src/types/interfaces/interface'; +import { Entity, Column } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; + +@Entity() +export class Child extends BaseEntity { + @Column() + id_ngo: number; + + @Column({ nullable: true }) + confirmUser?: number; + + @Column({ nullable: true }) + address: string; + + @Column({ nullable: true }) + awakeAvatarUrl: string; + + @Column({ nullable: true }) + sleptAvatarUrl: string; + + @Column({ nullable: true }) + adult_avatar_url: string; + + @Column({ type: 'hstore', hstoreType: 'object' }) + bio_summary_translations: Record; + + @Column({ type: 'hstore', hstoreType: 'object' }) + firstName_translations: Record; + + @Column({ type: 'hstore', hstoreType: 'object' }) + lastName_translations: Record; + + @Column({ type: 'hstore', hstoreType: 'object' }) + bio_translations: Record; + + @Column({ type: 'timestamptz', nullable: true }) + birthDate: Date; + + @Column({ nullable: true }) + birthPlace: string; + + @Column({ nullable: true }) + phoneNumber: string; + + @Column({ nullable: true }) + city: number; + + @Column({ type: 'timestamptz', nullable: true }) + confirmDate: Date; + + @Column({ nullable: true }) + country: number; + + @Column({ type: 'timestamptz', nullable: true }) + created: Date; + + @Column({ nullable: true }) + education: number; + + @Column({ nullable: true }) + existence_status: ChildExistence; + + @Column({ nullable: true }) + familyCount: number; + + @Column({ nullable: true }) + generatedCode: string; + + @Column({ nullable: true }) + housingStatus: number; + + @Column({ nullable: true }) + id_social_worker: number; + + @Column({ nullable: true }) + isConfirmed: boolean; + + @Column({ nullable: true }) + isDeleted: boolean; + + @Column({ nullable: true }) + isMigrated: boolean; + + @Column({ type: 'timestamptz', nullable: true }) + migrateDate: Date; + + @Column({ nullable: true }) + migratedId: number; + + @Column({ nullable: true }) + nationality: number; + + @Column({ nullable: true }) + sayFamilyCount: number; + + @Column({ type: 'hstore', hstoreType: 'object' }) + sayname_translations: Record; + + @Column({ nullable: true }) + status: number; + + @Column({ nullable: true }) + gender: boolean; // true:male | false:female + + @Column({ type: 'timestamptz', nullable: true }) + updated: Date; + + @Column({ nullable: true }) + voiceUrl: string; + + family: any; +} diff --git a/src/entities/flaskEntities/cities.entity.ts b/src/entities/flaskEntities/cities.entity.ts new file mode 100644 index 0000000000..c3e9405406 --- /dev/null +++ b/src/entities/flaskEntities/cities.entity.ts @@ -0,0 +1,33 @@ +import { Entity, Column } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; + +@Entity() +export class Cities extends BaseEntity { + @Column({ nullable: true }) + name: string + + @Column({ nullable: true }) + state_id: number + + @Column({ nullable: true }) + state_code: string + + @Column({ nullable: true }) + state_name: string + + @Column({ nullable: true }) + country_id: number + + @Column({ nullable: true }) + country_code: string + + @Column({ nullable: true }) + country_name: string + + @Column({ nullable: true }) + latitude: string + + @Column({ nullable: true }) + longitude: string + +} \ No newline at end of file diff --git a/src/entities/flaskEntities/countries.entity.ts b/src/entities/flaskEntities/countries.entity.ts new file mode 100644 index 0000000000..85f54c287a --- /dev/null +++ b/src/entities/flaskEntities/countries.entity.ts @@ -0,0 +1,44 @@ +import { Entity, Column } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; + +@Entity() +export class Countries extends BaseEntity { + @Column() + phone_code: string; + + @Column() + name: string; + + @Column() + capital: string; + + @Column() + currency: string; + + @Column() + currency_name: string; + + @Column() + currency_symbol: string; + + @Column() + tld: string; + + @Column() + region: string; + + @Column() + subregion: string; + + @Column() + timezones: string; + + @Column() + translations: string; + + @Column() + latitude: string; + + @Column() + longitude: string; +} diff --git a/src/entities/flaskEntities/family.entity.ts b/src/entities/flaskEntities/family.entity.ts new file mode 100644 index 0000000000..22c15e59d6 --- /dev/null +++ b/src/entities/flaskEntities/family.entity.ts @@ -0,0 +1,14 @@ +import { + Entity, + Column, +} from 'typeorm'; +import { BaseEntity } from './BaseEntity'; + +@Entity() +export class Family extends BaseEntity { + @Column() + id_child: number; + + @Column() + isDeleted: boolean +} \ No newline at end of file diff --git a/src/entities/flaskEntities/need.entity.ts b/src/entities/flaskEntities/need.entity.ts new file mode 100644 index 0000000000..fd1e79d437 --- /dev/null +++ b/src/entities/flaskEntities/need.entity.ts @@ -0,0 +1,116 @@ +import { + Entity, + Column, +} from 'typeorm'; +import { BaseEntity } from './BaseEntity'; + + +@Entity() +export class Need extends BaseEntity { + @Column({ nullable: true }) + title: string; + + @Column({ nullable: true }) + imageUrl: string; + + @Column({ nullable: true }) + img: string; + + @Column({ type: "hstore", hstoreType: "object" }) + name_translations: Record + + @Column({ nullable: true }) + doing_duration: number; + + @Column({ nullable: true }) + affiliateLinkUrl?: string; + + @Column({ nullable: true }) + bank_track_id?: string; + + @Column({ nullable: true }) + category: number; + + @Column({ type: 'timestamptz', nullable: true }) + child_delivery_date?: Date; + + @Column({ type: 'timestamptz', nullable: true }) + confirmDate?: Date; + + @Column({ nullable: true }) + _cost: number; + + @Column({ type: "hstore", hstoreType: "object" }) + description_translations: Record + + @Column({ nullable: true }) + details: string; + + @Column({ nullable: true }) + informations: string; + + @Column({ type: 'timestamptz', nullable: true }) + doneAt: Date; + + @Column({ type: 'timestamptz', nullable: true }) + expected_delivery_date: Date; + + @Column({ nullable: true }) + isConfirmed: boolean; + + @Column({ nullable: true }) + isDeleted: boolean; + + @Column({ nullable: true }) + isUrgent: boolean; + + @Column({ nullable: true }) + link: string; + + @Column({ type: 'timestamptz', nullable: true }) + ngo_delivery_date: Date; + + @Column({ nullable: true }) + purchase_cost: number; + + @Column({ type: 'timestamptz', nullable: true }) + purchase_date: Date; + + @Column({ nullable: true }) + status: number; + + @Column({ type: 'timestamptz', nullable: true }) + status_updated_at: Date; + + @Column({ nullable: true }) + type: number; + + @Column({ type: 'timestamptz', nullable: true }) + unavailable_from?: Date; + + @Column({ type: 'timestamptz', nullable: true }) + unconfirmed_at?: Date; + + @Column({ type: 'timestamptz', nullable: true }) + created: Date; + + @Column({ type: 'timestamptz', nullable: true }) + updated?: Date; + + @Column({ type: 'timestamptz', nullable: true }) + deleted_at?: Date; + + @Column() + child_id: number; + + @Column({ name: 'dkc' }) + deliveryCode: string; + + @Column() + created_by_id: number; + + @Column() + confirmUser: number; + +} + diff --git a/src/entities/flaskEntities/needFamily.ts b/src/entities/flaskEntities/needFamily.ts new file mode 100644 index 0000000000..713ffd9bb1 --- /dev/null +++ b/src/entities/flaskEntities/needFamily.ts @@ -0,0 +1,27 @@ +import { + Entity, + Column, +} from 'typeorm'; +import { BaseEntity } from './BaseEntity'; + +@Entity() +export class NeedFamily extends BaseEntity { + @Column() + id_user: number; + + @Column() + id_need: number; + + @Column() + id_family: number; + + @Column() + type: string; + + @Column({ name: 'user_role' }) + flaskFamilyRole: number + + @Column() + isDeleted: boolean + +} diff --git a/src/entities/flaskEntities/needReceipt.entity.ts b/src/entities/flaskEntities/needReceipt.entity.ts new file mode 100644 index 0000000000..398a76d597 --- /dev/null +++ b/src/entities/flaskEntities/needReceipt.entity.ts @@ -0,0 +1,17 @@ +import { Entity, Column } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; + +@Entity({name: 'need_receipt'}) +export class NeedReceipt extends BaseEntity { + @Column() + need_id: number; + + @Column() + sw_id: number; + + @Column() + receipt_id: number; + + @Column({ nullable: true }) + deleted: Date; +} diff --git a/src/entities/flaskEntities/ngo.entity.ts b/src/entities/flaskEntities/ngo.entity.ts new file mode 100644 index 0000000000..fc86fa7487 --- /dev/null +++ b/src/entities/flaskEntities/ngo.entity.ts @@ -0,0 +1,45 @@ +import { Entity, Column } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; + +@Entity() +export class NGO extends BaseEntity { + @Column({ nullable: true }) + name: string; + + @Column({ nullable: true }) + website: string; + + @Column({ nullable: true }) + balance: number; + + @Column({ nullable: true }) + city_id: number; + + @Column({ nullable: true }) + postalAddress: string; + + @Column({ nullable: true }) + emailAddress: string; + + @Column({ nullable: true }) + phoneNumber: string; + + @Column({ nullable: true }) + logoUrl: string; + + @Column({ default: false }) + isActive: boolean; + + @Column({ type: 'timestamptz', nullable: true }) + registerDate?: Date; + + @Column({ type: 'timestamptz', nullable: true }) + created?: Date; + + @Column({ type: 'timestamptz', nullable: true }) + updated?: Date; + + @Column({ nullable: true }) + isDeleted?: boolean; + +} diff --git a/src/entities/flaskEntities/payment.entity.ts b/src/entities/flaskEntities/payment.entity.ts new file mode 100644 index 0000000000..3797ef5946 --- /dev/null +++ b/src/entities/flaskEntities/payment.entity.ts @@ -0,0 +1,50 @@ +import { + Entity, + Column, +} from 'typeorm'; +import { BaseEntity } from './BaseEntity' + +@Entity() +export class Payment extends BaseEntity { + [x: string]: any; // when mapping need and payment and we do not have payment.need => p.need.created + @Column({ nullable: true }) + id_need: number; + + @Column({ nullable: true }) + id_user: number; + + @Column({ nullable: true }) + order_id: number; + + @Column({ nullable: true }) + credit_amount: number; + + @Column({ nullable: true }) + donation_amount: number; + + @Column({ nullable: true }) + card_no: string; + + @Column({ nullable: true }) + gateway_payment_id: string; + + @Column({ nullable: true }) + gateway_track_id: string; + + @Column({ nullable: true }) + need_amount: number; + + @Column({ type: 'timestamptz', nullable: true }) + transaction_date: Date; + + @Column({ type: 'timestamptz', nullable: true }) + created: Date; + + @Column({ type: 'timestamptz', nullable: true }) + updated: Date; + + @Column({ type: 'timestamptz', nullable: true }) + verified: Date; + +} + diff --git a/src/entities/flaskEntities/receipt.entity.ts b/src/entities/flaskEntities/receipt.entity.ts new file mode 100644 index 0000000000..749993d111 --- /dev/null +++ b/src/entities/flaskEntities/receipt.entity.ts @@ -0,0 +1,29 @@ +import { Entity, Column } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; + +@Entity() +export class Receipt extends BaseEntity { + @Column() + owner_id: number; + + @Column() + attachment: string; + + @Column() + need_status: number; + + @Column() + code: string; + + @Column() + title: string; + + @Column() + description: string; + + @Column({ nullable: true }) + is_public: boolean; + + @Column({ nullable: true }) + deleted: Date; +} diff --git a/src/entities/flaskEntities/user.entity.ts b/src/entities/flaskEntities/user.entity.ts new file mode 100644 index 0000000000..dec133d9da --- /dev/null +++ b/src/entities/flaskEntities/user.entity.ts @@ -0,0 +1,136 @@ +import { Entity, Column, Index } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; + +@Entity() +export class User extends BaseEntity { + [x: string]: any; // when in analytic.service user.payments not available from flask this helps + @Column({ nullable: true }) + firstName?: string; + + @Column({ nullable: true }) + lastName?: string; + + @Column({ nullable: true }) + userName?: string; + + @Column({ nullable: true }) + avatarUrl?: string; + + @Column({ nullable: true }) + emailAddress?: string; + + @Column({ nullable: true }) + phone_number?: string; + + @Column({ type: 'timestamptz', nullable: true }) + updated?: Date; + + @Column({ type: 'timestamptz', nullable: true }) + created?: Date; + + @Column({ type: 'timestamptz', nullable: true }) + birthDate?: Date; + + @Column() + is_email_verified: boolean; + + @Column() + is_phonenumber_verified: boolean; + + @Column() + isDeleted: boolean; +} + +@Entity() // panel admin, sw, auditor, ... +export class SocialWorker extends BaseEntity { + @Column({ nullable: true, name: 'first_name' }) + firstName?: string; + + @Column({ nullable: true, name: 'last_name' }) + lastName?: string; + + @Column({ type: 'timestamptz', nullable: true }) + updated?: Date; + + @Column({ nullable: true }) + birth_certificate_number?: string; + + @Column({ nullable: true }) + id_card_url?: string; + + @Column({ nullable: true }) + generated_code?: string; + + @Column({ nullable: true }) + city_id?: string; + + @Column({ nullable: true }) + id_number?: string; + + @Column({ nullable: true }) + passport_number?: string; + + @Column({ nullable: true }) + postal_address?: string; + + @Column({ nullable: true }) + gender?: boolean; + + @Column({ nullable: true }) + bank_account_number?: string; + + @Column({ nullable: true }) + bank_account_sheba_number?: string; + + @Column({ nullable: true }) + birth_date?: Date; + + @Column({ nullable: true }) + telegram_id?: string; + + @Column({ nullable: true }) + is_coordinator?: boolean; + + @Column({ nullable: true }) + ngo_id?: number; + + @Column({ nullable: true }) + phone_number?: string; + + @Column({ nullable: true }) + emergency_phone_number?: string; + + @Column({ nullable: true }) + email?: string; + + @Column({ nullable: true }) + avatar_url?: string; + + @Column({ nullable: true }) + passport_url?: string; + + @Column({ nullable: true, name: 'username' }) + userName?: string; + + @Column({ nullable: true }) + created?: Date; + + @Column({ nullable: true }) + last_login_date?: Date; + + @Column({ nullable: true }) + locale?: string; + + @Column({ nullable: true }) + type_id?: number; + + @Column({ nullable: true }) + is_active?: boolean; +} + +@Entity() +export class FamilyEntity extends User { + @Index({ unique: true }) + @Column({ nullable: false }) + flaskId: number; +} diff --git a/src/entities/flaskEntities/userFamily.entity.ts b/src/entities/flaskEntities/userFamily.entity.ts new file mode 100644 index 0000000000..db5c7763a5 --- /dev/null +++ b/src/entities/flaskEntities/userFamily.entity.ts @@ -0,0 +1,23 @@ +import { Entity, Column } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; + +@Entity() +export class UserFamily extends BaseEntity { + @Column() + id_user: number; + + @Column() + id_family: number; + + @Column({ name: 'userRole' }) + flaskFamilyRole: number; + + @Column() + isDeleted: boolean; + + @Column({ type: 'timestamptz', nullable: true }) + created: Date; + + @Column({ type: 'timestamptz', nullable: true }) + updated: Date; +} diff --git a/src/entities/ipfs.entity.ts b/src/entities/ipfs.entity.ts new file mode 100644 index 0000000000..7384bd861f --- /dev/null +++ b/src/entities/ipfs.entity.ts @@ -0,0 +1,25 @@ +import { Entity, Column, OneToOne, JoinColumn } from 'typeorm'; +import { NeedEntity } from './need.entity'; +import { BaseEntity } from './BaseEntity'; + +@Entity() +export class IpfsEntity extends BaseEntity { + @Column() + flaskNeedId: number; + + @Column({ nullable: false }) + needDetailsHash: string; + + @Column({ nullable: true }) + receiptsHash: string; + + @Column({ nullable: true }) + paymentsHash: string; + + @OneToOne(() => NeedEntity, (need) => need.ipfs, { + eager: false, + nullable: false, + }) + @JoinColumn() + need: NeedEntity; +} diff --git a/src/entities/location.entity.ts b/src/entities/location.entity.ts new file mode 100644 index 0000000000..e5fdb860ce --- /dev/null +++ b/src/entities/location.entity.ts @@ -0,0 +1,48 @@ +import { Entity, Column, OneToMany, Index } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; +import { NgoEntity } from './ngo.entity'; +import { ChildrenPreRegisterEntity } from './childrenPreRegister.entity'; + +@Entity() +export class LocationEntity extends BaseEntity { + @Column() + flaskCityId: number; + + @Column({ nullable: true }) + name: string; + + @Column({ nullable: true }) + stateId: number; + + @Column({ nullable: true }) + stateCode: string; + + @Column({ nullable: true }) + stateName: string; + + @Column({ nullable: true }) + countryId: number; + + @Column({ nullable: true }) + countryCode: string; + + @Column({ nullable: true }) + countryName: string; + + @Column({ nullable: true }) + latitude: string; + + @Column({ nullable: true }) + longitude: string; + + @OneToMany(() => NgoEntity, (n) => n.location, { eager: false }) + ngos?: NgoEntity[]; + + @OneToMany(() => NgoEntity, (n) => n.location, { eager: false }) + preRegisters?: NgoEntity[]; + + @OneToMany(() => ChildrenPreRegisterEntity, (c) => c.location, { + eager: false, + }) + children: ChildrenPreRegisterEntity[]; +} diff --git a/src/entities/midjourney.entity.ts b/src/entities/midjourney.entity.ts new file mode 100644 index 0000000000..955bed75ac --- /dev/null +++ b/src/entities/midjourney.entity.ts @@ -0,0 +1,17 @@ +import { Column, Entity, Index, JoinColumn, OneToOne } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; +import { NeedEntity } from './need.entity'; + +@Entity() +export class MidjourneyEntity extends BaseEntity { + @Index({ unique: true }) + @Column() + flaskNeedId: number; + + @Column() + fileName: string; + + @OneToOne(() => NeedEntity) + @JoinColumn() + need: NeedEntity; +} diff --git a/src/entities/need.entity.ts b/src/entities/need.entity.ts index 6a68b32589..d955849af4 100644 --- a/src/entities/need.entity.ts +++ b/src/entities/need.entity.ts @@ -2,37 +2,40 @@ import { Entity, Column, Index, - JoinTable, - ManyToMany, OneToMany, ManyToOne, - DeleteDateColumn, + OneToOne, + ManyToMany, } from 'typeorm'; -import { SocialWorkerEntity, FamilyEntity } from './user.entity'; -import { SignatureEntity } from './signature.entity'; import { ProviderEntity } from './provider.entity'; import { ChildrenEntity } from './children.entity'; import { PaymentEntity } from './payment.entity'; import { BaseEntity } from './BaseEntity'; -import { CategoryEnum, NeedTypeEnum } from '../types/interface'; +import { CategoryEnum, NeedTypeEnum } from '../types/interfaces/interface'; import { ReceiptEntity } from './receipt.entity'; import { NgoEntity } from './ngo.entity'; +import { TicketEntity } from './ticket.entity'; +import { StatusEntity } from './status.entity'; +import { IpfsEntity } from './ipfs.entity'; +import { AllUserEntity } from './user.entity'; +import { SignatureEntity } from './signature.entity'; +import { CommentEntity } from './comment.entity'; +import { VariableEntity } from './variable.entity'; +import { EthereumTransaction } from './ethereum.transaction.entity'; +import { CampaignEntity } from './campaign.entity'; @Entity() export class NeedEntity extends BaseEntity { - @DeleteDateColumn({ type: 'timestamptz', nullable: true }) - deletedAt?: Date; - @Index({ unique: true }) - @Column() - flaskNeedId: number; - @Column({ nullable: true }) - flaskSupervisorId?: number; //confirmUser from flask + flaskId: number; @Column({ nullable: true }) title: string; + @Column({ nullable: true }) + name: string; + @Column({ nullable: true }) doingDuration: number; @@ -45,12 +48,6 @@ export class NeedEntity extends BaseEntity { @Column({ type: 'enum', enum: CategoryEnum, nullable: true }) category: number; - @Column({ nullable: true }) - childGeneratedCode: string; - - @Column({ nullable: true }) - childSayName: string; - @Column({ type: 'timestamptz', nullable: true }) childDeliveryDate?: Date; @@ -63,9 +60,6 @@ export class NeedEntity extends BaseEntity { @Column({ type: 'timestamptz', nullable: true }) created: Date; - @Column({ nullable: true }) - description: string; - @Column('simple-json', { nullable: true }) descriptionTranslations: { en: string; fa: string }; @@ -73,7 +67,7 @@ export class NeedEntity extends BaseEntity { details: string; @Column({ nullable: true }) - donated: number; + information: string; @Column({ type: 'timestamptz', nullable: true }) doneAt: Date; @@ -88,7 +82,7 @@ export class NeedEntity extends BaseEntity { needRetailerImg: string; @Column({ nullable: true }) - information: string; + midjourneyImage: string; @Column({ nullable: true }) isConfirmed: boolean; @@ -96,12 +90,6 @@ export class NeedEntity extends BaseEntity { @Column({ nullable: true }) isDeleted: boolean; - @Column({ nullable: true }) - isDone: boolean; - - @Column({ nullable: true }) - isReported: boolean; - @Column({ nullable: true }) isUrgent: boolean; @@ -109,26 +97,11 @@ export class NeedEntity extends BaseEntity { link: string; @Column('simple-json', { nullable: true }) - titleTranslations: { en: string; fa: string }; - - @Column({ nullable: true }) - ngoAddress: string; - - @Column({ nullable: true }) - ngoName: string; + nameTranslations: { en: string; fa: string }; @Column({ type: 'timestamptz', nullable: true }) ngoDeliveryDate: Date; - @Column({ nullable: true }) - oncePurchased: boolean; - - @Column({ nullable: true }) - paid: number; - - @Column({ nullable: true }) - progress: string; - @Column({ nullable: true }) purchaseCost: number; @@ -136,76 +109,74 @@ export class NeedEntity extends BaseEntity { purchaseDate: Date; @Column({ nullable: true }) - receiptCount?: number; + deliveryCode: string; @Column({ nullable: true }) status: number; - @Column({ nullable: true }) - statusDescription?: string; - - @Column({ type: 'timestamptz', nullable: true }) - statusUpdatedAt?: Date; - @Column({ type: 'enum', enum: NeedTypeEnum, nullable: true }) type: NeedTypeEnum; - @Column({ nullable: true }) - typeName?: string; - @Column({ type: 'timestamptz', nullable: true }) - unavailableFrom?: Date; + updated?: Date; @Column({ type: 'timestamptz', nullable: true }) - unconfirmedAt?: Date; + unavailableFrom: Date; - @Column({ nullable: true }) - unpaidCost?: number; + @Column() + flaskChildId: number; @Column({ nullable: true }) - unpayable?: boolean; + flaskNgoId: number; - @Column({ type: 'timestamptz', nullable: true }) - unpayableFrom?: Date; + @ManyToOne(() => ChildrenEntity, (child) => child.needs, { eager: true }) + child: ChildrenEntity; - @Column({ type: 'timestamptz', nullable: true }) - updated?: Date; + @ManyToOne(() => ProviderEntity, (p) => p.needs, { eager: true }) + provider?: ProviderEntity; - @ManyToMany(() => FamilyEntity, (user) => user.doneNeeds, { eager: false }) - @JoinTable() - participants?: FamilyEntity[]; + @ManyToOne(() => NgoEntity, (n) => n.needs, { eager: false }) + ngo: NgoEntity; - @OneToMany(() => SignatureEntity, (signature) => signature.need, { eager: true }) - signatures?: SignatureEntity[]; + @ManyToOne(() => AllUserEntity, { eager: true }) + socialWorker: AllUserEntity; - @OneToMany(() => PaymentEntity, (payment) => payment.need, { eager: false }) - payments?: PaymentEntity[]; + @ManyToOne(() => AllUserEntity, { eager: true }) + auditor: AllUserEntity; - @OneToMany(() => ReceiptEntity, (receipt) => receipt.need, { eager: true }) - receipts?: ReceiptEntity[]; + @ManyToOne(() => AllUserEntity, { eager: true }) + purchaser: AllUserEntity; - @Column() - flaskChildId: number; + @OneToMany(() => TicketEntity, (t) => t.need) + tickets?: TicketEntity[]; - @Column() - flaskSwId: number; + @OneToMany(() => CommentEntity, (t) => t.need) + comments?: CommentEntity[]; - @Column({ nullable: true }) - flaskNgoId: number; + @Column({ default: true }) // only for family comment/report usage + isResolved: boolean; - @ManyToOne(() => ChildrenEntity, (child) => child.needs, { eager: false }) - child: ChildrenEntity; + @Column({ default: false }) + isMined: boolean; - @ManyToOne(() => ProviderEntity, (p) => p.needs, { eager: true }) - provider?: ProviderEntity; + @OneToMany(() => SignatureEntity, (s) => s.need, { eager: true }) + signatures?: SignatureEntity[]; - @ManyToOne(() => NgoEntity, (n) => n.needs, { eager: false }) - ngo: NgoEntity; + @OneToOne(() => IpfsEntity, (ipfs) => ipfs.need, { eager: true }) // specify inverse side as a second parameter + ipfs: IpfsEntity; - @ManyToOne(() => SocialWorkerEntity, (sw) => sw.createdNeeds, { eager: false }) - socialWorker: SocialWorkerEntity; + @OneToMany(() => PaymentEntity, (payment) => payment.need, { eager: false }) + verifiedPayments?: PaymentEntity[]; - @ManyToOne(() => SocialWorkerEntity, (sw) => sw.confirmedNeeds, { eager: false }) - supervisor: SocialWorkerEntity; -} + @OneToMany(() => ReceiptEntity, (receipt) => receipt.need, { eager: false }) + receipts?: ReceiptEntity[]; + + @OneToMany(() => StatusEntity, (status) => status.need, { eager: false }) + statusUpdates?: StatusEntity[]; + @OneToMany(() => EthereumTransaction, (t) => t.need, { eager: true }) + ethereumTransactions?: EthereumTransaction[]; + + @OneToMany(() => VariableEntity, (v) => v.need, { eager: true }) + variables?: VariableEntity[]; +} diff --git a/src/entities/ngo.entity.ts b/src/entities/ngo.entity.ts index e6ca3324ef..a27c47ec9d 100644 --- a/src/entities/ngo.entity.ts +++ b/src/entities/ngo.entity.ts @@ -1,52 +1,88 @@ -import { Entity, Column, OneToMany, Index } from 'typeorm' -import { BaseEntity } from './BaseEntity' -import { NeedEntity } from './need.entity' -import { ChildrenEntity } from './children.entity' -import { SocialWorkerEntity } from './user.entity' +import { Entity, Column, OneToMany, Index, ManyToOne } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; +import { NeedEntity } from './need.entity'; +import { ChildrenEntity } from './children.entity'; +import { LocationEntity } from './location.entity'; +import { ContributorEntity } from './contributor.entity'; +import { ChildrenPreRegisterEntity } from './childrenPreRegister.entity'; @Entity() export class NgoEntity extends BaseEntity { - @Column({ nullable: true }) - name: string + @Index({ unique: true }) + @Column({ nullable: true }) + flaskNgoId: number; - @Column({ nullable: true }) - website: string + @Column({ nullable: true }) + name: string; - @Index({ unique: true }) - @Column() - flaskNgoId: number + @Column({ nullable: true }) + website: string; - @Column({ nullable: true }) - city: number + @Column({ nullable: true }) + flaskCityId: number; - @Column({ nullable: true }) - state: number + @Column({ nullable: true }) + flaskStateId: number; - @Column({ nullable: true }) - country: number + @Column({ nullable: true }) + flaskCountryId: number; - @Column({ nullable: true }) - postalAddress: string + @Column({ nullable: true }) + postalAddress: string; - @Column({ nullable: true }) - emailAddress: string + @Column({ nullable: true }) + emailAddress: string; - @Column({ nullable: true }) - phoneNumber: string + @Column({ nullable: true }) + phoneNumber: string; - @Column({ nullable: true }) - logoUrl: string + @Column({ nullable: true }) + logoUrl: string; - @Column({ default: false }) - isActive: boolean + @Column({ default: false }) + isActive: boolean; - @OneToMany(() => NeedEntity, (need) => need.ngo) - needs: NeedEntity[]; + @Column({ type: 'timestamptz', nullable: true }) + registerDate?: Date; - @OneToMany(() => ChildrenEntity, (c) => c.ngo) - children?: ChildrenEntity[] + @Column({ type: 'timestamptz', nullable: true }) + created?: Date; - @OneToMany(() => SocialWorkerEntity, (sw) => sw.ngo) - socialWorkers?: SocialWorkerEntity[] + @Column({ type: 'timestamptz', nullable: true }) + updated?: Date; + + @Column({ nullable: true }) + isDeleted?: boolean; + + @OneToMany(() => NeedEntity, (need) => need.ngo) + needs: NeedEntity[]; + + @OneToMany(() => ChildrenEntity, (c) => c.ngo) + children?: ChildrenEntity[]; + + @OneToMany(() => ContributorEntity, (sw) => sw.ngo) + socialWorkers?: ContributorEntity[]; + + @ManyToOne(() => LocationEntity, (n) => n.ngos, { eager: true }) + location: LocationEntity; + + @OneToMany(() => ChildrenPreRegisterEntity, (c) => c.ngo, { + eager: false, + }) + preRegisters?: ChildrenPreRegisterEntity[]; } +@Entity() +export class NgoArrivalEntity extends BaseEntity { + @Column({ nullable: false }) + arrivalCode: string; + + @Column({ nullable: false }) + deliveryCode: string; + + @Column({ nullable: true }) + website: string; + + @ManyToOne(() => NgoEntity) + ngo: NgoEntity; +} diff --git a/src/entities/payment.entity.ts b/src/entities/payment.entity.ts index 25d74b7deb..db0e469041 100644 --- a/src/entities/payment.entity.ts +++ b/src/entities/payment.entity.ts @@ -6,43 +6,34 @@ import { } from 'typeorm'; import { BaseEntity } from './BaseEntity' import { NeedEntity } from './need.entity'; -import { FamilyEntity } from './user.entity'; +import { AllUserEntity } from './user.entity'; @Entity() export class PaymentEntity extends BaseEntity { - @Index({ unique: true }) - @Column() - flaskPaymentId: number; - - @Column({ nullable: true }) - bankAmount: number; - + @Index({unique: true}) @Column({ nullable: true }) - cardNumber: string; + flaskId: number; @Column({ nullable: true }) creditAmount: number; @Column({ nullable: true }) - description: string; - + orderId: string; + @Column({ nullable: true }) donationAmount: number; @Column({ nullable: true }) - gatewayPaymentId: string; - - @Column({ nullable: true }) - gatewayTrackId: string; + cardNumber: string; @Column({ nullable: true }) - hashedCardNumber: string; + gatewayPaymentId: string; @Column({ nullable: true }) - link: string; + gatewayTrackId: string; @Column({ nullable: true }) - totalAmount: number; + needAmount: number; @Column({ type: 'timestamptz', nullable: true }) transactionDate: Date; @@ -62,10 +53,10 @@ export class PaymentEntity extends BaseEntity { @Column() flaskUserId: number; - @ManyToOne(() => NeedEntity, (need) => need.payments, { eager: false }) + @ManyToOne(() => NeedEntity, (need) => need.verifiedPayments, { eager: false, nullable: true }) need: NeedEntity; - @ManyToOne(() => FamilyEntity, (user) => user.payments, { eager: false }) - user: FamilyEntity; - + @ManyToOne(() => AllUserEntity, (family) => family.payments, { eager: true }) + familyMember: AllUserEntity; } + diff --git a/src/entities/provider.Join.need..entity.ts b/src/entities/provider.Join.need..entity.ts new file mode 100644 index 0000000000..554beed0ad --- /dev/null +++ b/src/entities/provider.Join.need..entity.ts @@ -0,0 +1,12 @@ +import { Entity, Column, Index } from 'typeorm' +import { BaseEntity } from './BaseEntity' + +@Entity() +export class ProviderJoinNeedEntity extends BaseEntity { + @Index({ unique: true }) + @Column({ nullable: false }) + flaskNeedId: number + + @Column({ nullable: false }) + nestProviderId: string +} \ No newline at end of file diff --git a/src/entities/provider.entity.ts b/src/entities/provider.entity.ts index b1498959ba..ca87c0b0b9 100644 --- a/src/entities/provider.entity.ts +++ b/src/entities/provider.entity.ts @@ -1,4 +1,4 @@ -import { NeedTypeDefinitionEnum, NeedTypeEnum } from '../types/interface' +import { NeedTypeDefinitionEnum, NeedTypeEnum } from '../types/interfaces/interface' import { Entity, Column, OneToMany } from 'typeorm' import { BaseEntity } from './BaseEntity' import { NeedEntity } from './need.entity' @@ -14,6 +14,9 @@ export class ProviderEntity extends BaseEntity { @Column({ nullable: true }) description: string + @Column({ nullable: true }) + address: string + @Column() city: number @@ -35,7 +38,6 @@ export class ProviderEntity extends BaseEntity { @Column({ default: false }) isActive: boolean - @OneToMany(() => NeedEntity, (need) => need.provider) needs: NeedEntity[]; } \ No newline at end of file diff --git a/src/entities/receipt.entity.ts b/src/entities/receipt.entity.ts index 7076267c83..224d716933 100644 --- a/src/entities/receipt.entity.ts +++ b/src/entities/receipt.entity.ts @@ -1,12 +1,11 @@ import { Entity, Column, Index, ManyToOne } from 'typeorm'; import { BaseEntity } from './BaseEntity'; import { NeedEntity } from './need.entity'; -import { SocialWorkerEntity } from './user.entity'; @Entity() export class ReceiptEntity extends BaseEntity { @Index({ unique: true }) - @Column() + @Column({ nullable: true }) flaskReceiptId: number; @Column() @@ -31,14 +30,8 @@ export class ReceiptEntity extends BaseEntity { needStatus: number; @Column({ nullable: true }) - isPublic: boolean; - - @Column({ nullable: true }) - deleted: boolean; + deleted: Date; @ManyToOne(() => NeedEntity, (need) => need.receipts, { eager: false }) need: NeedEntity; - - @ManyToOne(() => SocialWorkerEntity, (s) => s.receipts, { eager: true }) - socialWorker: SocialWorkerEntity; } diff --git a/src/entities/session.entity.ts b/src/entities/session.entity.ts new file mode 100644 index 0000000000..d5a7aed1bc --- /dev/null +++ b/src/entities/session.entity.ts @@ -0,0 +1,18 @@ + +import { Column, DeleteDateColumn, Entity, PrimaryColumn, } from "typeorm"; + +// used by session management and pg +@Entity() +export class Session { + @PrimaryColumn() + sid: string + + @Column({ nullable: false }) + expire: Date + + @Column({ nullable: false, unique: true }) + sess: string + + @DeleteDateColumn() + public destroyedAt?: Date; +} \ No newline at end of file diff --git a/src/entities/signature.entity.ts b/src/entities/signature.entity.ts index 9384f177e3..5674097f8b 100644 --- a/src/entities/signature.entity.ts +++ b/src/entities/signature.entity.ts @@ -1,37 +1,42 @@ -import { - Entity, - PrimaryGeneratedColumn, - CreateDateColumn, - UpdateDateColumn, - Column, - ManyToOne, -} from 'typeorm'; -import { ApiProperty } from '@nestjs/swagger'; +import { Entity, Column, ManyToOne, ManyToMany } from 'typeorm'; +import { SAYPlatformRoles } from '../types/interfaces/interface'; +import { BaseEntity } from './BaseEntity'; import { NeedEntity } from './need.entity'; -import { SignatureEnum } from '../types/interface'; +import { AllUserEntity } from './user.entity'; +import { CampaignEntity } from './campaign.entity'; @Entity() -export class SignatureEntity { - @ApiProperty() - @PrimaryGeneratedColumn('uuid') - id: string; +export class SignatureEntity extends BaseEntity { + @Column({ nullable: false }) + verifyingContract: string; - @CreateDateColumn({ type: 'timestamptz' }) - createdAt: Date; + @Column({ nullable: true, default: false }) + isVerified: boolean; - @UpdateDateColumn({ type: 'timestamptz' }) - updatedAt: Date; + @Column({ nullable: false }) + signerAddress: string; + + @ManyToOne(() => AllUserEntity, (user) => user.signatures, { + eager: false, + nullable: false, + }) + user: AllUserEntity; @Column() - signer: string; + flaskUserId: number; @Column() + flaskNeedId: number; + + @Column({ unique: true }) hash: string; - @Column({ type: 'enum', enum: SignatureEnum, nullable: true }) - role: SignatureEnum; + @Column({ type: 'enum', enum: SAYPlatformRoles, nullable: false }) + role: SAYPlatformRoles; - @ManyToOne(() => NeedEntity, (need) => need.signatures, { eager: false }) + @ManyToOne(() => NeedEntity, (n) => n.signatures, { + eager: false, + nullable: false, + }) need: NeedEntity; - } diff --git a/src/entities/status.entity.ts b/src/entities/status.entity.ts new file mode 100644 index 0000000000..c06d1dbd32 --- /dev/null +++ b/src/entities/status.entity.ts @@ -0,0 +1,26 @@ + +import { Entity, Column, Index, ManyToOne } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; +import { NeedEntity } from './need.entity'; + +@Entity() +export class StatusEntity extends BaseEntity { + @Index({ unique: true }) + @Column({ nullable: true }) + flaskId?: number; + + @Column({ nullable: true }) + swId?: number; + + @Column({ nullable: true }) + flaskNeedId?: number; + + @Column({ nullable: true }) + newStatus?: number; + + @Column({ nullable: true }) + oldStatus?: number; + + @ManyToOne(() => NeedEntity, (need) => need.statusUpdates, { eager: false }) + need: NeedEntity; +} \ No newline at end of file diff --git a/src/entities/ticket.entity.ts b/src/entities/ticket.entity.ts new file mode 100644 index 0000000000..58cfaa07b1 --- /dev/null +++ b/src/entities/ticket.entity.ts @@ -0,0 +1,44 @@ +import { AnnouncementEnum, Colors, SAYPlatformRoles } from "src/types/interfaces/interface"; +import { Column, Entity, Index, JoinTable, ManyToMany, ManyToOne, OneToMany } from "typeorm"; +import { BaseEntity } from "./BaseEntity"; +import { NeedEntity } from "./need.entity"; +import { TicketContentEntity } from "./ticketContent.entity"; +import { TicketViewEntity } from "./ticketView.entity"; +import { AllUserEntity } from "./user.entity"; + +@Entity() +export class TicketEntity extends BaseEntity { + @Column({ nullable: true }) + role: SAYPlatformRoles + + @Column({ nullable: false }) + color: Colors + + @Column({ nullable: true }) + title: string + + @Index() + @Column() + flaskUserId: number + + @Column() + flaskNeedId: number + + @Column({ nullable: true }) + lastAnnouncement: AnnouncementEnum + + @ManyToMany(() => AllUserEntity, (user) => user.tickets, { eager: true }) + @JoinTable() + contributors?: AllUserEntity[]; + + @ManyToOne(() => NeedEntity, (n) => n.tickets, { eager: false, nullable: false }) + need: NeedEntity + + @OneToMany(() => TicketContentEntity, (c) => c.ticket, { eager: true, nullable: true }) + ticketHistories?: TicketContentEntity[] + + @OneToMany(() => TicketViewEntity, (v) => v.ticket, { eager: true, onDelete: 'CASCADE' }) + views: TicketViewEntity[] + +} + diff --git a/src/entities/ticketContent.entity.ts b/src/entities/ticketContent.entity.ts new file mode 100644 index 0000000000..60605ac117 --- /dev/null +++ b/src/entities/ticketContent.entity.ts @@ -0,0 +1,24 @@ +import { AnnouncementEnum } from "src/types/interfaces/interface"; +import { Column, Entity, ManyToOne } from "typeorm"; +import { BaseEntity } from "./BaseEntity"; +import { TicketEntity } from "./ticket.entity"; + +@Entity() +export class TicketContentEntity extends BaseEntity { + @Column({ nullable: false }) + message: string + + @Column({ nullable: false }) + from: number + + @Column({ nullable: true }) + announcement: AnnouncementEnum + + @Column({ type: 'timestamptz', nullable: true }) + announcedArrivalDate?: Date; + + @ManyToOne(() => TicketEntity, (t) => t.ticketHistories, { eager: false }) + ticket: TicketEntity; + +} + diff --git a/src/entities/ticketView.entity.ts b/src/entities/ticketView.entity.ts new file mode 100644 index 0000000000..b8571cb3bb --- /dev/null +++ b/src/entities/ticketView.entity.ts @@ -0,0 +1,20 @@ +import { Column, Entity, ManyToOne } from "typeorm"; +import { BaseEntity } from "./BaseEntity"; +import { TicketEntity } from "./ticket.entity"; + +@Entity() +export class TicketViewEntity extends BaseEntity { + @Column({ nullable: false }) + flaskUserId: number + + @Column({ nullable: false }) + ticketId: string + + @ManyToOne(() => TicketEntity, (t) => t.views, { eager: false, onDelete: 'CASCADE' }) + ticket: TicketEntity; + + @Column({ type: 'timestamptz', nullable: false }) + viewed: Date; + +} + diff --git a/src/entities/url.entity.ts b/src/entities/url.entity.ts new file mode 100644 index 0000000000..8a7af18b1a --- /dev/null +++ b/src/entities/url.entity.ts @@ -0,0 +1,15 @@ +import { Column, Entity } from "typeorm"; +import { BaseEntity } from "./BaseEntity"; + +@Entity() +export class UrlEntity extends BaseEntity { + @Column() + urlCode: string; + + @Column() + longUrl: string; + + @Column() + shortUrl: string; + +} diff --git a/src/entities/user.entity.ts b/src/entities/user.entity.ts index 866875d7b4..7e266e036a 100644 --- a/src/entities/user.entity.ts +++ b/src/entities/user.entity.ts @@ -1,76 +1,73 @@ -import { - Entity, - Column, - Index, - ManyToMany, - OneToMany, - OneToOne, - JoinColumn, - ManyToOne, - JoinTable, -} from 'typeorm'; -import { NeedEntity } from './need.entity'; +import { Entity, Column, ManyToMany, OneToMany } from 'typeorm'; import { PaymentEntity } from './payment.entity'; -import { RolesEnum } from '../types/interface'; import { BaseEntity } from './BaseEntity'; -import { EthereumAccount } from './ethereum.account.entity'; -import { ChildrenEntity } from './children.entity'; -import { NgoEntity } from './ngo.entity'; -import { ReceiptEntity } from './receipt.entity'; - +import { EthereumAccountEntity } from '../entities/ethereum.account.entity'; +import { TicketEntity } from './ticket.entity'; +import { ContributorEntity } from './contributor.entity'; +import { SignatureEntity } from './signature.entity'; +import { CommentEntity } from './comment.entity'; +import { CampaignEntity } from './campaign.entity'; @Entity() export class AllUserEntity extends BaseEntity { - @OneToOne(() => EthereumAccount, { eager: true }) - @JoinColumn() - wallet: EthereumAccount; + @Column({ nullable: false }) + flaskUserId: number; @Column({ nullable: true }) - avatarUrl: string; + typeId: number; // for contributors - @Column({ default: true }) - isActive: boolean; + @OneToMany(() => ContributorEntity, (c) => c.user, { eager: true }) + contributions: ContributorEntity[]; - @Column({ type: 'enum', enum: RolesEnum, nullable: true }) - role: RolesEnum -} + @OneToMany(() => EthereumAccountEntity, (account) => account.user, { + eager: true, + }) + wallets: EthereumAccountEntity[]; -@Entity() -export class FamilyEntity extends AllUserEntity { - @Index({ unique: true }) - @Column({ nullable: true }) - flaskUserId: number; + @OneToMany(() => CommentEntity, (comment) => comment.user, { + eager: false, + }) + comments: CommentEntity[]; - @ManyToMany(() => NeedEntity, need => need.participants, { eager: false }) - @JoinTable() - doneNeeds: NeedEntity[] + @ManyToMany(() => CampaignEntity, (c) => c.receivers) + campaigns: CampaignEntity[]; - @OneToMany(() => PaymentEntity, payment => payment.user, { eager: false }) - payments: PaymentEntity[] -} + @Column({ nullable: false }) + isContributor: boolean; -@Entity() -export class SocialWorkerEntity extends AllUserEntity { - @Index({ unique: true, }) @Column({ nullable: true }) - flaskSwId: number; + userName: string; - @OneToMany(() => NeedEntity, (n) => n.socialWorker, { eager: false }) - createdNeeds: NeedEntity[]; + @Column({ nullable: true }) + firstName: string; - @OneToMany(() => NeedEntity, (n) => n.supervisor, { eager: false }) - confirmedNeeds: NeedEntity[]; + @Column({ nullable: true }) + lastName: string; - @OneToMany(() => ChildrenEntity, (c) => c.socialWorker) - children: ChildrenEntity[]; + @Column({ nullable: true }) + avatarUrl: string; - @OneToMany(() => ChildrenEntity, (c) => c.supervisor) - confirmedChildren: ChildrenEntity[]; + @Column({ type: 'timestamptz', nullable: true }) + birthDate: Date; - @OneToMany(() => ReceiptEntity, (r) => r.socialWorker, { eager: false }) - receipts: ReceiptEntity[]; + @ManyToMany(() => TicketEntity, (ticket) => ticket.contributors, { + eager: false, + }) + tickets: TicketEntity[]; - @ManyToOne(() => NgoEntity, (n) => n.socialWorkers, { eager: true }) - ngo: NgoEntity; + @OneToMany(() => PaymentEntity, (payment) => payment.familyMember, { + eager: false, + }) + payments: PaymentEntity[]; + @OneToMany(() => SignatureEntity, (s) => s.user, { + eager: false, + }) + signatures: SignatureEntity[]; + + @Column({ default: true }) + monthlyCampaign: boolean; + + @Column({ default: true }) + newsLetterCampaign: boolean; } diff --git a/src/entities/variable.entity.ts b/src/entities/variable.entity.ts new file mode 100644 index 0000000000..4992be117d --- /dev/null +++ b/src/entities/variable.entity.ts @@ -0,0 +1,51 @@ +import { Entity, Column, ManyToOne } from 'typeorm'; +import { BaseEntity } from './BaseEntity'; +import { NeedEntity } from './need.entity'; +import { + DecimalToString, + DecimalTransformer, +} from '../utils/decimal.transformer'; +import { Transform } from 'class-transformer'; +import Decimal from 'decimal.js'; + +@Entity() +export class VariableEntity extends BaseEntity { + @Column({ nullable: false }) + flaskUserId: number; + + @Column({ + type: 'decimal', + precision: 10, + scale: 2, + default: 0.0, + transformer: new DecimalTransformer(), + }) + @Transform(DecimalToString(), { toPlainOnly: true }) + public distanceRatio: Decimal; + + @Column({ + type: 'decimal', + precision: 10, + scale: 2, + default: 0.0, + transformer: new DecimalTransformer(), + }) + @Transform(DecimalToString(), { toPlainOnly: true }) + public difficultyRatio: Decimal; + + @Column({ + type: 'decimal', + precision: 10, + scale: 2, + default: 0.0, + transformer: new DecimalTransformer(), + }) + @Transform(DecimalToString(), { toPlainOnly: true }) + public contributionRatio: Decimal; + + @Column({ nullable: false }) + needFlaskId: number; + + @ManyToOne(() => NeedEntity, (n) => n.variables, { eager: false }) + need: NeedEntity; +} diff --git a/src/events/receipt-stored.event.ts b/src/events/receipt-stored.event.ts new file mode 100644 index 0000000000..7911ee482a --- /dev/null +++ b/src/events/receipt-stored.event.ts @@ -0,0 +1,3 @@ +export class ReceiptStoredEvent { + constructor(public readonly ipnft: string, public readonly url: string) { } +} \ No newline at end of file diff --git a/src/features/analytic/analytic.controller.ts b/src/features/analytic/analytic.controller.ts new file mode 100644 index 0000000000..007cf07fac --- /dev/null +++ b/src/features/analytic/analytic.controller.ts @@ -0,0 +1,227 @@ +import { + Controller, + ForbiddenException, + Get, + Param, + Req, +} from '@nestjs/common'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; +import { + FlaskUserTypesEnum, + NeedTypeEnum, + SAYPlatformRoles, +} from 'src/types/interfaces/interface'; +import { convertFlaskToSayRoles, daysDifference } from 'src/utils/helpers'; +import { UserService } from '../user/user.service'; +import { AnalyticService } from './analytic.service'; +import config from 'src/config'; +import { isAuthenticated } from 'src/utils/auth'; + +@ApiTags('Analytic') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) +@Controller('analytic') +export class AnalyticController { + constructor( + private userService: UserService, + + private readonly analyticService: AnalyticService, + ) {} + + @Get('ecosystem/children') + @ApiOperation({ description: 'get SAY children ecosystem analytics' }) + async getChildrenEcosystemAnalytic(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + + let result: { + meanNeedsPerChild: number; + meanConfirmedPerChild: number; + meanUnConfirmedPerChild: number; + meanConfirmedNotPaidPerChild: number; + meanCompletePayPerChild: number; + meanPartialPayPerChild: number; + meanPurchasedPerChild: number; + meanMoneyToNgoPerChild: number; + meanDeliveredNgoPerChild: number; + meanDeliveredChildPerChild: number; + totalFamiliesCount: number; + totalFamilyMembersCount: number; + meanFamilyMembers: number; + childrenList: any; + }; + const data = config().dataCache.fetchChildrenEcosystem(); + + if (!data || daysDifference(data.created, new Date()) > 1) { + result = await this.analyticService.getChildrenEcosystemAnalytic(); + config().dataCache.storeChildrenEcosystem({ + meanNeedsPerChild: result.meanNeedsPerChild, + meanConfirmedPerChild: result.meanConfirmedPerChild, + meanUnConfirmedPerChild: result.meanUnConfirmedPerChild, + meanConfirmedNotPaidPerChild: result.meanConfirmedNotPaidPerChild, + meanCompletePayPerChild: result.meanCompletePayPerChild, + meanPartialPayPerChild: result.meanPartialPayPerChild, + meanPurchasedPerChild: result.meanPurchasedPerChild, + meanMoneyToNgoPerChild: result.meanMoneyToNgoPerChild, + meanDeliveredNgoPerChild: result.meanDeliveredNgoPerChild, + meanDeliveredChildPerChild: result.meanDeliveredChildPerChild, + totalFamilies: result.totalFamiliesCount, + totalFamilyMembers: result.totalFamilyMembersCount, + meanFamilyMembers: result.meanFamilyMembers, + childrenList: result.childrenList, + }); + } else { + result = data; + } + + return result; + } + + @Get(`needs/delivered/:needType`) + @ApiOperation({ description: 'Get all delivered needs from flask' }) + async getNeedsAnalytic( + @Req() req: Request, + @Param('needType') needType: NeedTypeEnum, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.analyticService.getDeliveredNeedsAnalytic(needType); + } + + @Get(`children`) + @ApiOperation({ description: 'Get all needs from flask' }) + async getChildrenAnalytic(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.analyticService.getChildrenAnalytic(); + } + + @Get(`ngos`) + @ApiOperation({ description: 'Get all needs from flask' }) + async getNgoAnalytic(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.analyticService.getNgoAnalytic(); + } + + @Get(`child/needs/:childId`) + @ApiOperation({ + description: + 'Get child needs count (confirmed,unConfirmed, confirmedNotPaid,...) from flask', + }) + async getChildNeedsAnalytic( + @Req() req: Request, + @Param('childId') childId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.analyticService.getChildNeedsAnalytic(childId); + } + + @Get(`child/active/family`) + @ApiOperation({ description: 'Get all needs from flask' }) + async getChildFamilyAnalytic(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + let activesList = config().dataCache.fetchActiveFamilies(); + if (!activesList) { + const childrenActiveFamilyList = + await this.analyticService.getChildrenFamilyAnalytic(); + activesList = { actives: childrenActiveFamilyList, created: new Date() }; + config().dataCache.storeActiveFamilies(childrenActiveFamilyList); + } + return activesList; + } + + @Get(`family/roles/scattered`) + @ApiOperation({ description: 'Get all family role analysis for a user' }) + async getFamilyMemberAnalyticCache(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return { + scattered: config().dataCache.roleScatteredData(), + }; + } + + @Get('contributions') + @ApiOperation({ description: 'Users contributions in month' }) + async getUserContribution(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not the Super admin'); + } + const role = convertFlaskToSayRoles(Number(panelFlaskTypeId)); + let swIds: number[]; + if (role === SAYPlatformRoles.AUDITOR) { + swIds = await this.userService + .getFlaskSwIds() + .then((r) => r.map((s) => s.id)); + } + if (role === SAYPlatformRoles.NGO_SUPERVISOR) { + const supervisor = await this.userService.getFlaskSocialWorker( + panelFlaskUserId, + ); + swIds = await this.userService + .getFlaskSocialWorkersByNgo(supervisor.ngo_id) + .then((r) => r.map((s) => s.id)); + } + if (role === SAYPlatformRoles.PURCHASER) { + swIds = await this.userService + .getFlaskSwIds() + .then((r) => r.map((s) => s.id)); + } + return await this.analyticService.getUserContribution( + swIds, + role, + panelFlaskUserId, + ); + } +} diff --git a/src/features/analytic/analytic.module.ts b/src/features/analytic/analytic.module.ts new file mode 100644 index 0000000000..7da37828d5 --- /dev/null +++ b/src/features/analytic/analytic.module.ts @@ -0,0 +1,70 @@ +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; +import { AnalyticService } from './analytic.service'; +import { AnalyticController } from './analytic.controller'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { NGO } from 'src/entities/flaskEntities/ngo.entity'; +import { UserService } from '../user/user.service'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; +import { NeedService } from '../need/need.service'; +import { NeedEntity } from 'src/entities/need.entity'; +import { ChildrenService } from '../children/children.service'; +import { ChildrenEntity } from 'src/entities/children.entity'; +import { FamilyService } from '../family/family.service'; +import { AnalyticMiddleware } from './middlewares/analytic.middleware'; +import { PaymentEntity } from 'src/entities/payment.entity'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; + +@Module({ + imports: [ + TypeOrmModule.forFeature( + [ + User, + SocialWorker, + Need, + Child, + NGO, + Payment, + Family, + UserFamily, + Receipt, + NeedReceipt, + ], + 'flaskPostgres', + ), + TypeOrmModule.forFeature([ + AllUserEntity, + ContributorEntity, + EthereumAccountEntity, + NeedEntity, + VariableEntity, + ChildrenEntity, + PaymentEntity, + ChildrenPreRegisterEntity, + ]), + ], + + controllers: [AnalyticController], + providers: [ + AnalyticService, + UserService, + NeedService, + ChildrenService, + FamilyService, + ], +}) +export class AnalyticModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer.apply(AnalyticMiddleware).forRoutes('analytic'); + } +} diff --git a/src/features/analytic/analytic.service.ts b/src/features/analytic/analytic.service.ts new file mode 100644 index 0000000000..201d5a2813 --- /dev/null +++ b/src/features/analytic/analytic.service.ts @@ -0,0 +1,636 @@ +import { Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { mean, round } from 'mathjs'; +import config from 'src/config'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { NGO } from 'src/entities/flaskEntities/ngo.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { + NeedTypeEnum, + SAYPlatformRoles, + ChildExistence, +} from 'src/types/interfaces/interface'; +import { + daysDifference, + getNeedsTimeLine, + removeSpecialDuplicates, + timeDifferenceWithComment, +} from 'src/utils/helpers'; +import { Repository } from 'typeorm'; + +@Injectable() +export class AnalyticService { + constructor( + @InjectRepository(NGO, 'flaskPostgres') + private flaskNgoRepository: Repository, + @InjectRepository(Payment, 'flaskPostgres') + private flaskPaymentRepository: Repository, + @InjectRepository(Family, 'flaskPostgres') + private flaskFamilyRepository: Repository, + @InjectRepository(UserFamily, 'flaskPostgres') + private flaskUserFamilyRepository: Repository, + @InjectRepository(SocialWorker, 'flaskPostgres') + private flaskSocialWorkerRepository: Repository, + @InjectRepository(User, 'flaskPostgres') + private flaskUserRepository: Repository, + @InjectRepository(Child, 'flaskPostgres') + private flaskChildRepository: Repository, + @InjectRepository(Need, 'flaskPostgres') + private flaskNeedRepository: Repository, + ) {} + + async getDeliveredNeedsAnalytic(type: NeedTypeEnum) { + return await this.flaskNeedRepository + .createQueryBuilder('need') + .select([ + 'need.id', + 'need.name_translations', + 'need.type', + 'need.created', + 'need.confirmDate', + 'need.doneAt', + 'need.purchase_date', + 'need.ngo_delivery_date', + 'need.child_delivery_date', + ]) + .where('need.isConfirmed = :isConfirmed', { isConfirmed: true }) + .andWhere('need.type = :type', { type }) + // .where("need.purchase_date > :startDate", { startDate: new Date(2021, 2, 3) }) + // .andWhere("need.child_delivery_date < :endDate", { endDate: new Date(2023, 1, 3) }) + .andWhere('need.child_delivery_date IS NOT NULL') + // .orderBy("need.created", "ASC") + // .limit(10) + .getManyAndCount(); + } + + async getUsersAnalytic() { + const families = await this.flaskFamilyRepository + .createQueryBuilder('family') + .getCount(); + + const users = await this.flaskUserRepository + .createQueryBuilder('user') + .andWhere('user.isDeleted = :isDeleted', { isDeleted: false }) + .getCount(); + return { users, families }; + } + + async getNgoAnalytic() { + return await this.flaskNgoRepository + .createQueryBuilder('ngo') + .innerJoinAndMapMany( + 'ngo.children', + Child, + 'child', + 'child.id_ngo = ngo.id', + ) + .where('ngo.isActive = :isActive', { isActive: true }) + .select([ + 'ngo.id', + 'ngo.name', + 'child.id', + 'child.id_ngo', + 'child.sayname_translations', + ]) + .getMany(); + } + + async getChildrenAnalytic() { + const allChildren = await this.flaskChildRepository + .createQueryBuilder('child') + .select([ + 'child.id', + 'child.id_ngo', + 'child.sayname_translations', + 'child.isConfirmed', + ]) + .andWhere('child.id_ngo NOT IN (:...testNgoIds)', { + testNgoIds: [3, 14], + }) + .andWhere('child.isMigrated = :childIsMigrated', { + childIsMigrated: false, + }) + .getManyAndCount(); + + const dead = await this.flaskChildRepository + .createQueryBuilder('child') + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + .where('child.existence_status = :existence_status', { + existence_status: ChildExistence.DEAD, + }) + .andWhere('child.isConfirmed = :isConfirmed', { isConfirmed: true }) + .andWhere('ngo.isDeleted = :isDeleted', { isDeleted: false }) + .andWhere('ngo.isActive = :isActive', { isActive: true }) + .andWhere('child.isMigrated = :childIsMigrated', { + childIsMigrated: false, + }) + .andWhere('child.id_ngo NOT IN (:...testNgoIds)', { + testNgoIds: [3, 14], + }) + .select(['child.id', 'ngo']) + .getCount(); + + const alivePresent = await this.flaskChildRepository + .createQueryBuilder('child') + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + .where('child.existence_status = :existence_status', { + existence_status: ChildExistence.AlivePresent, + }) + .andWhere('child.isConfirmed = :isConfirmed', { isConfirmed: true }) + .andWhere('ngo.isDeleted = :isDeleted', { isDeleted: false }) + .andWhere('ngo.isActive = :isActive', { isActive: true }) + .andWhere('child.isMigrated = :childIsMigrated', { + childIsMigrated: false, + }) + .andWhere('child.id_ngo NOT IN (:...testNgoIds)', { + testNgoIds: [3, 14], + }) + .select(['child.id', 'ngo']) + .getCount(); + + const aliveGone = await this.flaskChildRepository + .createQueryBuilder('child') + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + .where('child.existence_status = :existence_status', { + existence_status: ChildExistence.AliveGone, + }) + .andWhere('child.isConfirmed = :isConfirmed', { isConfirmed: true }) + .andWhere('ngo.isDeleted = :isDeleted', { isDeleted: false }) + .andWhere('ngo.isActive = :isActive', { isActive: true }) + .andWhere('child.isMigrated = :childIsMigrated', { + childIsMigrated: false, + }) + .andWhere('child.id_ngo NOT IN (:...testNgoIds)', { + testNgoIds: [3, 14], + }) + .select(['child.id', 'ngo']) + .getCount(); + + const tempGone = await this.flaskChildRepository + .createQueryBuilder('child') + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + .where('child.existence_status = :existence_status', { + existence_status: ChildExistence.TempGone, + }) + .andWhere('child.isConfirmed = :isConfirmed', { isConfirmed: true }) + .andWhere('ngo.isDeleted = :isDeleted', { isDeleted: false }) + .andWhere('ngo.isActive = :isActive', { isActive: true }) + .andWhere('child.isMigrated = :childIsMigrated', { + childIsMigrated: false, + }) + .andWhere('child.id_ngo NOT IN (:...testNgoIds)', { + testNgoIds: [3, 14], + }) + .select(['child.id', 'ngo']) + .getCount(); + + const confirmed = await this.flaskChildRepository + .createQueryBuilder('child') + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + .andWhere('child.isConfirmed = :isConfirmed', { isConfirmed: true }) + .andWhere('ngo.isDeleted = :isDeleted', { isDeleted: false }) + .andWhere('ngo.isActive = :isActive', { isActive: true }) + .andWhere('child.isMigrated = :childIsMigrated', { + childIsMigrated: false, + }) + .andWhere('child.id_ngo NOT IN (:...testNgoIds)', { + testNgoIds: [3, 14], + }) + .select(['child.id', 'ngo']) + .getCount(); + + return { + noNeeds: config().dataCache.fetchChildrenNoNeeds(), + allChildren: allChildren[1], + dead, + alivePresent, + aliveGone, + tempGone, + confirmed, + }; + } + + async getChildNeedsAnalytic(childId: number) { + const child = await this.flaskChildRepository + .createQueryBuilder('child') + .select([ + 'child.id', + 'child.id_ngo', + 'child.sayname_translations', + 'child.isConfirmed', + ]) + .where('child.id = :childId', { childId: childId }) + .getOne(); + + const allCount = await this.flaskNeedRepository + .createQueryBuilder('need') + .select(['need.id', 'need.child_id', 'isDeleted']) + .where('need.child_id = :childId', { childId: childId }) + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .getCount(); + + const confirmedCount = await this.flaskNeedRepository + .createQueryBuilder('need') + .select(['need.id', 'need.child_id', 'isConfirmed', 'isDeleted']) + .where('need.child_id = :childId', { childId: childId }) + .andWhere('need.isConfirmed = :isConfirmed', { isConfirmed: true }) + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .getCount(); + + const unConfirmedCount = await this.flaskNeedRepository + .createQueryBuilder('need') + .select(['need.id', 'need.child_id', 'isConfirmed', 'isDeleted']) + .where('need.child_id = :childId', { childId: childId }) + .andWhere('need.isConfirmed = :isConfirmed', { isConfirmed: false }) + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .getCount(); + + const confirmedNotPaidCount = await this.flaskNeedRepository + .createQueryBuilder('need') + .select([ + 'need.id', + 'need.child_id', + 'need.status', + 'isConfirmed', + 'isDeleted', + ]) + .where('need.child_id = :childId', { childId: childId }) + .andWhere('need.isConfirmed = :isConfirmed', { isConfirmed: true }) + .andWhere('need.status = 0') + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .getCount(); + + const completePayCount = await this.flaskNeedRepository + .createQueryBuilder('need') + .select(['need.id', 'need.child_id', 'need.status', 'isDeleted']) + .where('need.child_id = :childId', { childId: childId }) + .andWhere('need.status = 1') + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .getCount(); + + const partialPayCount = await this.flaskNeedRepository + .createQueryBuilder('need') + .select(['need.id', 'need.child_id', 'need.status', 'isDeleted']) + .where('need.child_id = :childId', { childId: childId }) + .andWhere('need.status = 2') + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .getCount(); + + const purchasedCount = await this.flaskNeedRepository + .createQueryBuilder('need') + .select([ + 'need.id', + 'need.child_id', + 'need.status', + 'need.type', + 'isDeleted', + ]) + .where('need.child_id = :childId', { childId: childId }) + .andWhere('need.type = :type', { type: 1 }) + .andWhere('need.status = 3') + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .getCount(); + + const moneyToNgoCount = await this.flaskNeedRepository + .createQueryBuilder('need') + .select([ + 'need.id', + 'need.child_id', + 'need.status', + 'need.type', + 'isDeleted', + ]) + .where('need.child_id = :childId', { childId: childId }) + .andWhere('need.type = :type', { type: 0 }) + .andWhere('need.status = 3') + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .getCount(); + + const deliveredNgoCount = await this.flaskNeedRepository + .createQueryBuilder('need') + .select([ + 'need.id', + 'need.child_id', + 'need.status', + 'need.type', + 'isDeleted', + ]) + .where('need.child_id = :childId', { childId: childId }) + .andWhere('need.type = :type', { type: 1 }) + .andWhere('need.status = 4') + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .getCount(); + + const deliveredChildCount = await this.flaskNeedRepository + .createQueryBuilder('need') + .select([ + 'need.id', + 'need.child_id', + 'need.child_delivery_date', + 'isDeleted', + ]) + .where('need.child_id = :childId', { childId: childId }) + .andWhere('need.child_delivery_date IS NOT NULL') + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .getCount(); + + // const childWithNeeds = await this.flaskUserRepository + // .createQueryBuilder("user") + // .select([ + // "payment.id", + // "payment.need_id", + // "payment.child_id", + // ]) + // .where("payment.child_id = :childId", { childId: childId }) + // .getCount(); + + return { + child, + childNeedsStats: { + allCount, + confirmedCount, + unConfirmedCount, + confirmedNotPaidCount, + completePayCount, + partialPayCount, + purchasedCount, + moneyToNgoCount, + deliveredNgoCount, + deliveredChildCount, + }, + }; + } + + async getChildrenFamilyAnalytic() { + const childrenList = []; + const children = await this.flaskChildRepository + .createQueryBuilder('child') + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + .where('child.existence_status = :existence_status', { + existence_status: ChildExistence.AlivePresent, + }) + .andWhere('child.isConfirmed = :isConfirmed', { isConfirmed: true }) + .andWhere('ngo.isDeleted = :isDeleted', { isDeleted: false }) + .andWhere('ngo.isActive = :isActive', { isActive: true }) + .andWhere('child.isMigrated = :childIsMigrated', { + childIsMigrated: false, + }) + .andWhere('child.id_ngo NOT IN (:...testNgoIds)', { + testNgoIds: [3, 14], + }) + .getMany(); + + for await (const child of children) { + const paidNeeds = await this.flaskNeedRepository + .createQueryBuilder('need') + .select(['need.id']) + .where('need.child_id = :childId', { childId: child.id }) + .andWhere('need.isDeleted = :isDeleted', { isDeleted: false }) + .andWhere('need.status > 0') + .getMany() + .then((needs) => { + return needs.map((n) => n.id); + }); + + // const d = new Date(); + // d.setMonth(d.getMonth() - 3); // three months ago + + let familyId: number; + let familyCount = 0; + const activeUsersId = []; + const activeUsersIdInOneMonths = []; + const activeUsersIdInThreeMonths = []; + await this.flaskUserFamilyRepository + .createQueryBuilder('userFamily') + .leftJoinAndSelect(Family, 'family', 'family.id = userFamily.id_family') + .where('family.Id_child = :childId', { childId: child.id }) + .andWhere('userFamily.isDeleted = :isDeleted', { isDeleted: false }) + .getMany() + .then(async (members) => { + familyCount = members.length; + if (familyCount > 0) { + familyId = members[0].id_family; + for await (const user of members) { + await this.flaskPaymentRepository + .createQueryBuilder('payment') + .where('payment.id_user = :userId', { userId: user.id_user }) + .andWhere('payment.id IS NOT NULL') + .andWhere('payment.verified IS NOT NULL') + .andWhere('payment.order_id IS NOT NULL') + .andWhere('payment.id_need IS NOT NULL') + // .andWhere('payment.created > :startDate', { + // startDate: d.toLocaleDateString(), + // }) + // .andWhere('payment.created < :endDate', { endDate: new Date() }) + .getMany() + .then((userPayments) => { + userPayments.map((p) => { + if (p.verified && paidNeeds.includes(p.id_need)) { + activeUsersId.push({ id: p.id_user }); + if (daysDifference(p.created, new Date()) <= 30) { + activeUsersIdInOneMonths.push({ id: p.id_user }); + } + if (daysDifference(p.created, new Date()) <= 90) { + activeUsersIdInThreeMonths.push({ id: p.id_user }); + } + } + }); + }); + } + } + }); + + childrenList.push({ + child: child.id, + childSayName: child.sayname_translations.en, + family: { + familyId: familyId, + activeUsers: removeSpecialDuplicates(activeUsersId).length, + activeUsersInOneMonths: removeSpecialDuplicates( + activeUsersIdInOneMonths, + ).length, + activeUsersInThreeMonths: removeSpecialDuplicates( + activeUsersIdInThreeMonths, + ).length, + familyCount: familyCount, + }, + }); + } + return childrenList; + } + + async getChildrenEcosystemAnalytic() { + let listAll = []; + let listConfirmed = []; + let listUnConfirmed = []; + let listConfirmedNotPaid = []; + let listCompletePay = []; + let listPartialPay = []; + let listPurchased = []; + let listMoneyToNgo = []; + let listDeliveredNgo = []; + let listDeliveredChild = []; + const childrenList = []; + await this.flaskChildRepository + .createQueryBuilder('child') + .select(['child.id']) + .andWhere('child.existence_status = :existence_status', { + existence_status: ChildExistence.AlivePresent, + }) + .andWhere('child.isMigrated = :childIsMigrated', { + childIsMigrated: false, + }) + .andWhere('child.id_ngo NOT IN (:...testNgoIds)', { + testNgoIds: [3, 14], + }) + .andWhere('child.isConfirmed = :isConfirmed', { isConfirmed: true }) + .getMany() + .then(async (children) => { + for await (const c of children) { + // 1- count child needs in every status + const { + child, + childNeedsStats: { + allCount, + confirmedCount, + unConfirmedCount, + confirmedNotPaidCount, + completePayCount, + partialPayCount, + purchasedCount, + moneyToNgoCount, + deliveredNgoCount, + deliveredChildCount, + }, + } = await this.getChildNeedsAnalytic(c.id); + + childrenList.push({ + child, + childNeedsStats: { + allCount, + confirmedCount, + unConfirmedCount, + confirmedNotPaidCount, + completePayCount, + partialPayCount, + purchasedCount, + moneyToNgoCount, + deliveredNgoCount, + deliveredChildCount, + }, + }); + + // 2- add all children stats to one array + listAll = [...listAll, allCount]; + listConfirmed = [...listConfirmed, confirmedCount]; + listUnConfirmed = [...listUnConfirmed, unConfirmedCount]; + listConfirmedNotPaid = [ + ...listConfirmedNotPaid, + confirmedNotPaidCount, + ]; + listCompletePay = [...listCompletePay, completePayCount]; + listPartialPay = [...listPartialPay, partialPayCount]; + listPurchased = [...listPurchased, purchasedCount]; + listMoneyToNgo = [...listMoneyToNgo, moneyToNgoCount]; + listDeliveredNgo = [...listDeliveredNgo, deliveredNgoCount]; + listDeliveredChild = [...listDeliveredChild, deliveredChildCount]; + } + }); + + const totalFamiliesCount = await this.flaskFamilyRepository + .createQueryBuilder('family') + .leftJoinAndSelect( + UserFamily, + 'userFamily', + 'userFamily.id_family = family.id', + ) + .andWhere('family.isDeleted = :isDeleted', { isDeleted: false }) + .getCount(); + + const totalFamilyMembersCount = await this.flaskUserFamilyRepository + .createQueryBuilder('userFamily') + .leftJoinAndSelect(Family, 'family', 'family.id = userFamily.id_family') + .andWhere('userFamily.isDeleted = :isDeleted', { isDeleted: false }) + .getCount(); + + return { + meanNeedsPerChild: round(mean(listAll)), + meanConfirmedPerChild: round(mean(listConfirmed)), + meanUnConfirmedPerChild: round(mean(listUnConfirmed)), + meanConfirmedNotPaidPerChild: round(mean(listConfirmedNotPaid)), + meanCompletePayPerChild: round(mean(listCompletePay)), + meanPartialPayPerChild: round(mean(listPartialPay)), + meanPurchasedPerChild: round(mean(listPurchased)), + meanMoneyToNgoPerChild: round(mean(listMoneyToNgo)), + meanDeliveredNgoPerChild: round(mean(listDeliveredNgo)), + meanDeliveredChildPerChild: round(mean(listDeliveredChild)), + totalFamiliesCount, + totalFamilyMembersCount, + meanFamilyMembers: Math.round( + totalFamilyMembersCount / totalFamiliesCount, + ), + childrenList, + }; + } + + async getUserContribution( + swIds: number[], + role: SAYPlatformRoles, + flaskUserId: number, + ) { + const today = new Date(); + const monthsAgo = today.setMonth(today.getMonth() - 4); + + const needs = await this.flaskNeedRepository + .createQueryBuilder('need') + .leftJoinAndMapOne( + 'need.child', + Child, + 'child', + 'child.id = need.child_id', + ) + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + .where('child.id_ngo = :ngoIds', { ngoIds: 22 }) + .where('child.isConfirmed = :childConfirmed', { childConfirmed: true }) + .where('child.id_ngo NOT IN (:...ngoIds)', { ngoIds: [3, 14] }) + .where('need.created > :startDate', { startDate: new Date(monthsAgo) }) + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .andWhere('need.created_by_id IN (:...swIds)', { + swIds: + role === SAYPlatformRoles.SOCIAL_WORKER ? [flaskUserId] : [...swIds], + }) + .select([ + // 'child.id_ngo', + // 'ngo.id', + // 'need.id', + // 'need.child_id', + // 'need.created_by_id', + // 'need.bank_track_id', + // 'need.doing_duration', + 'need.created', + // 'need.updated', + 'need.confirmDate', + // 'need.confirmUser', + // 'need.doneAt', + // 'need.ngo_delivery_date', + // 'need.child_delivery_date', + // 'need.purchase_date', + // 'need.expected_delivery_date', + // 'need.unavailable_from', + // 'need.deleted_at' + ]) + .orderBy('need.created', 'DESC') + .getManyAndCount(); + + const time7 = new Date().getTime(); + const { summary, inMonth } = getNeedsTimeLine(needs[0]); + const time8 = new Date().getTime(); + timeDifferenceWithComment(time7, time8, 'TimeLine User Analytic In'); + + return { summary, inMonth, count: needs[1], swIds }; + } +} diff --git a/src/features/analytic/dto/create-analytic.dto.ts b/src/features/analytic/dto/create-analytic.dto.ts new file mode 100644 index 0000000000..74e5c5e2cf --- /dev/null +++ b/src/features/analytic/dto/create-analytic.dto.ts @@ -0,0 +1 @@ +export class CreateAnalyticDto {} diff --git a/src/features/analytic/dto/update-analytic.dto.ts b/src/features/analytic/dto/update-analytic.dto.ts new file mode 100644 index 0000000000..39ca5a358f --- /dev/null +++ b/src/features/analytic/dto/update-analytic.dto.ts @@ -0,0 +1,4 @@ +import { PartialType } from '@nestjs/swagger'; +import { CreateAnalyticDto } from './create-analytic.dto'; + +export class UpdateAnalyticDto extends PartialType(CreateAnalyticDto) {} diff --git a/src/features/analytic/middlewares/analytic.middleware.ts b/src/features/analytic/middlewares/analytic.middleware.ts new file mode 100644 index 0000000000..4af894d523 --- /dev/null +++ b/src/features/analytic/middlewares/analytic.middleware.ts @@ -0,0 +1,36 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class AnalyticMiddleware implements NestMiddleware { + private readonly logger = new Logger(AnalyticMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/campaign/campaign.controller.ts b/src/features/campaign/campaign.controller.ts new file mode 100644 index 0000000000..6b25bed669 --- /dev/null +++ b/src/features/campaign/campaign.controller.ts @@ -0,0 +1,113 @@ +import { + Controller, + Get, + Req, + ForbiddenException, + Post, + Body, + Res, + Param, +} from '@nestjs/common'; +import { ApiHeader, ApiSecurity, ApiTags } from '@nestjs/swagger'; +import { FlaskUserTypesEnum } from 'src/types/interfaces/interface'; +import { isAuthenticated } from 'src/utils/auth'; +import { CampaignService } from './campaign.service'; +import { ShortenURLDto } from 'src/types/dtos/url.dto'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { CreateSendNewsLetterDto } from 'src/types/dtos/CreateSendNewsLetter.dto'; +import { ValidateNewsLetterPipe } from './pipes/validate-campaign.pipe'; + +@ApiTags('Campaign') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) +@Controller('campaign') +export class CampaignController { + constructor(private readonly campaignService: CampaignService) {} + + @Get('all/sent') + getAvailableContributions(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + + const X_LIMIT = parseInt(req.headers['x-limit']); + const X_TAKE = parseInt(req.headers['x-take']); + const limit = X_LIMIT > 100 ? 100 : X_LIMIT; + const page = X_TAKE ? X_TAKE + 1 : 1; + + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + !( + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not authorized'); + } + + return this.campaignService.getCampaigns({ + page: page, + limit: limit, + path: '/', + }); + } + + @Get(':code') + async redirect(@Res() res, @Param('code') code: string) { + const url = await this.campaignService.redirect(code); + if (!url) { + throw new ServerError('Could not find the url', 500); + } + return res.redirect(url.longUrl); + } + + @Post('shorten') + shortenUrl(@Body() longUrl: ShortenURLDto) { + return this.campaignService.shortenUrl(longUrl); + } + + @Get('send/force') + async SendCampaign(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + !( + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not authorized'); + } + // ############## BE CAREFUL ################# + if (process.env.NODE_ENV === 'production') { + await this.campaignService.sendUserMonthlyCampaigns(); + } + } + + @Post('send/newsLetter') + async SendNewsLetter( + @Req() req: Request, + @Body(ValidateNewsLetterPipe) body: CreateSendNewsLetterDto, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + !( + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not authorized'); + } + // ############## BE CAREFUL ################# + if (process.env.NODE_ENV === 'production') { + await this.campaignService.sendNewsLetter(body); + } + } + +} diff --git a/src/features/campaign/campaign.module.ts b/src/features/campaign/campaign.module.ts new file mode 100644 index 0000000000..7eb64e5867 --- /dev/null +++ b/src/features/campaign/campaign.module.ts @@ -0,0 +1,155 @@ +import { MailerModule } from '@nestjs-modules/mailer'; +import { HandlebarsAdapter } from '@nestjs-modules/mailer/dist/adapters/handlebars.adapter'; +import { Global, MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; +import { CampaignService } from './campaign.service'; +import { join } from 'path'; +import { ConfigService } from '@nestjs/config'; +import { UserService } from '../user/user.service'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { NeedService } from '../need/need.service'; +import { ChildrenService } from '../children/children.service'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { NeedEntity } from 'src/entities/need.entity'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { ChildrenEntity } from 'src/entities/children.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { WalletService } from '../wallet/wallet.service'; +import { SignatureEntity } from 'src/entities/signature.entity'; +import { FamilyService } from '../family/family.service'; +import { MineService } from '../mine/mine.service'; +import { PaymentEntity } from 'src/entities/payment.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { CampaignEntity } from 'src/entities/campaign.entity'; +import { CampaignController } from './campaign.controller'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; +import { UrlEntity } from 'src/entities/url.entity'; +import { CampaignMiddleware } from './middlewares/campaign.middleware'; +import { SyncService } from '../sync/sync.service'; +import { NgoService } from '../ngo/ngo.service'; +import { ReceiptService } from '../receipt/receipt.service'; +import { PaymentService } from '../payment/payment.service'; +import { StatusService } from '../status/status.service'; +import { ProviderService } from '../provider/provider.service'; +import { LocationService } from '../location/location.service'; +import { NgoArrivalEntity, NgoEntity } from 'src/entities/ngo.entity'; +import { NGO } from 'src/entities/flaskEntities/ngo.entity'; +import { ReceiptEntity } from 'src/entities/receipt.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { StatusEntity } from 'src/entities/status.entity'; +import { ProviderJoinNeedEntity } from 'src/entities/provider.Join.need..entity'; +import { ProviderEntity } from 'src/entities/provider.entity'; +import { LocationEntity } from 'src/entities/location.entity'; +import { Cities } from 'src/entities/flaskEntities/cities.entity'; +import { Countries } from 'src/entities/flaskEntities/countries.entity'; +import { TicketService } from '../ticket/ticket.service'; +import { TicketViewEntity } from 'src/entities/ticketView.entity'; +import { TicketEntity } from 'src/entities/ticket.entity'; +import { TicketContentEntity } from 'src/entities/ticketContent.entity'; + +@Global() // 👈 global module +@Module({ + imports: [ + MailerModule.forRootAsync({ + // imports: [ConfigModule], // import module if not enabled globally + useFactory: async (config: ConfigService) => ({ + // transport: config.get("MAIL_TRANSPORT"), + // or + transport: { + host: config.get('MAIL_HOST'), + secure: true, + auth: { + user: config.get('MAIL_FROM'), + pass: config.get('MAIL_PASSWORD'), + }, + }, + defaults: { + from: `"No Reply" <${config.get('MAIL_FROM')}>`, + }, + template: { + dir: join(__dirname, 'templates'), + adapter: new HandlebarsAdapter(), + options: { + strict: true, + }, + }, + }), + inject: [ConfigService], + }), + TypeOrmModule.forFeature( + [ + SocialWorker, + User, + Need, + Child, + Family, + UserFamily, + Receipt, + NeedReceipt, + NGO, + Payment, + Cities, + Countries, + ], + 'flaskPostgres', + ), + TypeOrmModule.forFeature([ + NeedEntity, + VariableEntity, + ChildrenEntity, + ContributorEntity, + AllUserEntity, + EthereumAccountEntity, + ChildrenPreRegisterEntity, + SignatureEntity, + PaymentEntity, + AllUserEntity, + CampaignEntity, + UrlEntity, + NgoEntity, + NgoArrivalEntity, + ReceiptEntity, + PaymentEntity, + StatusEntity, + ProviderJoinNeedEntity, + ProviderEntity, + LocationEntity, + TicketViewEntity, + TicketEntity, + TicketContentEntity, + ]), + ], + providers: [ + CampaignService, + UserService, + NeedService, + ChildrenService, + WalletService, + FamilyService, + MineService, + SyncService, + NgoService, + ReceiptService, + PaymentService, + StatusService, + ProviderService, + LocationService, + TicketService, + ], + controllers: [CampaignController], + exports: [CampaignService], +}) +export class CampaignModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer + .apply(CampaignMiddleware) + .exclude('campaign/:code') + .forRoutes('campaign'); + } +} diff --git a/src/features/campaign/campaign.service.ts b/src/features/campaign/campaign.service.ts new file mode 100644 index 0000000000..47bf24a6b1 --- /dev/null +++ b/src/features/campaign/campaign.service.ts @@ -0,0 +1,1111 @@ +import { + BadRequestException, + ForbiddenException, + Injectable, + Logger, + NotFoundException, + UnprocessableEntityException, +} from '@nestjs/common'; +import { UserService } from '../user/user.service'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { ChildrenService } from '../children/children.service'; +import { NeedService } from '../need/need.service'; +import { + isUnpayable, + fetchCampaignCode, + persianMonthStringFarsi, + prepareUrl, + removeDuplicates, + shuffleArray, + sleep, + convertFlaskToSayPanelRoles, + daysDifference, +} from 'src/utils/helpers'; +import { + AnnouncementEnum, + CampaignNameEnum, + CampaignTypeEnum, + ChildExistence, + NeedTypeEnum, + PanelContributors, + ProductStatusEnum, + ServiceStatusEnum, +} from 'src/types/interfaces/interface'; +import { FamilyService } from '../family/family.service'; +import { CampaignEntity } from 'src/entities/campaign.entity'; +import { InjectRepository } from '@nestjs/typeorm'; +import { Repository } from 'typeorm'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { MailerService } from '@nestjs-modules/mailer'; +import config from 'src/config'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { isURL } from 'class-validator'; +import { UrlEntity } from 'src/entities/url.entity'; +import { nanoid } from 'nanoid'; +import { ShortenURLDto } from 'src/types/dtos/url.dto'; +import MelipayamakApi from 'melipayamak'; +import { + PaginateQuery, + Paginated, + paginate as nestPaginate, +} from 'nestjs-paginate'; +import { CreateSendNewsLetterDto } from 'src/types/dtos/CreateSendNewsLetter.dto'; +import { SyncService } from '../sync/sync.service'; +import { TicketService } from '../ticket/ticket.service'; + +@Injectable() +export class CampaignService { + constructor( + @InjectRepository(CampaignEntity) + private campaignRepository: Repository, + @InjectRepository(UrlEntity) + private urlRepository: Repository, + private needService: NeedService, + private userService: UserService, + private familyService: FamilyService, + private mailerService: MailerService, + private childrenService: ChildrenService, + private syncService: SyncService, + private ticketService: TicketService, + ) {} + private readonly logger = new Logger(CampaignService.name); + smsApi = new MelipayamakApi(process.env.SMS_USER, process.env.SMS_PASSWORD); + smsRest = this.smsApi.sms(); + + async handleEmailCampaign( + campaignEmailCode: string, + title: string, + emailReceivers: any[], + ) { + const emailCampaign = await this.getCampaignByCampaignCode( + campaignEmailCode, + CampaignTypeEnum.EMAIL, + ); + + if (!emailCampaign && emailReceivers && emailReceivers[0]) { + await this.createCampaign( + campaignEmailCode, + CampaignNameEnum.MONTHLY_CAMPAIGNS, + CampaignTypeEnum.EMAIL, + title, + emailReceivers, + ); + this.logger.log(`EMAIL: Campaign Created - ${campaignEmailCode}`); + } + + if (emailCampaign && emailReceivers && emailReceivers[0]) { + await this.updateCampaignUsers( + emailCampaign, + emailCampaign.receivers, + emailReceivers, + ); + this.logger.log(`EMAIL: Campaign Updated - ${campaignEmailCode}`); + } + } + + async handleSmsCampaign( + campaignSmsCode: string, + title: string, + smsReceivers: any[], + ) { + const smsCampaign = await this.getCampaignByCampaignCode( + campaignSmsCode, + CampaignTypeEnum.SMS, + ); + + if (!smsCampaign && smsReceivers && smsReceivers[0]) { + await this.createCampaign( + campaignSmsCode, + CampaignNameEnum.MONTHLY_CAMPAIGNS, + CampaignTypeEnum.SMS, + title, + smsReceivers, + ); + this.logger.log(`SMS: Campaign Created - ${campaignSmsCode}`); + } + + if (smsCampaign && smsReceivers && smsReceivers[0]) { + await this.updateCampaignUsers( + smsCampaign, + smsCampaign.receivers, + smsReceivers, + ); + this.logger.log(`SMS: Campaign Updated - ${campaignSmsCode}`); + } + } + + async childrenWithNoNeed() { + this.logger.log(`Updating children with no needs.`); + const children = await this.childrenService.getFlaskActiveChildren(); + const list = []; + for await (const child of children) { + const childUnpaidNeeds = await this.needService.getFlaskChildUnpaidNeeds( + child.id, + ); + const childUnconfirmedNeeds = + await this.needService.getFlaskChildUnconfirmedNeeds(child.id); + const allUnpaidNeeds = childUnpaidNeeds.concat(childUnconfirmedNeeds); + + if (!allUnpaidNeeds || !allUnpaidNeeds[0]) { + list.push({ + swId: child.id_social_worker, + child, + }); + } + } + // save in cache for admin dashboard + config().dataCache.updateChildrenNoNeeds(list.length); + this.logger.log(`Updated children with no need.`); + return list; + } + + async getCampaigns( + options: PaginateQuery, + ): Promise> { + const queryBuilder = this.campaignRepository + .createQueryBuilder('campaign') + .leftJoin('campaign.receivers', 'receiver') + .select(['campaign', 'receiver.id']); + + return await nestPaginate(options, queryBuilder, { + sortableColumns: ['id'], + defaultSortBy: [['createdAt', 'DESC']], + nullSort: 'last', + }); + } + + getCampaignById(id: string): Promise { + const need = this.campaignRepository.findOne({ + where: { + id, + }, + }); + return need; + } + + getCampaignByCampaignCode( + campaignCode: string, + type: CampaignTypeEnum, + ): Promise { + const need = this.campaignRepository.findOne({ + where: { + campaignCode, + type, + }, + }); + return need; + } + + createCampaign( + campaignCode: string, + campaignName: CampaignNameEnum, + type: CampaignTypeEnum, + title: string, + users: AllUserEntity[], + ) { + const newCampaign = this.campaignRepository.create({ + campaignCode, + campaignName: campaignName, + title, + type, + }); + + newCampaign.receivers = users; + return this.campaignRepository.save(newCampaign); + } + + async updateCampaignUsers( + campaign: CampaignEntity, + currentReceivers: AllUserEntity[], + users: AllUserEntity[], + ): Promise { + const newReceivers = currentReceivers + ? [...currentReceivers, ...users] + : [...users]; + campaign.receivers = newReceivers; + return this.campaignRepository.save(campaign); + } + + async sendSwChildConfirmation( + swId: number, + preChild: ChildrenPreRegisterEntity, + ) { + const socialWorker = await this.userService.getContributorByFlaskId( + swId, + PanelContributors.SOCIAL_WORKER, + ); + const email = (await this.userService.getFlaskSw(swId)).email; + const title = `${preChild.sayName.fa} تأیید شد`; + + this.logger.warn( + `Emailing: Social worker ${socialWorker.flaskUserId} for new child Confirm!`, + ); + await this.mailerService.sendMail({ + from: '"NGOs" ', // override default from + to: email, + bcc: process.env.SAY_ADMIN_EMAIL, + subject: title, + template: './swConfirmedChild', // `.hbs` extension is appended automatically + context: { + avatarAwake: preChild.awakeUrl, + sayName: preChild.sayName.fa, + firstName: preChild.firstName.fa, + lastName: preChild.lastName.fa, + userName: socialWorker.firstName + ? socialWorker.firstName + : socialWorker.userName, + }, + }); + } + + async sendSwAnnounceReminder() { + function findSwById( + objects: { swId: number; eligible: number; total: number }[], + id: number, + ): { swId: number; eligible: number; total: number } { + return objects.find((object) => object.swId === id); + } + try { + const list: [{ swId: number; eligible: number; total: number }] = [ + { swId: null, eligible: null, total: null }, + ]; + const needs = await this.needService.getArrivalUpdateCandidates(); + console.log(`Number of needs: ${needs[1]}`); + for await (const need of needs[0]) { + if ( + (need.type === NeedTypeEnum.PRODUCT && + need.status === ProductStatusEnum.PURCHASED_PRODUCT) || + (need.type === NeedTypeEnum.SERVICE && + need.status === ServiceStatusEnum.MONEY_TO_NGO) + ) { + const ticket = await this.ticketService.getTicketByFlaskNeedId( + need.id, + ); + + if ( + // (daysDifference(need.purchase_date, new Date()) > 1 && !ticket) || + !ticket || + !ticket.ticketHistories || + (ticket.ticketHistories && + !ticket.ticketHistories.find( + (h) => h.announcement == AnnouncementEnum.ARRIVED_AT_NGO, + )) + ) { + console.log(`Adding need: ${need.id} Sw Id: ${need.created_by_id}`); + + let foundObject: { swId: number; eligible: number; total: any }; + if (!list || list.length < 1) { + foundObject = null; + } else { + foundObject = findSwById(list, need.created_by_id); + } + if (foundObject) { + foundObject.total++; + let isEligible: boolean; + if (need.type === NeedTypeEnum.PRODUCT) { + isEligible = + daysDifference(need.expected_delivery_date, new Date()) > 1; + } + if (need.type === NeedTypeEnum.SERVICE) { + isEligible = + daysDifference(need.expected_delivery_date, new Date()) > 1; + } + isEligible && foundObject.eligible++; + } else { + let isEligible: boolean; + if (need.type === NeedTypeEnum.PRODUCT) { + isEligible = + daysDifference(need.expected_delivery_date, new Date()) > 1; + } + if (need.type === NeedTypeEnum.SERVICE) { + isEligible = + daysDifference(need.expected_delivery_date, new Date()) > 1; + } + + list.push({ + swId: need.created_by_id, + eligible: isEligible ? 1 : 0, + total: 1, + }); + } + } + } + } + let once = true; + list.forEach(async (object) => { + if (object.swId) { + const sw = await this.userService.getFlaskSocialWorker(object.swId); + const to = sw.phone_number; + const from = process.env.SMS_FROM; + + const text = `سلام ${sw.firstName}،\nدر حال حاضر ${object.eligible} از ${object.total} نیاز ثبت شده توسط شما در انتظار <<اعلام رسیدن>> هستند.\n لطفا وارد پنل شوید و از ستون سوم صفحه من در پنل، نیاز را پیدا کنید و از طریق منوی هر یک از نیازها گزینه اعلام رسیدن را انتخاب کنید.\n در صورتی که کالا یا مبلغ به شما تحویل داده نشده است، لطفا تیکتی جدید به نیاز اضافه کنید. \n با احترام، \n SAY \nپنل: https://panel.saydao.org \n لغو۱۱`; + + await this.smsRest.send(to, from, text); + console.log(to); + console.log(from); + console.log(text); + if (once) { + once = false; + await this.smsRest.send( + process.env.SAY_ADMIN_SMS, + from, + 'سلام، یادآوری به مددکاران انجام شد.', + ); + sleep(2000); + } + console.log('------------------------\n'); + } + }); + console.log(list); + } catch (e) { + console.log(e); + } + } + + async sendSwChildNoNeedReminder() { + const list = await this.childrenWithNoNeed(); + const swIds = removeDuplicates(list.map((e) => e.swId)); + try { + for await (const id of swIds) { + const selected = list.filter((e) => e.swId === id); + const socialWorker = await this.userService.getFlaskSw(Number(id)); + const swChildren = selected.map((s) => s.child); + this.logger.warn( + `Emailing: Social worker ${socialWorker.id} of children with no need!`, + ); + await this.mailerService.sendMail({ + from: '"NGOs" ', // override default from + to: socialWorker.email, + bcc: process.env.SAY_ADMIN_EMAIL, + subject: `${swChildren.length} کودک بدون نیاز ثبت شده`, + template: './swRemindNoNeeds', // `.hbs` extension is appended automatically + context: { + children: swChildren, + userName: socialWorker.firstName + ? socialWorker.firstName + : socialWorker.userName, + }, + }); + } + } catch (e) { + console.log(e); + } + } + + async sendUserMonthlyCampaigns() { + try { + // campaign codes + const campaignEmailCode = fetchCampaignCode( + CampaignNameEnum.MONTHLY_CAMPAIGNS, + CampaignTypeEnum.EMAIL, + ); + const campaignSmsCode = fetchCampaignCode( + CampaignNameEnum.MONTHLY_CAMPAIGNS, + CampaignTypeEnum.SMS, + ); + + const emailCampaign = await this.getCampaignByCampaignCode( + campaignEmailCode, + CampaignTypeEnum.EMAIL, + ); + const smsCampaign = await this.getCampaignByCampaignCode( + campaignSmsCode, + CampaignTypeEnum.SMS, + ); + + // Notify admin if running out of sms credit + const credit = await this.smsRest.getCredit(); + if (Number(credit.Value) < 150) { + const to = process.env.SAY_ADMIN_SMS; + const from = process.env.SMS_FROM; + const text = `سلام،\nتعداد پیامک شما رو به پایان است. \n با احترام \n SAY \n لغو۱۱`; + await this.smsRest.send(to, from, text); + throw new ForbiddenException('We need to charge the sms provider'); + } + + // 0 -setup + const persianStringMonth = persianMonthStringFarsi(new Date()); + if (!persianStringMonth) { + throw new ServerError('We need the month string'); + } + const title = `نیازهای ${persianStringMonth} ماه کودکان شما`; + + const flaskUsers = await this.userService.getFlaskUsers(); + const shuffledUsers = shuffleArray(flaskUsers); + + let alreadyReceivedEmailCount = 0; + let alreadyReceivedSmsCount = 0; + let skippedUsersNoChildren = 0; + let skippedUsersNoUnpaid = 0; + let turnedOffCount = 0; + let emailReceiversTotal = 0; + let smsReceiversTotal = 0; + + // const testUsers = [ + // await this.userService.getFlaskUser(12687), + // await this.userService.getFlaskUser(115), + // ]; + // shuffledUsers = testUsers; + // if (shuffledUsers.length > 2) { + // return; + // } + + // 1- loop shuffled users + for await (const flaskUser of shuffledUsers) { + const eligibleChildren = []; + let nestUser = await this.userService.getFamilyByFlaskId(flaskUser.id); + if (!nestUser) { + nestUser = await this.userService.createFamily(flaskUser.id); + } + // 2- eligible to receive? + if (!nestUser.monthlyCampaign) { + turnedOffCount++; + continue; + } + if (emailCampaign) { + const alreadyReceivedEmail = emailCampaign.receivers.find( + (r) => r.flaskUserId === flaskUser.id, + ); + if (alreadyReceivedEmail) { + this.logger.warn(`Already Received Email: ${nestUser.flaskUserId}`); + alreadyReceivedEmailCount++; + continue; + } + } + + if (smsCampaign) { + const alreadyReceivedSms = smsCampaign.receivers.find( + (r) => r.flaskUserId === flaskUser.id, + ); + if (alreadyReceivedSms) { + this.logger.warn(`Already Received Sms: ${nestUser.flaskUserId}`); + alreadyReceivedSmsCount++; + continue; + } + } + + // 3- get user children & shuffle + const userChildren = ( + await this.childrenService.getMyChildren(flaskUser.id) + ).filter((c) => c.existence_status === ChildExistence.AlivePresent); + + // 4- send campaign users with no children + if (!userChildren || !userChildren[0]) { + if (flaskUser.is_email_verified && flaskUser.emailAddress) { + try { + this.logger.warn( + `Sending expand family Email to: ${flaskUser.emailAddress}`, + ); + await this.mailerService.sendMail({ + to: flaskUser.emailAddress, + subject: `گسترش خانواده مجازی`, + template: './expandFamilyNoChild', // `.hbs` extension is appended automatically + context: { + userName: flaskUser.firstName + ? flaskUser.firstName + : flaskUser.userName, + }, + }); + await this.handleEmailCampaign(campaignEmailCode, title, [ + nestUser, + ]); + } catch (e) { + console.log(e); + continue; + } + } + let smsResult: { + Value: string; + RetStatus: number; + StrRetStatus: string; + }; + if (flaskUser.is_phonenumber_verified) { + const to = flaskUser.phone_number; + const from = process.env.SMS_FROM; + const shortNeedUrl = await this.shortenUrl({ + longUrl: `https://dapp.saydao.org/main/search?utm_source=monthly_campaign&utm_medium=${CampaignTypeEnum.SMS}&utm_campaign=${CampaignNameEnum.MONTHLY_CAMPAIGNS}&utm_id=${campaignSmsCode}`, + }); + this.logger.warn(`Sending expand family SMS to: ${to}`); + + const text = `سلام ${ + flaskUser.firstName ? flaskUser.firstName : flaskUser.userName + }، شما در حال حاضر سرپرستی هیچ کودکی را ندارید، برای گسترش خانواده مجازی‌تان: ${shortNeedUrl} \n لغو۱۱`; + try { + await sleep(1000); + console.log('Woke Up...'); + + smsResult = await this.smsRest.send(to, from, text); + } catch (e) { + this.logger.error( + `Could not send SMS to: ${flaskUser.phone_number} for user: ${flaskUser.id} `, + ); + console.log(e); + } + } + if (smsResult && Number(smsResult.RetStatus) === 1) { + await this.handleSmsCampaign(campaignSmsCode, title, [nestUser]); + skippedUsersNoChildren++; + } else { + this.logger.warn( + `Could not send SMS to: ${flaskUser.phone_number} for user: ${flaskUser.id} `, + ); + } + + continue; + } + + let counter = 1; + // 5- loop shuffled children + for await (const child of shuffleArray(userChildren)) { + if (counter <= 3) { + const childUnpaidNeeds = ( + await this.needService.getFlaskChildUnpaidNeeds(child.id) + ).filter((n) => !isUnpayable(n)); + if (!childUnpaidNeeds || !childUnpaidNeeds[0]) { + // we separately email social workers + continue; + } + counter++; + + // 6- shuffle children needs and create an object - prioritize partial paid needs + const TAKE = 2; + const shuffledNeeds = shuffleArray(childUnpaidNeeds); + const organizedNeeds = shuffledNeeds + .sort((a, b) => b.status - a.status) + .slice(0, TAKE); + + const theChild = { + id: child.id, + sayName: child.sayname_translations.fa, + avatar: prepareUrl(child.awakeAvatarUrl), + unPaidNeeds: organizedNeeds.map((n) => { + return { + id: n.id, + name: n.name_translations.fa, + price: n._cost.toLocaleString(), + image: + n.type === NeedTypeEnum.PRODUCT && n.img + ? n.img + : prepareUrl(n.imageUrl), + }; + }), + }; + eligibleChildren.push(theChild); + } + } + if (!eligibleChildren || !eligibleChildren[0]) { + skippedUsersNoUnpaid++; + continue; + } + + // 7 - Send Campaign + if (flaskUser.is_email_verified && flaskUser.emailAddress) { + const googleCampaignBuilder = String( + `?utm_source=monthly_campaign&utm_medium=${CampaignTypeEnum.EMAIL}&utm_campaign=${CampaignNameEnum.MONTHLY_CAMPAIGNS}&utm_id=${campaignEmailCode}`, + ); + + const readyToSignNeeds = ( + await this.familyService.getFamilyReadyToSignNeeds(flaskUser.id) + ).filter((n) => n.midjourneyImage); + try { + this.logger.warn( + `Sending campaign Email to: ${flaskUser.emailAddress}`, + ); + + await this.mailerService.sendMail({ + to: flaskUser.emailAddress, + subject: `نیازهای ${persianStringMonth} ماه کودکان شما`, + template: './monthlyCampaign', // `.hbs` extension is appended automatically + context: { + myChildren: eligibleChildren, + readyToSignNeeds, + googleCampaignBuilder, + }, + }); + await this.handleEmailCampaign(campaignEmailCode, title, [ + nestUser, + ]); + this.logger.log(`Email Sent to User: ${nestUser.flaskUserId}`); + emailReceiversTotal++; + } catch (e) { + console.log(e); + continue; + } + } else if ( + flaskUser.is_phonenumber_verified && + flaskUser.phone_number + ) { + const to = flaskUser.phone_number; + const from = process.env.SMS_FROM; + const shortNeedUrl = await this.shortenUrl({ + longUrl: `https://dapp.saydao.org/child/${eligibleChildren[0].id}/needs/${eligibleChildren[0].unPaidNeeds[0].id}?utm_source=monthly_campaign&utm_medium=${CampaignTypeEnum.SMS}&utm_campaign=${CampaignNameEnum.MONTHLY_CAMPAIGNS}&utm_id=${campaignSmsCode}`, + }); + this.logger.warn(`Sending campaign SMS to: ${to}`); + + const text = `سلام ${ + flaskUser.firstName ? flaskUser.firstName : flaskUser.userName + }،\n از آخرین نیازهای کودک شما، ${ + eligibleChildren[0].sayName + }: ${shortNeedUrl} لغو۱۱`; + + let smsResult: { + Value: string; + RetStatus: number; + StrRetStatus: string; + }; + + try { + await sleep(1000); + console.log('Woke Up...'); + smsResult = await this.smsRest.send(to, from, text); + } catch (e) { + this.logger.error( + `Could not send SMS to: ${flaskUser.phone_number} for user: ${flaskUser.id} `, + ); + console.log(e); + } + if (smsResult && Number(smsResult.RetStatus) === 1) { + await this.handleSmsCampaign(campaignSmsCode, title, [nestUser]); + this.logger.log(`SMS Sent to User: ${nestUser.flaskUserId}`); + smsReceiversTotal++; + } else { + this.logger.error( + `Could not send SMS to: ${flaskUser.phone_number} for user: ${flaskUser.id} `, + ); + } + } else { + this.logger.error( + `This user has not email or phonNumber:${flaskUser.id}`, + ); + } + } + + this.logger.warn( + `Did Not reach: ${skippedUsersNoUnpaid} users did not have unpaidNeeds`, + ); + this.logger.warn( + `Did Not reach: ${skippedUsersNoChildren} users did not have an active child`, + ); + this.logger.warn( + `Did Not reach: ${alreadyReceivedEmailCount} users have already received Email`, + ); + this.logger.warn( + `Did Not reach: ${alreadyReceivedSmsCount} users have already received Sms`, + ); + this.logger.warn( + `Did Not reach: ${turnedOffCount} users have turned off monthly campaign`, + ); + this.logger.log( + `All done for this month. - ${title} - SMS:${smsReceiversTotal} - Email:${emailReceiversTotal} - Out of ${flaskUsers.length}`, + ); + } catch (e) { + console.log(e); + + throw new ServerError(e.message, e.status); + } + } + + async shortenUrl(url: ShortenURLDto) { + const { longUrl } = url; + //checks if longUrl is a valid URL + if (!isURL(longUrl)) { + throw new BadRequestException('String Must be a Valid URL'); + } + const urlCode = nanoid(10); + const baseURL = 'https://nest.saydao.org/api/dao/campaign'; + try { + // check if the URL has already been shortened + let url = await this.urlRepository.findOneBy({ longUrl }); + // return it if it exists + if (url) return url.shortUrl; + + // if it doesn't exist, shorten it + const shortUrl = `${baseURL}/${urlCode}`; + + //add the new record to the database + url = this.urlRepository.create({ + urlCode, + longUrl, + shortUrl, + }); + + this.urlRepository.save(url); + return url.shortUrl; + } catch (e) { + throw new UnprocessableEntityException('Server Error'); + } + } + + async redirect(urlCode: string) { + try { + const url = await this.urlRepository.findOneBy({ urlCode }); + if (url) return url; + } catch (e) { + throw new NotFoundException('Resource Not Found'); + } + } + + async sendNewsLetter(campaignDetails: CreateSendNewsLetterDto) { + try { + // campaign codes + const campaignEmailCode = fetchCampaignCode( + CampaignNameEnum.NEWS_LETTER, + CampaignTypeEnum.EMAIL, + ); + const campaignSmsCode = fetchCampaignCode( + CampaignNameEnum.NEWS_LETTER, + CampaignTypeEnum.SMS, + ); + + const emailCampaign = await this.getCampaignByCampaignCode( + campaignEmailCode, + CampaignTypeEnum.EMAIL, + ); + const smsCampaign = await this.getCampaignByCampaignCode( + campaignSmsCode, + CampaignTypeEnum.SMS, + ); + + // Notify admin if running out of sms credit + const credit = await this.smsRest.getCredit(); + if (Number(credit.Value) < 500) { + const to = process.env.SAY_ADMIN_SMS; + const from = process.env.SMS_FROM; + const text = `سلام،\nتعداد پیامک باقی‌ مانده شما کمتر از ۵۰۰ عدد است. \n با احترام \n SAY \n لغو۱۱`; + await this.smsRest.send(to, from, text); + } + if (Number(credit.Value) < 150) { + const to = process.env.SAY_ADMIN_SMS; + const from = process.env.SMS_FROM; + const text = `سلام،\nتعداد پیامک شما رو به پایان است. \n با احترام \n SAY \n لغو۱۱`; + await this.smsRest.send(to, from, text); + throw new ForbiddenException('We need to charge the sms provider'); + } + + // 0 -setup + const persianStringMonth = persianMonthStringFarsi(new Date()); + if (!persianStringMonth) { + throw new ServerError('We need the month string'); + } + + const flaskUsers = await this.userService.getFlaskUsers(); + let shuffledUsers = shuffleArray(flaskUsers); + + let alreadyReceivedEmailCount = 0; + let alreadyReceivedSmsCount = 0; + let turnedOffCount = 0; + let emailReceiversTotal = 0; + let smsReceiversTotal = 0; + if (campaignDetails.isTest) { + shuffledUsers = [ + await this.userService.getFlaskUser(12687), + await this.userService.getFlaskUser(115), + ]; + } + + if (campaignDetails.isTest && shuffledUsers.length > 2) { + return; + } + // 1- loop shuffled users + for await (const flaskUser of shuffledUsers) { + sleep(1000); + this.logger.warn(`Looking at: ${flaskUser.id} ...`); + let nestUser = await this.userService.getFamilyByFlaskId(flaskUser.id); + if (!nestUser) { + nestUser = await this.userService.createFamily(flaskUser.id); + } + // 2- eligible to receive? + if (!nestUser.newsLetterCampaign) { + turnedOffCount++; + continue; + } + if (emailCampaign) { + const alreadyReceivedEmail = + emailCampaign.receivers && + emailCampaign.receivers.find((r) => r.flaskUserId === flaskUser.id); + if (alreadyReceivedEmail && !campaignDetails.isTest) { + this.logger.warn(`Already Received Email: ${nestUser.flaskUserId}`); + alreadyReceivedEmailCount++; + continue; + } + } + + if (smsCampaign) { + const alreadyReceivedSms = smsCampaign.receivers.find( + (r) => r.flaskUserId === flaskUser.id, + ); + if (alreadyReceivedSms && !campaignDetails.isTest) { + this.logger.warn(`Already Received Sms: ${nestUser.flaskUserId}`); + alreadyReceivedSmsCount++; + continue; + } + } + + // 3 - Send NewsLetter + if (flaskUser.is_email_verified && flaskUser.emailAddress) { + try { + this.logger.warn( + `Sending NewsLetter Email to: ${flaskUser.emailAddress}`, + ); + + await this.mailerService.sendMail({ + to: flaskUser.emailAddress, + subject: campaignDetails.title, + template: `./${campaignDetails.fileName}`, // `.hbs` extension is appended automatically + context: { + userName: flaskUser.firstName + ? flaskUser.firstName + : flaskUser.userName, + }, + }); + if (!campaignDetails.isTest) { + await this.handleEmailCampaign( + campaignEmailCode, + campaignDetails.title, + [nestUser], + ); + this.logger.log(`Email Sent to User: ${nestUser.flaskUserId}`); + emailReceiversTotal++; + } + } catch (e) { + console.log(e); + continue; + } + } else if ( + flaskUser.is_phonenumber_verified && + flaskUser.phone_number + ) { + const to = flaskUser.phone_number; + const from = process.env.SMS_FROM; + + this.logger.warn(`Sending campaign SMS to: ${to}`); + + const text = `سلام ${ + flaskUser.firstName ? flaskUser.firstName : flaskUser.userName + }،\n ${campaignDetails.smsContent}\n ${ + campaignDetails.smsLink + } لغو۱۱`; + + let smsResult: { + Value: string; + RetStatus: number; + StrRetStatus: string; + }; + + try { + await sleep(1000); + console.log('Woke Up...'); + smsResult = await this.smsRest.send(to, from, text); + } catch (e) { + this.logger.error( + `Could not send SMS to: ${flaskUser.phone_number} for user: ${flaskUser.id} `, + ); + console.log(e); + } + if (smsResult && Number(smsResult.RetStatus) === 1) { + if (!campaignDetails.isTest) { + await this.handleSmsCampaign( + campaignSmsCode, + campaignDetails.title, + [nestUser], + ); + this.logger.log(`SMS Sent to User: ${nestUser.flaskUserId}`); + smsReceiversTotal++; + } + } else { + this.logger.error( + `Could not send SMS to: ${flaskUser.phone_number} for user: ${flaskUser.id} `, + ); + } + } else { + this.logger.error( + `This user has not email or phonNumber:${flaskUser.id}`, + ); + } + } + + this.logger.warn( + `Did Not reach: ${alreadyReceivedEmailCount} users have already received Email`, + ); + this.logger.warn( + `Did Not reach: ${alreadyReceivedSmsCount} users have already received Sms`, + ); + this.logger.warn( + `Did Not reach: ${turnedOffCount} users have turned off monthly campaign`, + ); + this.logger.log( + `All done for this NewsLetter. - ${campaignDetails.title} - SMS:${smsReceiversTotal} - Email:${emailReceiversTotal} - Out of ${flaskUsers.length}`, + ); + + // extra: loop shuffled sws + if (!campaignDetails.isTest) { + let contributorAlreadyReceivedEmailCount = 0; + let contributorAlreadyReceivedSmsCount = 0; + let contributorTurnedOffCount = 0; + let contributorEmailReceiversTotal = 0; + let contributorSmsReceiversTotal = 0; + const flaskSws = await this.userService.getActiveFlaskSws(); + for await (const sw of flaskSws) { + sleep(1000); + const role = convertFlaskToSayPanelRoles(sw.type_id); + let nestContributor = await this.userService.getContributorByFlaskId( + sw.id, + role, + ); + const swDetails = { + typeId: sw.type_id, + firstName: sw.firstName, + lastName: sw.lastName, + avatarUrl: sw.avatar_url, + flaskUserId: sw.id, + birthDate: sw.birth_date && new Date(sw.birth_date), + panelRole: convertFlaskToSayPanelRoles(sw.type_id), + userName: sw.userName, + }; + + if (!nestContributor) { + const swNgo = await this.syncService.syncContributorNgo(sw); + nestContributor = await this.userService.createContributor( + swDetails, + swNgo, + ); + } + this.logger.warn( + `Looking at contributor: ${nestContributor.flaskUserId} ...`, + ); + + if (!nestContributor.isContributor) { + this.logger.warn( + `Not a contributor: ${nestContributor.flaskUserId} ...`, + ); + continue; + } + // 2- eligible to receive? + if (!nestContributor.newsLetterCampaign) { + contributorTurnedOffCount++; + continue; + } + if (emailCampaign) { + const alreadyReceivedEmail = + emailCampaign.receivers && + emailCampaign.receivers.find((r) => r.id === nestContributor.id); + if (alreadyReceivedEmail) { + this.logger.warn( + `Already Received Email: ${nestContributor.flaskUserId}`, + ); + contributorAlreadyReceivedEmailCount++; + continue; + } + } + + if (smsCampaign) { + const alreadyReceivedSms = smsCampaign.receivers.find( + (r) => r.id === nestContributor.id, + ); + if (alreadyReceivedSms) { + this.logger.warn( + `Already Received Sms: ${nestContributor.flaskUserId}`, + ); + contributorAlreadyReceivedSmsCount++; + continue; + } + } + + // 3 - Send NewsLetter + if (sw.email) { + try { + this.logger.warn(`Sending NewsLetter Email to: ${sw.email}`); + + // await this.mailerService.sendMail({ + // to: sw.email, + // subject: campaignDetails.title, + // template: `./${campaignDetails.fileName}`, // `.hbs` extension is appended automatically + // context: { + // userName: sw.firstName ? sw.firstName : sw.userName, + // }, + // }); + if (!campaignDetails.isTest) { + await this.handleEmailCampaign( + campaignEmailCode, + campaignDetails.title, + [nestContributor], + ); + this.logger.log( + `Email Sent to User: ${nestContributor.flaskUserId}`, + ); + contributorEmailReceiversTotal++; + } + } catch (e) { + console.log(e); + continue; + } + } else if (sw.phone_number) { + const to = sw.phone_number; + const from = process.env.SMS_FROM; + + this.logger.warn(`Sending campaign SMS to: ${to}`); + + const text = `سلام ${ + sw.firstName ? sw.firstName : sw.userName + }،\n ${campaignDetails.smsContent}\n ${ + campaignDetails.smsLink + } لغو۱۱`; + + let smsResult: { + Value: string; + RetStatus: number; + StrRetStatus: string; + }; + + try { + await sleep(1000); + console.log('Woke Up...'); + smsResult = await this.smsRest.send(to, from, text); + } catch (e) { + this.logger.error( + `Could not send SMS to: ${sw.phone_number} for Contributor: ${sw.id} `, + ); + console.log(e); + } + if (smsResult && Number(smsResult.RetStatus) === 1) { + if (!campaignDetails.isTest) { + await this.handleSmsCampaign( + campaignSmsCode, + campaignDetails.title, + [nestContributor], + ); + this.logger.log( + `SMS Sent to Contributor: ${nestContributor.flaskUserId}`, + ); + contributorSmsReceiversTotal++; + } + } else { + this.logger.error( + `Could not send SMS to: ${sw.phone_number} for user: ${sw.id} `, + ); + } + } else { + this.logger.error( + `This Contributor does not have email or phonNumber:${sw.id}`, + ); + } + } + this.logger.warn( + `Did Not reach: ${contributorAlreadyReceivedEmailCount} Contributors have already received Email`, + ); + this.logger.warn( + `Did Not reach: ${contributorAlreadyReceivedSmsCount} Contributors have already received Sms`, + ); + this.logger.warn( + `Did Not reach: ${contributorTurnedOffCount} Contributors have turned off monthly campaign`, + ); + this.logger.log( + `All done for this Contributors NewsLetter. - ${campaignDetails.title} - SMS:${contributorSmsReceiversTotal} - Email:${contributorEmailReceiversTotal} - Out of ${flaskSws.length}`, + ); + } + } catch (e) { + console.log(e); + throw new ServerError(e.message, e.status); + } + } +} diff --git a/src/features/campaign/middlewares/campaign.middleware.ts b/src/features/campaign/middlewares/campaign.middleware.ts new file mode 100644 index 0000000000..00a02e9302 --- /dev/null +++ b/src/features/campaign/middlewares/campaign.middleware.ts @@ -0,0 +1,36 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class CampaignMiddleware implements NestMiddleware { + private readonly logger = new Logger(CampaignMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/campaign/pipes/validate-campaign.pipe.ts b/src/features/campaign/pipes/validate-campaign.pipe.ts new file mode 100644 index 0000000000..276681284e --- /dev/null +++ b/src/features/campaign/pipes/validate-campaign.pipe.ts @@ -0,0 +1,10 @@ +import { ArgumentMetadata, Injectable, PipeTransform } from '@nestjs/common'; + +@Injectable() +export class ValidateNewsLetterPipe implements PipeTransform { + transform(value: any, metadata: ArgumentMetadata) { + console.log('Validating NewsLetter...'); + + return value; + } +} diff --git a/src/features/campaign/templates/accEmail1.hbs b/src/features/campaign/templates/accEmail1.hbs new file mode 100644 index 0000000000..5275f71324 --- /dev/null +++ b/src/features/campaign/templates/accEmail1.hbs @@ -0,0 +1,605 @@ + + + + + + SAY Accelerator + + + + + + + + + +
+ +
+ + +
+ + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ +
+
+
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + +
+
+
+

شتابدهنده

+
+
+
+ + +
+
+
+

SAY

+
+
+
+ + +
+
+
+

+ آغاز شتابدهنده SAY برای توانمندسازی
کودکان ساکن روستاها، با

+
+
+
+
+
+
+

+ موضوع محیط زیست.

کسب مقام اول منطقه یک تهران

+
+
+
+ +
+
+ + + + + +
+ + + + +
+
+
+ + + + +
+ + + + + + + +
+

+ سلام {{userName}}, +

+
+

+ در ماه‌های اخیر مشغول به تکمیل ماژول/بخشی مهم از اکوسیستم SAY بوده‌ایم که برای + توانمندسازی کودکان مدارس روستایی طراحی شده است و اولین دوره آن از دی ماه ۱۴۰۲ + آغاز + شد و تا خرداد ماه ۱۴۰۳ ادامه یافت.

+

+ ماژول نیاز که توسط خانواده‌های مجازی، سمن‌ها و مددکاران ممکن شده است اولین + ماژول در + SAY است و شتابدهنده SAY که در دوره‌های ۳ تا ۶ ماه و در رشته‌ای مختلف اجرا + می‌شود + دومین ماژول است. در اولین دوره این شتابدهنده کودکان با فراگیری روش‌های + استارتاپ‌ها + (شرکت‌های نوپا) و همچنین با شرکت در کارگاه‌های عملی و آشنا شدن با تکنولوژی‌های + روز + دنیا، ایده ابتدای‌شان را به مرحله اجرا رساندن تا در حل مشکلات جامعه‌شان قدم + بردارند + که نتایج آن پایین تر با شما به اشتراک گذاشته شده است.
دیگر مخاطبان این + شتابدهنده + شرکت‌ها، سازمان‌ها، سرمایه‌گذاران خرد و کلان (Angels and Venture Capitals) + هستند. + این سازمان‌ها/اشخاص در راستای انجام مسئولیت اجتماعی‌شان، هم در تکمیل چرخه + تولید + سهام/ارز مجازی SAY مشارکت خواهند داشت (تولید سهام از نیاز امضا شده توسط + خانواده + مجازی) و هم با حمایت مالی‌شان ما را در راه‌اندازی اتاق کامپیوتر در مدارس یاری + خواهند + کرد. در اکوسیستم SAY این سازمان‌ها/اشخاص خویشاوند نام دارند.
قابل ذکر است + نرم + افزار SAY Brain که در حال حاضر از مدل‌های آماده هوش مصنوعی بهره میگیرد بر روی + کامپیوترهای این مدارس نصب می‌شود تا پس از اتمام هر دوره مسیر جستجو و کنجکاوی + ادامه پیدا + کند.
 

+

+ آینده:
ماژول‌ها در SAY با هم مرتبط هستند و از منابع یکدیگر + استفاده می‌کنند،‌ به این معنی که، نیازی که خانواده‌های مجازی برطرف می‌کنند، و + پشتیبانی مالی که خویشاوندان برعهده می‌گیرند در رشد SAY و سرعت این رشد تاثیر + مستقیم + دارد. به زبان ساده تر، همراهی همگانی است که ثبت‌نام کودکان بیشتر در هر دو + ماژول را + فراهم میکند. در انتها هم باید بگوییم که اگر تکمیل زیر ساخت بلاک‌چین کمی به طول + انجامیده، دلیل اصلی آن کارهای میدانی مانند این شتابدهند بوده تا فرآیند تولید + سهام را + نهایی کرده و تبدیل به نرم افزار کنیم. امیدواریم صبورانه ما را همراهی کنید و + عذرخواهی + ما را برای این تاخیر بپذیرید. جزئیات بیشتر تا پاییز ۱۴۰۳ به مستندات وبسایت + اضافه + خواهد شد. 
+

+

+ +

+

+
+

+
+
+
+ + + + + +
+ + + + +
+
+ + + + + +
+ + + + + + + +
+

+ در اولین شتابدهنده SAY چه گذشت ...

+
+

+ این دوره در دبستان وحدت روستای ایگل در استان تهران برگزار شد. در ابتدا دانش‌آموزان + با اهالی روستا مصاحبه کردند و از مشکلات روستا پرسش کردند. یکی از مشکلاتی که اهالی با + آن مواجه بودند، باز گذاشتن شیر آب در زمستان بود تا از یخ زدن لوله‌های آب جلوگیری + کنند. + دانش‌آموزان برای جلوگیری از اسراف آب در زمستان، بعد از فرا گیری نگاه سیستمی برای خرد + کردن مسئله، با قطعات الکترونیکی مانند مقاومت، دیود، ماسفت،‌ سنسورها و ... آشنا شدند + و + در ادامه با بهره‌گیری از میکروکنترولرها و پایه‌های کد نویسی، دستگاه کوچک و کم + هزینه‌ای را طراحی کردند که پاسخی به یکی از مشکلات روستا بود. 

+
+
+
+ + + + + + + +
+ + + + + + + +
+

+ ​

+

+ در مسیر برگشت پس از مصاحه با اهالی روستای ایگل

+
+
+
+ +
+
+
+ + + + +
+ + + + + + + +
+

+ ​

+

+ تکمیل MVP یا حداقل محصول قابل ارائه

+
+
+
+
+ + + + + + + +
+ + + + + + + + + + + + + + +
+

+ بازدید بخش‌دار، دهیار و شورای شهر از پروژه و مدرسه 

+
+

+ ​

+

+ نصب بنر توسط دهیاری و شورا برای کسب مقام اول منطقه یک تهران

+
+

+ ​

+

+ تقدیر از دانش‌آموزان توسط آموزش و پرورش

+
+
+
+
+
+ + + + + +
+ + \ No newline at end of file diff --git a/src/features/campaign/templates/expandFamilyNoChild.hbs b/src/features/campaign/templates/expandFamilyNoChild.hbs new file mode 100644 index 0000000000..32f3ba7bf1 --- /dev/null +++ b/src/features/campaign/templates/expandFamilyNoChild.hbs @@ -0,0 +1,478 @@ + + + + + + + + + SAY DAO No Children Template + + + + + + + + + +
+ +
+ + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + +
+ Logo +
+ + + + + + + +
+
+
+
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + +
+ +
+
+ شما کودک فعالی ندارید. +
+
+

+ سلام {{userName}}، +

+

+ در حال حاضر شما کودک فعالی ندارید. شما + می‌توانید با رفتن به صفحه جستجو + اپلیکیشن/دپلیکیشن، کودک دیگری را به + سرپرستی قبول کنید... +

+
+ اپلیکیشن +
+
+
+
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+

+ در صورتی که مایل نیستید این یادآوری ماهانه + را دریافت کنید، لطفا از طریق این + + لینک + به صفحه کاربری بروید و آن را خاموش کنید. +

+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/features/campaign/templates/gmail-color-hack.hbs b/src/features/campaign/templates/gmail-color-hack.hbs new file mode 100644 index 0000000000..bf2670e88c --- /dev/null +++ b/src/features/campaign/templates/gmail-color-hack.hbs @@ -0,0 +1,24 @@ + + + + + Fixing Gmail’s dark mode issues with CSS Blend Modes + + + +
+
+
Lorem ipsum dolor, sit amet, consectetur adipisicing elit.
+
+
+ + \ No newline at end of file diff --git a/src/features/campaign/templates/monthlyCampaign.hbs b/src/features/campaign/templates/monthlyCampaign.hbs new file mode 100644 index 0000000000..61f26af02c --- /dev/null +++ b/src/features/campaign/templates/monthlyCampaign.hbs @@ -0,0 +1,1153 @@ + + + + + + + + + Campaign Template + + + + + + + + + +
+ +
+ + +
+ + + + +
+ + + + +
+ + + + + + + +
+ + + + +
+ + + + +
+ SAY logo +
+
+
+ + + + + +
+ + + + +
+ وبسایت +
+
+ + + + + +
+ + + + +
+ مستندات +
+
+ + + + +
+ + + + +
+ دپلیکیشن +
+
+
+
+ + + + +
+ + + + + + + +
+ + + + +
+ + + + +
+ + + + +
+
+
+
+ + + + +
+ + + + + + + +
+

+   + آخرین + نیاز + کودکان +   +

+
+ +
+
+
+
+ {{#each myChildren as | child |}} + + + + +
+ + + + + + + +
+ + + + + +
+ + + + + + + +
+

+   {{child.sayName}} +

+
+ + + + +
+
+
+ + + + + +
+ + + + +
+ +
+
+ +
+ + + + + +
+ + + + + + + + + + +
+

+ آخرین نیازها +

+
+ + + + +
+
+

+   + + دیگر نیاز‌های کودک ... +   +

+
+
+ {{#each unPaidNeeds as |need|}} + + + + +
+ + + + + + + + + + + + + +
+ {{need.name}} +
+

+ {{need.price}} تومان +

+
+

+ {{need.name}} +

+
+ پرداخت +
+
+ {{/each}} +
+
+ {{/each}} + + + + +
+ + + + + + + +
+ + + + +
+ + + + + + + +
+ + تمام کودکان ... +
+ + + + +
+
+
+
+ + + + +
+ + + + + + + + + + + + + +
+

+   + امضای + دیجیتال +   +

+
+

+ نیازی که توسط خانواده مجازی پرداخت شده + باشد و به دست کودک رسیده باشد وارد مرحله + تازه ای می‌شود. در این مرحله امکان امضای + دیجیتال نیاز توسط مددکار، شاهد، میانجی و + خانواده مجازی فراهم می‌شود که خود پیش نیاز + توسعه SAY بر روی بستر بلاک‌چین و تبدیل شدن + به سازمانی غیرمتمرکز و خودمختار است. +

+
+ مطالعه بیشتر ... +
+ +
+
+
+
+ + + + +
+ + {{#unless readyToSignNeeds}} + + + + {{/unless}} + + + +
+

+ در میان نیازهای امضا شده توسط مددکاران، نیاز پرداخت + شده شما را پیدا نکردیم، اگر نیازی را پرداخت کرده‌اید و + اینجا نمی‌بینید لطفا در روزهای آتی به صفحه امضاها سر + بزنید. +

+
+ {{#each readyToSignNeeds as |readyNeed|}} + + + + + + + +
+ + + + +
+ {{readyNeed.name}} +
+
+ + + + +
+

+ {{readyNeed.name}} +

+
+
+ {{/each}} +
+
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ دیگر امضا‌ها ... +
+
+
+
+ + + + +
+ + + + +
+ + + + +
+ + + +
+
+
+
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + +
+

+ در صورتی که با این نشانی ایمیل اقدام به + همراهی ما نکرده‌اید لطفا این ایمیل را + ندیده بگیرید و روی لینک زیر کلیک + کنید +

+
+

+ لغو همراهی +

+
+ +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/features/campaign/templates/swConfirmedChild.hbs b/src/features/campaign/templates/swConfirmedChild.hbs new file mode 100644 index 0000000000..db1036ff58 --- /dev/null +++ b/src/features/campaign/templates/swConfirmedChild.hbs @@ -0,0 +1,481 @@ + + + + + + + + + Social Workers Reminder Template + + + + + + + + + +
+ +
+ + +
+ + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+

+ View online version +

+
+
+
+
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + +
+ Logo +
+ + + + + + + +
+
+
+
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + +
+ +
+
+ {{sayName}} +
+ + ({{firstName}} {{lastName}}) + +
+

+ سلام {{userName}}، +

+

+ ​ +

+

+ {{firstName}} {{lastName}}، تأیید شده‌ و + به زودی برای او خانواده مجازی پیدا خواهیم + کرد. شما می‌توانید از امروز نیازهای او را + ثبت کنید. +

+

+ ​
با احترام، +

+

+ SAY +

+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/features/campaign/templates/swRemindNoNeeds.hbs b/src/features/campaign/templates/swRemindNoNeeds.hbs new file mode 100644 index 0000000000..77246058b3 --- /dev/null +++ b/src/features/campaign/templates/swRemindNoNeeds.hbs @@ -0,0 +1,500 @@ + + + + + + + + + Social Workers Reminder Template + + + + + + + + + +
+ +
+ + +
+ + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+

+ View online version +

+
+
+
+
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + +
+ Logo +
+ + + + + + + +
+
+
+
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + +
+ +
+
+ کودکان بدون نیاز ثبت شده! +
+
+

+ سلام {{userName}}، +

+

+ ​ +

+

+ در حال حاضر تعدادی از کودکان شما نیاز ثبت + شده‌ای ندارند.  در صورتی که کودک از + تحت پوشش شما خارج شده است یا نیازهای آنها + از  محل دیگری رفع می‌گردد، لطفا از + طریق ایمیل ngo@saydao.org به ما اطلاع + دهید، در غیر این صورت این ایمیل را نادیده + بگیرید. +

+

+ ​
با احترام، +

+

+ SAY +

+

+ ​ +

+

+ کودکان بدون نیاز ثبت شده: +

+

+

+
    + {{#each children as | child|}} +
  • + {{child.firstName_translations.fa}} + {{child.lastName_translations.fa}} + ({{child.sayname_translations.fa}}) +
  • + {{/each}} +
+

+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/features/children/children.controller.ts b/src/features/children/children.controller.ts index 2825012c04..f7902553a9 100644 --- a/src/features/children/children.controller.ts +++ b/src/features/children/children.controller.ts @@ -1,103 +1,1165 @@ - - - -import { Controller, Get, Param, ParseIntPipe, Req } from '@nestjs/common'; -import { ApiOperation, ApiTags } from '@nestjs/swagger'; -import { NeedService } from '../need/need.service'; +import { + Controller, + ForbiddenException, + Get, + Body, + Param, + Req, + Post, + UsePipes, + ValidationPipe, + Patch, + UseInterceptors, + UploadedFile, + UploadedFiles, + Delete, + Res, + BadRequestException, +} from '@nestjs/common'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; import { ChildrenService } from './children.service'; +import { + FlaskUserTypesEnum, + ChildExistence, + ChildConfirmation, + SexEnum, + PanelContributors, + PreRegisterStatusEnum, + SchoolTypeEnum, + SAYPlatformRoles, +} from 'src/types/interfaces/interface'; +import { isAuthenticated } from 'src/utils/auth'; +import config from 'src/config'; +import { UserService } from '../user/user.service'; +import { + CreateFlaskChildDto, + PreparePreRegisterChildDto, + UpdateApprovedPreRegisterDto, + UpdatePreRegisterChildDto, +} from 'src/types/dtos/CreateChild.dto'; +import { ValidateChildPipe } from './pipes/validate-child.ts/validate-child.ts.pipe'; +import { + FileFieldsInterceptor, + FileInterceptor, +} from '@nestjs/platform-express'; +import { avatarStorage } from 'src/storage/avatarStorage'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { voiceStorage } from 'src/storage/voiceStorage'; +import { ChildrenInterceptor } from './interceptors/children.interceptors'; +import { LocationService } from '../location/location.service'; +import { DownloadService } from '../download/download.service'; +import { NgoService } from '../ngo/ngo.service'; +import { randomUUID } from 'crypto'; +import { NgoEntity } from 'src/entities/ngo.entity'; +import { SyncService } from '../sync/sync.service'; +import { LocationEntity } from 'src/entities/location.entity'; +import { NgoParams } from 'src/types/parameters/NgoParammeters'; +import { + capitalizeFirstLetter, + convertFlaskToSayAppRoles, + convertFlaskToSayPanelRoles, + convertFlaskToSayRoles, + formatDate, + truncateString, +} from 'src/utils/helpers'; +import axios from 'axios'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { checkIfDirectoryExists, getCurrentFilenames, moveFile, renameFile } from 'src/utils/file'; +import fs from 'fs'; +import { CampaignService } from '../campaign/campaign.service'; +import { File } from '@web-std/file'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { ObjectNotFound } from 'src/filters/notFound-expectation.filter'; +import { forEach } from 'mathjs'; @ApiTags('Children') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) @Controller('children') export class ChildrenController { - constructor(private childrenService: ChildrenService, - private needService: NeedService, - ) { } - - @Get(`all`) - @ApiOperation({ description: 'Get a single transaction by ID' }) - async getChildren() { - return await this.childrenService.getChildren(); - } - - @Get(`flask/child/needs-summary/:childId`) - @ApiOperation({ description: 'Get a single child needs summary by ID' }) - async getChildNeedsSummary(@Req() req: Request, @Param('childId') childId: number) { - const accessToken = req.headers["authorization"] - // const template = { - // flaskChildId: needs[i].flaskChildId, - // flaskNeedId: needs[i].flaskNeedId, - // title: needs[i].title, - // affiliateLinkUrl: needs[i].affiliateLinkUrl, - // link: needs[i].link, - // category: needs[i].category, - // confirmUser: needs[i].flaskSupervisorId, - // flaskSupervisorId: needs[i].flaskSupervisorId, - // cost: needs[i].cost, - // created: needs[i].created && new Date(needs[i]?.created), - // createdById: needs[i].flaskSwId, - // deletedAt: needs[i].deletedAt && new Date(needs[i]?.deletedAt), - // description: needs[i].description, // { en: '' , fa: ''} - // descriptionTranslations: needs[i].descriptionTranslations, // { en: '' , fa: ''} - // titleTranslations: needs[i].titleTranslations, - // details: needs[i].details, - // isUrgent: needs[i].isUrgent, - // type: needs[i].type, - // typeName: needs[i].typeName, - // unpayable: needs[i].unpayable, - // unpayableFrom: - // needs[i].unpayableFrom && new Date(needs[i]?.unpayableFrom), - // imageUrl: needs[i].imageUrl, - // needRetailerImg: needs[i].needRetailerImg, - // } - return await this.childrenService.getChildNeedsSummeay(accessToken, childId); - } - - - // @Get(`child/done/:id`) - // @ApiOperation({ description: 'Get child all done need' }) - // async getChildNeeds(@Param('childId', ParseIntPipe) childId: number) { - // const theChild = await this.childrenService.getChildById(childId); - // return theChild.needs; - // } - - - @Get(`child/needs/templates/:id`) - @ApiOperation({ description: 'Get child all done need' }) - async createNeedsTemplates(@Req() req: Request, @Param('id', ParseIntPipe) childId: number) { - const accessToken = req.headers["authorization"] - const needs = await this.needService.getPreNeed(accessToken) - const templates = [] - // for (let i = 0; i < needs.length; i++) { - // const template = { - // flaskChildId: needs[i].flaskChildId, - // flaskNeedId: needs[i].flaskNeedId, - // title: needs[i].title, - // affiliateLinkUrl: needs[i].affiliateLinkUrl, - // link: needs[i].link, - // category: needs[i].category, - // confirmUser: needs[i].flaskSupervisorId, - // flaskSupervisorId: needs[i].flaskSupervisorId, - // cost: needs[i].cost, - // created: needs[i].created && new Date(needs[i]?.created), - // createdById: needs[i].flaskSwId, - // deletedAt: needs[i].deletedAt && new Date(needs[i]?.deletedAt), - // description: needs[i].description, // { en: '' , fa: ''} - // descriptionTranslations: needs[i].descriptionTranslations, // { en: '' , fa: ''} - // titleTranslations: needs[i].titleTranslations, - // details: needs[i].details, - // isUrgent: needs[i].isUrgent, - // type: needs[i].type, - // typeName: needs[i].typeName, - // unpayable: needs[i].unpayable, - // unpayableFrom: - // needs[i].unpayableFrom && new Date(needs[i]?.unpayableFrom), - // imageUrl: needs[i].imageUrl, - // needRetailerImg: needs[i].needRetailerImg, - // } - // templates.push(template) - // } - // return templates; + constructor( + private childrenService: ChildrenService, + private syncService: SyncService, + private userService: UserService, + private ngoService: NgoService, + private locationService: LocationService, + private downloadService: DownloadService, + private campaignService: CampaignService, + ) { } + @Get(`preregister/:childFlaskId`) + @ApiOperation({ description: 'Get child preregister' }) + async getChildPreregister( + @Req() req: Request, + @Param('childFlaskId') childFlaskId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + !( + panelFlaskTypeId === FlaskUserTypesEnum.SOCIAL_WORKER || + panelFlaskTypeId === FlaskUserTypesEnum.NGO_SUPERVISOR || + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not the Authorized!'); } -} + return await this.childrenService.getChildrenPreRegisterByFlaskId( + childFlaskId, + ); + } + + @UsePipes(new ValidationPipe()) // validation for dto files + @Patch(`preregister/approve/:id`) + @ApiOperation({ description: 'Approve a pre register' }) + @UseInterceptors(FileInterceptor('voiceFile', voiceStorage)) + async approvePreregister( + @Req() req: Request, + @UploadedFile() voiceFile: Express.Multer.File, + @Param('id') id: string, + @Body(ValidateChildPipe) body: CreateFlaskChildDto, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + !( + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + + try { + const preRegister = await this.childrenService.getChildPreRegisterById( + id, + ); + if ( + preRegister.status === PreRegisterStatusEnum.CONFIRMED || + preRegister.status === PreRegisterStatusEnum.NOT_REGISTERED + ) { + throw new ServerError('Pre register approval could not go ahead!'); + } + if (!voiceFile) { + throw new ServerError('we need the Edited Voice!'); + } + const token = + config().dataCache.fetchPanelAuthentication(panelFlaskUserId).token; + const awakeFile = await this.downloadService.fileFromPath( + process.env.NODE_ENV === 'development' + ? `http://localhost:8002/api/dao/children/avatars/images/${preRegister.awakeUrl}` + : `https://nest.saydao.org/api/dao/children/avatars/images/${preRegister.awakeUrl}`, + `${preRegister.awakeUrl}`, + ); + const sleptFile = await this.downloadService.fileFromPath( + process.env.NODE_ENV === 'development' + ? `http://localhost:8002/api/dao/children/avatars/images/${preRegister.sleptUrl}` + : `https://nest.saydao.org/api/dao/children/avatars/images/${preRegister.sleptUrl}`, + `${preRegister.sleptUrl}`, + ); + + const fileBuffer = await fs.promises.readFile( + `uploads/children/voices/${voiceFile.filename}`, + ); + + const file = new File([fileBuffer], `${voiceFile.filename}`, { + type: voiceFile.mimetype, + }); + + const formData = new FormData(); + formData.append('ngo_id', String(preRegister.flaskNgoId)); + formData.append('sw_id', String(preRegister.flaskSwId)); + formData.append('awakeAvatarUrl', awakeFile); + formData.append('sleptAvatarUrl', sleptFile); + formData.append('voiceUrl', file); + formData.append( + 'gender', + String(preRegister.sex === SexEnum.MALE ? true : false), + ); + formData.append('city', String(preRegister.city)); + formData.append('country', String(preRegister.country)); + formData.append('phoneNumber', preRegister.phoneNumber); + formData.append('birthDate', formatDate(preRegister.birthDate)); //'2015-05-20' + formData.append( + 'sayname_translations', + JSON.stringify({ + fa: preRegister.sayName.fa, + en: preRegister.sayName.en, + }), + ); + formData.append( + 'bio_translations', + JSON.stringify({ + fa: preRegister.bio.fa, + en: body.bioEn, + }), + ); + formData.append( + 'bio_summary_translations', + JSON.stringify({ + fa: truncateString(preRegister.bio.fa, 120), + en: truncateString(body.bioEn, 120), + }), + ); + formData.append( + 'firstName_translations', + JSON.stringify({ + fa: preRegister.firstName.fa, + en: body.firstNameEn, + }), + ); + formData.append( + 'lastName_translations', + JSON.stringify({ + fa: preRegister.lastName.fa, + en: body.lastNameEn, + }), + ); + formData.append('nationality', String(preRegister.birthPlaceId)); + formData.append('birthPlace', String(preRegister.birthPlaceId)); + formData.append('familyCount', String(preRegister.familyCount)); + formData.append('education', String(preRegister.educationLevel)); + formData.append('housingStatus', String(preRegister.housingStatus)); + formData.append('address', preRegister.address); + + const configs = { + headers: { + 'Content-Type': 'multipart/form-data', + Authorization: token, + processData: false, + contentType: false, + }, + }; + + // create flask child + const { data } = await axios.post( + 'https://api.sayapp.company/api/v2/child/add/', + formData, + configs, + ); + + // approve / confirm child Pre register + const approvedPre = await this.childrenService.approvePreregister( + preRegister, + body.firstNameEn, + body.lastNameEn, + body.bioEn, + data.id, + voiceFile.filename, + ); + + // clean up downloaded files + fs.unlinkSync(`${preRegister.awakeUrl}`); + fs.unlinkSync(`${preRegister.sleptUrl}`); + + const configs2 = { + headers: { + 'Content-Type': 'application/json', + Authorization: token, + }, + }; + // confirm child + await axios.patch( + `https://api.sayapp.company/api/v2/child/confirm/childId=${data.id}`, + {}, + configs2, + ); + + // send email + await this.campaignService.sendSwChildConfirmation( + preRegister.flaskSwId, + preRegister, + ); + + return { + added: data, + approvedPre: approvedPre, + }; + } catch (e) { + throw new ServerError('Flask reverted!'); + } + } + + @Post(`preregister`) + @ApiOperation({ description: 'Create children pre register' }) + @UseInterceptors( + FileFieldsInterceptor( + [ + { name: 'awakeFile', maxCount: 1 }, + { name: 'sleptFile', maxCount: 1 }, + ], + avatarStorage, + ), + ) + @UsePipes(new ValidationPipe()) + async preRegisterAdminCreate( + @Req() req: Request, + @UploadedFiles() + files: { + awakeFile?: Express.Multer.File[]; + sleptFile?: Express.Multer.File[]; + }, + @Body() + body: { sex: SexEnum; sayNameFa: string; sayNameEn: string }, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + !( + panelFlaskTypeId === FlaskUserTypesEnum.SOCIAL_WORKER || + panelFlaskTypeId === FlaskUserTypesEnum.NGO_SUPERVISOR || + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not the Authorized!'); + } + + if (!files || !files.awakeFile || !files.sleptFile) { + throw new BadRequestException('No files were uploaded!'); + } + + const preRegister = await this.childrenService.createPreRegisterChild( + files.awakeFile[0].filename, + files.sleptFile[0].filename, + { fa: body.sayNameFa, en: body.sayNameEn }, + body.sex, + ); + + // for local purposes - organized folders and files + if (process.env.NODE_ENV === 'development') { + const preRegistersByName = await this.childrenService.getPreChildrenByName(body.sayNameFa) + + if (preRegistersByName && preRegistersByName.length > 0) { + throw new BadRequestException('Can not have similar names!'); + } + + const originalAwakeGirl = `../../Docs/children/girls/${files.awakeFile[0].filename.split('-s-')[0] + }.png`; + const originalAwakeBoy = `../../Docs/children/boys/${files.awakeFile[0].filename.split('-s-')[0] + }.png`; + const originalSleptGirl = `../../Docs/children/girls/${files.sleptFile[0].filename.split('-s-')[0] + }.png`; + const originalSleptBoy = `../../Docs/children/boys/${files.sleptFile[0].filename.split('-s-')[0] + }.png`; + + + const newAwakeName = `awake-${body.sayNameEn.toLowerCase()}.png`; + const newSleepName = `sleep-${body.sayNameEn.toLowerCase()}.png`; + + try { + if ( + checkIfDirectoryExists(originalAwakeGirl) || + checkIfDirectoryExists(originalAwakeBoy) + ) { + + + const newChildFolder = `../../Docs/children${Number(body.sex) === SexEnum.MALE ? '/boys/' : '/girls/' + }organized/${capitalizeFirstLetter(body.sayNameEn)}_${preRegister.id}`; + + if (!checkIfDirectoryExists(newChildFolder)) { + console.log('Creating the child organized folder ...'); + fs.mkdirSync(newChildFolder); + if (!checkIfDirectoryExists(newChildFolder)) { + throw new ServerError('could not find the folder'); + } + } + if (Number(body.sex) === SexEnum.MALE) { + moveFile(originalAwakeBoy, `${newChildFolder}/${newAwakeName}`); + moveFile(originalSleptBoy, `${newChildFolder}/${newSleepName}`); + } + if (Number(body.sex) === SexEnum.FEMALE) { + moveFile(originalAwakeGirl, `${newChildFolder}/${newAwakeName}`); + moveFile(originalSleptGirl, `${newChildFolder}/${newSleepName}`); + } + } else { + throw new ServerError('could not find the file'); + } + return preRegister; + + + } catch (e) { + throw new ServerError(e.msg); + } + } + } + + @Delete(`preregister/:id`) + @ApiOperation({ description: 'Delete a pre register' }) + async deletePreRegister(@Req() req: Request, @Param('id') id: string) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + !( + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + + try { + const preRegister = await this.childrenService.getChildPreRegisterById( + id, + ); + + if (preRegister.status === PreRegisterStatusEnum.CONFIRMED) { + throw new ForbiddenException('This Child has been confirmed'); + } + await this.childrenService.deletePreRegister(preRegister.id); + } catch (e) { + throw new ServerError(e.message, e.status); + } + } + + @Get(`complete-delete`) + @ApiOperation({ + description: 'After delete we need to move back the avatars to their folders', + }) + @UsePipes(new ValidationPipe()) + async preRegisterCompleteDelete(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + !( + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not the Authorized!'); + } + // for local purposes - organized folders and files + if (process.env.NODE_ENV === 'development') { + try { + const token = + config().dataCache.fetchPanelAuthentication(panelFlaskUserId).token; + const configs = { + headers: { + 'Content-Type': 'multipart/form-data', + Authorization: token, + contentType: false, + flaskId: panelFlaskUserId, + 'X-TAKE': 0, + 'X-LIMIT': 100, + }, + }; + const result1 = await axios.get( + `https://nest.saydao.org/api/dao/children/preregister/all/${PreRegisterStatusEnum.PRE_REGISTERED}`, + configs, + ); + const result2 = await axios.get( + `https://nest.saydao.org/api/dao/children/preregister/all/${PreRegisterStatusEnum.CONFIRMED}`, + configs, + ); + const result3 = await axios.get( + `https://nest.saydao.org/api/dao/children/preregister/all/${PreRegisterStatusEnum.NOT_REGISTERED}`, + configs, + ); + const allPreRegisters = result1.data.data.concat(result2.data.data).concat(result3.data.data); + + // remove the path which has a preregister id. return the paths left in array -> those which were deleted, ... + function removeItemOnce(arr: any[], value: string) { + const index = arr.indexOf(value); + if (index > -1) { + arr.splice(index, 1); + } + return arr; + } + let path: string; + const boysFiles = fs.readdirSync(`../../Docs/children/boys/organized`); + const girlsFiles = fs.readdirSync(`../../Docs/children/girls/organized`); + const filesDir = boysFiles.concat(girlsFiles); + const separateFilesDir = { boysFiles, girlsFiles } + + for (const p of allPreRegisters) { + path = filesDir.find( + (d) => d.split(`_`)[1] === p.id + ); + if (!path) { + // This one is deleted and we need to restore the child folder + continue + } else { + removeItemOnce(filesDir, path) + } + } + + if (girlsFiles.length + boysFiles.length !== (boysFiles.concat(girlsFiles)).length) { + throw new ServerError('The arrays are different'); + } + + const girlPathList = [] + const boyPathList = [] + + filesDir.forEach((dir) => { + const girlPath = separateFilesDir.girlsFiles.find( + (d) => dir === d + ); + const boyPath = separateFilesDir.boysFiles.find( + (d) => dir === d + ); + + if (girlPath) { + girlPathList.push(girlPath) + } + if (boyPath) { + boyPathList.push(boyPath) + } + + }) + + + + if (boyPathList[0]) { + console.log("boy"); + boyPathList.forEach((p) => { + const targetDirectory = `../../Docs/children/boys/organized/${p}` + const files = fs.readdirSync(targetDirectory); + files.forEach(async (f) => await moveFile(`${targetDirectory}/${f}`, `../../Docs/children/to-be-restored/${f}`)) + fs.promises.rmdir(targetDirectory, { recursive: false }); + }) + } + if (girlPathList[0]) { + console.log("girl"); + girlPathList.forEach((p) => { + const targetDirectory = `../../Docs/children/girls/organized/${p}` + const files = fs.readdirSync(targetDirectory); + files.forEach(async (f) => await moveFile(`${targetDirectory}/${f}`, `../../Docs/children/to-be-restored/${f}`)) + fs.promises.rmdir(targetDirectory, { recursive: false }); + + }) + } + return { "FoldersToBeManaged": filesDir }; + } catch (e) { + console.log(e); + throw new ServerError(e.message); + } + } + } + + @ApiOperation({ + description: 'NGO / SW add a child by updating pre register', + }) + @Patch(`preregister/assign`) + @UsePipes(new ValidationPipe()) + @UseInterceptors(FileInterceptor('voiceFile', voiceStorage)) + async preRegisterAssignChild( + @Req() req: Request, + @UploadedFile() voiceFile, + @Body(ValidateChildPipe) body: PreparePreRegisterChildDto, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + !( + panelFlaskTypeId === FlaskUserTypesEnum.SOCIAL_WORKER || + panelFlaskTypeId === FlaskUserTypesEnum.NGO_SUPERVISOR || + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + if (!voiceFile) { + throw new ServerError('No file was uploaded!'); + } + try { + const allPreRegisters = + await this.childrenService.getChildrenPreRegisterSimple( + PreRegisterStatusEnum.NOT_REGISTERED, + ); + + const candidate = allPreRegisters.find( + (p) => !p.voiceUrl && p.sex === Number(body.sex), + ); + if (!candidate) { + throw new ServerError('We need more avatars'); + } + + let location = await this.locationService.getCityById(body.city); + const birthPlace = await this.locationService.getCityByCountryId( + Number(body.birthPlaceId), + ); + + if (!location) { + console.log('\x1b[36m%s\x1b[0m', 'Creating a Location ...'); + const flaskCity = await this.locationService.getFlaskCity(body.city); + const { + id: flaskId, + name, + state_id, + state_code, + state_name, + country_id, + country_code, + country_name, + latitude, + longitude, + } = flaskCity; + + location = await this.locationService.createLocation({ + flaskCityId: flaskId, + name: name, + stateId: state_id, + stateCode: state_code, + stateName: state_name, + countryId: country_id, + countryCode: country_code, + countryName: country_name, + latitude, + longitude, + }); + console.log('\x1b[36m%s\x1b[0m', 'Created a Location ...'); + } + const ngo = await this.ngoService.getNgoById(Number(body.ngoId)); + + let nestSocialWorker: AllUserEntity; + let swNgo: NgoEntity; + + nestSocialWorker = await this.userService.getContributorByFlaskId( + Number(body.swId), + PanelContributors.SOCIAL_WORKER, + ); + if (!nestSocialWorker) { + const flaskSocialWorker = await this.userService.getFlaskSocialWorker( + body.swId, + ); + + const swDetails = { + typeId: flaskSocialWorker.type_id, + firstName: flaskSocialWorker.firstName, + lastName: flaskSocialWorker.lastName, + avatarUrl: flaskSocialWorker.avatar_url, + flaskUserId: flaskSocialWorker.id, + birthDate: + flaskSocialWorker.birth_date && + new Date(flaskSocialWorker.birth_date), + panelRole: PanelContributors.SOCIAL_WORKER, + userName: flaskSocialWorker.userName, + }; + + swNgo = await this.syncService.syncContributorNgo(flaskSocialWorker); + console.log('\x1b[36m%s\x1b[0m', 'Creating a Social Worker ...\n'); + nestSocialWorker = await this.userService.createContributor( + swDetails, + swNgo, + ); + console.log('\x1b[36m%s\x1b[0m', 'Created a Social Worker ...\n'); + } + + const contributor = nestSocialWorker.contributions.find( + (c) => c.flaskUserId === Number(body.swId), + ); + if (!nestSocialWorker || !ngo || !contributor) { + throw new ServerError('This social worker has not contributed yet'); + } + return await this.childrenService.preRegisterAssignChild( + candidate.id, + { + phoneNumber: body.phoneNumber, + country: Number(body.country), + city: Number(body.city), + bio: { fa: body.bio, en: '' }, + voiceUrl: voiceFile.filename, + birthPlaceId: Number(body.birthPlaceId), + birthPlaceName: birthPlace.name, + birthDate: new Date(body.birthDate), + housingStatus: Number(body.housingStatus), + familyCount: Number(body.familyCount), + educationLevel: Number(body.educationLevel), + schoolType: Number(body.schoolType), + flaskNgoId: Number(body.ngoId), + flaskSwId: Number(body.swId), + lastName: { fa: body.lastName, en: '' }, + firstName: { fa: body.firstName, en: '' }, + state: Number(body.state), + address: body.address, + status: PreRegisterStatusEnum.PRE_REGISTERED, + }, + location, + ngo, + contributor, + ); + } catch (e) { + throw new ServerError(e.message, e.status); + } + } + + @ApiOperation({ description: 'update pre register' }) + @Patch(`preregister/update`) + @UsePipes(new ValidationPipe()) + @UseInterceptors(FileInterceptor('voiceFile', voiceStorage)) + async preRegisterUpdate( + @Req() req: Request, + @UploadedFile() voiceFile, + @Body(ValidateChildPipe) body: UpdatePreRegisterChildDto, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + !( + panelFlaskTypeId === FlaskUserTypesEnum.SOCIAL_WORKER || + panelFlaskTypeId === FlaskUserTypesEnum.NGO_SUPERVISOR || + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + try { + return await this.childrenService.preRegisterUpdate(body.id, { + bio: { fa: body.bio, en: '' }, + voiceUrl: voiceFile && voiceFile.filename, + housingStatus: Number(body.housingStatus), + educationLevel: Number(body.educationLevel), + schoolType: Number(body.schoolType), + lastName: { fa: body.lastName, en: '' }, + firstName: { fa: body.firstName, en: '' }, + }); + } catch (e) { + throw new ServerError(e.message, e.status); + } + } + + @ApiOperation({ description: 'update approved pre register' }) + @Patch(`preregister/update-approved/:flaskChildId`) + @UsePipes(new ValidationPipe()) + async preRegisterUpdateApproved( + @Param('flaskChildId') flaskChildId: number, + @Body() body: { schoolType: SchoolTypeEnum; addedState: number }, + @Req() req: Request, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + !( + panelFlaskTypeId === FlaskUserTypesEnum.SOCIAL_WORKER || + panelFlaskTypeId === FlaskUserTypesEnum.NGO_SUPERVISOR || + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + let preRegister: ChildrenPreRegisterEntity; + try { + const flaskChild = await this.childrenService.getFlaskChild(flaskChildId); + preRegister = await this.childrenService.getChildrenPreRegisterByFlaskId( + flaskChildId, + ); + if (!preRegister) { + preRegister = await this.childrenService.createPreRegisterChild( + flaskChild.awakeAvatarUrl, + flaskChild.sleptAvatarUrl, + { + fa: flaskChild.sayname_translations.fa, + en: flaskChild.sayname_translations.en, + }, + flaskChild.gender === false ? SexEnum.FEMALE : SexEnum.MALE, + ); + console.log(preRegister); + } + const preRegisterDetails = { + birthDate: new Date(flaskChild.birthDate), + firstName: { + fa: flaskChild.firstName_translations.fa, + en: flaskChild.firstName_translations.en, + }, + lastName: { + fa: flaskChild.lastName_translations.fa, + en: flaskChild.lastName_translations.en, + }, + sayName: { + fa: flaskChild.sayname_translations.fa, + en: flaskChild.sayname_translations.en, + }, + birthPlaceId: Number(flaskChild.nationality), + phoneNumber: flaskChild.phoneNumber, + address: flaskChild.address, + country: Number(flaskChild.country), + city: Number(flaskChild.city), + state: Number(body.addedState), + awakeUrl: flaskChild.awakeAvatarUrl, + sleptUrl: flaskChild.sleptAvatarUrl, + voiceUrl: flaskChild.voiceUrl, + sex: flaskChild.gender === false ? SexEnum.FEMALE : SexEnum.MALE, + bio: { + fa: flaskChild.bio_translations.fa, + en: flaskChild.bio_translations.en, + }, + housingStatus: Number(flaskChild.housingStatus), + educationLevel: Number(flaskChild.education), + schoolType: body.schoolType, + familyCount: Number(flaskChild.familyCount), + }; + console.log('\x1b[36m%s\x1b[0m', 'Updating the preRegister ...\n'); + + await this.childrenService.preRegisterUpdateApproved( + flaskChildId, + preRegister.id, + preRegisterDetails, + ); + + preRegister = await this.childrenService.getChildrenPreRegisterByFlaskId( + flaskChildId, + ); + + return await this.syncService.syncChild( + flaskChild, + body.addedState, + body.schoolType, + ); + } catch (e) { + throw new ServerError(e.message, e.status); + } + } + + @UseInterceptors(ChildrenInterceptor) + @Get(`preregister/all/:status`) + @ApiOperation({ description: 'Get all children from db' }) + async getChildrenPreRegister( + @Param('status') status: PreRegisterStatusEnum, + @Req() req: Request, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + + const X_LIMIT = parseInt(req.headers['x-limit']); + const X_TAKE = parseInt(req.headers['x-take']); + const limit = X_LIMIT > 100 ? 100 : X_LIMIT; + const page = X_TAKE + 1; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not the Super admin'); + } + let ngoIds: number[]; + let swIds: number[]; + const socialWorker = await this.userService.getFlaskSocialWorker( + panelFlaskUserId, + ); + if (convertFlaskToSayRoles(panelFlaskTypeId) === SAYPlatformRoles.AUDITOR) { + // for auditor - admin + swIds = await this.userService + .getFlaskSwIds() + .then((r) => r.map((s) => s.id)); // all NGOs id + + ngoIds = await this.ngoService + .getFlaskNgos() + .then((r) => r.map((s) => s.id)); + } + + if ( + convertFlaskToSayRoles(panelFlaskTypeId) === + SAYPlatformRoles.NGO_SUPERVISOR + ) { + // for ngo supervisor + + swIds = await this.userService + .getFlaskSocialWorkersByNgo(socialWorker.ngo_id) + .then((r) => r.map((s) => s.id)); + ngoIds = [socialWorker.ngo_id]; + } + + if ( + (panelFlaskTypeId === FlaskUserTypesEnum.ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN) && + Number(status) === PreRegisterStatusEnum.NOT_REGISTERED + ) { + return await this.childrenService.getChildrenPreRegisterNotRegistered( + { + page: page, + limit: limit, + path: '/', + }, + status, + ); + } + + return await this.childrenService.getChildrenPreRegisters( + { + page: page, + limit: limit, + path: '/', + }, + status, + ngoIds ? ngoIds : [socialWorker.ngo_id], + panelFlaskTypeId === FlaskUserTypesEnum.SOCIAL_WORKER + ? [panelFlaskUserId] + : swIds, + ); + } + + @Get(`all`) + @ApiOperation({ description: 'Get all children from db' }) + async getChildren(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) && + !( + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.childrenService.getChildren(); + } + + @Get(`all/actives`) + @ApiOperation({ description: 'Get all active children from flask db' }) + async getActiveChildren(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) && + !( + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.childrenService.getFlaskActiveChildren(); + } + + @ApiOperation({ + description: 'update child', + }) + @Patch(`flaskChildId=:flaskChildId`) + @UseInterceptors(FileInterceptor('voiceFile', voiceStorage)) + @UsePipes(new ValidationPipe()) + async updateChild( + @Req() req: Request, + @UploadedFile() voiceFile: Express.Multer.File, + @Body() body, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) && + !( + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + let theVoiceFile: File; + if (voiceFile) { + const fileBuffer = await fs.promises.readFile( + `uploads/children/voices/${voiceFile.filename}`, + ); + + theVoiceFile = new File([fileBuffer], `${voiceFile.filename}`, { + type: voiceFile.mimetype, + }); + } + console.log(body); + console.log(theVoiceFile); + + return theVoiceFile; + } + + @Get(`check/names/:newName/:lang`) + @ApiOperation({ description: 'Check similar names' }) + async checkChildrenNames( + @Param('newName') newName: string, + @Param('lang') lang: 'fa' | 'en', + @Req() req: Request, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + !( + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + const confirmedNames = ( + await this.childrenService.getFlaskChildrenNames() + ).map((r) => r.sayname_translations); + + const preNames = (await this.childrenService.getPreChildrenNames()).map( + (r) => r.sayName, + ); + + const names = confirmedNames.concat(preNames); + + // to minimize human mistakes, we also compare the last 3 chars - همادخت vs هُمادخت + const found = names.filter((n) => + lang === 'en' + ? n.en.toUpperCase() === newName.toUpperCase() || + (n.en && + n.en.slice(-3).toUpperCase() === newName.slice(-3).toUpperCase()) + : n.fa === newName || (n.fa && n.fa.slice(-3) === newName.slice(-3)), + ); + + return { + found, + total: found.length, + }; + } + + @Get(`generate/say/names`) + @ApiOperation({ description: 'Get all children from db' }) + async generateNames(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) && + !( + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.downloadService.excelStream( + 'dist/features/children/resources/names.xlsx', + ); + } + + @UseInterceptors(ChildrenInterceptor) + @Post(`flask/all`) + @ApiOperation({ description: 'Get all flask children from db' }) + async getFlaskChildren( + @Req() req: Request, + @Body() + body: { + isMigrated: boolean; + statuses: ChildExistence[]; + isConfirmed: ChildConfirmation; + }, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + + const X_LIMIT = parseInt(req.headers['x-limit']); + const X_TAKE = parseInt(req.headers['x-take']); + const limit = X_LIMIT > 100 ? 100 : X_LIMIT; + const page = X_TAKE + 1; + + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not the Super admin'); + } + + if ( + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) { + const socialWorkerIds = await this.userService + .getFlaskSwIds() + .then((r) => r.map((s) => s.id)); + + return await this.childrenService.getFlaskChildren( + { + page: page, + limit: limit, + path: '/', + }, + body, + socialWorkerIds, + ); + } else if (panelFlaskTypeId === FlaskUserTypesEnum.NGO_SUPERVISOR) { + const user = await this.userService.getFlaskSw(panelFlaskUserId); + + const socialWorkerIds = await this.userService + .getFlaskSocialWorkersByNgo(user.ngo_id) + .then((r) => r.map((s) => s.id)); + + return await this.childrenService.getFlaskChildren( + { + page: page, + limit: limit, + path: '/', + }, + body, + socialWorkerIds, + ); + } else { + const socialWorkerIds = [panelFlaskUserId]; + return await this.childrenService.getFlaskChildren( + { + page: page, + limit: limit, + path: '/', + }, + body, + socialWorkerIds, + ); + } + } + + @Get(`flask/child/needs-summary/:childId`) + @ApiOperation({ description: 'Get a single child needs summary by ID' }) + async getChildNeedsSummary( + @Req() req: Request, + @Param('childId') childId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized'); + } + const token = + config().dataCache.fetchPanelAuthentication(panelFlaskUserId).token; + return await this.childrenService.getChildNeedsSummery(token, childId); + } + + @Get(`no-need`) + @ApiOperation({ description: 'Get children with no need' }) + async childrenWithNoNeed(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized'); + } + + return await this.campaignService.childrenWithNoNeed(); + } + + @Get('/network') + getAvailableContributions(@Req() req: Request) { + const dappFlaskUserId = req.headers['dappFlaskUserId']; + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } + return this.childrenService.getTheNetwork(); + } + + @Get('avatars/images/:fileName') + async serveAwakeAvatar( + @Param('fileName') fileName: string, + @Res() res: any, + ): Promise { + try { + res.sendFile(fileName, { root: './uploads/children/avatars' }); + } catch (e) { + console.log(e); + } + } + + @Get('voices/:fileName') + async serveVoice( + @Param('fileName') fileName: string, + @Res() res: any, + ): Promise { + res.sendFile(fileName, { root: './uploads/children/voices' }); + } +} diff --git a/src/features/children/children.module.ts b/src/features/children/children.module.ts index 9804c7ce9a..debd0c9508 100644 --- a/src/features/children/children.module.ts +++ b/src/features/children/children.module.ts @@ -1,5 +1,10 @@ import { HttpModule } from '@nestjs/axios'; -import { Module } from '@nestjs/common'; +import { + MiddlewareConsumer, + Module, + NestModule, + RequestMethod, +} from '@nestjs/common'; import { ScheduleModule } from '@nestjs/schedule'; import { TypeOrmModule } from '@nestjs/typeorm'; import { NeedEntity } from '../../entities/need.entity'; @@ -7,14 +12,109 @@ import { ChildrenEntity } from '../../entities/children.entity'; import { NeedService } from '../need/need.service'; import { ChildrenController } from './children.controller'; import { ChildrenService } from './children.service'; -import { NgoEntity } from '../../entities/ngo.entity'; +import { NgoArrivalEntity, NgoEntity } from '../../entities/ngo.entity'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { ChildrenMiddleware } from './middlewares/children.middleware'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { UserService } from '../user/user.service'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { LocationService } from '../location/location.service'; +import { LocationEntity } from 'src/entities/location.entity'; +import { Cities } from 'src/entities/flaskEntities/cities.entity'; +import { DownloadService } from '../download/download.service'; +import { NgoService } from '../ngo/ngo.service'; +import { NGO } from 'src/entities/flaskEntities/ngo.entity'; +import { Countries } from 'src/entities/flaskEntities/countries.entity'; +import { SyncService } from '../sync/sync.service'; +import { ReceiptService } from '../receipt/receipt.service'; +import { PaymentService } from '../payment/payment.service'; +import { StatusService } from '../status/status.service'; +import { ProviderService } from '../provider/provider.service'; +import { ReceiptEntity } from 'src/entities/receipt.entity'; +import { PaymentEntity } from 'src/entities/payment.entity'; +import { StatusEntity } from 'src/entities/status.entity'; +import { ProviderJoinNeedEntity } from 'src/entities/provider.Join.need..entity'; +import { ProviderEntity } from 'src/entities/provider.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; @Module({ - imports: [ - TypeOrmModule.forFeature([ChildrenEntity, NeedEntity, NgoEntity]), - ScheduleModule.forRoot(), - HttpModule, - ], - controllers: [ChildrenController], - providers: [ChildrenService, NeedService, ChildrenService], -}) export class ChildrenModule { } + imports: [ + TypeOrmModule.forFeature( + [ + Need, + Child, + Payment, + SocialWorker, + UserFamily, + Family, + User, + Cities, + NGO, + Countries, + Payment, + Receipt, + NeedReceipt, + ], + 'flaskPostgres', + ), + TypeOrmModule.forFeature([ + ChildrenEntity, + NeedEntity, + VariableEntity, + NgoEntity, + ContributorEntity, + AllUserEntity, + EthereumAccountEntity, + ChildrenPreRegisterEntity, + LocationEntity, + NgoEntity, + NgoArrivalEntity, + ReceiptEntity, + PaymentEntity, + StatusEntity, + ProviderJoinNeedEntity, + ProviderEntity, + ]), + ScheduleModule.forRoot(), + HttpModule, + ], + controllers: [ChildrenController], + providers: [ + ChildrenService, + NeedService, + ChildrenService, + UserService, + LocationService, + NgoService, + DownloadService, + SyncService, + ReceiptService, + PaymentService, + StatusService, + ProviderService, + ], +}) +export class ChildrenModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer + .apply(ChildrenMiddleware) + .exclude( + { + path: 'children/avatars/images/:fileName', + method: RequestMethod.GET, + }, + { path: 'children/voices/:fileName', method: RequestMethod.GET }, + { path: `children/preregister/old`, method: RequestMethod.GET }, + ) + .forRoutes(ChildrenController); + } +} diff --git a/src/features/children/children.service.ts b/src/features/children/children.service.ts index 08df60eb61..0332eb08f4 100644 --- a/src/features/children/children.service.ts +++ b/src/features/children/children.service.ts @@ -1,111 +1,537 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { ChildParams } from '../../types/parameters/ChildParameters'; -import { Repository } from 'typeorm'; +import { Repository, UpdateResult } from 'typeorm'; import { ChildrenEntity } from '../../entities/children.entity'; -import { - Pagination, - IPaginationOptions, - paginate, -} from 'nestjs-typeorm-paginate'; -import { from, map, Observable } from 'rxjs'; import { ChildAPIApi } from 'src/generated-sources/openapi'; +import { NeedSummary } from 'src/types/interfaces/Need'; +import { + ChildParams, + PreRegisterChildPrepareParams, + PreRegisterChildUpdateApprovedParams, + PreRegisterChildUpdateParams, + createFlaskChildParams, +} from 'src/types/parameters/ChildParameters'; +import { NgoEntity } from 'src/entities/ngo.entity'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { + ChildConfirmation, + ChildExistence, + PreRegisterStatusEnum, + SexEnum, +} from 'src/types/interfaces/interface'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { User } from 'src/entities/flaskEntities/user.entity'; +import { NGO } from 'src/entities/flaskEntities/ngo.entity'; +import { + Paginated, + PaginateQuery, + paginate as nestPaginate, +} from 'nestjs-paginate'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { Observable, from } from 'rxjs'; +import { LocationEntity } from 'src/entities/location.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; @Injectable() export class ChildrenService { constructor( + @InjectRepository(ChildrenPreRegisterEntity) + private preRegisterChildrenRepository: Repository, @InjectRepository(ChildrenEntity) private childrenRepository: Repository, + @InjectRepository(Child, 'flaskPostgres') + private flaskChildRepository: Repository, ) { } - async getChildNeedsSummeay(accessToken: any, childId: number - ): Promise { + async countChildren(ngoIds: number[]) { + return this.flaskChildRepository + .createQueryBuilder('child') + .select(['child']) + .where('child.isConfirmed = :childConfirmed', { childConfirmed: true }) + .andWhere('child.isDeleted = :childDeleted', { childDeleted: false }) + .andWhere('child.isMigrated = :childIsMigrated', { + childIsMigrated: false, + }) + .andWhere('child.existence_status IN (:...existenceStatus)', { + existenceStatus: [ChildExistence.AlivePresent], + }) + .andWhere('child.id_ngo IN (:...ngoIds)', { + ngoIds: [...ngoIds], + }) + .getCount(); + } + + getFlaskChild(flaskChildId: number) { + return this.flaskChildRepository.findOne({ + where: { id: flaskChildId }, + }); + } + + async getFlaskChildrenSimple(): Promise { + return this.flaskChildRepository + .createQueryBuilder('child') + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + .where('child.isMigrated = :childIsMigrated', { + childIsMigrated: false, + }) + .andWhere('child.id_ngo NOT IN (:...testNgoIds)', { + testNgoIds: [3, 14], + }) + .cache(60000) + .getMany(); + } + + async addChildToFlask( + accessToken: any, + childDetails: createFlaskChildParams, + ): Promise { + const childApi = new ChildAPIApi(); + const child = childApi.apiV2ChildAddPost( + accessToken, + childDetails.awakeAvatarUrl, + childDetails.sleptAvatarUrl, + childDetails.voiceUrl, + childDetails.saynameTranslations, + childDetails.bioTranslations, + childDetails.bioSummaryTranslations, + childDetails.phoneNumber, + childDetails.country, + childDetails.city, + childDetails.gender, + childDetails.ngoId, + childDetails.swId, + childDetails.firstNameTranslations, + childDetails.lastNameTranslations, + childDetails.nationalityId, + childDetails.birthPlace, + childDetails.birthDate, + childDetails.address, + childDetails.housingStatus, + childDetails.familyCount, + childDetails.education, + 0, + ); + return child; + } + + async getChildNeedsSummery( + accessToken: any, + childId: number, + ): Promise { const childApi = new ChildAPIApi(); - const needs: Promise = childApi.apiV2ChildChildIdNeedsSummaryGet(accessToken, childId).then((r) => r - ).catch((e) => e) + const needs = childApi.apiV2ChildChildIdNeedsSummaryGet( + accessToken, + childId, + ); return needs; } + createPreRegisterChild( + awakeUrl: string, + sleptUrl: string, + sayName: { fa: string; en: string }, + sex: SexEnum, + ): Promise { + const newChild = this.preRegisterChildrenRepository.create({ + awakeUrl, + sleptUrl, + sayName: { fa: sayName.fa, en: sayName.en }, + sex, + }); + return this.preRegisterChildrenRepository.save(newChild); + } + + approvePreregister( + preRegister: ChildrenPreRegisterEntity, + firstNameEn: string, + lastNameEn: string, + bioEn: string, + flaskChildId: number, + voiceUrl: string, + ): Promise { + return this.preRegisterChildrenRepository.update( + { id: preRegister.id }, + { + status: PreRegisterStatusEnum.CONFIRMED, + flaskChildId, + firstName: { fa: preRegister.firstName.fa, en: firstNameEn }, + lastName: { fa: preRegister.lastName.fa, en: lastNameEn }, + bio: { fa: preRegister.bio.fa, en: bioEn }, + voiceUrl, + }, + ); + } + + preRegisterAssignChild( + theId: string, + childDetails: PreRegisterChildPrepareParams, + location: LocationEntity, + ngo: NgoEntity, + sw: ContributorEntity, + ): Promise { + return this.preRegisterChildrenRepository.update( + { id: theId }, + { + ...childDetails, + firstName: { + fa: childDetails.firstName.fa, + en: childDetails.firstName.en, + }, + lastName: { fa: childDetails.lastName.fa, en: '' }, + bio: { fa: childDetails.bio.fa, en: '' }, + location, + ngo, + socialWorker: sw, + }, + ); + } + + preRegisterUpdate( + theId: string, + childDetails: PreRegisterChildUpdateParams, + ): Promise { + return this.preRegisterChildrenRepository.update( + { id: theId }, + { + ...childDetails, + firstName: { + fa: childDetails.firstName.fa, + en: childDetails.firstName.en, + }, + lastName: { fa: childDetails.lastName.fa, en: '' }, + bio: { fa: childDetails.bio.fa, en: '' }, + }, + ); + } + + preRegisterUpdateApproved( + flaskChildId: number, + theId: string, + childDetails: PreRegisterChildUpdateApprovedParams, + ): Promise { + return this.preRegisterChildrenRepository.update( + { id: theId }, + { flaskChildId, ...childDetails }, + ); + } + + createChild( + childDetails: ChildParams, + ngo: NgoEntity, + socialWorker: ContributorEntity, + ): Promise { + const newChild = this.childrenRepository.create({ + ...childDetails, + ngo: ngo, + socialWorker: socialWorker, + flaskSwId: socialWorker.flaskUserId, + flaskNgoId: ngo.flaskNgoId, + }); + + return this.childrenRepository.save({ ...newChild }); + } + + updateChild( + childDetails: ChildParams, + child: ChildrenEntity, + ): Promise { + return this.childrenRepository.update( + { id: child.id }, + { ...childDetails }, + ); + } getChildren(): Promise { return this.childrenRepository.find(); } - getChildById(flaskChildId: number): Promise { - const child = this.childrenRepository.findOne({ + getChildrenPreRegisterByFlaskId( + flaskChildId: number, + ): Promise { + return this.preRegisterChildrenRepository.findOne({ where: { - flaskChildId: flaskChildId, + flaskChildId, }, }); - return child; } - createChild(childDetails: ChildParams): Promise { - const newChild = this.childrenRepository.create({ - flaskChildId: childDetails.flaskChildId, - sleptAvatarUrl: childDetails.sleptAvatarUrl, - awakeAvatarUrl: childDetails.awakeAvatarUrl, - bio: childDetails.bio, - bioSummary: childDetails.bioSummary, - bioSummaryTranslations: childDetails.bioSummaryTranslations, - bioTranslations: childDetails.bioTranslations, - birthDate: childDetails.birthDate && new Date(childDetails.birthDate), - birthPlace: childDetails.birthPlace, - city: childDetails.city, - confirmDate: childDetails.confirmDate && new Date(childDetails.confirmDate), - country: childDetails.country, - created: childDetails.created && new Date(childDetails.created), - doneNeedsCount: childDetails.doneNeedsCount, - education: childDetails.education, - existenceStatus: childDetails.existenceStatus, - familyCount: childDetails.familyCount, - generatedCode: childDetails.generatedCode, - housingStatus: childDetails.housingStatus, - ngo: childDetails.ngo, - socialWorker: childDetails.socialWorker, - supervisor: childDetails.supervisor, - flaskSwId: childDetails.flaskSwId, - flaskSupervisorId: childDetails.flaskSupervisorId, - isConfirmed: childDetails.isConfirmed, - isDeleted: childDetails.isDeleted, - isMigrated: childDetails.isMigrated, - isGone: childDetails.isGone, - migrateDate: childDetails.migrateDate && new Date(childDetails.migrateDate), - migratedId: childDetails.migratedId, - nationality: childDetails.nationality, - sayFamilyCount: childDetails.sayFamilyCount, - sayName: childDetails.sayName, - sayNameTranslations: childDetails.sayNameTranslations, - status: childDetails.status, - updated: childDetails.updated && new Date(childDetails.updated), - voiceUrl: childDetails.voiceUrl, + async getChildrenPreRegisters( + options: PaginateQuery, + status: PreRegisterStatusEnum, + ngoIds: number[], + swIds: number[], + ): Promise> { + const queryBuilder = this.preRegisterChildrenRepository + .createQueryBuilder('preRegister') + .leftJoinAndMapOne( + 'preRegister.location', + LocationEntity, + 'location', + 'location.flaskCityId = preRegister.city', + ) + .leftJoinAndMapOne( + 'preRegister.socialWorker', + AllUserEntity, + 'socialWorker', + 'socialWorker.flaskUserId = preRegister.flaskSwId', + ) + .leftJoinAndMapOne( + 'preRegister.ngo', + NgoEntity, + 'ngo', + 'ngo.flaskNgoId = preRegister.flaskNgoId', + ) + .where('preRegister.status = :status', { + status, + }) + .andWhere('ngo.flaskNgoId IN (:...ngoIds)', { + ngoIds: [...ngoIds], + }) + .andWhere('preRegister.flaskSwId IN (:...swIds)', { + swIds: swIds, + }) + .andWhere('socialWorker.isContributor = :isContributor', { + isContributor: true, + }); + + return await nestPaginate( + options, + queryBuilder, + { + defaultSortBy: [['createdAt', 'DESC']], + sortableColumns: ['id'], + nullSort: 'last', + }, + ); + } + + async getChildrenPreRegisterNotRegistered( + options: PaginateQuery, + status: PreRegisterStatusEnum, + ): Promise> { + const queryBuilder = this.preRegisterChildrenRepository + .createQueryBuilder('preRegister') + .leftJoinAndMapOne( + 'preRegister.location', + LocationEntity, + 'location', + 'location.flaskCityId = preRegister.city', + ) + .where('preRegister.status = :status', { + status, + }); + return await nestPaginate( + options, + queryBuilder, + { + defaultSortBy: [['createdAt', 'DESC']], + sortableColumns: ['id'], + nullSort: 'last', + }, + ); + } + + //no pagination + getChildrenPreRegisterSimple( + status: PreRegisterStatusEnum, + ): Promise { + return this.preRegisterChildrenRepository.find({ + where: { + status: status, + }, }); - return this.childrenRepository.save(newChild) } - getSocialWorkerChildren(flaskSwId: number): Promise { - return this.childrenRepository.find({ + + + async getFlaskChildren( + options: PaginateQuery, + body: { + isMigrated: boolean; + statuses: ChildExistence[]; + isConfirmed: ChildConfirmation; + }, + socialWorkerIds: number[], + ): Promise> { + const queryBuilder = this.flaskChildRepository + .createQueryBuilder('child') + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + .where('child.isMigrated = :childIsMigrated', { + childIsMigrated: body.isMigrated, + }) + .andWhere('ngo.isDeleted = :isDeleted', { isDeleted: false }) + .andWhere('child.isConfirmed IN (:...childConfirmed)', { + childConfirmed: + body.isConfirmed === ChildConfirmation.CONFIRMED + ? [true] + : ChildConfirmation.NOT_CONFIRMED + ? [false] + : ChildConfirmation.BOTH && [true, false], + }) + .andWhere('child.id_social_worker IN (:...socialWorkerIds)', { + socialWorkerIds: [...socialWorkerIds], + }) + .andWhere('child.existence_status IN (:...existenceStatuses)', { + existenceStatuses: + body.statuses[0] >= 0 + ? [...body.statuses] + : [ + ChildExistence.DEAD, + ChildExistence.AlivePresent, + ChildExistence.AliveGone, + ChildExistence.TempGone, + ], + }) + + .andWhere('child.id_ngo NOT IN (:...testNgoIds)', { + testNgoIds: [3, 14], + }) + .cache(60000); + + return await nestPaginate(options, queryBuilder, { + sortableColumns: ['id'], + defaultSortBy: [['isConfirmed', 'ASC']], + nullSort: 'last', + }); + } + + async getFlaskActiveChildren(): Promise { + return await this.flaskChildRepository + .createQueryBuilder('child') + .where('child.isConfirmed = :childConfirmed', { childConfirmed: true }) + .andWhere('child.isDeleted = :isDeleted', { isDeleted: false }) + .andWhere('child.existence_status = :existence_status', { + existence_status: ChildExistence.AlivePresent, + }) + .andWhere('child.isMigrated = :childIsMigrated', { + childIsMigrated: false, + }) + .andWhere('child.id_ngo NOT IN (:...testNgoIds)', { + testNgoIds: [3, 14], + }) + .getMany(); + } + + async getFlaskChildrenNames(): Promise { + return await this.flaskChildRepository + .createQueryBuilder('child') + .select(['child.sayname_translations']) + .getMany(); + } + + async getPreChildrenNames(): Promise { + return await this.preRegisterChildrenRepository + .createQueryBuilder('child') + .where('child.status != :status', { + status: PreRegisterStatusEnum.CONFIRMED, + }) + .select(['child.sayName']) + .getMany(); + } + + async getPreChildrenByName(sayNameEn: string): Promise { + return await this.preRegisterChildrenRepository + .createQueryBuilder('child') + // .where('child.status != :status', { + // status: PreRegisterStatusEnum.CONFIRMED, + // }) + .where("child.sayName -> 'en' = :sayName", { + sayName: sayNameEn, + }) + .select(['child.sayName']) + .getMany(); + } + + getChildPreRegisterById(id: string): Promise { + const child = this.preRegisterChildrenRepository.findOne({ where: { - flaskSwId - } + id: id, + }, }); + return child; } + getChildById(flaskId: number): Promise { + const child = this.childrenRepository.findOne({ + relations: { ngo: true }, + where: { + flaskId: flaskId, + }, + }); + return child; + } - async getSupervisorConfirmedChildren(flaskSwId: number, - options: IPaginationOptions, - ): Promise>> { - return from( - paginate(this.childrenRepository, options, { - relations: { - supervisor: true - }, - where: { - isDeleted: false, - isConfirmed: true, - flaskSupervisorId: flaskSwId - }, - }), - ).pipe(map((needs: Pagination) => needs)); + async getMyChildren(userId: number): Promise { + return await this.flaskChildRepository + .createQueryBuilder('child') + .leftJoinAndMapOne( + 'child.family', + Family, + 'family', + 'family.id_child = child.id', + ) + .innerJoinAndMapMany( + 'family.members', + UserFamily, + 'userFamily', + 'userFamily.id_family = family.id', + ) + .where('userFamily.id_user = :userId', { userId: userId }) + // .andWhere('child.existence_status IN (:...existence_status)', { + // existence_status: [ChildExistence.AlivePresent], + // }) + .andWhere('userFamily.isDeleted = :isDeleted', { isDeleted: false }) + .select(['child', 'family', 'userFamily']) + .getMany(); + } + + async getTheNetwork(): Promise { + return this.flaskChildRepository + .createQueryBuilder('child') + .leftJoinAndMapOne( + 'child.family', + Family, + 'family', + 'family.id_child = child.id', + ) + .leftJoinAndMapMany( + 'family.currentMembers', + UserFamily, + 'userFamily', + 'userFamily.id_family = family.id', + ) + .innerJoinAndMapOne( + 'userFamily.user', + User, + 'user', + 'user.id = userFamily.id_user', + ) + + .where('child.isConfirmed = :isConfirmed', { isConfirmed: true }) + .andWhere('child.isDeleted = :isDeleted', { isDeleted: false }) + .andWhere('child.isMigrated = :childIsMigrated', { + childIsMigrated: false, + }) + .andWhere('child.existence_status = :existence_status', { + existence_status: ChildExistence.AlivePresent, + }) + .andWhere('child.id_ngo NOT IN (:...testNgoIds)', { + testNgoIds: [3, 14], + }) + .select([ + 'child.id', + 'child.awakeAvatarUrl', + 'family.id', + 'userFamily.id', + 'user.id', + 'user.avatarUrl', + ]) + .cache(10000) + .getMany(); + } + async deletePreRegister(id: string): Promise> { + return from(this.preRegisterChildrenRepository.delete(id)); } } diff --git a/src/features/children/interceptors/children.interceptors.ts b/src/features/children/interceptors/children.interceptors.ts new file mode 100644 index 0000000000..f7a446dda8 --- /dev/null +++ b/src/features/children/interceptors/children.interceptors.ts @@ -0,0 +1,22 @@ +import { + Injectable, + NestInterceptor, + ExecutionContext, + CallHandler, +} from '@nestjs/common'; +import { Observable } from 'rxjs'; +import { tap } from 'rxjs/operators'; + +@Injectable() +export class ChildrenInterceptor implements NestInterceptor { + intercept(context: ExecutionContext, next: CallHandler): Observable { + console.log('Intercepting Children...'); + console.log('Before...'); + const request = context.getArgByIndex(0); + + const now = Date.now(); + return next + .handle() + .pipe(tap(() => console.log(`After... ${Date.now() - now}ms`))); + } +} diff --git a/src/features/children/middlewares/children.middleware.ts b/src/features/children/middlewares/children.middleware.ts new file mode 100644 index 0000000000..184295b5ab --- /dev/null +++ b/src/features/children/middlewares/children.middleware.ts @@ -0,0 +1,36 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class ChildrenMiddleware implements NestMiddleware { + private readonly logger = new Logger(ChildrenMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/children/pipes/validate-child.ts/validate-child.ts.pipe.ts b/src/features/children/pipes/validate-child.ts/validate-child.ts.pipe.ts index 9f0c0241cd..dfda034684 100644 --- a/src/features/children/pipes/validate-child.ts/validate-child.ts.pipe.ts +++ b/src/features/children/pipes/validate-child.ts/validate-child.ts.pipe.ts @@ -1,9 +1,9 @@ import { ArgumentMetadata, HttpException, HttpStatus, Injectable, PipeTransform } from '@nestjs/common'; -import { CreateChildDto } from 'src/types/dtos/CreateChildren.dto'; +import { Children } from 'src/types/interfaces/Children'; @Injectable() -export class ValidateChildTsPipe implements PipeTransform { - transform(value: CreateChildDto, metadata: ArgumentMetadata) { +export class ValidateChildPipe implements PipeTransform { + transform(value: Children, metadata: ArgumentMetadata) { console.log("Validating Children...") return value; diff --git a/src/features/children/resources/names.xlsx b/src/features/children/resources/names.xlsx new file mode 100644 index 0000000000..a405f7a4f5 Binary files /dev/null and b/src/features/children/resources/names.xlsx differ diff --git a/src/features/children/validate-children.pipe.ts b/src/features/children/validate-children.pipe.ts index 82276528f7..1965c9ac72 100644 --- a/src/features/children/validate-children.pipe.ts +++ b/src/features/children/validate-children.pipe.ts @@ -1,13 +1,10 @@ -import { ArgumentMetadata, HttpException, HttpStatus, Injectable, PipeTransform } from '@nestjs/common'; -import { CreateChildDto } from '../../types/dtos/CreateChildren.dto'; +import { ArgumentMetadata, Injectable, PipeTransform } from '@nestjs/common'; +import { Children } from 'src/types/interfaces/Children'; @Injectable() export class ValidateChildrenPipe implements PipeTransform { - transform(value: CreateChildDto, metadata: ArgumentMetadata) { + transform(value: Children, metadata: ArgumentMetadata) { console.log("Validating Children data...") - if (!value.childId) { - console.log(`passing from a child with no Id in Flask!`) - } return value } } \ No newline at end of file diff --git a/src/features/comment/comment.controller.ts b/src/features/comment/comment.controller.ts new file mode 100644 index 0000000000..e0095666ab --- /dev/null +++ b/src/features/comment/comment.controller.ts @@ -0,0 +1,179 @@ +import { + Body, + Controller, + Delete, + ForbiddenException, + Get, + Param, + Patch, + Post, + Req, + UsePipes, + ValidationPipe, +} from '@nestjs/common'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; +import { CommentService } from './comment.service'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { NeedService } from '../need/need.service'; +import { NeedEntity } from 'src/entities/need.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { UserService } from '../user/user.service'; +import { ValidateCommentPipe } from './pipes/validate-ticket.pipe'; +import { CreateCommentDto } from 'src/types/dtos/CreateComment.dto'; +import { CommentEntity } from 'src/entities/comment.entity'; +import { + FlaskUserTypesEnum, + VirtualFamilyRole, +} from 'src/types/interfaces/interface'; +import { isAuthenticated } from 'src/utils/auth'; + +@ApiTags('Comment') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) +@Controller('comment') +export class CommentController { + constructor( + private readonly commentService: CommentService, + private readonly needService: NeedService, + private userService: UserService, + ) { } + + @Get(`all`) + @ApiOperation({ description: 'Get all comments' }) + async getComments(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.commentService.getComments(); + } + + @Get(`need/:needId`) + @ApiOperation({ description: 'Get the Need comments' }) + async getNeedComments(@Req() req: Request, @Param('needId') needId: string) { + const dappFlaskUserId = req.headers['dappFlaskUserId']; + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } + return await this.commentService.getNeedComments(needId); + } + + @Post('create') + @UsePipes(new ValidationPipe()) + async createComment( + @Req() req: Request, + @Body(ValidateCommentPipe) + body: CreateCommentDto, + ) { + const dappFlaskUserId = Number(req.headers['dappFlaskUserId']); + const panelFlaskUserId = Number(req.headers['panelFlaskUserId']); + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + + let theNeed: NeedEntity; + let theUser: AllUserEntity; + let comment: CommentEntity; + try { + if (!panelFlaskUserId && !dappFlaskUserId) { + throw new ServerError('We need the user Id!'); + } + theNeed = await this.needService.getNeedByFlaskId(body.flaskNeedId); + if (dappFlaskUserId) { + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } + theUser = await this.userService.getUserByFlaskId(dappFlaskUserId); + comment = await this.commentService.createComment( + theUser, + theNeed, + dappFlaskUserId, + { + vRole: body.vRole, + message: body.message, + flaskNeedId: body.flaskNeedId, + }, + ); + await this.needService.updateIsResolved(theNeed.id, false); + } + if (panelFlaskUserId) { + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized'); + } + theUser = await this.userService.getUserByFlaskId(panelFlaskUserId); + comment = await this.commentService.createComment( + theUser, + theNeed, + panelFlaskUserId, + { + vRole: VirtualFamilyRole.SAY, + message: body.message, + flaskNeedId: body.flaskNeedId, + }, + ); + } + } catch (e) { + throw new ServerError(e.message, e.status); + } + + return comment; + } + + @Delete(`:commentId`) + @ApiOperation({ description: 'Delete a comment' }) + async deleteComment( + @Req() req: Request, + @Param('commentId') commentId: string, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + try { + const theComment = await this.commentService.getComment(commentId); + const flaskPanelUserId = Number(req.headers['panelFlaskUserId']); + if (theComment.flaskUserId !== flaskPanelUserId) { + throw new ServerError('You can not delete users comment!'); + } + await this.commentService.deleteOne(theComment.id); + const theNeed = await this.needService.getNeedById(theComment.need.id); + if (theNeed.comments.length === 0) { + await this.needService.updateIsResolved(theNeed.id, true); + } + } catch (e) { + throw new ServerError(e.message, e.status); + } + } + + @Patch(`resolve/:needId`) + @ApiOperation({ description: 'Delete a comment' }) + async updateComment(@Req() req: Request, @Param('needId') needId: string) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + const theNeed = await this.needService.getNeedById(needId); + let isResolved = theNeed.isResolved; + if (isResolved) { + isResolved = false; + } else { + isResolved = true; + } + await this.needService.updateIsResolved(needId, isResolved); + return { isResolved, needId }; + } +} diff --git a/src/features/comment/comment.module.ts b/src/features/comment/comment.module.ts new file mode 100644 index 0000000000..0c50ab2572 --- /dev/null +++ b/src/features/comment/comment.module.ts @@ -0,0 +1,42 @@ +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; +import { CommentService } from './comment.service'; +import { CommentController } from './comment.controller'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { CommentEntity } from 'src/entities/comment.entity'; +import { NeedService } from '../need/need.service'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { NeedEntity } from 'src/entities/need.entity'; +import { CommentMiddleware } from './middlewares/comment.middleware'; +import { UserService } from '../user/user.service'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; + +@Module({ + imports: [ + TypeOrmModule.forFeature( + [User, Need, SocialWorker, Child, Receipt, NeedReceipt], + 'flaskPostgres', + ), + TypeOrmModule.forFeature([ + CommentEntity, + VariableEntity, + NeedEntity, + ContributorEntity, + AllUserEntity, + EthereumAccountEntity, + ]), + ], + controllers: [CommentController], + providers: [CommentService, NeedService, UserService], +}) +export class CommentModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer.apply(CommentMiddleware).forRoutes('comment'); + } +} diff --git a/src/features/comment/comment.service.ts b/src/features/comment/comment.service.ts new file mode 100644 index 0000000000..b90f85f28f --- /dev/null +++ b/src/features/comment/comment.service.ts @@ -0,0 +1,71 @@ +import { Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { Observable, from } from 'rxjs'; +import { CommentEntity } from 'src/entities/comment.entity'; +import { NeedEntity } from 'src/entities/need.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { VirtualFamilyRole } from 'src/types/interfaces/interface'; +import { IsNull, Not, Repository } from 'typeorm'; + +@Injectable() +export class CommentService { + constructor( + @InjectRepository(CommentEntity) + private commentRepository: Repository, + @InjectRepository(NeedEntity) + private needRepository: Repository, + ) {} + + async getComment(commentId: string): Promise { + return await this.commentRepository.findOne({ + where: { + id: commentId, + }, + }); + } + + async getNeedComments(needId: string): Promise { + return this.commentRepository.find({ + relations: { + user: true, + }, + where: { + need: { + id: needId, + }, + }, + }); + } + + async getComments(): Promise { + return this.needRepository.find({ + relations: { comments: true }, + where: { + comments: { + content: Not(IsNull()), + }, + }, + }); + } + + async createComment( + theUser: AllUserEntity, + theNeed: NeedEntity, + flaskUserId: number, + details: { vRole: VirtualFamilyRole; message: string; flaskNeedId: number }, + ): Promise { + const theComment = this.commentRepository.create({ + flaskUserId: flaskUserId, + vRole: details.vRole, + content: details.message, + flaskNeedId: details.flaskNeedId, + }); + theComment.need = theNeed; + theComment.user = theUser; + return await this.commentRepository.save(theComment); + } + + async deleteOne(commentId: string): Promise> { + return from(this.commentRepository.delete(commentId)); + } +} diff --git a/src/features/comment/middlewares/comment.middleware.ts b/src/features/comment/middlewares/comment.middleware.ts new file mode 100644 index 0000000000..45f830ea30 --- /dev/null +++ b/src/features/comment/middlewares/comment.middleware.ts @@ -0,0 +1,35 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class CommentMiddleware implements NestMiddleware { + private readonly logger = new Logger(CommentMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/comment/pipes/validate-ticket.pipe.ts b/src/features/comment/pipes/validate-ticket.pipe.ts new file mode 100644 index 0000000000..002223d1f8 --- /dev/null +++ b/src/features/comment/pipes/validate-ticket.pipe.ts @@ -0,0 +1,10 @@ +import { ArgumentMetadata, Injectable, PipeTransform } from '@nestjs/common'; + +@Injectable() +export class ValidateCommentPipe implements PipeTransform { + transform(value: any, metadata: ArgumentMetadata) { + console.log("Validating Comment...") + + return value; + } +} diff --git a/src/features/contribution/contribution.controller.ts b/src/features/contribution/contribution.controller.ts new file mode 100644 index 0000000000..c40a55891c --- /dev/null +++ b/src/features/contribution/contribution.controller.ts @@ -0,0 +1,111 @@ +import { + Body, + Controller, + Delete, + ForbiddenException, + Get, + Param, + Post, + Req, + UsePipes, + ValidationPipe, +} from '@nestjs/common'; +import { ContributionService } from './contribution.service'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { ValidateContributionPipe } from './pipes/validate-ticket.pipe'; +import { CreateContributionDto } from 'src/types/dtos/contribution/CreateContribution.dto'; +import { isAuthenticated } from 'src/utils/auth'; +import { FlaskUserTypesEnum } from 'src/types/interfaces/interface'; + +@ApiTags('Contribution') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) +@Controller('contribution') +export class ContributionController { + constructor(private readonly contributionService: ContributionService) { } + + @Get('/all') + getAvailableContributions(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + const dappFlaskUserId = req.headers['dappFlaskUserId']; + if (panelFlaskUserId) { + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized'); + } + } + if (dappFlaskUserId) { + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } + } + return this.contributionService.getAvailableContributions(); + } + + @Post('/create') + @UsePipes(new ValidationPipe()) + createContributions( + @Body(ValidateContributionPipe) + body: CreateContributionDto, + ) { + return this.contributionService.create(body.title, body.description); + } + + @Get(`:contributionId`) + @ApiOperation({ description: 'Delete a contribution' }) + async getContribution( + @Req() req: Request, + @Param('contributionId') contributionId: string, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + const dappFlaskUserId = req.headers['dappFlaskUserId']; + if (panelFlaskUserId) { + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized'); + } + } + if (dappFlaskUserId) { + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } + } + + try { + return await this.contributionService.getContribution(contributionId); + } catch (e) { + throw new ServerError(e.message, e.status); + } + } + + @Delete(`:contributionId`) + @ApiOperation({ description: 'Delete a contribution' }) + async deleteContribution( + @Req() req: Request, + @Param('contributionId') contributionId: string, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + + try { + const contribution = await this.contributionService.getContribution( + contributionId, + ); + + await this.contributionService.deleteOne(contribution.id); + } catch (e) { + throw new ServerError(e.message, e.status); + } + } +} diff --git a/src/features/contribution/contribution.module.ts b/src/features/contribution/contribution.module.ts new file mode 100644 index 0000000000..3973f6994f --- /dev/null +++ b/src/features/contribution/contribution.module.ts @@ -0,0 +1,17 @@ +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; +import { ContributionService } from './contribution.service'; +import { ContributionController } from './contribution.controller'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { ContributionEntity } from 'src/entities/contribution.entity'; +import { contributionMiddleware } from './middlewares/comment.middleware'; + +@Module({ + imports: [TypeOrmModule.forFeature([ContributionEntity])], + controllers: [ContributionController], + providers: [ContributionService], +}) +export class ContributionModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer.apply(contributionMiddleware).forRoutes('contribution'); + } +} diff --git a/src/features/contribution/contribution.service.ts b/src/features/contribution/contribution.service.ts new file mode 100644 index 0000000000..4f25e3ec66 --- /dev/null +++ b/src/features/contribution/contribution.service.ts @@ -0,0 +1,41 @@ +import { Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { Observable, from } from 'rxjs'; +import { ContributionEntity } from 'src/entities/contribution.entity'; +import { Repository } from 'typeorm'; + +@Injectable() +export class ContributionService { + constructor( + @InjectRepository(ContributionEntity) + private contributionRepository: Repository, + ) {} + + getAvailableContributions(): Promise { + return this.contributionRepository.find({ + order: { + createdAt: 'DESC', + }, + }); + } + + async getContribution(contributionId: string): Promise { + return await this.contributionRepository.findOne({ + where: { + id: contributionId, + }, + }); + } + + create(title: string, description: string): Promise { + const contribution = this.contributionRepository.create({ + title, + description, + }); + return this.contributionRepository.save(contribution); + } + + async deleteOne(commentId: string): Promise> { + return from(this.contributionRepository.delete(commentId)); + } +} diff --git a/src/features/contribution/middlewares/comment.middleware.ts b/src/features/contribution/middlewares/comment.middleware.ts new file mode 100644 index 0000000000..3db8caeed4 --- /dev/null +++ b/src/features/contribution/middlewares/comment.middleware.ts @@ -0,0 +1,35 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class contributionMiddleware implements NestMiddleware { + private readonly logger = new Logger(contributionMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/contribution/pipes/validate-ticket.pipe.ts b/src/features/contribution/pipes/validate-ticket.pipe.ts new file mode 100644 index 0000000000..6dabcfb53b --- /dev/null +++ b/src/features/contribution/pipes/validate-ticket.pipe.ts @@ -0,0 +1,10 @@ +import { ArgumentMetadata, Injectable, PipeTransform } from '@nestjs/common'; + +@Injectable() +export class ValidateContributionPipe implements PipeTransform { + transform(value: any, metadata: ArgumentMetadata) { + console.log('Validating Contribution...'); + + return value; + } +} diff --git a/src/features/download/api-file-response.decorator.ts b/src/features/download/api-file-response.decorator.ts new file mode 100644 index 0000000000..b341279110 --- /dev/null +++ b/src/features/download/api-file-response.decorator.ts @@ -0,0 +1,14 @@ +import { applyDecorators } from '@nestjs/common'; +import { ApiOkResponse, ApiProduces } from '@nestjs/swagger'; + +export function ApiFileResponse(...mimeTypes: string[]) { + return applyDecorators( + ApiOkResponse({ + schema: { + type: 'string', + format: 'binary', + }, + }), + ApiProduces(...mimeTypes), + ); +} diff --git a/src/features/download/download.controller.ts b/src/features/download/download.controller.ts new file mode 100644 index 0000000000..e890f912a2 --- /dev/null +++ b/src/features/download/download.controller.ts @@ -0,0 +1,104 @@ +import { DownloadService } from './download.service'; +import { + Controller, + ForbiddenException, + Get, + Param, + Query, + Req, + Res, + StreamableFile, + UseInterceptors, +} from '@nestjs/common'; +import { Response } from 'express'; +import { ApiFileResponse } from './api-file-response.decorator'; +import { DownloadInterceptor } from './interceptors/download.interceptors'; +import { ApiHeader, ApiSecurity, ApiTags } from '@nestjs/swagger'; +import { isAuthenticated } from 'src/utils/auth'; +import { FlaskUserTypesEnum } from 'src/types/interfaces/interface'; + +@UseInterceptors(DownloadInterceptor) +@ApiTags('Download') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) +@Controller('download') +export class DownloadController { + constructor(private readonly downloadService: DownloadService) { } + + @Get('buffer/:path') + @ApiFileResponse('image/png') + async buffer( + @Req() req: Request, + @Param('path') path: string, + @Res() response: Response, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + const file = await this.downloadService.imageReadBuffer(path); + response.contentType('image/png'); + response.send(file); + } + + @Get('stream') + async stream( + @Req() req: Request, + @Query('path') path: string, + @Res() response: Response, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + const file = await this.downloadService.imageStream(path); + file.pipe(response); + } + + @Get('streamable') + async streamable(@Query('path') path: string, @Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + const file = await this.downloadService.fileStream(path); + return new StreamableFile(file); // 👈 supports Buffer and Stream + // or + // const file = this.downloadService.fileBuffer(path); + // return file + } + + @Get('streamable2/:flaskNeedId') + async streamable2( + @Req() req: Request, + @Param('flaskNeedId') flaskNeedId: string, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.downloadService.fileStream( + `../midjourney-bot/main/need-images/need-${flaskNeedId}/${flaskNeedId}_1.png`, + ); + } +} diff --git a/src/features/download/download.module.ts b/src/features/download/download.module.ts new file mode 100644 index 0000000000..274c00e1cf --- /dev/null +++ b/src/features/download/download.module.ts @@ -0,0 +1,16 @@ +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; +import { DownloadService } from './download.service'; +import { DownloadController } from './download.controller'; +import { HttpModule } from '@nestjs/axios'; +import { DownloadMiddleware } from './middlewares/download.middleware'; + +@Module({ + imports: [HttpModule], + controllers: [DownloadController], + providers: [DownloadService], +}) +export class DownloadModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer.apply(DownloadMiddleware).forRoutes('download'); + } +} diff --git a/src/features/download/download.service.ts b/src/features/download/download.service.ts new file mode 100644 index 0000000000..f84fcb0375 --- /dev/null +++ b/src/features/download/download.service.ts @@ -0,0 +1,123 @@ +import { HttpService } from '@nestjs/axios'; +import { Injectable, Logger } from '@nestjs/common'; +import { createReadStream, readFileSync } from 'fs'; +import { join } from 'path'; +import { createWriteStream } from 'fs'; +import axios from 'axios'; +import { Readable } from 'stream'; +import { prepareUrl } from 'src/utils/helpers'; +import { ServerError } from 'src/filters/server-exception.filter'; +import mime from 'mime'; +import fs from 'fs'; +import { WalletExceptionFilter } from 'src/filters/wallet-exception.filter'; +import { File } from '@web-std/file'; +import readXlsxFile from 'read-excel-file/node'; + +@Injectable() +export class DownloadService { + private readonly logger = new Logger(DownloadService.name); + constructor(private httpService: HttpService) {} + + // Excel + async excelReadBuffer(path: string) { + // `rows` is an array of rows + // each row being an array of cells. + return readXlsxFile(path); + } + + async excelStream(path: string) { + // `rows` is an array of rows + // each row being an array of cells. + return readXlsxFile(fs.createReadStream(path)); + } + + async excelFileBuffer(path: string) { + // `rows` is an array of rows + // each row being an array of cells. + return readXlsxFile(Buffer.from(fs.readFileSync(path))); + } + + // image and files + async imageReadBuffer(fileName: string) { + return readFileSync(join(process.cwd(), fileName)); + } + + async imageStream(fileName: string) { + return createReadStream(join(process.cwd(), fileName)); + } + + async fileBuffer(fileName: string) { + return readFileSync(join(process.cwd(), fileName)); + } + + async fileStream(fileName: string) { + return createReadStream(join(process.cwd(), fileName)); + } + + async downloadFile(fileUrl: string, path: string) { + if (fileUrl.startsWith('/')) { + fileUrl = fileUrl.slice(1); + } + + // const response = await this.httpService.axiosRef({ + // url: `https://api.sayapp.company/${fileUrl}`, + // method: 'GET', + // responseType: 'stream', + // timeout: 80000, + // headers:{ + // Accept: 'text/html,application/xhtml+xml,application/xml' + // } + // }); + // const config = { + // headers: { + // Accept: 'text/html,application/xhtml+xml,application/xml', + // responseType: 'stream', + // }, + // timeout: 80000, + // }; + + // await firstValueFrom( + // this.httpService + // .get(`https://api.sayapp.company/${fileUrl}`, config) + // .pipe( + // catchError((error: AxiosError) => { + // console.log(error); + // this.logger.error(error.response.data); + // throw 'An error happened!'; + // }), + // ), + // ); + const { data } = await axios.get( + !fileUrl.startsWith('http') ? prepareUrl(fileUrl) : fileUrl, + { + responseType: 'stream', + }, + ); + // now, you can process or transform the data as a Readable type. + const writeStream = createWriteStream(path); + data.pipe(writeStream); // save file to local file system + return new Promise((resolve, reject) => { + writeStream.on('finish', resolve); + writeStream.on('error', reject); + }); + } + + async fileFromPath(url: string, name = 'noTitle'): Promise { + try { + console.log('Downloading ' + name); + await this.downloadFile(url, `${name}`); + const content = await fs.promises.readFile(`${name}`); + if (!content) { + throw new ServerError('could not read the file.'); + } + const type = mime.getType(`${name}`); + + const file = new File([content], `${name}`, { type: type }); + console.log('Downloaded !! ' + name); + return file; + } catch (e) { + console.log(e); + throw new WalletExceptionFilter(e.status, e.message); + } + } +} diff --git a/src/features/download/interceptors/download.interceptors.ts b/src/features/download/interceptors/download.interceptors.ts new file mode 100644 index 0000000000..e92e93347f --- /dev/null +++ b/src/features/download/interceptors/download.interceptors.ts @@ -0,0 +1,23 @@ +import { + Injectable, + NestInterceptor, + ExecutionContext, + CallHandler, + } from '@nestjs/common'; + import { Observable } from 'rxjs'; + import { tap } from 'rxjs/operators'; + + @Injectable() + export class DownloadInterceptor implements NestInterceptor { + intercept(context: ExecutionContext, next: CallHandler): Observable { + console.log('Intercepting Download...'); + console.log('Before...'); + + const now = Date.now(); + return next.handle().pipe( + tap(() => console.log(`After... ${Date.now() - now}ms`)), + tap((response) => console.log(response)), // 👈 response is defined only when StreamableFile is used + ); + } + } + \ No newline at end of file diff --git a/src/features/download/middlewares/download.middleware.ts b/src/features/download/middlewares/download.middleware.ts new file mode 100644 index 0000000000..51e2aaa2aa --- /dev/null +++ b/src/features/download/middlewares/download.middleware.ts @@ -0,0 +1,36 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class DownloadMiddleware implements NestMiddleware { + private readonly logger = new Logger(DownloadMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/family/family.controller.ts b/src/features/family/family.controller.ts new file mode 100644 index 0000000000..bf8eb03eb3 --- /dev/null +++ b/src/features/family/family.controller.ts @@ -0,0 +1,605 @@ +import { + Controller, + ForbiddenException, + Get, + Param, + Patch, + Query, + Req, +} from '@nestjs/common'; +import { FamilyService } from './family.service'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; +import { ChildrenService } from '../children/children.service'; +import { + FlaskUserTypesEnum, + SAY_DAPP_ID, + VirtualFamilyRole, +} from 'src/types/interfaces/interface'; +import config from 'src/config'; +import { ObjectNotFound } from 'src/filters/notFound-expectation.filter'; +import { findQuartileGrant } from 'src/utils/helpers'; +import { + CONTRIBUTION_COEFFICIENT, + Q1_LOWER_COEFFICIENT, + Q1_TO_Q2_COEFFICIENT, + Q2_TO_Q3_COEFFICIENT, + Q3_UPPER_COEFFICIENT, + daysDifference, +} from 'src/utils/helpers'; +import { mean, quantileSeq, round } from 'mathjs'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { PaymentService } from '../payment/payment.service'; +import { NeedService } from '../need/need.service'; +import { isAuthenticated } from 'src/utils/auth'; +import { UserService } from '../user/user.service'; + +@ApiTags('Family') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) +@Controller('family') +export class FamilyController { + constructor( + private readonly familyService: FamilyService, + private userService: UserService, + private childrenService: ChildrenService, + private needService: NeedService, + private paymentService: PaymentService, + ) {} + + @Get('search') + async searchUsers( + @Req() req: Request, + @Query('q') query: string, + ): Promise { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + if (query.length > 3) { + const users = await this.familyService.searchUsers(query); + return { users }; + } + } + + @Get(`my/children/:familyUserId`) + @ApiOperation({ description: 'Get my children' }) + async getMyFamilies( + @Req() req: Request, + @Param('familyUserId') familyUserId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + + return await this.childrenService.getMyChildren(familyUserId); + } + + @Get(`say/payments`) + @ApiOperation({ description: 'Get all family role analysis for a user' }) + async getSayPayments(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.familyService.getFamilyRoleCompletePay( + VirtualFamilyRole.SAY, + Number(SAY_DAPP_ID), + ); + } + + @Get(`roles/ecosystem/payments`) + @ApiOperation({ description: 'Get all family role analysis for a user' }) + async getFamilyRolesCompletePays(@Req() req: Request) { + const dappFlaskUserId = req.headers['dappFlaskUserId']; + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (dappFlaskUserId) { + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } + } + if (panelFlaskUserId) { + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + } + const ecoCompletePayQuartile = config().dataCache.theQuartile(); + const ecoCompletePayAsRole = config().dataCache.fetchFamilyAll(); + const rolesCount = config().dataCache.fetchFamilyCount(); + + return { + ecosystem: { + rolesCount: { + fathersCount: rolesCount.fathersCount, + mothersCount: rolesCount.mothersCount, + amoosCount: rolesCount.amoosCount, + khalehsCount: rolesCount.khalehsCount, + daeisCount: rolesCount.daeisCount, + ammesCount: rolesCount.ammesCount, + totalCount: + rolesCount.fathersCount + + rolesCount.mothersCount + + rolesCount.amoosCount + + rolesCount.khalehsCount + + rolesCount.daeisCount + + rolesCount.ammesCount, + }, + rolesPayCount: { + fathersCompletePay: ecoCompletePayAsRole.fathersData.length, + mothersCompletePay: ecoCompletePayAsRole.mothersData.length, + amoosCompletePay: ecoCompletePayAsRole.amoosData.length, + khalehsCompletePay: ecoCompletePayAsRole.khalehsData.length, + daeisCompletePay: ecoCompletePayAsRole.daeisData.length, + ammesCompletePay: ecoCompletePayAsRole.ammesData.length, + totalCompletePay: + ecoCompletePayAsRole.fathersData.length + + ecoCompletePayAsRole.mothersData.length + + ecoCompletePayAsRole.amoosData.length + + ecoCompletePayAsRole.khalehsData.length + + ecoCompletePayAsRole.daeisData.length + + ecoCompletePayAsRole.ammesData.length, + }, + + ecoCompletePayQuartile, + }, + }; + } + + @Get(`user/coefficients/:needId`) + @ApiOperation({ description: 'Get all needs from db 1' }) + async getNeedCoefficients( + @Param('needId') needId: string, + @Req() req: Request, + ) { + const dappFlaskUserId = req.headers['dappFlaskUserId']; + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (dappFlaskUserId) { + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } + } + if (panelFlaskUserId) { + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + } + const flaskUserId = req.headers['dappFlaskUserId']; + const need = await this.needService.getNeedById(needId); + + if (!need.verifiedPayments.find((p) => p.flaskUserId === flaskUserId)) { + throw new ObjectNotFound('This is not your need!'); + } + const userPay = need.verifiedPayments.find( + (p) => p.flaskUserId === flaskUserId && p.needAmount > 0, + ); + + let payAmountQGrant: number; + let payDurationQGrant: number; + let confirmDurationQGrant: number; + let logisticDurationQGrant: number; + + const onlyAmountsList = []; + const onlyPayDurationList = []; + const onlyConfirmDurationList = []; + const onlyLogisticDurationList = []; + + // payment duration + amount + const paymentDuration = daysDifference(need.confirmDate, userPay.created); + const paymentsInRange = await this.paymentService.getPaymentsInRange( + userPay.created, + need.category, + need.type, + 2, + ); + paymentsInRange[0].forEach((p) => { + onlyAmountsList.push(p.need_amount); + onlyPayDurationList.push(daysDifference(p.need.confirmDate, p.created)); + }); + + // confirm duration + let confirmDuration = daysDifference(need.created, need.confirmDate); + if (confirmDuration < 0) { + // some data from 2019 have wrong confirm dates, such as need 35 + confirmDuration = 0; + } + const confirmsInRange = await this.needService.getConfirmsInRange( + need.confirmDate, + need.category, + need.type, + 2, + ); + confirmsInRange[0].forEach((c) => { + onlyConfirmDurationList.push(daysDifference(c.created, c.confirmDate)); + }); + + // logistic duration + const logisticDuration = daysDifference( + userPay.created, + need.childDeliveryDate, + ); + const logisticsInRange = paymentsInRange; + logisticsInRange[0].forEach((p) => { + onlyLogisticDurationList.push( + daysDifference(p.created, p.need.child_delivery_date), + ); + }); + + // payment amount: lower amount means lower grant + const min_payment_amount = Number(quantileSeq(onlyAmountsList, 0)); //min + const Q1_payment_amount = Number(quantileSeq(onlyAmountsList, 0.25)); + const Q2_payment_amount = Number(quantileSeq(onlyAmountsList, 0.5)); + const Q3_payment_amount = Number(quantileSeq(onlyAmountsList, 0.75)); + const max_payment_amount = Number(quantileSeq(onlyAmountsList, 1)); // max + if (0 < userPay.needAmount && userPay.needAmount <= Q1_payment_amount) { + payAmountQGrant = Q1_LOWER_COEFFICIENT; + } else if ( + Q1_payment_amount < userPay.needAmount && + userPay.needAmount <= Q2_payment_amount + ) { + payAmountQGrant = Q1_TO_Q2_COEFFICIENT; + } else if ( + Q2_payment_amount < userPay.needAmount && + userPay.needAmount <= Q3_payment_amount + ) { + payAmountQGrant = Q2_TO_Q3_COEFFICIENT; + } else if (userPay.needAmount > Q3_payment_amount) { + payAmountQGrant = Q3_UPPER_COEFFICIENT; + } + + // payment duration: lower duration means higher grant + const min_payment_duration = Number(quantileSeq(onlyPayDurationList, 0)); //min + const Q1_payment_duration = Number(quantileSeq(onlyPayDurationList, 0.25)); + const Q2_payment_duration = Number(quantileSeq(onlyPayDurationList, 0.5)); + const Q3_payment_duration = Number(quantileSeq(onlyPayDurationList, 0.75)); + const max_payment_duration = Number(quantileSeq(onlyPayDurationList, 1)); // max + if (paymentDuration > Q3_payment_duration) { + payDurationQGrant = Q1_LOWER_COEFFICIENT; + } else if ( + Q2_payment_duration < paymentDuration && + paymentDuration <= Q3_payment_duration + ) { + payDurationQGrant = Q1_TO_Q2_COEFFICIENT; + } else if ( + Q1_payment_duration < paymentDuration && + paymentDuration <= Q2_payment_duration + ) { + payDurationQGrant = Q2_TO_Q3_COEFFICIENT; + } else if (0 < paymentDuration && paymentDuration <= Q1_payment_duration) { + payDurationQGrant = Q3_UPPER_COEFFICIENT; + } + + // confirm duration: lower duration means higher grant + const min_confirm_duration = Number( + quantileSeq(onlyConfirmDurationList, 0), + ); //min + const Q1_confirm_duration = Number( + quantileSeq(onlyConfirmDurationList, 0.25), + ); + const Q2_confirm_duration = Number( + quantileSeq(onlyConfirmDurationList, 0.5), + ); + const Q3_confirm_duration = Number( + quantileSeq(onlyConfirmDurationList, 0.75), + ); + const max_confirm_duration = Number( + quantileSeq(onlyConfirmDurationList, 1), + ); // max + if (confirmDuration > Q3_confirm_duration) { + confirmDurationQGrant = Q1_LOWER_COEFFICIENT; + } else if ( + Q2_confirm_duration < confirmDuration && + confirmDuration <= Q3_confirm_duration + ) { + confirmDurationQGrant = Q1_TO_Q2_COEFFICIENT; + } else if ( + Q1_confirm_duration < confirmDuration && + confirmDuration <= Q2_confirm_duration + ) { + confirmDurationQGrant = Q2_TO_Q3_COEFFICIENT; + } else if (0 < confirmDuration && confirmDuration <= Q1_confirm_duration) { + confirmDurationQGrant = Q3_UPPER_COEFFICIENT; + } + + // logistic duration: lower duration means higher grant + const min_logistic_duration = Number( + quantileSeq(onlyLogisticDurationList, 0), + ); //min + const Q1_logistic_duration = Number( + quantileSeq(onlyLogisticDurationList, 0.25), + ); + const Q2_logistic_duration = Number( + quantileSeq(onlyLogisticDurationList, 0.5), + ); + const Q3_logistic_duration = Number( + quantileSeq(onlyLogisticDurationList, 0.75), + ); + const max_logistic_duration = Number( + quantileSeq(onlyLogisticDurationList, 1), + ); // max + if (logisticDuration > Q3_logistic_duration) { + logisticDurationQGrant = Q1_LOWER_COEFFICIENT; + } else if ( + Q2_logistic_duration < logisticDuration && + logisticDuration <= Q3_logistic_duration + ) { + logisticDurationQGrant = Q1_TO_Q2_COEFFICIENT; + } else if ( + Q1_logistic_duration < logisticDuration && + logisticDuration <= Q2_logistic_duration + ) { + logisticDurationQGrant = Q2_TO_Q3_COEFFICIENT; + } else if ( + 0 < logisticDuration && + logisticDuration <= Q1_logistic_duration + ) { + logisticDurationQGrant = Q3_UPPER_COEFFICIENT; + } + const payments = need.verifiedPayments.filter( + (p) => p.flaskUserId !== SAY_DAPP_ID && p.needAmount > 0 && p.verified, + ); + const contributionRatio = + payments.length > 1 + ? round((payments.length - 1) * CONTRIBUTION_COEFFICIENT, 2) + : 1; + + if ( + !logisticDurationQGrant || + !confirmDurationQGrant || + !payDurationQGrant || + !payAmountQGrant + ) { + throw new ServerError('Something is not right!'); + } + return { + needLogisticDuration: { + logisticDurationQGrant, + logisticDuration: round(logisticDuration, 2), + min_logistic_duration: round(min_logistic_duration, 2), + Q1_logistic_duration: round(Q1_logistic_duration, 2), + Q2_logistic_duration: round(Q2_logistic_duration, 2), + Q3_logistic_duration: round(Q3_logistic_duration, 2), + max_logistic_duration: round(max_logistic_duration, 2), + }, + needConfirmDuration: { + confirmDurationQGrant, + confirmDuration: round(confirmDuration, 2), + min_confirm_duration: round(min_confirm_duration, 2), + Q1_confirm_duration: round(Q1_confirm_duration, 2), + Q2_confirm_duration: round(Q2_confirm_duration, 2), + Q3_confirm_duration: round(Q3_confirm_duration, 2), + max_confirm_duration: round(max_confirm_duration, 2), + }, + needPaymentDuration: { + payDurationQGrant, + paymentDuration: round(paymentDuration, 2), + min_payment_duration: round(min_payment_duration, 2), + Q1_payment_duration: round(Q1_payment_duration, 2), + Q2_payment_duration: round(Q2_payment_duration, 2), + Q3_payment_duration: round(Q3_payment_duration, 2), + max_payment_duration: round(max_payment_duration, 2), + }, + needPaymentAmount: { + payAmountQGrant, + needAmount: userPay.needAmount, + min_payment_amount, + Q1_payment_amount, + Q2_payment_amount, + Q3_payment_amount, + max_payment_amount, + }, + difficultyRatio: round( + mean([ + logisticDurationQGrant, + confirmDurationQGrant, + payDurationQGrant, + payAmountQGrant, + ]), + 2, + ), + contributionRatio, + // onlyAmountsList, + // onlyPayDurationList, + // onlyConfirmDurationList, + // onlyLogisticDurationList, + }; + } + + @Get(`distanceRatio`) + @ApiOperation({ + description: 'Get virtual family member"s distance ratio', + }) + async getFamilyDistanceRatio(@Req() req: Request) { + const dappFlaskUserId = req.headers['dappFlaskUserId']; + + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } + + const userAsFather = await this.familyService.getFamilyRoleCompletePay( + VirtualFamilyRole.FATHER, + Number(dappFlaskUserId), + ); + const userAsMother = await this.familyService.getFamilyRoleCompletePay( + VirtualFamilyRole.MOTHER, + Number(dappFlaskUserId), + ); + const userAsAmoo = await this.familyService.getFamilyRoleCompletePay( + VirtualFamilyRole.AMOO, + Number(dappFlaskUserId), + ); + const userAsKhaleh = await this.familyService.getFamilyRoleCompletePay( + VirtualFamilyRole.KHALEH, + Number(dappFlaskUserId), + ); + const userAsDaei = await this.familyService.getFamilyRoleCompletePay( + VirtualFamilyRole.DAEI, + Number(dappFlaskUserId), + ); + const userAsAmme = await this.familyService.getFamilyRoleCompletePay( + VirtualFamilyRole.AMME, + Number(dappFlaskUserId), + ); + + const myChildren = await this.childrenService.getMyChildren( + dappFlaskUserId, + ); + // Check if paid at least one need for all my children + let childrenStatus: { + childId: any; + caredFor: boolean; + status: number; + userRole: number; + }; + const childrenList = []; + for await (const child of myChildren) { + const caredFor = await this.familyService.isChildCaredOnce( + dappFlaskUserId, + child.id, + ); + + childrenStatus = { + childId: child.id, + caredFor: caredFor, + status: child.existence_status, + userRole: child.family.members.find( + (m) => m.id_user === Number(dappFlaskUserId), + ).flaskFamilyRole, + }; + childrenList.push(childrenStatus); + } + const ecoCompletePayQuartile = config().dataCache.theQuartile(); + + const distanceRatio = findQuartileGrant( + { + fatherCompletePay: userAsFather[1], + motherCompletePay: userAsMother[1], + amooCompletePay: userAsAmoo[1], + khalehCompletePay: userAsKhaleh[1], + daeiCompletePay: userAsDaei[1], + ammeCompletePay: userAsAmme[1], + }, + childrenList, + ecoCompletePayQuartile.IQRObject, + ); + + return { + distanceRatio: distanceRatio, + // be ware that some needs counted more than once (e.g more than 1 participants, amoo, Khaleh paid) + paid: { + fatherCompletePay: userAsFather[1], + motherCompletePay: userAsMother[1], + amooCompletePay: userAsAmoo[1], + daeiCompletePay: userAsDaei[1], + khalehCompletePay: userAsKhaleh[1], + ammeCompletePay: userAsAmme[1], + }, + }; + } + + @Get(`credit/:flaskUserId`) + @ApiOperation({ description: 'Get all contributors' }) + async getFamilyCredit( + @Param('flaskUserId') flaskUserId: number, + @Req() req: Request, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + !( + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN + ) + ) { + throw new ForbiddenException('You Are not authorized'); + } + + const credit = await this.paymentService.getFamilyCredit(flaskUserId); + return credit; + } + + @Get(`campaigns/statuses`) + @ApiOperation({ description: 'Get all contributors' }) + async getEmailStatus(@Req() req: Request) { + const dappFlaskUserId = req.headers['dappFlaskUserId']; + if (dappFlaskUserId) { + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } + } + let nestFamilyMember = await this.userService.getFamilyByFlaskId( + dappFlaskUserId, + ); + if (!nestFamilyMember) { + nestFamilyMember = await this.userService.createFamily(dappFlaskUserId); + } + return { + monthlyStatus: nestFamilyMember.monthlyCampaign, + newsLetterStatus: nestFamilyMember.newsLetterCampaign, + }; + } + + @Patch(`campaigns/monthly/status`) + @ApiOperation({ description: 'Update monthly campaign status' }) + async updateMonthlyCampaign(@Req() req: Request) { + const dappFlaskUserId = req.headers['dappFlaskUserId']; + if (dappFlaskUserId) { + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } + } + let nestFamilyMember = await this.userService.getFamilyByFlaskId( + dappFlaskUserId, + ); + if (!nestFamilyMember) { + nestFamilyMember = await this.userService.createFamily(dappFlaskUserId); + } + await this.familyService.updateMonthlyCampaign(nestFamilyMember); + return (await this.userService.getFamilyByFlaskId(dappFlaskUserId)) + .monthlyCampaign; + } + + @Patch(`campaign/newsletter/status`) + @ApiOperation({ description: 'Update newsletter campaign status' }) + async updateNewsLetterCampaign(@Req() req: Request) { + const dappFlaskUserId = req.headers['dappFlaskUserId']; + if (dappFlaskUserId) { + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } + } + let nestFamilyMember = await this.userService.getFamilyByFlaskId( + dappFlaskUserId, + ); + if (!nestFamilyMember) { + nestFamilyMember = await this.userService.createFamily(dappFlaskUserId); + } + await this.familyService.updateNewsLetterCampaign(nestFamilyMember); + return (await this.userService.getFamilyByFlaskId(dappFlaskUserId)) + .newsLetterCampaign; + } +} diff --git a/src/features/family/family.module.ts b/src/features/family/family.module.ts new file mode 100644 index 0000000000..5262df6584 --- /dev/null +++ b/src/features/family/family.module.ts @@ -0,0 +1,71 @@ +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; +import { FamilyService } from './family.service'; +import { FamilyController } from './family.controller'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { FamilyMiddleware } from './middlewares/family.middleware'; +import { ChildrenService } from '../children/children.service'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { ChildrenEntity } from 'src/entities/children.entity'; +import { NeedEntity } from 'src/entities/need.entity'; +import { WalletService } from '../wallet/wallet.service'; +import { SignatureEntity } from 'src/entities/signature.entity'; +import { NeedService } from '../need/need.service'; +import { UserService } from '../user/user.service'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { PaymentEntity } from 'src/entities/payment.entity'; +import { PaymentService } from '../payment/payment.service'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; + +@Module({ + imports: [ + TypeOrmModule.forFeature( + [ + Need, + Family, + User, + Child, + SocialWorker, + UserFamily, + Payment, + Receipt, + NeedReceipt, + ], + 'flaskPostgres', + ), + TypeOrmModule.forFeature([ + ChildrenEntity, + VariableEntity, + NeedEntity, + SignatureEntity, + ContributorEntity, + AllUserEntity, + EthereumAccountEntity, + PaymentEntity, + ChildrenPreRegisterEntity, + ]), + ], + controllers: [FamilyController], + providers: [ + FamilyService, + ChildrenService, + WalletService, + NeedService, + UserService, + PaymentService, + ], +}) +export class FamilyModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer.apply(FamilyMiddleware).forRoutes('family'); + } +} diff --git a/src/features/family/family.service.ts b/src/features/family/family.service.ts new file mode 100644 index 0000000000..697c7802f1 --- /dev/null +++ b/src/features/family/family.service.ts @@ -0,0 +1,322 @@ +import { Injectable } from '@nestjs/common'; +import { + PaymentStatusEnum, + SAYPlatformRoles, + VirtualFamilyRole, +} from 'src/types/interfaces/interface'; +import { InjectRepository } from '@nestjs/typeorm'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { And, IsNull, Not, Repository, UpdateResult } from 'typeorm'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { User } from 'src/entities/flaskEntities/user.entity'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { NeedEntity } from 'src/entities/need.entity'; +import { NeedFamily } from 'src/entities/flaskEntities/needFamily'; +import { AllUserEntity } from 'src/entities/user.entity'; + +@Injectable() +export class FamilyService { + constructor( + @InjectRepository(NeedEntity) + private needRepository: Repository, + @InjectRepository(AllUserEntity) + private allUserRepository: Repository, + @InjectRepository(Need, 'flaskPostgres') + private flaskNeedRepository: Repository, + @InjectRepository(User, 'flaskPostgres') + private flaskUserRepository: Repository, + @InjectRepository(Family, 'flaskPostgres') + private flaskFamilyRepository: Repository, + @InjectRepository(UserFamily, 'flaskPostgres') + private flaskUserFamilyRepository: Repository, + ) {} + + async searchUsers(query: string): Promise { + return this.flaskUserRepository + .createQueryBuilder('user') + .where( + 'user.userName ILIKE :query OR user.emailAddress ILIKE :query OR user.phone_number ILIKE :query OR user.firstName ILIKE :query', + { + query: `%${query}%`, + }, + ) + .getMany(); + } + + async getFamilyMembers(familyId: number): Promise { + return await this.flaskFamilyRepository + .createQueryBuilder('family') + .innerJoinAndMapMany( + 'family.members', + UserFamily, + 'userFamily', + 'userFamily.id_family = family.id', + ) + .where('userFamily.id_family = :familyId', { familyId: familyId }) + .andWhere('userFamily.isDeleted = :isDeleted', { isDeleted: false }) + .select(['family', 'userFamily']) + .getManyAndCount(); + } + + async getFamilyRolesCount(vfamilyRole: VirtualFamilyRole): Promise { + return this.flaskUserRepository + .createQueryBuilder('user') + .leftJoinAndMapMany( + 'user.user_families', + UserFamily, + 'userFamily', + 'userFamily.id_user = user.id', + ) + .leftJoinAndMapOne( + 'userFamily.family', + Family, + 'family', + 'family.id = userFamily.id_family', + ) + .andWhere('userFamily.isDeleted = :userFamilyDeleted', { + userFamilyDeleted: false, + }) + .andWhere('userFamily.flaskFamilyRole = :flaskFamilyRole', { + flaskFamilyRole: vfamilyRole, // we have -1 and -2 in data as well (e.g user id:208 is SAY) + }) + .cache(10000) + .getCount(); + } + + async isChildCaredOnce(userId: number, childId: number): Promise { + return await this.flaskUserRepository + .createQueryBuilder('user') + .leftJoinAndMapMany( + 'user.payments', + Payment, + 'payment', + 'payment.id_user = user.id', + ) + .leftJoinAndMapOne( + 'payment.need', + Need, + 'need', + 'need.id = payment.id_need', + ) + .leftJoinAndMapOne( + 'need.child', + Child, + 'child', + 'child.id = need.child_id', + ) + .where('user.id = :userId', { userId: userId }) + .andWhere('child.id = :childId', { childId: childId }) + .andWhere('need.isDeleted = :isNeedDeleted', { isNeedDeleted: false }) + .andWhere('payment.id_user = :pUserId', { pUserId: userId }) + .andWhere('payment.id_need IS NOT NULL') + .andWhere('payment.id IS NOT NULL') + .andWhere('payment.verified IS NOT NULL') + .andWhere('payment.order_id IS NOT NULL') + .getExists(); + } + + async getFamilyRoleCompletePay( + vfamilyRole: VirtualFamilyRole, + userId: number, + ): Promise { + return ( + this.flaskNeedRepository + .createQueryBuilder('need') + .leftJoinAndMapMany( + 'need.participants', + NeedFamily, + 'needFamily', + 'needFamily.id_need = need.id', + ) + .leftJoinAndMapOne( + 'need.child', + Child, + 'child', + 'child.id = need.child_id', + ) + .leftJoinAndMapMany( + 'need.payments', + Payment, + 'payment', + 'payment.id_need = need.id', + ) + .andWhere('need.status >= :statusNotPaid', { + statusNotPaid: PaymentStatusEnum.COMPLETE_PAY, + }) + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .andWhere(userId > 0 && `payment.id_user = :pUserId`, { + pUserId: userId, + }) + .andWhere(userId > 0 && `needFamily.id_user = :nUserId`, { + nUserId: userId, + }) + // -----> From here: diff from what we get on panel delivered column + .andWhere('needFamily.isDeleted = :needFamilyDeleted', { + needFamilyDeleted: false, + }) + .andWhere('needFamily.flaskFamilyRole = :flaskFamilyRole', { + flaskFamilyRole: vfamilyRole, // we have -1 and -2 in data as well (e.g user id:208 is SAY) + }) + //<------- to here + .andWhere('payment.id IS NOT NULL') + .andWhere('payment.verified IS NOT NULL') + .andWhere('payment.id_need IS NOT NULL') + .andWhere('child.id_ngo NOT IN (:...testNgoIds)', { + testNgoIds: [3, 14], + }) + .select([ + 'need.id', + 'need.created', + 'need.child_delivery_date', + 'need._cost', + 'need.status', + 'need.isConfirmed', + 'need.confirmDate', + 'need.isDeleted', + 'need.status', + 'need.child_id', + 'needFamily', + 'payment', + ]) + .cache(10000) + .getManyAndCount() + ); + } + + // async getFamilyPaidNeeds(familyMemberId: number): Promise { + // const payments = await this.paymentRepository.find({ + // relations: { + // need: { + // signatures: true, + // }, + // }, + // where: { + // verified: Not(IsNull()), + // flaskUserId: familyMemberId, + // needAmount: MoreThan(0), + // }, + // }); + // return payments; + // } + + async getAllFamilyReadyToSignNeeds(): Promise { + const needs = this.needRepository.find({ + relations: { + signatures: true, + verifiedPayments: true, + ngo: true, + }, + where: { + signatures: { + role: SAYPlatformRoles.SOCIAL_WORKER, // must be signed by social worker + }, + }, + order: { + signatures: { + createdAt: 'DESC', + }, + }, + }); + return needs; + } + + async getFamilyReadyToSignNeeds(flaskUserId: number): Promise { + return this.needRepository.find({ + relations: { + signatures: true, + verifiedPayments: true, + ngo: true, + }, + where: { + signatures: { + role: SAYPlatformRoles.SOCIAL_WORKER, // must be signed by social worker + }, + verifiedPayments: { + flaskUserId: flaskUserId, + verified: Not(IsNull()), + }, + }, + order: { + createdAt: 'DESC', + }, + }); + } + + async getFamilyReadyToSignOneNeed(needId: string): Promise { + const need = await this.needRepository.findOne({ + relations: { + verifiedPayments: true, + signatures: true, + comments: { + user: true, + }, + }, + where: { + verifiedPayments: { + verified: And(Not(IsNull())), + }, + id: needId, + }, + }); + + return need; + } + + async countFamilySignedNeeds(flaskUserId: number): Promise { + return this.needRepository.count({ + relations: { + signatures: true, + verifiedPayments: true, + ngo: true, + }, + where: { + signatures: { + role: SAYPlatformRoles.FAMILY, // must be signed by social worker + flaskUserId, + }, + verifiedPayments: { + flaskUserId, + verified: Not(IsNull()), + }, + }, + }); + } + + async getChildFamilyMembers( + childFlaskId: number, + paidMembers: number[], + ): Promise { + return this.flaskUserFamilyRepository + .createQueryBuilder('userFamily') + .leftJoinAndMapOne( + 'userFamily.family', + Family, + 'family', + 'family.id = userFamily.id_family', + ) + .andWhere(`family.id_child = :childFlaskId`, { + childFlaskId: childFlaskId, + }) + .andWhere('userFamily.id_user IN (:...paidMembers)', { + paidMembers: paidMembers, + }) + .cache(10000) + .getMany(); + } + + async updateMonthlyCampaign(user: AllUserEntity): Promise { + const newStatus = user.monthlyCampaign ? false : true; + return this.allUserRepository.update(user.id, { + monthlyCampaign: newStatus, + }); + } + + async updateNewsLetterCampaign(user: AllUserEntity): Promise { + const newStatus = user.newsLetterCampaign ? false : true; + return this.allUserRepository.update(user.id, { + newsLetterCampaign: newStatus, + }); + } +} diff --git a/src/features/family/middlewares/family.middleware.ts b/src/features/family/middlewares/family.middleware.ts new file mode 100644 index 0000000000..d21f6202e8 --- /dev/null +++ b/src/features/family/middlewares/family.middleware.ts @@ -0,0 +1,36 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class FamilyMiddleware implements NestMiddleware { + private readonly logger = new Logger(FamilyMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/gateway/gateway.module.ts b/src/features/gateway/gateway.module.ts new file mode 100644 index 0000000000..e0709e2118 --- /dev/null +++ b/src/features/gateway/gateway.module.ts @@ -0,0 +1,41 @@ +import { HttpModule } from '@nestjs/axios'; +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; +import { ScheduleModule } from '@nestjs/schedule'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { NeedEntity } from 'src/entities/need.entity'; +import { TicketEntity } from 'src/entities/ticket.entity'; +import { TicketContentEntity } from 'src/entities/ticketContent.entity'; +import { TicketViewEntity } from 'src/entities/ticketView.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { TicketService } from '../ticket/ticket.service'; +import { UserService } from '../user/user.service'; +import { GateWayController } from './gatway.controller'; +import { GateWayMiddleware } from './middlewares/gateway.middleware'; + +@Module({ + imports: [ + TypeOrmModule.forFeature([SocialWorker, Need, User], 'flaskPostgres'), + TypeOrmModule.forFeature([ + TicketEntity, + TicketContentEntity, + TicketViewEntity, + ContributorEntity, + AllUserEntity, + EthereumAccountEntity, + NeedEntity, + ]), + ScheduleModule.forRoot(), + HttpModule, + ], + controllers: [], + providers: [GateWayController, TicketService, UserService], +}) +export class GatewayModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer.apply(GateWayMiddleware).forRoutes('gateway'); + } +} diff --git a/src/features/gateway/gatway.controller.ts b/src/features/gateway/gatway.controller.ts new file mode 100644 index 0000000000..367243daa4 --- /dev/null +++ b/src/features/gateway/gatway.controller.ts @@ -0,0 +1,269 @@ +import { + Injectable, + OnModuleInit, + UseFilters, + UsePipes, + ValidationPipe, +} from '@nestjs/common'; +import { + SubscribeMessage, + WebSocketGateway, + MessageBody, + WebSocketServer, + ConnectedSocket, +} from '@nestjs/websockets'; +import { Server, Socket } from 'socket.io'; +import { TicketEntity } from 'src/entities/ticket.entity'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { BadRequestTransformationFilter } from 'src/filters/socket-exception.filter'; +import { CreateJoinRoomDto } from 'src/types/dtos/ticket/CreateJoinRoom.dto'; +import { CreateTicketColorDto } from 'src/types/dtos/ticket/CreateTicketColor.dto'; +import { CreateTicketContentDto } from 'src/types/dtos/ticket/CreateTicketContent.dto'; +import { CreateTicketNotificationDto } from 'src/types/dtos/ticket/CreateTicketNotif.dto'; +import { CreateTicketViewDto } from 'src/types/dtos/ticket/CreateTicketView.dto'; +import { + AnnouncementEnum, + PanelContributors, + SAYPlatformRoles, +} from 'src/types/interfaces/interface'; +import { convertFlaskToSayRoles, ticketNotifications } from 'src/utils/helpers'; +import { TicketService } from '../ticket/ticket.service'; +import { UserService } from '../user/user.service'; +import { ValidateGatewayPipe } from './pipes/validate-gateway.pipe'; + +@WebSocketGateway({ + cors: { + origin: [ + 'http://localhost:3000', + 'https://panel.saydao.org', + 'nest.saydao.org', + ], + }, +}) +@Injectable() +export class GateWayController implements OnModuleInit { + constructor( + private ticketService: TicketService, + private userService: UserService, + ) {} + socket: Socket; + currentNotifications: TicketEntity[]; + @WebSocketServer() + server: Server; + + onModuleInit() { + if (!this.socket || !this.socket.connected) { + // server-side Initialization + this.server.on('connection', (socket) => { + this.socket = socket; + console.log('check connection', socket.connected); + this.checkConnection(); + + console.log('\x1b[36m%s\x1b[0m', 'Connected ...'); + console.log( + '\x1b[33m%s\x1b[0m', + `Connected to Socket ${this.socket.id}...\n`, + ); + }); + } + } + checkConnection() { + const count = this.server.engine.getMaxListeners(); + // may or may not be similar to the count of Socket instances in the main namespace, depending on your usage + const count2 = this.server.of('/').sockets.size; + console.log('count total listeners:', count); + console.log('count current listeners:', count2); + } + + @UseFilters(new BadRequestTransformationFilter()) // https://github.com/nestjs/nest/issues/5267 + @UsePipes(new ValidationPipe()) + @SubscribeMessage('check:ticket:notifications') + async onTicketNotifications( + @MessageBody(ValidateGatewayPipe) body: CreateTicketNotificationDto, + @ConnectedSocket() client: Socket, + ) { + this.checkConnection(); + console.log('\x1b[36m%s\x1b[0m', `Checking Unread Tickets...`); + const myTickets = await this.ticketService.getUserTickets(body.flaskUserId); + + const unReads = ticketNotifications(myTickets, body.flaskUserId); + if (unReads && unReads.length > 0) { + console.log( + '\x1b[36m%s\x1b[0m', + `Sending back ${unReads.length} Unread Tickets...\n`, + ); + client.emit(`onUnReadTickets${body.flaskUserId}`, { + newTickets: unReads.map((t) => { + const { id, title, ...others } = t; + return { id, title }; + }), + }); + return unReads; + } else { + console.log( + '\x1b[36m%s\x1b[0m', + `No new Ticket notifications for userId: ${body.flaskUserId} :(...\n`, + ); + client.emit(`onUnReadTickets${body.flaskUserId}`, { + newTickets: [], + }); + } + } + + // @UseFilters(new BadRequestTransformationFilter()) + // @UsePipes(new ValidationPipe()) + // @SubscribeMessage('new:ticket:message') + // async onNewTicketContent( + // @MessageBody(ValidateGatewayPipe) body: CreateTicketContentDto, + // ) { + // this.checkConnection(); + // const { ticket } = await this.ticketService.getTicketById( + // body.ticketId, + // body.from, + // ); + // console.log('\x1b[36m%s\x1b[0m', 'Socket Creating Ticket Content ...\n'); + // const content = await this.ticketService.createTicketContent( + // { + // message: body.message, + // from: body.from, + // announcement: AnnouncementEnum.NONE, + // }, + // ticket, + // ); + // await this.ticketService.updateTicketTime(ticket, body.from); + + // if (this.socket.connected) { + // console.log( + // '\x1b[36m%s\x1b[0m', + // `Sending back the content for ticket: ${body.ticketId}...`, + // ); + // // send message to the room + // this.server + // .to(`room:${ticket.id}`) + // .emit(`onTicketMessage${body.ticketId}`, { + // socketId: this.socket.id, + // content: content, + // }); + // return content; + // } + // } + + // @UseFilters(new BadRequestTransformationFilter()) + // @UsePipes(new ValidationPipe()) + // @SubscribeMessage('new:ticket:view') + // async onNewTicketView( + // @MessageBody(ValidateGatewayPipe) body: CreateTicketViewDto, + // @ConnectedSocket() client: Socket, + // ) { + // console.log('\x1b[36m%s\x1b[0m', 'Socket Updating Views...\n'); + // const { ticket, myView } = await this.ticketService.getTicketById( + // body.ticketId, + // body.flaskUserId, + // ); + // console.log('\x1b[36m%s\x1b[0m', 'Updated my view ...\n'); + // if (this.socket.connected) { + // console.log('\x1b[36m%s\x1b[0m', 'Sending back view details ...\n'); + // client.emit(`onViewMessage${myView.flaskUserId}`, { + // ticketId: ticket.id, + // viewId: myView.id, + // flaskUserId: myView.flaskUserId, + // lastView: myView.viewed, + // socketId: this.socket.id, + // }); + // } + // } + + @UseFilters(new BadRequestTransformationFilter()) + @UsePipes(new ValidationPipe()) + @SubscribeMessage('change:ticket:color') + async onTicketColorChange( + @MessageBody(ValidateGatewayPipe) body: CreateTicketColorDto, + @ConnectedSocket() client: Socket, + ) { + const { ticket: ticketBeforeUpdate } = + await this.ticketService.getTicketById(body.ticketId, body.flaskUserId); + const caller = await this.userService.getFlaskSocialWorker( + body.flaskUserId, + ); + const ticketParticipant = ticketBeforeUpdate.contributors.find( + (c) => c.flaskUserId === body.flaskUserId, + ); + if ( + ticketParticipant && + ticketParticipant.contributions.find( + (c) => c.flaskUserId == body.flaskUserId, + ).panelRole !== PanelContributors.AUDITOR + ) { + throw new ServerError('You are not an AUDITOR'); + } + await this.ticketService.updateTicketColor(body.ticketId, body.color); + const { ticket } = await this.ticketService.getTicketById( + body.ticketId, + body.flaskUserId, + ); + + console.log('\x1b[36m%s\x1b[0m', 'Socket changing ticket color...\n'); + if (this.socket.connected) { + for (let i = 0; i < ticket.contributors.length; i++) { + if (ticket.contributors[i].flaskUserId !== body.flaskUserId) + console.log( + '\x1b[36m%s\x1b[0m', + `Sending back color details user:${ticket.contributors[i].flaskUserId}...\n`, + ); + client.emit(`onColorChange${ticket.contributors[i].flaskUserId}`, { + ticketId: ticket.id, + color: ticket.color, + needFlaskId: ticket.flaskNeedId, + needType: ticket.need.type, + needStatus: ticket.need.status, + }); + if (convertFlaskToSayRoles(caller.type_id) === SAYPlatformRoles.AUDITOR) + console.log( + '\x1b[36m%s\x1b[0m', + `Sending back color details user:${body.flaskUserId}...\n`, + ); + client.emit(`onColorChange${body.flaskUserId}`, { + ticketId: ticket.id, + color: ticket.color, + needFlaskId: ticket.flaskNeedId, + needType: ticket.need.type, + needStatus: ticket.need.status, + }); + } + } + } + + @UseFilters(new BadRequestTransformationFilter()) + @UsePipes(new ValidationPipe()) + @SubscribeMessage('join:room') + async onJoinRoom( + @MessageBody(ValidateGatewayPipe) body: CreateJoinRoomDto, + @ConnectedSocket() client: Socket, + ) { + if (this.socket.connected) { + const { ticket } = await this.ticketService.getTicketById( + body.ticketId, + body.flaskUserId, + ); + console.log('\x1b[36m%s\x1b[0m', `joining room:${ticket.id}...\n`); + client.join(`room:${ticket.id}`); + } + } + + // @UseFilters(new BadRequestTransformationFilter()) + // @UsePipes(new ValidationPipe()) + // @SubscribeMessage('leave:room') + // async onLeaveRoom( + // @MessageBody(ValidateGatewayPipe) body: CreateJoinRoomDto, + // @ConnectedSocket() client: Socket, + // ) { + // if (this.socket.connected) { + // const { ticket } = await this.ticketService.getTicketById( + // body.ticketId, + // body.flaskUserId, + // ); + // console.log('\x1b[36m%s\x1b[0m', `leaving room:${ticket.id}...\n`); + // client.leave(`room:${ticket.id}`); + // } + // } +} diff --git a/src/features/gateway/middlewares/gateway.middleware.ts b/src/features/gateway/middlewares/gateway.middleware.ts new file mode 100644 index 0000000000..0e8215ff2b --- /dev/null +++ b/src/features/gateway/middlewares/gateway.middleware.ts @@ -0,0 +1,13 @@ +import { Injectable, NestMiddleware, ForbiddenException } from '@nestjs/common'; +import { NextFunction } from 'express'; + +@Injectable() +export class GateWayMiddleware implements NestMiddleware { + async use(session: Record, next: NextFunction) { + console.log('GateWay MiddleWare...'); + if (!session.siwe) { + throw new ForbiddenException('You have to first sign_in'); + } + next(); + } +} diff --git a/src/features/gateway/pipes/validate-gateway.pipe.ts b/src/features/gateway/pipes/validate-gateway.pipe.ts new file mode 100644 index 0000000000..14f4a77b18 --- /dev/null +++ b/src/features/gateway/pipes/validate-gateway.pipe.ts @@ -0,0 +1,9 @@ +import { ArgumentMetadata, Injectable, PipeTransform } from '@nestjs/common'; + +@Injectable() +export class ValidateGatewayPipe implements PipeTransform { + transform(value: any, metadata: ArgumentMetadata) { + console.log("Validating Gateway...") + return value; + } +} diff --git a/src/features/ipfs/interceptors/ipfs.interceptors.ts b/src/features/ipfs/interceptors/ipfs.interceptors.ts new file mode 100644 index 0000000000..e87ca9ca4a --- /dev/null +++ b/src/features/ipfs/interceptors/ipfs.interceptors.ts @@ -0,0 +1,22 @@ +import { + Injectable, + NestInterceptor, + ExecutionContext, + CallHandler, + } from '@nestjs/common'; + import { Observable } from 'rxjs'; + import { tap } from 'rxjs/operators'; + + @Injectable() + export class IpfsInterceptor implements NestInterceptor { + intercept(context: ExecutionContext, next: CallHandler): Observable { + console.log('Intercepting IPFS...'); + console.log('Before...'); + + const now = Date.now(); + return next.handle().pipe( + tap(() => console.log(`After... ${Date.now() - now}ms`)), + ); + } + } + \ No newline at end of file diff --git a/src/features/ipfs/ipfs.controller.ts b/src/features/ipfs/ipfs.controller.ts new file mode 100644 index 0000000000..988e5510e0 --- /dev/null +++ b/src/features/ipfs/ipfs.controller.ts @@ -0,0 +1,32 @@ +import { Controller, ForbiddenException, Get, Req } from '@nestjs/common'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; +import { IpfsService } from './ipfs.service'; +import { FlaskUserTypesEnum } from 'src/types/interfaces/interface'; +import { isAuthenticated } from 'src/utils/auth'; + +@ApiTags('IPFS') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) +@Controller('ipfs') +export class IpfsController { + constructor(private readonly ipfsService: IpfsService) { } + + @Get(`all`) + @ApiOperation({ description: 'Get all IPFS' }) + async getProviders(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + + return await this.ipfsService.getAllIpfs(); + } +} diff --git a/src/features/ipfs/ipfs.module.ts b/src/features/ipfs/ipfs.module.ts new file mode 100644 index 0000000000..b2b93c1778 --- /dev/null +++ b/src/features/ipfs/ipfs.module.ts @@ -0,0 +1,65 @@ +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; +import { IpfsService } from './ipfs.service'; +import { IpfsController } from './ipfs.controller'; +import { HttpModule } from '@nestjs/axios'; +import { NeedService } from '../need/need.service'; +import { NeedEntity } from 'src/entities/need.entity'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { IpfsEntity } from 'src/entities/ipfs.entity'; +import { ChildrenService } from '../children/children.service'; +import { ChildrenEntity } from 'src/entities/children.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { PaymentService } from '../payment/payment.service'; +import { PaymentEntity } from 'src/entities/payment.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { DownloadService } from '../download/download.service'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { IpfsMiddleware } from './middlewares/ipfs.middleware'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; + +@Module({ + imports: [ + TypeOrmModule.forFeature( + [ + Need, + Child, + Payment, + SocialWorker, + UserFamily, + Family, + User, + Receipt, + NeedReceipt, + ], + 'flaskPostgres', + ), + TypeOrmModule.forFeature([ + VariableEntity, + NeedEntity, + IpfsEntity, + ChildrenEntity, + PaymentEntity, + ChildrenPreRegisterEntity, + ]), + HttpModule, + ], + controllers: [IpfsController], + providers: [ + IpfsService, + ChildrenService, + NeedService, + PaymentService, + DownloadService, + ], +}) +export class IpfsModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer.apply(IpfsMiddleware).forRoutes('ipfs'); + } +} diff --git a/src/features/ipfs/ipfs.service.ts b/src/features/ipfs/ipfs.service.ts new file mode 100644 index 0000000000..d8e40bc776 --- /dev/null +++ b/src/features/ipfs/ipfs.service.ts @@ -0,0 +1,317 @@ +import { Injectable, Logger } from '@nestjs/common'; +import { NFTStorage, File } from 'nft.storage'; +import { HttpService } from '@nestjs/axios'; +import { InjectRepository } from '@nestjs/typeorm'; +import { Repository } from 'typeorm'; +import { IpfsEntity } from 'src/entities/ipfs.entity'; +import { NeedEntity } from 'src/entities/need.entity'; +import { ObjectNotFound } from 'src/filters/notFound-expectation.filter'; +import { Token } from 'nft.storage/dist/src/lib/interface'; +import { WalletExceptionFilter } from 'src/filters/wallet-exception.filter'; +import { ChildrenService } from '../children/children.service'; +import { PaymentService } from '../payment/payment.service'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { DownloadService } from '../download/download.service'; + +@Injectable() +export class IpfsService { + constructor( + private httpService: HttpService, + private childrenService: ChildrenService, + private paymentService: PaymentService, + private downloadService: DownloadService, + @InjectRepository(IpfsEntity) + private ipfsRepository: Repository, + ) {} + + private readonly logger = new Logger(IpfsService.name); + + async getAllIpfs(): Promise { + return this.ipfsRepository.find(); + } + + async createIpfs( + need: NeedEntity, + needDetailsHash: string, + ): Promise { + const newIpfs = this.ipfsRepository.create({ + flaskNeedId: need.flaskId, + needDetailsHash, + need, + }); + return this.ipfsRepository.save(newIpfs); + } + + getNeedIpfs(flaskNeedId: number) { + return this.ipfsRepository.findOne({ + where: { + flaskNeedId, + }, + }); + } + + async handleIpfs(signature: string, need: NeedEntity) { + const unlinkList = []; + const endpoint = new URL('https://api.nft.storage'); + const token = process.env.NFT_STORAGE_KEY; + const client = new NFTStorage({ endpoint, token }); + if (!need) { + throw new ObjectNotFound(); + } + if (need.ipfs) { + throw new WalletExceptionFilter(403, 'Need has an IPFS hash!'); + } + let dataNeed: Token<{ image: any; name: string; description: string }>; + // Need + try { + console.log('\x1b[36m%s\x1b[0m', `1- Storing child to IPFS...`); + const child = await this.childrenService.getChildById(need.child.flaskId); + if (!child) { + throw new WalletExceptionFilter(403, 'Child could not be found!'); + } + let awakeImage: any; + let sleptImage: any; + unlinkList.push(`./${child.sayName}Awake.jpg`); + if (child.awakeAvatarUrl) { + // Awake avatar + awakeImage = await this.downloadService.fileFromPath( + child.awakeAvatarUrl, + `${child.sayName}Awake.jpg`, + ); + } + unlinkList.push(`./${child.sayName}Slept.jpg`); + if (child && child.sleptAvatarUrl) { + // Slept avatar + sleptImage = await this.downloadService.fileFromPath( + child.sleptAvatarUrl, + `${child.sayName}Slept.jpg`, + ); + } + + const iconImage = await this.downloadService.fileFromPath(need.imageUrl, `${need.name}.jpg`); + + unlinkList.push(`./${need.name}.jpg`); + // dates + const needDates = { + estimationDays: need.doingDuration, + updated: String(need.updated), + created: String(need.created), + confirmDate: String(need.confirmDate), + paidDate: String(need.doneAt), + purchaseDate: String(need.purchaseDate), + ngoDeliveryDate: String(need.ngoDeliveryDate), + expectedDeliveryDate: String(need.expectedDeliveryDate), + childDeliveryDate: String(need.childDeliveryDate), + }; + + // details + const needDetails = { + needId: need.id, // nest id + childId: need.child.id, // nest id + ngoId: child.ngo.id, // nest id + providerId: need.provider.id, // nest id + socialWorkerNotes: need.details ? need.details : '', + information: need.information ? need.information : '', + description: need.descriptionTranslations + ? { + en: need.descriptionTranslations.en, + fa: need.descriptionTranslations.fa, + } + : 'N/A', + titles: need.nameTranslations + ? { + en: need.nameTranslations.en, + fa: need.nameTranslations.fa, + } + : 'N/A', + title: need.title, + isUrgent: need.isUrgent, + type: need.type, + category: need.category, + name: need.name, + status: need.status, + link: need.link, + cost: need.cost, + purchaseCost: need.purchaseCost, + }; + + // Main need IPFS + const needContributors = { + // contributors + auditorId: need.auditor.contributions.find( + (c) => c.flaskUserId == need.auditor.flaskUserId, + ).flaskUserId, + socialWorkerId: need.socialWorker.contributions.find( + (c) => c.flaskUserId == need.socialWorker.flaskUserId, + ).flaskUserId, + purchaserId: need.purchaser.contributions.find( + (c) => c.flaskUserId == need.purchaser.flaskUserId, + ).flaskUserId, + // family + // virtualFamilies: [ + // ...new Map(need.verifiedPayments.map((p) => p.verified && [p.id, p.id_user])).values(), + // ] + }; + + console.log('\x1b[36m%s\x1b[0m', `2- Storing Need to IPFS...`); + // console.log({ + // image: iconImage, + // name: need.name, + // description: need.descriptionTranslations + // ? need.descriptionTranslations.fa + // : 'N/A', + // properties: { + // needDetails, + // needDates, + // initialSignature: signature, + // }, + // child: { + // awakeImage: awakeImage, + // sleptImage: sleptImage, + // name: { + // en: child.sayNameTranslations.en, + // fa: child.sayNameTranslations.fa, + // }, + // story: { + // en: child.bioTranslations.en, + // fa: child.bioTranslations.fa, + // }, + // joined: String(child.created), + // cityId: child.city, + // countryId: child.country, + // nationality: child.nationality, + // birthDate: String(child.birthDate), + // }, + // receipt: { + // properties: { + // }, + // receipts: need.receipts.map(async r => { + // const receiptImage = await this.downloadService.fileFromPath( + // r.attachment, + // r.title.jpg, + // ) + // return { + // image: receiptImage, + // name: r.title, + // description: r.description, + // } + // }) + // }, + // ngo: { + // name: child.ngo.name, + // website: child.ngo.website, + // cityId: child.ngo.location.flaskCityId, + // stateId: child.ngo.location.stateId, + // countryId: child.ngo.location.countryId, + // countryName: child.ngo.location.countryName, + // cityName: child.ngo.location.name, + // }, + // provider: need.provider && { + // providerId: need.provider.id, + // name: need.provider.name, + // website: need.provider.website, + // }, + // contributors: needContributors, + + // }) + dataNeed = await client.store({ + image: iconImage, + name: need.name, + description: need.descriptionTranslations + ? need.descriptionTranslations.fa + : 'N/A', + properties: { + needDetails, + needDates, + initialSignature: signature, + }, + child: { + awakeImage: awakeImage, + sleptImage: sleptImage, + name: { + en: child.sayNameTranslations.en, + fa: child.sayNameTranslations.fa, + }, + story: { + en: child.bioTranslations.en, + fa: child.bioTranslations.fa, + }, + joined: String(child.created), + cityId: child.city, + countryId: child.country, + nationality: child.nationality, + birthDate: String(child.birthDate), + }, + receipt: { + properties: {}, + receipts: need.receipts.map(async (r) => { + const receiptImage = await this.downloadService.fileFromPath(r.attachment, `${r.title}.jpg`); + return { + image: receiptImage, + name: r.title, + description: r.description, + }; + }), + }, + ngo: { + name: child.ngo.name, + website: child.ngo.website, + cityId: child.ngo.location.flaskCityId, + stateId: child.ngo.location.stateId, + countryId: child.ngo.location.countryId, + countryName: child.ngo.location.countryName, + cityName: child.ngo.location.name, + }, + provider: need.provider && { + providerId: need.provider.id, + name: need.provider.name, + website: need.provider.website, + }, + contributors: needContributors, + }); + console.log('\x1b[36m%s\x1b[0m', `Stored Need to IPFS...`); + + const status = await client.check(dataNeed.ipnft); + if (status.pin.status !== null) { + console.log(status); + } + // for (let i = 0; i < unlinkList.length; i++) { + // console.log( + // '\x1b[36m%s\x1b[0m', + // `Cleaning ${unlinkList[i]} from local storage ...`, + // ); + // fs.unlinkSync(unlinkList[i]); + // } + console.log( + '\x1b[36m%s\x1b[0m', + ' Cleaned last file from local storage!', + ); + + const needIpfs = await this.createIpfs(need, dataNeed.ipnft); + + console.log( + '\x1b[36m%s\x1b[0m', + '4- Updated DataBase with IPFS details ...', + ); + this.logger.log('Stored on IPFS'); + + return needIpfs; + } catch (e) { + // for (let i = 0; i < unlinkList.length; i++) { + // console.log( + // '\x1b[36m%s\x1b[0m', + // `Cleaning ${unlinkList[i]} from local storage ...`, + // ); + // fs.unlinkSync(unlinkList[i]); + // } + console.log( + '\x1b[36m%s\x1b[0m', + ' Error: Cleaned last file from local storage!', + ); + + console.log(e); + throw new ServerError(e.message, e.status); + } + } + +} diff --git a/src/features/ipfs/middlewares/ipfs.middleware.ts b/src/features/ipfs/middlewares/ipfs.middleware.ts new file mode 100644 index 0000000000..14ed92913d --- /dev/null +++ b/src/features/ipfs/middlewares/ipfs.middleware.ts @@ -0,0 +1,36 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class IpfsMiddleware implements NestMiddleware { + private readonly logger = new Logger(IpfsMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/location/location.controller.ts b/src/features/location/location.controller.ts new file mode 100644 index 0000000000..2c98345d38 --- /dev/null +++ b/src/features/location/location.controller.ts @@ -0,0 +1,32 @@ +import { Controller, ForbiddenException, Get, Req } from '@nestjs/common'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; +import { LocationService } from './location.service'; +import { isAuthenticated } from 'src/utils/auth'; +import { FlaskUserTypesEnum } from 'src/types/interfaces/interface'; + +@ApiTags('Location') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) +@Controller('location') +export class LocationController { + constructor(private readonly locationService: LocationService) { } + + @Get(`all`) + @ApiOperation({ description: 'Get all ngos' }) + async getCities(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + + return await this.locationService.getCities(); + } +} diff --git a/src/features/location/location.module.ts b/src/features/location/location.module.ts new file mode 100644 index 0000000000..33521d3993 --- /dev/null +++ b/src/features/location/location.module.ts @@ -0,0 +1,22 @@ +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; +import { LocationService } from './location.service'; +import { LocationController } from './location.controller'; +import { Cities } from 'src/entities/flaskEntities/cities.entity'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { LocationEntity } from 'src/entities/location.entity'; +import { LocationMiddleware } from './middlewares/location.middleware'; +import { Countries } from 'src/entities/flaskEntities/countries.entity'; + +@Module({ + imports: [ + TypeOrmModule.forFeature([Cities, Countries], 'flaskPostgres'), + TypeOrmModule.forFeature([LocationEntity]), + ], + controllers: [LocationController], + providers: [LocationService], +}) +export class LocationModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer.apply(LocationMiddleware).forRoutes('location'); + } +} diff --git a/src/features/location/location.service.ts b/src/features/location/location.service.ts new file mode 100644 index 0000000000..bb63915eb6 --- /dev/null +++ b/src/features/location/location.service.ts @@ -0,0 +1,67 @@ +import { Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { Cities } from 'src/entities/flaskEntities/cities.entity'; +import { Countries } from 'src/entities/flaskEntities/countries.entity'; +import { LocationEntity } from 'src/entities/location.entity'; +import { CityParams } from 'src/types/parameters/CityParameters'; +import { Repository } from 'typeorm'; + +@Injectable() +export class LocationService { + constructor( + @InjectRepository(LocationEntity) + private locationRepository: Repository, + @InjectRepository(Cities, 'flaskPostgres') + private cityFlaskRepository: Repository, + @InjectRepository(Countries, 'flaskPostgres') + private countryFlaskRepository: Repository, + ) {} + + getCities(): Promise { + return this.locationRepository.find(); + } + + getCityById(flaskCityId: number): Promise { + const city = this.locationRepository.findOne({ + where: { + flaskCityId, + }, + }); + return city; + } + + getCityByCountryId(countryId: number): Promise { + const city = this.countryFlaskRepository.findOne({ + where: { + id: countryId, + }, + }); + return city; + } + + getFlaskCities(): Promise { + return this.cityFlaskRepository.find(); + } + async getFlaskCity(id: number): Promise { + return this.cityFlaskRepository.findOne({ + where: { id: id }, + }); + } + + getCityByFlaskId(flaskCityId: number): Promise { + const city = this.locationRepository.findOne({ + where: { + flaskCityId: flaskCityId, + }, + }); + return city; + } + + createLocation(cityDetails: CityParams): Promise { + const location = this.locationRepository.create({ + flaskCityId: cityDetails.flaskCityId, + ...cityDetails, + }); + return this.locationRepository.save(location); + } +} diff --git a/src/features/location/middlewares/location.middleware.ts b/src/features/location/middlewares/location.middleware.ts new file mode 100644 index 0000000000..8c268126ae --- /dev/null +++ b/src/features/location/middlewares/location.middleware.ts @@ -0,0 +1,36 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class LocationMiddleware implements NestMiddleware { + private readonly logger = new Logger(LocationMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/midjourney/middlewares/midjourney.image.middleware.ts.ts b/src/features/midjourney/middlewares/midjourney.image.middleware.ts.ts new file mode 100644 index 0000000000..f5a1e952e2 --- /dev/null +++ b/src/features/midjourney/middlewares/midjourney.image.middleware.ts.ts @@ -0,0 +1,27 @@ +import { + HttpException, + HttpStatus, + Injectable, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; + +@Injectable() +export class MidjourneyImageMiddleware implements NestMiddleware { + + async use(@Request() req, @Response() res, next: NextFunction) { + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/midjourney/middlewares/midjourney.middleware.ts b/src/features/midjourney/middlewares/midjourney.middleware.ts new file mode 100644 index 0000000000..b55b2e4bcd --- /dev/null +++ b/src/features/midjourney/middlewares/midjourney.middleware.ts @@ -0,0 +1,36 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class MidjourneyMiddleware implements NestMiddleware { + private readonly logger = new Logger(MidjourneyMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/midjourney/midjourney.controller.ts b/src/features/midjourney/midjourney.controller.ts new file mode 100644 index 0000000000..2bffafa487 --- /dev/null +++ b/src/features/midjourney/midjourney.controller.ts @@ -0,0 +1,322 @@ +import { + Controller, + Get, + Post, + Param, + Res, + Req, + ForbiddenException, + Delete, +} from '@nestjs/common'; +import { MidjourneyService } from './midjourney.service'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { DownloadService } from '../download/download.service'; +import { NeedService } from '../need/need.service'; +import { ApiFileResponse } from '../download/api-file-response.decorator'; +import { Response as expressResponse } from 'express'; +import { MessageBody } from '@nestjs/websockets'; +import { FamilyService } from '../family/family.service'; +import { rimraf } from 'rimraf'; +import { isAuthenticated } from 'src/utils/auth'; +import { + FlaskUserTypesEnum, + SUPER_ADMIN_ID_PANEL, +} from 'src/types/interfaces/interface'; +import { WalletExceptionFilter } from 'src/filters/wallet-exception.filter'; +import { checkIfDirectoryExists } from 'src/utils/file'; +import fs from 'fs'; +import path from 'path'; + +@ApiTags('Midjourney') +@Controller('midjourney') +export class MidjourneyController { + constructor( + private readonly midjourneyService: MidjourneyService, + private readonly downloadService: DownloadService, + private readonly needService: NeedService, + private readonly familyService: FamilyService, + ) { } + + @Get(`db/all`) + @ApiSecurity('flask-access-token') + @ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, + }) + @ApiOperation({ description: 'Get all IPFS' }) + async getImages(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.midjourneyService.getAllImages(); + } + + @Post('db/store/:flaskNeedId') + @ApiSecurity('flask-access-token') + @ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, + }) + @ApiOperation({ description: 'Storing images' }) + async storeImages( + @Req() req: Request, + @Param('flaskNeedId') flaskNeedId: number, + ): Promise { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + let theImage; + try { + const need = await this.needService.getNeedByFlaskId(flaskNeedId); + theImage = await this.midjourneyService.createImage({ + fileName: '../../midjourney/dao.png', + flaskNeedId: 2, + need, + }); + } catch (e) { + throw new ServerError(e.message, e.status); + } + return theImage; + } + + @Get(`local/all`) + @ApiSecurity('flask-access-token') + @ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, + }) + @ApiOperation({ + description: 'Get all needs ready to be signed by family', + }) + async getLocalImages(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + + const X_LIMIT = parseInt(req.headers['x-limit']); + const X_TAKE = parseInt(req.headers['x-take']); + const limit = X_LIMIT > 100 ? 100 : X_LIMIT; + const page = X_TAKE + 1; + const needsWithSignatures = + await this.midjourneyService.getOnlyReadyToMidjourney({ + page: page, + limit: limit, + path: '', + }); + const count = await this.midjourneyService.countAllNeedJourney(); + + const list = []; + + needsWithSignatures.data.forEach((theNeed) => { + if (theNeed) { + list.push({ + needFlaskId: theNeed.flaskId, + childFlaskId: theNeed.flaskChildId, + ngoName: theNeed.ngo.name, + usersFlaskId: theNeed.verifiedPayments.map((v) => v.flaskUserId), + originalImage: theNeed.needRetailerImg, + selectedImage: theNeed.midjourneyImage, + }); + } + }); + return { + totalReady: needsWithSignatures.meta.totalItems, + total: count, + list, + }; + } + + @ApiFileResponse('image/png') + @ApiSecurity('flask-access-token') + @ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, + }) + @Get('buffer/:flaskNeedId') + async buffer( + @Req() req: Request, + @Param('flaskNeedId') flaskNeedId: number, + @Res() response: expressResponse, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + const theImage = await this.midjourneyService.getImage(flaskNeedId); + const file = await this.downloadService.imageReadBuffer(theImage.fileName); + response.contentType('image/png'); + response.send(file); + } + + @Get('prepare/prompts') + @ApiSecurity('flask-access-token') + @ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, + }) + @ApiOperation({ description: 'Get all signed' }) + async preparePrompts(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + const promptList = await this.midjourneyService.preparePrompts(); + return promptList; + } + + @Post('select/:flaskNeedId') + @ApiSecurity('flask-access-token') + @ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, + }) + @ApiOperation({ description: 'Get all signed' }) + async selectFinalImage( + @Req() req: Request, + @Param('flaskNeedId') flaskNeedId: number, + @MessageBody() body, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + const promptList = this.midjourneyService.selectImage( + flaskNeedId, + body.selectedImage, + ); + return promptList; + } + + @Get('images/:flaskNeedId/:index') + async serveAvatar( + @Param('flaskNeedId') flaskNeedId: number, + @Param('index') index: number, + @Res() res: any, + ): Promise { + const fileName = `${flaskNeedId}_${index}.png`; + res.sendFile(fileName, { + root: `../midjourney-bot/main/need-images/need-${flaskNeedId}`, + }); + } + + @Delete(`bad/images`) + @ApiOperation({ description: 'Delete folder of need images' }) + async deleteBadImages(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskUserId !== SUPER_ADMIN_ID_PANEL + ) { + throw new WalletExceptionFilter(403, 'You Are not the Super admin'); + } + let ids; + const filePath = path.join(__dirname, 'bad-images-to-remove.txt'); + fs.readFile(filePath, 'utf8', (err, data) => { + if (err) { + console.error('Error reading the file:', err); + return; + } + // Step 2: Parse the data (assuming it's a newline-separated list) + ids = data.trim().split('\n'); + }); + + const list = []; + for await (const id of ids) { + const need = await this.needService.getNeedByFlaskId(id); + if (need) { + await this.needService.updateNeedMidjourney(need.id, ''); + } + + const path = `../midjourney-bot/main/need-images/need-${id}`; + if (checkIfDirectoryExists(path)) { + await rimraf(path); + list.push(path); + } else { + console.log(`Folder does not exist. Skipping...`); + } + } + return list; + } + + @Delete(`bad/images/:flaskNeedId`) + @ApiOperation({ description: 'Add need Id to list of delete candidate' }) + async deleteSignature( + @Req() req: Request, + @Param('flaskNeedId') flaskNeedId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskUserId !== SUPER_ADMIN_ID_PANEL + ) { + throw new WalletExceptionFilter(403, 'You Are not the Super admin'); + } + const filePath = 'src/features/midjourney/bad-images-to-remove.json'; + + fs.readFile(filePath, 'utf8', (err, data) => { + if (err) { + console.error('Error reading the file:', err); + return; + } + try { + // Parse the JSON data + const jsonData = JSON.parse(data); + + // Add a new element to the list + jsonData.push(Number(flaskNeedId)); + + // Convert the updated data back to JSON format + const updatedJsonData = JSON.stringify(jsonData, null, 2); + + // Write the updated JSON data back to the file + fs.writeFile(filePath, updatedJsonData, 'utf8', (err) => { + if (err) { + console.error('Error writing file:', err); + } else { + console.log('File updated successfully!'); + } + }); + } catch (parseError) { + console.error('Error parsing JSON:', parseError); + } + }); + } +} diff --git a/src/features/midjourney/midjourney.module.ts b/src/features/midjourney/midjourney.module.ts new file mode 100644 index 0000000000..056edec2a1 --- /dev/null +++ b/src/features/midjourney/midjourney.module.ts @@ -0,0 +1,73 @@ +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; +import { MidjourneyService } from './midjourney.service'; +import { MidjourneyController } from './midjourney.controller'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { MidjourneyEntity } from 'src/entities/midjourney.entity'; +import { WalletService } from '../wallet/wallet.service'; +import { NeedEntity } from 'src/entities/need.entity'; +import { SignatureEntity } from 'src/entities/signature.entity'; +import { NeedService } from '../need/need.service'; +import { UserService } from '../user/user.service'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; +import { MidjourneyMiddleware } from './middlewares/midjourney.middleware'; +import { DownloadService } from '../download/download.service'; +import { HttpModule } from '@nestjs/axios'; +import { FamilyService } from '../family/family.service'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { PaymentEntity } from 'src/entities/payment.entity'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; + +@Module({ + imports: [ + HttpModule, + TypeOrmModule.forFeature( + [ + Child, + Need, + SocialWorker, + User, + Family, + UserFamily, + Receipt, + NeedReceipt, + ], + 'flaskPostgres', + ), + TypeOrmModule.forFeature([ + MidjourneyEntity, + VariableEntity, + NeedEntity, + SignatureEntity, + ContributorEntity, + AllUserEntity, + EthereumAccountEntity, + PaymentEntity, + ]), + ], + controllers: [MidjourneyController], + providers: [ + MidjourneyService, + WalletService, + NeedService, + UserService, + DownloadService, + FamilyService, + ], +}) +export class MidjourneyModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer + .apply(MidjourneyMiddleware) + .exclude('midjourney/images/:flaskNeedId/:index') + .exclude('midjourney/bad/images/') + .forRoutes(MidjourneyController); + } +} diff --git a/src/features/midjourney/midjourney.service.ts b/src/features/midjourney/midjourney.service.ts new file mode 100644 index 0000000000..0d818420a6 --- /dev/null +++ b/src/features/midjourney/midjourney.service.ts @@ -0,0 +1,164 @@ +import { Injectable } from '@nestjs/common'; +import { MidjourneyEntity } from '../../entities/midjourney.entity'; +import { Repository } from 'typeorm'; +import { InjectRepository } from '@nestjs/typeorm'; +import { NeedEntity } from 'src/entities/need.entity'; +import fs from 'fs'; +import config from 'src/config'; +import { checkIfDirectoryExists, deleteFile } from 'src/utils/file'; +import { NeedService } from '../need/need.service'; +import { FamilyService } from '../family/family.service'; +import { SAYPlatformRoles } from 'src/types/interfaces/interface'; +import { + Paginated, + PaginateQuery, + paginate as nestPaginate, +} from 'nestjs-paginate'; +import { PaymentEntity } from 'src/entities/payment.entity'; +import { SignatureEntity } from 'src/entities/signature.entity'; +import { NgoEntity } from 'src/entities/ngo.entity'; + +@Injectable() +export class MidjourneyService { + constructor( + @InjectRepository(NeedEntity) + private needRepository: Repository, + @InjectRepository(MidjourneyEntity) + private readonly midjourneyRepository: Repository, + private readonly familyService: FamilyService, + private readonly needService: NeedService, + ) { } + + async getAllImages(): Promise { + return this.midjourneyRepository.find(); + } + + async getImage(flaskNeedId: number): Promise { + return this.midjourneyRepository.findOne({ + where: { + flaskNeedId: flaskNeedId, + }, + }); + } + + async createImage(values: { + flaskNeedId: number; + need: NeedEntity; + fileName: string; + }): Promise { + return this.midjourneyRepository.save({ + flaskNeedId: values.flaskNeedId, + fileName: values.fileName, + need: values.need, + }); + } + + async preparePrompts(): Promise { + // const needWithSignatures = + // await this.familyService.getAllFamilyReadyToSignNeeds(); + const deliveredNeeds = await this.needService.getMidjourneyNeeds(); + await this.familyService.getAllFamilyReadyToSignNeeds(); + const list = []; + const listOfIds = []; + deliveredNeeds.forEach((n) => { + if (!listOfIds.find((i) => i === n.id)) { + const data = { + flaskId: n.id, + needRetailerImg: n.img, + prompt: + 'write word "SAY" over a cute, 3d isometric ' + + n.name_translations.en + + ',cartoon soft pastel colors illustration, clay render, blender 3d, physically based rendering, soft and light background, pastel background, colorful, toy like proportions', + }; + list.push(data); + listOfIds.push(n.id); + } else { + console.log(listOfIds); + } + }); + config().dataCache.storeMidjourney(list); + if (checkIfDirectoryExists('../midjourney-bot/midjourney.json')) { + deleteFile('../midjourney-bot/midjourney.json'); + } + fs.appendFile( + '../midjourney-bot/midjourney.json', + JSON.stringify(config().dataCache.fetchMidjourney()), + function (err) { + if (err) { + // append failed + } else { + // done + } + }, + ); + return { total: deliveredNeeds.length, list }; + } + + async selectImage(flaskNeedId: number, selectedImage: string) { + const need = await this.needService.getNeedByFlaskId(flaskNeedId); + await this.needService.updateNeedMidjourney(need.id, selectedImage); + return await this.needService.getNeedByFlaskId(flaskNeedId); + } + + async getOnlyReadyToMidjourney( + options: PaginateQuery, + ): Promise> { + const queryBuilder = this.needRepository + .createQueryBuilder('need') + .leftJoinAndMapOne( + 'need.ngo', + NgoEntity, + 'ngo', + 'ngo.flaskNgoId = need.flaskNgoId', + ) + .leftJoinAndMapMany( + 'need.verifiedPayments', + PaymentEntity, + 'verifiedPayments', + 'verifiedPayments.flaskNeedId = need.flaskId', + ) + .leftJoinAndMapMany( + 'need.signatures', + SignatureEntity, + 'signature', + 'signature.flaskNeedId = need.flaskId', + ) + .where('signature.role = :role', { + role: SAYPlatformRoles.SOCIAL_WORKER, + }) + .andWhere('need.midjourneyImage IS NULL'); + + return await nestPaginate(options, queryBuilder, { + sortableColumns: ['id'], + defaultSortBy: [['createdAt', 'DESC']], + nullSort: 'last', + }); + } + + async countAllNeedJourney(): Promise { + return await this.needRepository + .createQueryBuilder('need') + .leftJoinAndMapOne( + 'need.ngo', + NgoEntity, + 'ngo', + 'ngo.flaskNgoId = need.flaskNgoId', + ) + .leftJoinAndMapMany( + 'need.verifiedPayments', + PaymentEntity, + 'verifiedPayments', + 'verifiedPayments.flaskNeedId = need.flaskId', + ) + .leftJoinAndMapMany( + 'need.signatures', + SignatureEntity, + 'signature', + 'signature.flaskNeedId = need.flaskId', + ) + .where('signature.role = :role', { + role: SAYPlatformRoles.SOCIAL_WORKER, + }) + .getCount(); + } +} diff --git a/src/features/milestone/middlewares/milestone.middleware.ts b/src/features/milestone/middlewares/milestone.middleware.ts new file mode 100644 index 0000000000..7bcac88d68 --- /dev/null +++ b/src/features/milestone/middlewares/milestone.middleware.ts @@ -0,0 +1,36 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class MileStoneMiddleware implements NestMiddleware { + private readonly logger = new Logger(MileStoneMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/milestone/milestone.controller.ts b/src/features/milestone/milestone.controller.ts index f3d3d84da1..8d52c4e947 100644 --- a/src/features/milestone/milestone.controller.ts +++ b/src/features/milestone/milestone.controller.ts @@ -1,5 +1,5 @@ import { Body, Controller, Get, Post } from '@nestjs/common'; -import { ApiOperation, ApiTags } from '@nestjs/swagger'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; import { CreateMileStoneDto } from '../../types/dtos/CreateMileStone.dto'; import { MilestoneService } from './milestone.service'; import { NeedService } from '../need/need.service'; @@ -8,14 +8,20 @@ import { StepService } from '../step/step.service'; import { ChildrenEntity } from '../../entities/children.entity'; @ApiTags('Milestone') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) @Controller('Milestone') export class MilestoneController { - constructor(private mileStoneService: MilestoneService, + constructor( + private mileStoneService: MilestoneService, private stepService: StepService, private childrenService: ChildrenService, - private needService: NeedService - ) { } - + private needService: NeedService, + ) {} @Get(`all`) @ApiOperation({ description: 'Get a single transaction by ID' }) @@ -28,17 +34,20 @@ export class MilestoneController { let theChild: ChildrenEntity; const steps = []; for (let i = 0; i < data.epics.length; i++) { - const theNeed = await this.needService.getNeedById( - data.epics[i].needId, - ); + // const theNeed = await this.needService.getNeedByFlaskId( + // data.epics[i].needId, + // ); if (!theChild) { - theChild = await this.childrenService.getChildById(theNeed.child.flaskChildId); + // theChild = await this.childrenService.getChildById(theNeed.child.flaskChildId); } - const step = this.stepService.createStep(theNeed, data.epics[i]); - steps.push(step); + // const step = this.stepService.createStep(theNeed, data.epics[i]); + // steps.push(step); } - const mileStone = await this.mileStoneService.createMileStone(steps, theChild); + const mileStone = await this.mileStoneService.createMileStone( + steps, + theChild, + ); const result = { mileStone: mileStone }; return result; } diff --git a/src/features/milestone/milestone.module.ts b/src/features/milestone/milestone.module.ts index a3e7391cd5..dbe634478d 100644 --- a/src/features/milestone/milestone.module.ts +++ b/src/features/milestone/milestone.module.ts @@ -1,4 +1,4 @@ -import { Module } from '@nestjs/common'; +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; import { ScheduleModule } from '@nestjs/schedule'; import { HttpModule } from '@nestjs/axios'; @@ -13,19 +13,49 @@ import { StepEntity } from '../../entities/step.entity'; import { StepService } from '../step/step.service'; import { PaymentEntity } from '../../entities/payment.entity'; import { PaymentService } from '../payment/payment.service'; -import { FamilyEntity, SocialWorkerEntity } from '../../entities/user.entity'; +import { AllUserEntity } from '../../entities/user.entity'; import { UserService } from '../user/user.service'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { MileStoneMiddleware } from './middlewares/milestone.middleware'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; @Module({ imports: [ + TypeOrmModule.forFeature( + [ + Need, + SocialWorker, + Child, + Payment, + UserFamily, + Family, + User, + Receipt, + NeedReceipt, + ], + 'flaskPostgres', + ), TypeOrmModule.forFeature([ MileStoneEntity, ChildrenEntity, + VariableEntity, NeedEntity, StepEntity, - FamilyEntity, - SocialWorkerEntity, - PaymentEntity + ContributorEntity, + AllUserEntity, + PaymentEntity, + EthereumAccountEntity, + ChildrenPreRegisterEntity, ]), ScheduleModule.forRoot(), HttpModule, @@ -37,7 +67,11 @@ import { UserService } from '../user/user.service'; NeedService, UserService, StepService, - PaymentService + PaymentService, ], }) -export class MilestoneModule { } +export class MilestoneModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer.apply(MileStoneMiddleware).forRoutes('milestone'); + } +} diff --git a/src/features/mine/middleware/middleware.middleware.ts b/src/features/mine/middleware/middleware.middleware.ts new file mode 100644 index 0000000000..54f5595b6d --- /dev/null +++ b/src/features/mine/middleware/middleware.middleware.ts @@ -0,0 +1,36 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class MineMiddleWare implements NestMiddleware { + private readonly logger = new Logger(MineMiddleWare.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/mine/mine.controller.ts b/src/features/mine/mine.controller.ts new file mode 100644 index 0000000000..9800c5dcfc --- /dev/null +++ b/src/features/mine/mine.controller.ts @@ -0,0 +1,169 @@ +import { + Controller, + Get, + Req, + Param, + ForbiddenException, +} from '@nestjs/common'; +import { MineService } from './mine.service'; +import { ObjectNotFound } from 'src/filters/notFound-expectation.filter'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; +import { FamilyService } from '../family/family.service'; +import { + FlaskUserTypesEnum, + SAY_DAPP_ID, +} from 'src/types/interfaces/interface'; +import { isAuthenticated } from 'src/utils/auth'; +import { NeedEntity } from 'src/entities/need.entity'; +import { NeedService } from '../need/need.service'; + +@ApiTags('Mines') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) +@Controller('mine') +export class MineController { + constructor( + private readonly mineService: MineService, + private readonly familyService: FamilyService, + private readonly needService: NeedService, + ) { } + + @Get(`needs/paid`) + @ApiOperation({ + description: 'Get all paid needs for family member', + }) + async getPaidNeeds(@Req() req: Request) { + const dappFlaskUserId = req.headers['dappFlaskUserId']; + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } + + const readyNeeds = await this.familyService.getFamilyReadyToSignNeeds( + dappFlaskUserId, + ); + + const signedNeedsCount = await this.familyService.countFamilySignedNeeds( + dappFlaskUserId, + ); + + return { + signed: signedNeedsCount, + readyNeedsList: readyNeeds.filter( + (need) => + need.midjourneyImage !== null || // we need to use panel to assign midjourney images first + (need.signatures && + need.signatures.find( + (s) => s.flaskUserId === Number(dappFlaskUserId), + )), + ), + }; + } + + @Get(`signature/ready/:needId`) + @ApiOperation({ + description: 'Get all signed needs for virtual family member', + }) + async getReadyOneNeed(@Req() req: Request, @Param('needId') needId: string) { + const dappFlaskUserId = req.headers['dappFlaskUserId']; + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } + + if (!needId) { + throw new ObjectNotFound('We need the needId!'); + } + const theNeed = await this.familyService.getFamilyReadyToSignOneNeed( + needId, + ); + + if ( + !theNeed || + !theNeed.verifiedPayments.find( + (p) => p.flaskUserId === Number(dappFlaskUserId) && p.verified, + ) + ) { + throw new ObjectNotFound('Could not match this need to you!'); + } + if ( + !theNeed.signatures.find( + (s) => s.flaskUserId === theNeed.socialWorker.flaskUserId, + ) + ) { + throw new ObjectNotFound( + 'This need does not have the social worker signature!', + ); + } + const members = await this.familyService.getChildFamilyMembers( + theNeed.child.flaskId, + theNeed.verifiedPayments.map((p) => p.flaskUserId), + ); + + return { + ...theNeed, + members, + }; + } + + @Get('ecosystem/mineables') + async getEcosystemMineables(@Req() req: Request) { + const dappFlaskUserId = req.headers['dappFlaskUserId']; + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } + // 1 - get my signed needs + const mySignedNeeds = await this.mineService.getMySignedNeeds( + dappFlaskUserId, + ); + let correctedNeeds: NeedEntity[]; + for await (const need of mySignedNeeds) { + // 2 - if other payments check if payer has signed as well + const othersPayment = need.verifiedPayments.filter( + (p) => + p.needAmount > 0 && + p.verified && + p.flaskUserId !== SAY_DAPP_ID && + p.flaskUserId !== dappFlaskUserId, + ); + + if (othersPayment && othersPayment.length > 0) { + const theNeed = await this.needService.getNeedById(need.id); + correctedNeeds = mySignedNeeds.filter( + (n) => + n.verifiedPayments.filter( + (p) => + p.needAmount > 0 && p.verified && p.flaskUserId !== SAY_DAPP_ID, + ).length === + theNeed.signatures.length - 1, + ); + } else { + correctedNeeds = mySignedNeeds; + } + } + const myReadyToMine = await this.mineService.getMyReadyToMine( + dappFlaskUserId, + ); + const myMined = await this.mineService.getMyMinedNeeds(dappFlaskUserId); + + const paidNeeds = await this.mineService.getEcosystemPaidNeeds(); + const readyToMine = await this.mineService.getEcosystemReadyToMine(); + const mined = await this.mineService.getEcosystemMinedNeeds(); + return { + ecosystem: { + waiting: paidNeeds - readyToMine.length, + ready: readyToMine.length, + mined, + readyMintNeeds: readyToMine, + }, + theUser: { + waiting: correctedNeeds ? correctedNeeds.length : 0, + ready: myReadyToMine.length, + mined: myMined, + readyMintNeeds: myReadyToMine, + }, + }; + } +} diff --git a/src/features/mine/mine.module.ts b/src/features/mine/mine.module.ts new file mode 100644 index 0000000000..a86890baf8 --- /dev/null +++ b/src/features/mine/mine.module.ts @@ -0,0 +1,43 @@ +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; +import { MineService } from './mine.service'; +import { MineController } from './mine.controller'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { NeedEntity } from 'src/entities/need.entity'; +import { ScheduleModule } from '@nestjs/schedule'; +import { HttpModule } from '@nestjs/axios'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { MineMiddleWare } from './middleware/middleware.middleware'; +import { FamilyService } from '../family/family.service'; +import { PaymentEntity } from 'src/entities/payment.entity'; +import { User } from 'src/entities/flaskEntities/user.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { NeedService } from '../need/need.service'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; + +@Module({ + imports: [ + TypeOrmModule.forFeature( + [Need, User, Family, UserFamily, Receipt, NeedReceipt], + 'flaskPostgres', + ), + TypeOrmModule.forFeature([ + NeedEntity, + PaymentEntity, + VariableEntity, + AllUserEntity, + ]), + ScheduleModule.forRoot(), + HttpModule, + ], + controllers: [MineController], + providers: [MineService, FamilyService, NeedService], +}) +export class MineModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer.apply(MineMiddleWare).forRoutes('mine'); + } +} diff --git a/src/features/mine/mine.service.ts b/src/features/mine/mine.service.ts new file mode 100644 index 0000000000..df1cfde6d6 --- /dev/null +++ b/src/features/mine/mine.service.ts @@ -0,0 +1,162 @@ +import { Injectable } from '@nestjs/common'; +import { CreateMineDto } from '../../types/dtos/mine/create-mine.dto'; +import { UpdateMineDto } from '../../types/dtos/mine/update-mine.dto'; +import { InjectRepository } from '@nestjs/typeorm'; +import { Repository } from 'typeorm'; +import { NeedEntity } from 'src/entities/need.entity'; +import { + PaymentStatusEnum, + SAYPlatformRoles, +} from 'src/types/interfaces/interface'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { SignatureEntity } from 'src/entities/signature.entity'; +import { PaymentEntity } from 'src/entities/payment.entity'; + +@Injectable() +export class MineService { + constructor( + @InjectRepository(Need, 'flaskPostgres') + private flaskNeedRepository: Repository, + @InjectRepository(NeedEntity) + private needRepository: Repository, + ) {} + + create(createMineDto: CreateMineDto) { + return 'This action adds a new mine'; + } + + getEcosystemPaidNeeds(): Promise { + return this.flaskNeedRepository + .createQueryBuilder('need') + .leftJoinAndMapMany( + 'need.payments', + Payment, + 'payment', + 'payment.id_need = need.id', + ) + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .andWhere('need.status >= :status', { + status: PaymentStatusEnum.COMPLETE_PAY, + }) + .andWhere('payment.id IS NOT NULL') + .andWhere('payment.verified IS NOT NULL') + .andWhere('payment.order_id IS NOT NULL') + .cache(60000) + .getCount(); + } + + getEcosystemReadyToMine(): Promise { + return this.needRepository.find({ + relations: { + signatures: true, + }, + where: { + signatures: { + role: SAYPlatformRoles.AUDITOR, + }, + }, + }); + } + getEcosystemMinedNeeds(): Promise { + return this.needRepository.count({ + relations: { + signatures: true, + }, + where: { + signatures: { + role: SAYPlatformRoles.AUDITOR, + }, + isMined: true, + }, + }); + } + + getMyReadyToMine(flaskUserId: number): Promise { + return this.needRepository + .createQueryBuilder('need') + .leftJoinAndMapMany( + 'need.payments', + PaymentEntity, + 'payment', + 'payment.flaskNeedId = need.flaskId', + ) + .leftJoinAndMapMany( + 'need.signatures', + SignatureEntity, + 'signature', + 'signature.flaskNeedId = need.flaskId', + ) + .andWhere('payment.flaskUserId = :flaskUserId', { + flaskUserId: flaskUserId, + }) + .andWhere('need.status >= :status', { + status: PaymentStatusEnum.COMPLETE_PAY, + }) + .andWhere('signature.role = :role', { + role: SAYPlatformRoles.AUDITOR, + }) + .cache(60000) + .getMany(); + } + + getMySignedNeeds(flaskUserId: number): Promise { + return this.needRepository + .createQueryBuilder('need') + .leftJoinAndMapMany( + 'need.verifiedPayments', + PaymentEntity, + 'payment', + 'payment.flaskNeedId = need.flaskId', + ) + .leftJoinAndMapMany( + 'need.signatures', + SignatureEntity, + 'signature', + 'signature.flaskNeedId = need.flaskId', + ) + .andWhere('signature.flaskUserId = :sFlaskUserId', { + sFlaskUserId: flaskUserId, + }) + .andWhere('need.status >= :status', { + status: PaymentStatusEnum.COMPLETE_PAY, + }) + .andWhere('signature.role = :role', { + role: SAYPlatformRoles.FAMILY, + }) + .cache(60000) + .getMany(); + } + + getMyMinedNeeds(flaskUserId: number): Promise { + return this.needRepository + .createQueryBuilder('need') + .leftJoinAndMapMany( + 'need.verifiedPayments', + PaymentEntity, + 'payment', + 'payment.flaskNeedId = need.flaskId', + ) + .leftJoinAndMapMany( + 'need.signatures', + SignatureEntity, + 'signature', + 'signature.flaskNeedId = need.flaskId', + ) + .where('need.isMined = :isMined', { isMined: true }) + .andWhere('payment.flaskUserId = :pFlaskUserId', { + pFlaskUserId: flaskUserId, + }) + .andWhere('signature.flaskUserId = :sFlaskUserId', { + sFlaskUserId: flaskUserId, + }) + .andWhere('need.status >= :status', { + status: PaymentStatusEnum.COMPLETE_PAY, + }) + .andWhere('signature.role = :role', { + role: SAYPlatformRoles.FAMILY, + }) + .cache(60000) + .getCount(); + } +} diff --git a/src/features/need/middlewares/get-need.middleware.ts b/src/features/need/middlewares/get-need.middleware.ts index 3b6c18e9b3..86ce4e4fe3 100644 --- a/src/features/need/middlewares/get-need.middleware.ts +++ b/src/features/need/middlewares/get-need.middleware.ts @@ -1,12 +1,36 @@ -import { HttpException, HttpStatus, Injectable, NestMiddleware } from '@nestjs/common'; -import { NextFunction, Request, Response } from 'express'; +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; @Injectable() export class GetNeedMiddleware implements NestMiddleware { - use(req: Request, res: Response, next: NextFunction) { - console.log('All Needs MiddleWare...') - console.log(req.headers) + private readonly logger = new Logger(GetNeedMiddleware.name); - next(); + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); } } diff --git a/src/features/need/middlewares/post-need.middleware.ts b/src/features/need/middlewares/post-need.middleware.ts index e5f3e5db84..6698a10f1a 100644 --- a/src/features/need/middlewares/post-need.middleware.ts +++ b/src/features/need/middlewares/post-need.middleware.ts @@ -1,21 +1,36 @@ -import { HttpException, HttpStatus, Injectable, NestMiddleware } from '@nestjs/common'; -import { NextFunction, Request, Response } from 'express'; +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; @Injectable() export class PostNeedMiddleware implements NestMiddleware { - use(req: Request, res: Response, next: NextFunction) { - console.log('Create Need MiddleWare...') - console.log(req.headers) - const { origin } = req.headers + private readonly logger = new Logger(PostNeedMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; const origins = [ process.env.AUTHORIZED_DAPP_LOCAL, process.env.AUTHORIZED_PANEL_LOCAL, - process.env.AUTHORIZED_DOCS_LOCAL - ] - - if (!origins.includes(origin)) { - throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN) + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); } - if (origins.includes(origin)) next(); + if (origins.includes(origin) || host) next(); } } diff --git a/src/features/need/need.controller.ts b/src/features/need/need.controller.ts index 1993f21cbf..9d778f4e03 100644 --- a/src/features/need/need.controller.ts +++ b/src/features/need/need.controller.ts @@ -1,83 +1,708 @@ -import { Body, Controller, Get, Post, Query, Req, Response } from '@nestjs/common'; -import { ApiOperation, ApiTags } from '@nestjs/swagger'; -import { NeedTypeEnum, RolesEnum } from '../../types/interface'; -import { NeedDto } from '../../types/dtos/CreateNeed.dto'; -import { ChildrenService } from '../children/children.service'; -import { NeedService } from './need.service'; -import { ValidateNeedPipe } from './pipes/validate-need.pipe'; -import { NeedEntity } from '../../entities/need.entity'; -import { ServerError } from '../../filters/server-exception.filter'; +import { + Body, + Controller, + ForbiddenException, + Get, + Param, + Post, + Query, + Req, +} from '@nestjs/common'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; import { UserService } from '../user/user.service'; -import { SocialWorkerParams } from '../../types/parameters/UserParameters'; -import { AllExceptionsFilter } from '../../filters/all-exception.filter'; +import { NeedService } from './need.service'; +import { isAuthenticated } from 'src/utils/auth'; +import { + AnnouncementEnum, + CategoryEnum, + Colors, + FlaskUserTypesEnum, + NeedTypeEnum, + ProductStatusEnum, + SUPER_ADMIN_ID_PANEL, +} from 'src/types/interfaces/interface'; +import config from 'src/config'; +import { daysDifference, timeDifference } from 'src/utils/helpers'; +import axios from 'axios'; import { NgoService } from '../ngo/ngo.service'; -import { NgoParams } from '../../types/parameters/NgoParammeters'; - +import { format } from 'date-fns'; +import { TicketService } from '../ticket/ticket.service'; +import { + checkNeed, + GRACE_PERIOD, + SIMILAR_NAME_LIMIT_PRODUCT, + SIMILAR_NAME_LIMIT_SERVICE, + validateNeed, +} from 'src/utils/needConfirm'; +import { ValidatedDupType } from 'src/types/interfaces/Need'; +import { SyncService } from '../sync/sync.service'; +import { TicketEntity } from 'src/entities/ticket.entity'; +import { ProviderService } from '../provider/provider.service'; +import { ServerError } from 'src/filters/server-exception.filter'; -export const NEEDS_URL = 'http://localhost:3000/api/dao/sync/update'; +const BASE_LIMIT_DUPLICATES_0 = 4; // when confirming a need 4 duplicates are allowed for the category 0 +const BASE_LIMIT_DUPLICATES_1 = 3; +const BASE_LIMIT_DUPLICATES_2 = 5; +const BASE_LIMIT_DUPLICATES_3 = 2; @ApiTags('Needs') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) @Controller('needs') export class NeedController { - constructor(private needService: NeedService, - private childrenService: ChildrenService, + constructor( + private needService: NeedService, private userService: UserService, private ngoService: NgoService, - ) { } + private ticketService: TicketService, + private syncService: SyncService, + private providerService: ProviderService, + ) {} + + @Get(`all`) + @ApiOperation({ description: 'Get all needs from db 1' }) + async getNeeds(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.needService.getNeeds(); + } + + @Get(`:needId`) + @ApiOperation({ description: 'Get one need' }) + async getANeed(@Req() req: Request, @Param('needId') needId: string) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.needService.getNeedById(needId); + } @Get(`flask/random`) - @ApiOperation({ description: 'Get all done needs from flask' }) - async getRandomNeed() { - return await this.needService.getRandomNeed() + @ApiOperation({ description: 'Get a random need from flask' }) + async getRandomNeed(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.needService.getFlaskRandomNeed(); + } + @Get(`flask/arriving/:code`) + @ApiOperation({ description: 'Get all done needs from flask' }) + async getFlaskNeedsByDeliveryCode( + @Req() req: Request, + @Param('code') code: string, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException(401, 'You Are not authorized!'); + } + return await this.needService.getFlaskNeedsByDeliveryCode(code); } - @Get(`flask/preneed`) + @Get(`flask/auditedBy/:flaskUserId`) @ApiOperation({ description: 'Get all done needs from flask' }) - async getPrNeed(@Req() req: Request) { - const accessToken = req.headers["authorization"] - const preNeeds = await this.needService.getPreNeed(accessToken) - return preNeeds - } - - @Get(`flask/all`) - @ApiOperation({ description: 'Get all needs from flask' }) - async getNeeds(@Req() req: Request, @Query('skip') skip = 0, @Query('take') take = 100) { - const accessToken = req.headers["authorization"] - take = take > 100 ? 100 : take; - return await this.needService.getNeeds( - { - accessToken: accessToken, - X_TAKE: Number(take), - X_SKIP: Number(skip), - }, - {} - ) + async getFlaskAuditorNeeds( + @Req() req: Request, + @Param('flaskUserId') flaskUserId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException(401, 'You Are not authorized!'); + } + return await this.needService.getFlaskAuditorNeeds(flaskUserId); } - NeedApiParams + @Get(`nest/auditedBy/:flaskUserId`) + @ApiOperation({ description: 'Get all done needs from nest' }) + async getNestAuditorNeeds( + @Req() req: Request, + @Param('flaskUserId') flaskUserId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException(401, 'You Are not authorized!'); + } + return await this.needService.getNestAuditorNeeds(flaskUserId); + } + @Get(`nest/purchasedBy/:flaskUserId`) + @ApiOperation({ description: 'Get all done needs from nest' }) + async getNestPurchaserNeeds( + @Req() req: Request, + @Param('flaskUserId') flaskUserId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException(401, 'You Are not authorized!'); + } + return await this.needService.getNestPurchaserNeeds(flaskUserId); + } - @Get(`all/done`) + @Get('title/search') // this will replace need template / preNeed + @ApiOperation({ description: 'Get a need from db 2 by title' }) + async getFlaskNeedByTitle(@Req() req: Request, @Query('q') query: string) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException(401, 'You Are not authorized!'); + } + return await this.needService.getNeedByTitle(query); + } + + @Get(`flask/:id`) + @ApiOperation({ description: 'Get a need from db 2' }) + async getFlaskNeed(@Req() req: Request, @Param('id') id: number) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException(401, 'You Are not authorized!'); + } + return await this.needService.getFlaskNeed(id); + } + + @Get(`one/:needFlaskId`) + @ApiOperation({ description: 'Get a need from db 2' }) + async getNeedByFlaskId( + @Req() req: Request, + @Param('needFlaskId') needFlaskId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException(401, 'You Are not authorized!'); + } + + const theNeed = await this.needService.getNeedByFlaskId(needFlaskId); + + return theNeed; + } + + @Get(`relation/:needFlaskId`) + @ApiOperation({ description: 'Get a need from db 2' }) + async getProviderNeedRelationById( + @Req() req: Request, + @Param('needFlaskId') needFlaskId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException(401, 'You Are not authorized!'); + } + return await this.providerService.getProviderNeedRelationById(needFlaskId); + } + + @Get('flask/preneeds/templates') @ApiOperation({ description: 'Get all done needs from flask' }) - async getDoneNeeds() { - const doneNeeds = await this.needService.getDoneNeeds() - return doneNeeds.length + async getPrNeed(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException(401, 'You Are not authorized!'); + } + const token = + config().dataCache.fetchPanelAuthentication(panelFlaskUserId).token; + const preNeeds = await this.needService.getFlaskPreNeed(token); + return preNeeds; } - @Get(`:flaskNeedId`) - @ApiOperation({ description: 'Get one need' }) - async getOneNeed(@Query('flaskNeedId') flaskNeedId: number) { - let need: NeedEntity + @Get(`unconfirmed/:swId`) + @ApiOperation({ description: 'Get all done needs from flask' }) + async getNotConfirmedNeeds( + @Req() req: Request, + @Param('swId') socialWorkerId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException(401, 'You Are not authorized!'); + } + + const socialWorker = await this.userService.getFlaskSocialWorker( + socialWorkerId, + ); // sw ngo + const unconfirmedCount = await this.needService.getNotConfirmedNeeds( + socialWorkerId, + null, + [socialWorker.ngo_id], + ); + return unconfirmedCount[1]; + } + + @Post(`confirm/mass`) + @ApiOperation({ description: 'Confirm array of needs' }) + async massConfirmNeeds( + @Req() req: Request, + @Body() body: { needIds: number[] }, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException(401, 'You Are not authorized!'); + } + + const token = + config().dataCache.fetchPanelAuthentication(panelFlaskUserId).token; try { - need = await this.needService.getNeedById(flaskNeedId) + if (body) { + for await (const needId of body.needIds) { + if (Number(needId) > 0) { + const configs = { + headers: { + 'Content-Type': 'multipart/form-data', + Authorization: token, + processData: false, + contentType: false, + }, + }; + const { data } = await axios.patch( + `https://api.sayapp.company/api/v2/need/confirm/needId=${needId}`, + {}, + configs, + ); + } + } + // to reset prepare + config().dataCache.storeToBeConfirmed([], new Date()); + } } catch (e) { - throw new ServerError(e); + console.log(e); + throw new ServerError(e.message); } - return need; } + @Get(`confirm/prepare`) + @ApiOperation({ description: 'Prepare confirm needs' }) + async prepareConfirmNeeds(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException(401, 'You Are not authorized!'); + } + + // 0- Fetch only active SW + NGO + const activeSwIds = await this.userService + .getFlaskSwIds() + .then((r) => r.filter((s) => s.is_active).map((s) => s.id)); + + const ngoIds = await this.ngoService + .getFlaskNgos() + .then((r) => r.filter((n) => n.isActive).map((n) => n.id)); + + let toBeConfirmed = config().dataCache.fetchToBeConfirmed(); + + const expired = + !toBeConfirmed || + !toBeConfirmed.list[0] || + !toBeConfirmed.createdAt || + timeDifference(toBeConfirmed.createdAt, new Date()).mm >= 5; + console.log(`Mass prepare expired: ${expired}`); + console.log( + `Last prepare: ${ + toBeConfirmed.createdAt && + timeDifference(toBeConfirmed.createdAt, new Date()).mm + } minutes ago`, + ); + + if (expired) { + const notConfirmed = await this.needService.getNotConfirmedNeeds( + null, + activeSwIds, + ngoIds, + ); + const myList = []; + let counter = 0; + for await (const need of notConfirmed[0]) { + counter += 1; + console.log( + `${counter} / ${notConfirmed[0].length} Mass Confirm preparation: ${need.id}`, + ); + // 1- sync & validate need + let fetchedNeed = await this.needService.getNeedByFlaskId(need.id); + + // Just in case + const fetchedProviderRel = + await this.providerService.getProviderNeedRelationById(need.id); + if ( + !fetchedNeed || + !fetchedNeed.provider || + (fetchedProviderRel && + fetchedNeed.provider.id != fetchedProviderRel.nestProviderId) || + fetchedNeed.status !== need.status || + fetchedNeed.category !== need.category || + fetchedNeed.type !== need.type || + fetchedNeed.details !== need.details || + fetchedNeed.title !== need.title || + fetchedNeed.information !== need.informations || + fetchedNeed.nameTranslations.en !== need.name_translations.en + ) { + const { need: nestNeed } = await this.syncService.syncNeed( + need, + need.child_id, + panelFlaskUserId, + null, + null, + null, + ); + fetchedNeed = nestNeed; + } + + const superAdmin = await this.userService.getUserByFlaskId( + SUPER_ADMIN_ID_PANEL, + ); + + const validatedNeed = await validateNeed(fetchedNeed, superAdmin); + let ticket: TicketEntity; + let needTickets = await this.ticketService.getTicketsByNeed( + validatedNeed.needId, + ); + const ticketError = needTickets.find( + (t) => + t.lastAnnouncement === AnnouncementEnum.ERROR || + t.color === Colors.RED, + ); + // 0- ticket if not a valid need and not ticketed yet + if (!validatedNeed.isValidNeed) { + // create ticket if already has not + if (!ticketError) { + console.log('\x1b[36m%s\x1b[0m', 'Creating Ticket Content ...\n'); + ticket = await this.ticketService.createTicket( + validatedNeed.ticketDetails, + validatedNeed.participants, + ); + await this.ticketService.createTicketContent( + { + message: validatedNeed.message, + from: superAdmin.flaskUserId, + announcement: validatedNeed.ticketDetails.lastAnnouncement, + color: validatedNeed.ticketDetails.color, + }, + ticket, + ); + // Disable notification for admin + await this.ticketService.createTicketView( + superAdmin.flaskUserId, + ticket.id, + ); + } else if ( + ticketError && + daysDifference(ticketError.createdAt, new Date()) > GRACE_PERIOD + ) { + // when we use panel we take care of this in the taskCard component + console.log( + '\x1b[36m%s\x1b[0m', + 'Need will be deleted from front-end...\n', + ); + } + needTickets = await this.ticketService.getTicketsByNeed( + validatedNeed.needId, + ); + ticket = needTickets.find( + (t) => t.lastAnnouncement === AnnouncementEnum.ERROR, + ); + myList.push({ + limit: null, + validCount: null, + need: fetchedNeed, + duplicates: null, + errorMsg: validatedNeed.message, + possibleMissMatch: [], + ticket, + }); + console.log('\x1b[36m%s\x1b[0m', 'Skipping need...\n'); + continue; + } + /// -------------------------------- If Valid Need --------------------------------------------/// + if (ticketError) { + // since it is a valid need with an old ticket, we need to update the ticket + await this.ticketService.updateTicketAnnouncement( + ticketError.id, + AnnouncementEnum.NONE, + ); + await this.ticketService.updateTicketColor( + ticketError.id, + Colors.BLUE, + ); + } + // 1- get duplicates for the child / same name-translations.en + const duplicates = await this.needService.getDuplicateNeeds( + need.child_id, + need.id, + ); + let validatedDups: ValidatedDupType[]; + if (duplicates && duplicates[0]) { + validatedDups = duplicates.map((d) => { + return { + ...d, + validation: checkNeed(need, d), + }; + }); + } + + let errorMsg: string; + // 2- compare to confirmed similar needs / names_translations + // then if not many similar needs it should be checked manually + const similarNameNeeds = await this.needService.getSimilarNeeds( + need.name_translations.en, + ); + const sameCatSimilarity = similarNameNeeds.filter( + (n) => n.category === need.category, + ); + const diffCatSimilarity = similarNameNeeds.filter( + (n) => n.category !== need.category, + ); + + if ( + need.type === NeedTypeEnum.PRODUCT && + sameCatSimilarity.length < SIMILAR_NAME_LIMIT_PRODUCT + ) { + errorMsg = `Similar count error, only ${sameCatSimilarity.length}.`; + } + if ( + need.type === NeedTypeEnum.SERVICE && + sameCatSimilarity.length < SIMILAR_NAME_LIMIT_SERVICE + ) { + errorMsg = `Similar count error, only ${sameCatSimilarity.length}.`; + } + + // 3- if we have a milk for sara, only two more needs from the same category. eg: cheese, butter,... + // every category different limit + let limit: number; + if (need.category === CategoryEnum.GROWTH) { + limit = BASE_LIMIT_DUPLICATES_0; + } + if (need.category === CategoryEnum.JOY) { + limit = BASE_LIMIT_DUPLICATES_1; + } + if (need.category === CategoryEnum.HEALTH) { + limit = BASE_LIMIT_DUPLICATES_2; + } + if (need.category === CategoryEnum.SURROUNDING) { + limit = BASE_LIMIT_DUPLICATES_3; + } + const validCount = + validatedDups && + validatedDups.filter((v) => v.validation.isValidDuplicate).length; + + if (validCount && limit < validCount) { + errorMsg = `Limit error, ${limit}`; + } + if ( + validatedDups && + validatedDups.filter((v) => v.category !== fetchedNeed.category) + .length > 0 + ) { + errorMsg = `Category error, ${ + validatedDups.filter((v) => v.category !== fetchedNeed.category) + .length + }`; + } + myList.push({ + limit, + validCount, + need: fetchedNeed, + duplicates: validatedDups, + errorMsg, + possibleMissMatch: diffCatSimilarity.map((n) => { + return { + needId: n.id, + childId: n.child_id, + status: n.status, + category: n.category, + type: n.type, + isConfirmed: n.confirmDate && true, + }; + }), + ticket, + }); + } + + config().dataCache.storeToBeConfirmed(myList, new Date()); + } + toBeConfirmed = config().dataCache.fetchToBeConfirmed(); + + return toBeConfirmed; + } + + @Get('duplicates/:flaskChildId/:flaskNeedId') + @ApiOperation({ description: 'Get duplicates need for confirming' }) + async getDuplicateNeeds( + @Req() req: Request, + @Param('flaskChildId') flaskChildId: number, + @Param('flaskNeedId') flaskNeedId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException(401, 'You Are not authorized!'); + } + + return await this.needService.getDuplicateNeeds(flaskChildId, flaskNeedId); + } + + @Get('delete/candidates') + @ApiOperation({ description: 'Get old needs to delete if not paid.' }) + async deleteCandidates(@Req() req: Request) { + // delete old confirmed needs + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskUserId !== SUPER_ADMIN_ID_PANEL + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + const deleteCandidates = await this.needService.getDeleteCandidates(); + + return { list: deleteCandidates[0], total: deleteCandidates[1] }; + } + + @Get('update/candidates') + @ApiOperation({ description: 'Get arrived needs to update them' }) + async updateArrivalsCandidates(@Req() req: Request) { + // delete old confirmed needs + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskUserId !== SUPER_ADMIN_ID_PANEL + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + const updateCandidates = + await this.needService.getArrivalUpdateCandidates(); + + return { list: updateCandidates[0], total: updateCandidates[1] }; + } + + @Get('delete/old') + @ApiOperation({ description: 'Get duplicates need for confirming' }) + async deleteOldNeeds(@Req() req: Request) { + // delete old confirmed needs + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskUserId !== SUPER_ADMIN_ID_PANEL + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + const deleteCandidates = await this.needService.getDeleteCandidates(); + for await (const need of deleteCandidates[0]) { + const daysDiff = daysDifference(need.confirmDate, new Date()); + if (daysDiff > 90) { + const accessToken = + config().dataCache.fetchPanelAuthentication(panelFlaskUserId).token; + await this.needService.deleteFlaskOneNeed(need.id, accessToken); + } + } + return { deleted: deleteCandidates[1] }; + } + + @Get('update/arrivals') + async updateNeedsStatus(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskUserId !== SUPER_ADMIN_ID_PANEL + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + + const needs = await this.needService.getArrivalUpdateCandidates(); + + const token = + config().dataCache.fetchPanelAuthentication(panelFlaskUserId).token; + + const configs = { + headers: { + 'Content-Type': 'multipart/form-data', + Authorization: token, + processData: false, + contentType: false, + }, + }; + + // Only for products: for service do a manual review for receipts + for await (const need of needs[0]) { + if ( + need.type === NeedTypeEnum.PRODUCT && + need.status === ProductStatusEnum.PURCHASED_PRODUCT + ) { + const ticket = await this.ticketService.getTicketByFlaskNeedId( + Number(need.id), + ); + console.log(ticket); + + try { + if ( + ticket && + ticket.ticketHistories && + ticket.ticketHistories.find( + (h) => h.announcement == AnnouncementEnum.ARRIVED_AT_NGO, + ) + ) { + const { data } = await axios.patch( + `https://api.sayapp.company/api/v2/need/update/needId=${need.id}`, + { + status: ProductStatusEnum.DELIVERED_TO_NGO, + ngo_delivery_date: String( + format( + new Date( + ticket.ticketHistories.find( + (h) => + h.announcement == AnnouncementEnum.ARRIVED_AT_NGO, + ).announcedArrivalDate, + ), + 'yyyy-MM-dd', + ), + ), + }, + configs, + ); + + if (data.status === ProductStatusEnum.DELIVERED_TO_NGO) { + await this.ticketService.updateTicketColor( + ticket.id, + Colors.BLUE, + ); + } + } + } catch (e) { + throw new ServerError(e.statusMessage, e.statusCode); + } + } + } + } } diff --git a/src/features/need/need.module.ts b/src/features/need/need.module.ts index 5d778f75f3..313c77c725 100644 --- a/src/features/need/need.module.ts +++ b/src/features/need/need.module.ts @@ -1,4 +1,4 @@ -import { MiddlewareConsumer, Module, NestModule, RequestMethod } from '@nestjs/common'; +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; import { ScheduleModule } from '@nestjs/schedule'; import { NeedEntity } from '../../entities/need.entity'; @@ -9,32 +9,113 @@ import { ChildrenEntity } from '../../entities/children.entity'; import { ChildrenService } from '../children/children.service'; import { PaymentEntity } from '../../entities/payment.entity'; import { PaymentService } from '../payment/payment.service'; -import { FamilyEntity, SocialWorkerEntity } from '../../entities/user.entity'; +import { AllUserEntity } from '../../entities/user.entity'; import { UserService } from '../user/user.service'; import { GetNeedMiddleware } from './middlewares/get-need.middleware'; -import { PostNeedMiddleware } from './middlewares/post-need.middleware'; -import { NgoEntity } from '../../entities/ngo.entity'; +import { NgoArrivalEntity, NgoEntity } from '../../entities/ngo.entity'; import { NgoService } from '../ngo/ngo.service'; +import { StatusEntity } from 'src/entities/status.entity'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { NGO } from 'src/entities/flaskEntities/ngo.entity'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { NeedStatusUpdate } from 'src/entities/flaskEntities/NeedStatusUpdate.entity'; +import { TicketEntity } from 'src/entities/ticket.entity'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { NeedFamily } from 'src/entities/flaskEntities/needFamily'; +import { FamilyService } from '../family/family.service'; +import { SyncService } from '../sync/sync.service'; +import { ReceiptService } from '../receipt/receipt.service'; +import { ReceiptEntity } from 'src/entities/receipt.entity'; +import { StatusService } from '../status/status.service'; +import { LocationService } from '../location/location.service'; +import { ProviderService } from '../provider/provider.service'; +import { LocationEntity } from 'src/entities/location.entity'; +import { Cities } from 'src/entities/flaskEntities/cities.entity'; +import { ProviderEntity } from 'src/entities/provider.entity'; +import { ProviderJoinNeedEntity } from 'src/entities/provider.Join.need..entity'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { Countries } from 'src/entities/flaskEntities/countries.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; +import { TicketService } from '../ticket/ticket.service'; +import { TicketContentEntity } from 'src/entities/ticketContent.entity'; +import { TicketViewEntity } from 'src/entities/ticketView.entity'; @Module({ imports: [ - TypeOrmModule.forFeature([NeedEntity, ChildrenEntity, PaymentEntity, FamilyEntity, SocialWorkerEntity, NgoEntity]), + TypeOrmModule.forFeature( + [ + Need, + SocialWorker, + NGO, + Child, + Payment, + NeedStatusUpdate, + SocialWorker, + UserFamily, + NeedFamily, + Family, + User, + Cities, + Countries, + Receipt, + NeedReceipt, + ], + 'flaskPostgres', + ), + TypeOrmModule.forFeature([ + VariableEntity, + NeedEntity, + TicketEntity, + TicketContentEntity, + TicketViewEntity, + StatusEntity, + ChildrenEntity, + PaymentEntity, + ContributorEntity, + AllUserEntity, + NgoEntity, + NgoArrivalEntity, + EthereumAccountEntity, + TicketEntity, + ReceiptEntity, + LocationEntity, + ProviderEntity, + ProviderJoinNeedEntity, + ChildrenPreRegisterEntity, + ]), ScheduleModule.forRoot(), HttpModule, ], controllers: [NeedController], - providers: [NeedService, ChildrenService, PaymentService, UserService, NgoService], + providers: [ + NeedService, + ChildrenService, + PaymentService, + UserService, + NgoService, + FamilyService, + ReceiptService, + SyncService, + StatusService, + LocationService, + ProviderService, + TicketService, + ], }) export class NeedModule implements NestModule { configure(consumer: MiddlewareConsumer) { - consumer - .apply(GetNeedMiddleware).forRoutes({ - path: 'needs/all', - method: RequestMethod.GET - }) - .apply(PostNeedMiddleware).forRoutes({ - path: 'needs/add', - method: RequestMethod.POST - }) + consumer.apply(GetNeedMiddleware).forRoutes('needs'); + // .apply(PostNeedMiddleware) + // .forRoutes({ + // path: 'needs/add', + // method: RequestMethod.POST, + // }); } -} \ No newline at end of file +} diff --git a/src/features/need/need.service.ts b/src/features/need/need.service.ts index 0798c5e633..133a6d118d 100644 --- a/src/features/need/need.service.ts +++ b/src/features/need/need.service.ts @@ -1,220 +1,1089 @@ -import { Injectable } from '@nestjs/common'; +import { ForbiddenException, Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { NeedEntity } from '../../entities/need.entity'; -import { Repository, UpdateResult } from 'typeorm'; -import { from, map, Observable } from 'rxjs'; +import { Need } from '../../entities/flaskEntities/need.entity'; import { - Pagination, - IPaginationOptions, - paginate, -} from 'nestjs-typeorm-paginate'; -import { Configuration, NeedAPIApi, PreneedAPIApi, PreneedSummary, PublicAPIApi, PublicNeed } from "../../generated-sources/openapi"; -import { ChildrenEntity } from '../../entities/children.entity'; -import { NeedParams } from '../../types/parameters/NeedParameters'; -import { PaymentEntity } from '../../entities/payment.entity'; -import { FamilyEntity } from '../../entities/user.entity'; -import { ReceiptEntity } from '../../entities/receipt.entity'; -import { HeaderOptions, NeedApiParams } from 'src/types/interface'; -import { NeedDto, NeedsDataDto } from 'src/types/dtos/CreateNeed.dto'; + Brackets, + LessThan, + MoreThan, + Repository, + UpdateResult, +} from 'typeorm'; +import { + Configuration, + NeedAPIApi, + PreneedAPIApi, + PreneedSummary, + PublicAPIApi, + PublicNeed, +} from '../../generated-sources/openapi'; +import { + ChildExistence, + NeedTypeEnum, + PaymentStatusEnum, + ProductStatusEnum, + ServiceStatusEnum, +} from 'src/types/interfaces/interface'; +import { ChildrenEntity } from 'src/entities/children.entity'; +import { NeedParams } from 'src/types/parameters/NeedParameters'; +import { NgoEntity } from 'src/entities/ngo.entity'; +import { StatusEntity } from 'src/entities/status.entity'; +import { PaymentEntity } from 'src/entities/payment.entity'; +import { ReceiptEntity } from 'src/entities/receipt.entity'; +import { IpfsEntity } from 'src/entities/ipfs.entity'; +import { ProviderEntity } from 'src/entities/provider.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { NeedStatusUpdate } from 'src/entities/flaskEntities/NeedStatusUpdate.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NGO } from 'src/entities/flaskEntities/ngo.entity'; +import { + Paginated, + PaginateQuery, + paginate as nestPaginate, +} from 'nestjs-paginate'; +import { from } from 'rxjs'; +import { VariableEntity } from 'src/entities/variable.entity'; +import Decimal from 'decimal.js'; +import { getMonthsAgo } from 'src/utils/helpers'; @Injectable() export class NeedService { constructor( + @InjectRepository(Need, 'flaskPostgres') + private flaskNeedRepository: Repository, @InjectRepository(NeedEntity) private needRepository: Repository, - ) { } + @InjectRepository(VariableEntity) + private variableRepository: Repository, + ) {} - async getRandomNeed( - ): Promise { - const configuration = new Configuration({ - basePath: "https://api.s.sayapp.company", + async getFlaskNeed(flaskNeedId: number): Promise { + return this.flaskNeedRepository.findOne({ + where: { + id: flaskNeedId, + }, }); + } - const publicApi = new PublicAPIApi(configuration, "https://api.s.sayapp.company", - (url: "https://api.s.sayapp.company/api"): Promise => { - console.log(url) - return fetch(url) - }); - - const need: Promise = publicApi.apiV2PublicRandomNeedGet().then((r) => r - ).catch((e) => e) + async getFlaskAuditorNeeds(flaskUserId: number): Promise { + return this.flaskNeedRepository.find({ + where: { + confirmUser: flaskUserId, + }, + select: { + id: true, + title: true, + }, + }); + } + async getNestAuditorNeeds(flaskUserId: number): Promise { + return this.needRepository.find({ + where: { + auditor: { + flaskUserId, + }, + }, + select: { + id: true, + title: true, + }, + relations: { + child: false, + }, + }); + } + async getNestPurchaserNeeds(flaskUserId: number): Promise { + return this.needRepository.find({ + where: { + purchaser: { + flaskUserId, + }, + }, + select: { + id: true, + title: true, + }, + relations: { + child: false, + }, + }); + } + getFlaskNeedsByDeliveryCode(code: string): Promise { + return this.flaskNeedRepository.find({ + where: { + deliveryCode: code, + }, + }); + } - return need; + getFlaskChildUnpaidNeeds(flaskChildId: number): Promise { + return this.flaskNeedRepository.find({ + where: { + child_id: flaskChildId, + status: LessThan(PaymentStatusEnum.COMPLETE_PAY), + isConfirmed: true, + isDeleted: false, + }, + }); } - async getNeeds(options: HeaderOptions, params: NeedApiParams - ): Promise { - const publicApi = new NeedAPIApi(); - console.log(options.accessToken, options.X_SKIP, options.X_TAKE, params.ngoId) + getFlaskChildUnconfirmedNeeds(flaskChildId: number): Promise { + return this.flaskNeedRepository.find({ + where: { + child_id: flaskChildId, + isConfirmed: false, + isDeleted: false, + }, + }); + } - const needs: Promise = publicApi.apiV2NeedsGet(options.accessToken, options.X_SKIP, options.X_TAKE, params.isConfirmed, params.isDone, params.isReported, params.status, params.type, params.ngoId).then((r) => r - ).catch((e) => e) - return needs; + getFlaskPreNeed(accessToken: any): Promise { + const preneedApi = new PreneedAPIApi(); + const preneeds = preneedApi.apiV2PreneedsGet(accessToken); + return preneeds; } + async getNeedIpfs(id: number): Promise { + const need = await this.needRepository.findOne({ + where: { + flaskId: id, + }, + }); + if (!need) { + return; + } + return need.ipfs; + } + getNeeds(): Promise { + return this.needRepository.find({ + relations: { + child: true, + verifiedPayments: true, + }, + }); + } - async getLastNeed(): Promise { - const lastNeed = await this.needRepository.findOne({ + getNeedsWithSignatures(): Promise { + return this.needRepository.find({ + relations: { + child: true, + verifiedPayments: true, + signatures: true, + }, where: { - isDeleted: false, - isConfirmed: true, + status: MoreThan(PaymentStatusEnum.PARTIAL_PAY), + signatures: { + flaskNeedId: MoreThan(0), + }, }, - select: ['id', 'createdAt', 'socialWorker', 'title',], - order: { createdAt: "DESC" }, - }) - return lastNeed; + }); } - async getDoneNeeds(): Promise { - const doneNeeds = await this.needRepository.find({ + getNeedById(needId: string): Promise { + const user = this.needRepository.findOne({ where: { - isDone: true, + id: needId, + }, + relations: { + verifiedPayments: true, + signatures: true, }, }); - return doneNeeds; + return user; } - async getNeedById(flaskNeedId: number): Promise { - const need = await this.needRepository.findOne({ + async getNeedByTitle(title: string): Promise { + console.log(title); + return await this.flaskNeedRepository + .createQueryBuilder('need') + .select() + .where( + new Brackets((qb) => { + qb.where('need.type = :typeProduct', { + typeProduct: NeedTypeEnum.PRODUCT, + }) + .andWhere('need.title ILIKE :searchTerm', { + searchTerm: `%${title}%`, + }) + .orWhere('need.type = :typeService', { + typeService: NeedTypeEnum.SERVICE, + }) + .andWhere( + "need.name_translations -> 'fa' ILIKE :nameTranslations", + { + nameTranslations: `%${title}%`, + }, + ); + }), + ) + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .andWhere('need.isConfirmed = :needConfirmed', { needConfirmed: true }) + .getMany(); + } + + async updateNeedRatios( + need: NeedEntity, + distanceRatio: Decimal, + difficultyRatio: Decimal, + contributionRatio: Decimal, + flaskUserId: number, + ) { + const variablesObject = this.variableRepository.create({ + distanceRatio, + difficultyRatio, + contributionRatio, + needFlaskId: need.flaskId, + flaskUserId, + need, + }); + + return await this.variableRepository.save(variablesObject); + } + + updateNeedContributors( + needId: string, + theAuditor: AllUserEntity, + thePurchaser: AllUserEntity, + ) { + return this.needRepository.update(needId, { + auditor: theAuditor, + purchaser: thePurchaser, + }); + } + + getNeedByFlaskId(flaskId: number): Promise { + const need = this.needRepository.findOne({ where: { - flaskNeedId: flaskNeedId, + flaskId, + // verifiedPayments: { verified: Not(IsNull()) }, }, relations: { + verifiedPayments: true, signatures: true, - payments: true, }, }); return need; } + updateNeed( + needId: string, + theChild: ChildrenEntity, + theNgo: NgoEntity, + theSw: AllUserEntity, + theAuditor: AllUserEntity, + thePurchaser: AllUserEntity, + needDetails: NeedParams, + theNestProvider: ProviderEntity, + ): Promise { + return this.needRepository.update(needId, { + child: theChild, + socialWorker: theSw, + auditor: theAuditor, + purchaser: thePurchaser, + ngo: theNgo, + provider: theNestProvider, + ...needDetails, + }); + } + + async updateNeedProvider(needId: string, provider: ProviderEntity) { + return this.needRepository.update(needId, { + provider, + }); + } + + async updateIsResolved(needId: string, isResolved: boolean) { + return this.needRepository.update(needId, { + isResolved: isResolved, + }); + } + + updateNeedMidjourney( + needId: string, + selectedImage: string, + ): Promise { + return this.needRepository.update(needId, { + midjourneyImage: selectedImage, + }); + } + createNeed( theChild: ChildrenEntity, + theNgo: NgoEntity, + theSw: AllUserEntity, + theAuditor: AllUserEntity, + thePurchaser: AllUserEntity, needDetails: NeedParams, - receiptList?: ReceiptEntity[], - paymentList?: PaymentEntity[], - participantList?: FamilyEntity[], + statusUpdates: StatusEntity[], + verifiedPayments: PaymentEntity[], + receipts: ReceiptEntity[], + provider: ProviderEntity, ): Promise { + if ( + !theSw || + (needDetails.status >= ProductStatusEnum.PARTIAL_PAY && !theAuditor) || + (needDetails.isConfirmed && !theAuditor) || + (needDetails.type === NeedTypeEnum.PRODUCT && + needDetails.status >= ProductStatusEnum.PURCHASED_PRODUCT && + !thePurchaser) || + (needDetails.status >= ProductStatusEnum.PARTIAL_PAY && + (!verifiedPayments || !verifiedPayments[0])) || + !theNgo + ) { + throw new ForbiddenException( + 'Can not Create need without contributors or NGO', + ); + } const newNeed = this.needRepository.create({ child: theChild, - flaskChildId: needDetails.flaskChildId, - flaskNeedId: needDetails.flaskNeedId, - flaskNgoId: needDetails.flaskNgoId, - flaskSupervisorId: needDetails.flaskSupervisorId, - title: needDetails.title, - affiliateLinkUrl: needDetails.affiliateLinkUrl, - link: needDetails.link, - bankTrackId: needDetails.bankTrackId, - category: needDetails.category, - childGeneratedCode: needDetails?.childGeneratedCode, - childSayName: needDetails.childSayName, - childDeliveryDate: - needDetails.childDeliveryDate && - new Date(needDetails.childDeliveryDate), - confirmDate: - needDetails.confirmDate && new Date(needDetails?.confirmDate), - supervisor: needDetails.supervisor, - cost: needDetails.cost, - created: needDetails.created && new Date(needDetails?.created), - socialWorker: needDetails.socialWorker, - flaskSwId: needDetails.flaskSwId, - deletedAt: needDetails.deletedAt && new Date(needDetails?.deletedAt), - description: needDetails.description, // { en: '' , fa: ''} - descriptionTranslations: needDetails.descriptionTranslations, // { en: '' , fa: ''} - titleTranslations: needDetails.titleTranslations, - details: needDetails.details, - doingDuration: needDetails.doingDuration, - donated: needDetails.donated, - doneAt: needDetails.doneAt && new Date(needDetails?.doneAt), - expectedDeliveryDate: - needDetails.expectedDeliveryDate && - new Date(needDetails?.expectedDeliveryDate), - information: needDetails.information, - isConfirmed: needDetails.isConfirmed, - isDeleted: needDetails.isDeleted, - isDone: needDetails.isDone, - isReported: needDetails.isReported, - isUrgent: needDetails.isUrgent, - ngo: needDetails.ngo, - ngoAddress: needDetails.ngoAddress, - ngoName: needDetails.ngoName, - ngoDeliveryDate: - needDetails.ngoDeliveryDate && new Date(needDetails?.ngoDeliveryDate), - oncePurchased: needDetails.oncePurchased, - paid: needDetails.paid, - purchaseCost: needDetails.purchaseCost, - purchaseDate: - needDetails.purchaseDate && new Date(needDetails?.purchaseDate), - receiptCount: needDetails.receiptCount, - status: needDetails.status, - statusDescription: needDetails.statusDescription, - statusUpdatedAt: - needDetails.statusUpdatedAt && new Date(needDetails?.statusUpdatedAt), - type: needDetails.type, - typeName: needDetails.typeName, - unavailableFrom: - needDetails.unavailableFrom && new Date(needDetails?.unavailableFrom), - unconfirmedAt: - needDetails.unconfirmedAt && new Date(needDetails?.unconfirmedAt), - unpaidCost: needDetails.unpaidCost, - unpayable: needDetails.unpayable, - unpayableFrom: - needDetails.unpayableFrom && new Date(needDetails?.unpayableFrom), - updated: needDetails.updated && new Date(needDetails?.updated), - imageUrl: needDetails.imageUrl, - needRetailerImg: needDetails.needRetailerImg, - progress: needDetails?.progress, - }); - newNeed.participants = participantList; - newNeed.payments = paymentList; - newNeed.receipts = receiptList; + socialWorker: theSw, + auditor: theAuditor, + purchaser: thePurchaser, + ngo: theNgo, + flaskNgoId: theNgo.flaskNgoId, + ...needDetails, + }); + newNeed.statusUpdates = statusUpdates; + newNeed.verifiedPayments = verifiedPayments; + newNeed.receipts = receipts; + newNeed.provider = provider; + return this.needRepository.save(newNeed); } - updateSyncNeed( - need: NeedEntity, - updateNeedDetails: NeedParams, - receiptList?: ReceiptEntity[], - paymentList?: PaymentEntity[], - participantList?: FamilyEntity[], - ): Promise { - need.payments = paymentList; - need.participants = participantList; - need.receipts = receiptList; - this.needRepository.save(need); - return this.needRepository.update( - { id: need.id }, - { ...updateNeedDetails }, + async getFlaskRandomNeed(): Promise { + const configuration = new Configuration({ + basePath: 'https://api.s.sayapp.company', + }); + + const publicApi = new PublicAPIApi( + configuration, + 'https://api.s.sayapp.company', + (url: 'https://api.s.sayapp.company/api'): Promise => { + return fetch(url); + }, ); + + const need: Promise = publicApi + .apiV2PublicRandomNeedGet() + .then((r) => r) + .catch((e) => e); + + return need; } - getPreNeed(accessToken: any): Promise { - const preneedApi = new PreneedAPIApi() - const preneeds = preneedApi.apiV2PreneedsGet(accessToken) - return preneeds + async getNotConfirmedNeeds( + socialWorker: number, + swIds: number[], + ngoIds: number[], + ): Promise<[Need[], number]> { + const queryBuilder = this.flaskNeedRepository + .createQueryBuilder('need') + .leftJoinAndMapOne( + 'need.child', + Child, + 'child', + 'child.id = need.child_id', + ) + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + .where('child.id_ngo IN (:...ngoIds)', { ngoIds: ngoIds }) + .andWhere('child.id_ngo NOT IN (:...testNgoIds)', { testNgoIds: [3, 14] }) + .andWhere('child.existence_status IN (:...existenceStatus)', { + existenceStatus: [ChildExistence.AlivePresent], + }) + .andWhere('need.isConfirmed = :needConfirmed', { needConfirmed: false }) + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .andWhere('need.created_by_id IN (:...swIds)', { + swIds: socialWorker ? [socialWorker] : [...swIds], + }) + .andWhere('need.status = :statusNotPaid', { + statusNotPaid: PaymentStatusEnum.NOT_PAID, + }) + // .select([ + // 'child.sayname_translations', + // 'ngo.id', + // 'ngo.name', + // 'need.id', + // 'need.child_id', + // 'need.created_by_id', + // 'need.name_translations', + // 'need.description_translations', + // 'need.title', + // 'need.imageUrl', + // 'need.category', + // 'need.type', + // 'need.link', + // 'need.status', + // 'need.img', + // 'need._cost', + // 'need.details', + // 'need.informations', + // 'need.isDeleted', + // 'need.created', + // 'need.confirmDate', + // ]) + .cache(60000) + .orderBy('need.created', 'ASC'); + return await queryBuilder.getManyAndCount(); } + async getNotPaidNeeds( + options: PaginateQuery, + socialWorker: number, + auditor: number, + purchaser: number, + ngoSupervisor: number, + swIds: number[], + ngoIds: number[], + ): Promise> { + const queryBuilder = this.flaskNeedRepository + .createQueryBuilder('need') + .leftJoinAndMapOne( + 'need.child', + Child, + 'child', + 'child.id = need.child_id', + ) + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + // .where('child.id_ngo IN (:...ngoIds)', { ngoIds: ngoIds }) + .where('child.id_ngo NOT IN (:...testNgoIds)', { testNgoIds: [3, 14] }) + .andWhere('child.existence_status IN (:...existenceStatus)', { + existenceStatus: [ChildExistence.AlivePresent], + }) + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .andWhere('need.created_by_id IN (:...swIds)', { + swIds: socialWorker ? [socialWorker] : [...swIds], + }) + .andWhere('need.status = :statusNotPaid', { + statusNotPaid: PaymentStatusEnum.NOT_PAID, + }) + .select([ + 'child', + 'ngo.id', + 'ngo.name', + 'ngo.logoUrl', + 'need.id', + 'need.child_id', + 'need.created_by_id', + 'need.name_translations', + 'need.title', + 'need.imageUrl', + 'need.category', + 'need.type', + 'need.isUrgent', + 'need.link', + 'need.affiliateLinkUrl', + 'need.bank_track_id', + 'need.doing_duration', + 'need.status', + 'need.img', + 'need.purchase_cost', + 'need._cost', + 'need.isConfirmed', + 'need.created', + 'need.updated', + 'need.confirmDate', + 'need.confirmUser', + 'need.doneAt', + 'need.ngo_delivery_date', + 'need.child_delivery_date', + 'need.purchase_date', + 'need.expected_delivery_date', + 'need.details', + 'need.informations', + 'need.unavailable_from', + ]) + .cache(60000); - async getSupervisorConfirmedNeeds(flaskSwId: number, - options: IPaginationOptions, - ): Promise>> { - return from( - paginate(this.needRepository, options, { - relations: { - payments: true, - receipts: true, - child: true, - provider: true, - supervisor: true - }, - where: { - isDeleted: false, - isConfirmed: true, - flaskSupervisorId: flaskSwId - }, - }), - ).pipe(map((needs: Pagination) => needs)); + return await nestPaginate(options, queryBuilder, { + sortableColumns: ['id'], + defaultSortBy: [['isConfirmed', 'ASC']], + nullSort: 'last', + }); + } + + async getPaidNeeds( + options: PaginateQuery, + socialWorker: number, + auditor: number, + purchaser: number, + ngoId: number, + swIds: number[], + ngoIds: number[], + ): Promise> { + const queryBuilder = this.flaskNeedRepository + .createQueryBuilder('need') + .leftJoinAndMapOne( + 'need.child', + Child, + 'child', + 'child.id = need.child_id', + ) + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + .leftJoinAndMapMany( + 'need.payments', + Payment, + 'payment', + 'payment.id_need = need.id', + ) + // .andWhere('child.id_ngo IN (:...ngoIds)', { ngoIds: ngoIds }) + .where('need.isDeleted = :needDeleted', { needDeleted: false }) + .andWhere('need.status IN (:...statuses)', { + statuses: [ + PaymentStatusEnum.COMPLETE_PAY, + PaymentStatusEnum.PARTIAL_PAY, + ], + }) + .andWhere('payment.id IS NOT NULL') + .andWhere('payment.verified IS NOT NULL') + .andWhere('payment.order_id IS NOT NULL') + .andWhere('need.created_by_id IN (:...swIds)', { + swIds: socialWorker ? [socialWorker] : [...swIds], + }) + .select([ + 'child', + 'ngo.id', + 'ngo.name', + 'ngo.logoUrl', + 'need.id', + 'need.child_id', + 'need.created_by_id', + 'need.name_translations', + 'need.title', + 'need.imageUrl', + 'need.category', + 'need.type', + 'need.isUrgent', + 'need.link', + 'need.affiliateLinkUrl', + 'need.bank_track_id', + 'need.doing_duration', + 'need.status', + 'need.img', + 'need.purchase_cost', + 'need._cost', + 'need.isConfirmed', + 'need.created', + 'need.updated', + 'need.confirmDate', + 'need.confirmUser', + 'need.doneAt', + 'need.ngo_delivery_date', + 'need.child_delivery_date', + 'need.purchase_date', + 'need.expected_delivery_date', + 'need.details', + 'need.informations', + 'need.unavailable_from', + 'payment', + ]) + .cache(60000); + + return await nestPaginate(options, queryBuilder, { + sortableColumns: ['id'], + defaultSortBy: [['doneAt', 'DESC']], + nullSort: 'last', + }); + } + + async getPurchasedNeeds( + options: PaginateQuery, + socialWorker: number, + auditor: number, + purchaser: number, + ngoId: number, + swIds: number[], + ngoIds: number[], + ): Promise> { + const queryBuilder = this.flaskNeedRepository + .createQueryBuilder('need') + .leftJoinAndMapOne( + 'need.child', + Child, + 'child', + 'child.id = need.child_id', + ) + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + .leftJoinAndMapMany( + 'need.payments', + Payment, + 'payment', + 'payment.id_need = need.id', + ) + .leftJoinAndMapMany( + 'need.status_updates', + NeedStatusUpdate, + 'need_status_updates', + 'need_status_updates.need_id = need.id', + ) + .leftJoinAndMapMany( + 'need.receipts_', + NeedReceipt, + 'need_receipt', + 'need_receipt.need_id = need.id', + ) + + .leftJoinAndMapMany( + 'need_receipt.receipt', + Receipt, + 'receipt', + 'receipt.id = need_receipt.receipt_id', + ) + // .andWhere('child.id_ngo IN (:...ngoIds)', { ngoIds: ngoIds }) + .where('need.isDeleted = :needDeleted', { needDeleted: false }) + .andWhere( + new Brackets((qb) => { + qb.where('need.type = :typeProduct', { + typeProduct: NeedTypeEnum.PRODUCT, + }) + .andWhere('need.status = :productStatus', { + productStatus: ProductStatusEnum.PURCHASED_PRODUCT, + }) + .orWhere('need.type = :typeService', { + typeService: NeedTypeEnum.SERVICE, + }) + .andWhere('need.status = :serviceStatus', { + serviceStatus: ServiceStatusEnum.MONEY_TO_NGO, + }); + }), + ) + .andWhere('need.created_by_id IN (:...swIds)', { + swIds: socialWorker ? [socialWorker] : [...swIds], + }) + + .select([ + 'child', + 'ngo.id', + 'ngo.name', + 'ngo.logoUrl', + 'need.id', + 'need.child_id', + 'need.created_by_id', + 'need.name_translations', + 'need.title', + 'need.imageUrl', + 'need.category', + 'need.type', + 'need.isUrgent', + 'need.link', + 'need.affiliateLinkUrl', + 'need.bank_track_id', + 'need.doing_duration', + 'need.status', + 'need.img', + 'need.purchase_cost', + 'need._cost', + 'need.deliveryCode', + 'need.isConfirmed', + 'need.created', + 'need.updated', + 'need.confirmDate', + 'need.confirmUser', + 'need.doneAt', + 'need.ngo_delivery_date', + 'need.child_delivery_date', + 'need.purchase_date', + 'need.expected_delivery_date', + 'need.details', + 'need.informations', + 'need.unavailable_from', + 'need_status_updates', + 'payment', + 'receipt', + 'need_receipt', + ]) + .cache(60000); + return await nestPaginate(options, queryBuilder, { + sortableColumns: ['id'], + defaultSortBy: [['updated', 'DESC']], + nullSort: 'last', + }); + } + + async getDeliveredNeeds( + options: PaginateQuery, + socialWorker: number, + auditor: number, + purchaser: number, + ngoId: number, + swIds: number[], + ngoIds: number[], + needWithSignatures: number[], + ): Promise> { + const queryBuilder = this.flaskNeedRepository + .createQueryBuilder('need') + .leftJoinAndMapOne( + 'need.child', + Child, + 'child', + 'child.id = need.child_id', + ) + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + .leftJoinAndMapMany( + 'need.payments', + Payment, + 'payment', + 'payment.id_need = need.id', + ) + .leftJoinAndMapMany( + 'need.status_updates', + NeedStatusUpdate, + 'need_status_updates', + 'need_status_updates.need_id = need.id', + ) + + .leftJoinAndMapMany( + 'need.receipts_', + NeedReceipt, + 'need_receipt', + 'need_receipt.need_id = need.id', + ) + + .leftJoinAndMapMany( + 'need_receipt.receipt', + Receipt, + 'receipt', + 'receipt.id = need_receipt.receipt_id', + ) + .where('need.id NOT IN (:...needWithSignatures)', { + needWithSignatures: needWithSignatures[0] + ? [...needWithSignatures] + : [0], + }) + .andWhere('need.created_by_id IN (:...swIds)', { + swIds: socialWorker ? [socialWorker] : [...swIds], + }) + // .andWhere('child.id_ngo IN (:...ngoIds)', { ngoIds: ngoIds }) // e.g: sw: 1 used to be in Ngo:13, therefore some needs are created in an ngo where their sw is now active somewhere else. + // .andWhere('need_receipt.deleted = :receiptDeleted', { receiptDeleted: null }) + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + // .andWhere('need._cost = :price', { price: 0 }) // only for test purposes + .andWhere( + new Brackets((qb) => { + qb.where('need.type = :typeProduct', { + typeProduct: NeedTypeEnum.PRODUCT, + }) + .andWhere('need.status = :productStatus', { + productStatus: ProductStatusEnum.DELIVERED, + }) + .orWhere('need.type = :typeService', { + typeService: NeedTypeEnum.SERVICE, + }) + .andWhere('need.status = :serviceStatus', { + serviceStatus: ServiceStatusEnum.DELIVERED, + }); + }), + ) + + .select([ + 'child', + 'ngo.id', + 'ngo.name', + 'ngo.logoUrl', + 'need.id', + 'need.child_id', + 'need.created_by_id', + 'need.name_translations', + 'need.title', + 'need.imageUrl', + 'need.category', + 'need.type', + 'need.isUrgent', + 'need.link', + 'need.affiliateLinkUrl', + 'need.bank_track_id', + 'need.doing_duration', + 'need.status', + 'need.img', + 'need.purchase_cost', + 'need._cost', + 'need.isConfirmed', + 'need.created', + 'need.updated', + 'need.confirmDate', + 'need.confirmUser', + 'need.doneAt', + 'need.ngo_delivery_date', + 'need.child_delivery_date', + 'need.purchase_date', + 'need.expected_delivery_date', + 'need.unavailable_from', + 'need.details', + 'need.informations', + 'need_status_updates', + 'receipt', + 'need_receipt', + 'payment', + ]) + .cache(60000); + return await nestPaginate(options, queryBuilder, { + sortableColumns: ['id'], + defaultSortBy: [['child_delivery_date', 'DESC']], + nullSort: 'last', + }); } + async getDuplicateNeeds(childId: number, needId: number) { + const need = await this.getFlaskNeed(needId); + const queryBuilder = this.flaskNeedRepository + .createQueryBuilder('need') + .leftJoinAndMapOne( + 'need.child', + Child, + 'child', + 'child.id = need.child_id', + ) + .andWhere('need.child_id = :childId', { childId: childId }) + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .andWhere('need.id != :needId', { needId: need.id }) + .andWhere("need.name_translations -> 'en' = :nameTranslations", { + nameTranslations: need.name_translations.en, + }) + // .andWhere('need.status < :statusPaid', { + // statusPaid: PaymentStatusEnum.COMPLETE_PAY, + // }) + // .andWhere('need.confirmDate > :confirmDate', { confirmDate: date }) + + .select([ + 'child.sayname_translations', + 'need.id', + 'need.title', + 'need.imageUrl', + 'need.child_id', + 'need.name_translations', + 'need.description_translations', + 'need.title', + 'need._cost', + 'need.type', + 'need.link', + 'need.status', + 'need.category', + 'need.isConfirmed', + 'need.created', + 'need.updated', + 'need.confirmDate', + ]) + .cache(60000) + .orderBy('need.created', 'ASC'); + return await queryBuilder.getMany(); + } + + async getDeleteCandidates(): Promise<[Need[], number]> { + const date = new Date(); + date.setMonth(date.getMonth() - 3); // three months ago + return this.flaskNeedRepository + .createQueryBuilder('need') + .leftJoinAndMapOne( + 'need.child', + Child, + 'child', + 'child.id = need.child_id', + ) + .where('need.isConfirmed = :isConfirmed', { isConfirmed: true }) + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .andWhere('child.id_ngo NOT IN (:...testNgoIds)', { testNgoIds: [3, 14] }) + .andWhere('need.confirmDate > :startDate', { + startDate: new Date(2019, 1, 1), + }) + .andWhere('need.confirmDate < :endDate', { endDate: date }) + .andWhere('need.status <= :statusNotPaid', { + statusNotPaid: PaymentStatusEnum.PARTIAL_PAY, + }) + .select([ + 'need.id', + 'need.status', + 'need.isConfirmed', + 'need.deleted_at', + 'need.created', + 'need.updated', + 'need.confirmDate', + ]) + .cache(60000) + .limit(500) + .orderBy('need.created', 'ASC') + .getManyAndCount(); + } + + async getArrivalUpdateCandidates(): Promise<[Need[], number]> { + return this.flaskNeedRepository + .createQueryBuilder('need') + .leftJoinAndMapOne( + 'need.child', + Child, + 'child', + 'child.id = need.child_id', + ) + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + .leftJoinAndMapMany( + 'need.payments', + Payment, + 'payment', + 'payment.id_need = need.id', + ) + .leftJoinAndMapMany( + 'need.status_updates', + NeedStatusUpdate, + 'need_status_updates', + 'need_status_updates.need_id = need.id', + ) + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .where( + new Brackets((qb) => { + qb.where('need.type = :typeProduct', { + typeProduct: NeedTypeEnum.PRODUCT, + }) + .andWhere('need.status = :productStatus', { + productStatus: ProductStatusEnum.PURCHASED_PRODUCT, + }) + .orWhere('need.type = :typeService', { + typeService: NeedTypeEnum.SERVICE, + }) + .andWhere('need.status = :serviceStatus', { + serviceStatus: ServiceStatusEnum.MONEY_TO_NGO, + }); + }), + ) + .getManyAndCount(); + } + + async deleteOneNeed(id: string) { + return from(this.needRepository.delete(id)); + } + + async deleteFlaskOneNeed(flaskNeedId: number, accessToken: string) { + const needApi = new NeedAPIApi(); + const deleted = needApi.apiV2NeedDeleteNeedIdneedIdPatch( + accessToken, + flaskNeedId, + ); + return deleted; + } + + async getMidjourneyNeeds(): Promise { + return await this.flaskNeedRepository + .createQueryBuilder('need') + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .andWhere('need.status >= :statusPaid', { + statusPaid: PaymentStatusEnum.COMPLETE_PAY, + }) + .select([ + 'need.id', + 'need.imageUrl', + 'need.name_translations', + 'need.title', + 'need.img', + 'need.link', + 'need.status', + 'need.created', + 'need.updated', + 'need.confirmDate', + 'need.doneAt', + ]) + .cache(60000) + .orderBy('need.created', 'DESC') + .getMany(); + } + + async getConfirmsInRange( + confirmDate: Date, + needCategory: number, + needType: number, + month: number, + ): Promise<[Need[], number]> { + const d = new Date(confirmDate); + d.setMonth(d.getMonth() - month); // 1 months ago + + const d2 = new Date(confirmDate); + d2.setMonth(d2.getMonth() + month); // 1 months after + + return await this.flaskNeedRepository + .createQueryBuilder('need') + .where('need.category = :needCategory', { needCategory }) + .andWhere('need.type = :needType', { needType }) + .andWhere('need.confirmDate > :startDate', { + startDate: new Date(d), + }) + .andWhere('need.confirmDate <= :endDate', { + endDate: new Date(d2), + }) + .andWhere('need.isConfirmed = :isConfirmed', { isConfirmed: true }) + .andWhere('need.isDeleted = :isDeleted', { isDeleted: false }) + .getManyAndCount(); + } + + async getPurchasedNeedsCount(socialWorker: number): Promise { + return this.flaskNeedRepository + .createQueryBuilder('need') + .leftJoinAndMapOne( + 'need.child', + Child, + 'child', + 'child.id = need.child_id', + ) + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + .leftJoinAndMapMany( + 'need.payments', + Payment, + 'payment', + 'payment.id_need = need.id', + ) + .leftJoinAndMapMany( + 'need.status_updates', + NeedStatusUpdate, + 'need_status_updates', + 'need_status_updates.need_id = need.id', + ) + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .andWhere('need.created_by_id IN (:...swIds)', { + swIds: [socialWorker], + }) + .where( + new Brackets((qb) => { + qb.where('need.type = :typeProduct', { + typeProduct: NeedTypeEnum.PRODUCT, + }) + .andWhere('need.status = :productStatus', { + productStatus: ProductStatusEnum.PURCHASED_PRODUCT, + }) + .orWhere('need.type = :typeService', { + typeService: NeedTypeEnum.SERVICE, + }) + .andWhere('need.status = :serviceStatus', { + serviceStatus: ServiceStatusEnum.MONEY_TO_NGO, + }); + }), + ) + .select(['need.id']) + .getMany(); + } + + async getSimilarNeeds(name: string): Promise { + const queryBuilder = this.flaskNeedRepository + .createQueryBuilder('need') + .where("need.name_translations -> 'en' = :nameTranslations", { + nameTranslations: name, + }) + .andWhere('need.isConfirmed = :isConfirmed', { isConfirmed: true }) + .andWhere('need.isDeleted = :isDeleted', { isDeleted: false }) + .select([ + 'need.id', + 'need.title', + 'need.status', + 'need.type', + 'need.child_id', + 'need.name_translations', + 'need.description_translations', + 'need.category', + 'need.isConfirmed', + 'need.created', + 'need.confirmDate', + ]) + .cache(60000) + .orderBy('need.created', 'ASC'); + return await queryBuilder.getMany(); + } } diff --git a/src/features/need/pipes/validate-need.pipe.ts b/src/features/need/pipes/validate-need.pipe.ts index a4de6271ff..3ea0e273eb 100644 --- a/src/features/need/pipes/validate-need.pipe.ts +++ b/src/features/need/pipes/validate-need.pipe.ts @@ -1,9 +1,11 @@ import { ArgumentMetadata, Injectable, PipeTransform } from '@nestjs/common'; -import { NeedDto } from '../../../types/dtos/CreateNeed.dto'; +import { SwMyPage } from 'src/generated-sources/openapi'; @Injectable() export class ValidateNeedPipe implements PipeTransform { - transform(value: NeedDto, metadata: ArgumentMetadata) { + transform(value: SwMyPage, metadata: ArgumentMetadata) { + console.log("Validating Need...") + return value; } } diff --git a/src/features/ngo/middlewares/ngo.middleware.ts b/src/features/ngo/middlewares/ngo.middleware.ts new file mode 100644 index 0000000000..2a24c8cac7 --- /dev/null +++ b/src/features/ngo/middlewares/ngo.middleware.ts @@ -0,0 +1,38 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class NgoMiddleware implements NestMiddleware { + private readonly logger = new Logger(NgoMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + console.log(req.headers); + + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/ngo/ngo.controller.ts b/src/features/ngo/ngo.controller.ts index 82f1f44009..f6ee3bc163 100644 --- a/src/features/ngo/ngo.controller.ts +++ b/src/features/ngo/ngo.controller.ts @@ -1,18 +1,129 @@ -import { Controller, Get } from '@nestjs/common'; -import { ApiOperation, ApiTags } from '@nestjs/swagger'; +import { + Controller, + ForbiddenException, + Get, + Param, + Patch, + Req, +} from '@nestjs/common'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; +import { + FlaskUserTypesEnum, + SAYPlatformRoles, +} from 'src/types/interfaces/interface'; +import { convertFlaskToSayRoles } from 'src/utils/helpers'; +import { SyncService } from '../sync/sync.service'; +import { UserService } from '../user/user.service'; import { NgoService } from './ngo.service'; +import { isAuthenticated } from 'src/utils/auth'; @ApiTags('Ngo') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) @Controller('ngo') export class NgoController { - constructor(private ngoService: NgoService, - ) { } + constructor( + private ngoService: NgoService, + private userService: UserService, + private syncService: SyncService, + ) { } - @Get(`all`) - @ApiOperation({ description: 'Get all ngos' }) - async getNgos() { - return await this.ngoService.getNgos() + @Get(`all`) + @ApiOperation({ description: 'Get all ngos' }) + async getNgos(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); } + return await this.ngoService.getNgos(); + } -} \ No newline at end of file + @Get(`socialworkers/:flaskNgoId`) + @ApiOperation({ description: 'Get all ngos' }) + async getNgoSws( + @Param('flaskNgoId') flaskNgoId: number, + @Req() req: Request, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.ngoService.getFlaskNGOSws( + Number(flaskNgoId), + Number(panelFlaskUserId), + Number(panelFlaskTypeId), + ); + } + + @Get(`arrivals/:swId`) + async getNgoArrivals(@Req() req: Request, @Param('swId') swId: number) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized'); + } + let socialWorkerId: number; + let swIds: number[]; + const socialWorker = await this.userService.getFlaskSocialWorker(swId); + const roleId = convertFlaskToSayRoles(socialWorker.type_id); + if (roleId === SAYPlatformRoles.SOCIAL_WORKER) { + socialWorkerId = swId; + } + if (roleId === SAYPlatformRoles.AUDITOR) { + socialWorkerId = null; + swIds = await this.userService + .getFlaskSwIds() + .then((r) => r.map((s) => s.id)); + } + if (roleId === SAYPlatformRoles.PURCHASER) { + socialWorkerId = null; + swIds = await this.userService + .getFlaskSwIds() + .then((r) => r.map((s) => s.id)); + } + if (roleId === SAYPlatformRoles.NGO_SUPERVISOR) { + socialWorkerId = null; + swIds = await this.userService + .getFlaskSocialWorkersByNgo(socialWorker.ngo_id) + .then((r) => r.map((s) => s.id)); + } + return await this.ngoService.getNgoArrivals(socialWorkerId, swIds); + } + + @Patch(`arrivals/update/:flaskUserId/:deliveryCode/:arrivalCode`) + async updateNgoArrivals( + @Req() req: Request, + @Param('flaskUserId') flaskUserId: number, + @Param('deliveryCode') deliveryCode: string, + @Param('arrivalCode') arrivalCode: string, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + const flaskSocialWorker = await this.userService.getFlaskSocialWorker( + flaskUserId, + ); + const ngo = await this.syncService.syncContributorNgo(flaskSocialWorker); + + return await this.ngoService.updateNgoArrivals( + ngo, + deliveryCode, + arrivalCode, + ); + } +} diff --git a/src/features/ngo/ngo.module.ts b/src/features/ngo/ngo.module.ts index 4e5a49c741..4e515e41e2 100644 --- a/src/features/ngo/ngo.module.ts +++ b/src/features/ngo/ngo.module.ts @@ -1,13 +1,97 @@ -import { Module } from '@nestjs/common'; +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { NgoEntity } from '../../entities/ngo.entity'; +import { ChildrenEntity } from 'src/entities/children.entity'; +import { LocationEntity } from 'src/entities/location.entity'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { Cities } from 'src/entities/flaskEntities/cities.entity'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { NGO } from 'src/entities/flaskEntities/ngo.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { NeedEntity } from 'src/entities/need.entity'; +import { PaymentEntity } from 'src/entities/payment.entity'; +import { ProviderEntity } from 'src/entities/provider.entity'; +import { ProviderJoinNeedEntity } from 'src/entities/provider.Join.need..entity'; +import { ReceiptEntity } from 'src/entities/receipt.entity'; +import { StatusEntity } from 'src/entities/status.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { NgoArrivalEntity, NgoEntity } from '../../entities/ngo.entity'; +import { ChildrenService } from '../children/children.service'; +import { LocationService } from '../location/location.service'; +import { NeedService } from '../need/need.service'; +import { PaymentService } from '../payment/payment.service'; +import { ProviderService } from '../provider/provider.service'; +import { ReceiptService } from '../receipt/receipt.service'; +import { StatusService } from '../status/status.service'; +import { SyncService } from '../sync/sync.service'; +import { UserService } from '../user/user.service'; import { NgoController } from './ngo.controller'; import { NgoService } from './ngo.service'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { NgoMiddleware } from './middlewares/ngo.middleware'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { Countries } from 'src/entities/flaskEntities/countries.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; @Module({ - imports: [TypeOrmModule.forFeature([NgoEntity])], - controllers: [NgoController], - providers: [NgoService], -}) + imports: [ + TypeOrmModule.forFeature( + [ + Child, + NGO, + Need, + SocialWorker, + Payment, + Cities, + UserFamily, + Family, + User, + Countries, + Receipt, + NeedReceipt, + ], + 'flaskPostgres', + ), -export class NgoModule { } + TypeOrmModule.forFeature([ + NgoEntity, + NgoArrivalEntity, + NeedEntity, + VariableEntity, + LocationEntity, + ProviderJoinNeedEntity, + ProviderEntity, + StatusEntity, + ChildrenEntity, + ReceiptEntity, + PaymentEntity, + ContributorEntity, + AllUserEntity, + EthereumAccountEntity, + ChildrenPreRegisterEntity, + ]), + ], + controllers: [NgoController], + providers: [ + NgoService, + UserService, + SyncService, + NeedService, + ChildrenService, + ReceiptService, + PaymentService, + StatusService, + LocationService, + ProviderService, + ], +}) +export class NgoModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer.apply(NgoMiddleware).forRoutes('ngo'); + } +} diff --git a/src/features/ngo/ngo.service.ts b/src/features/ngo/ngo.service.ts index ed9987c0f5..1075e3a0ab 100644 --- a/src/features/ngo/ngo.service.ts +++ b/src/features/ngo/ngo.service.ts @@ -1,36 +1,243 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { NgoEntity } from 'src/entities/ngo.entity'; +import { LocationEntity } from 'src/entities/location.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { NGO } from 'src/entities/flaskEntities/ngo.entity'; +import { SocialWorker } from 'src/entities/flaskEntities/user.entity'; +import { NgoArrivalEntity, NgoEntity } from 'src/entities/ngo.entity'; +import { + FlaskUserTypesEnum, + NeedTypeEnum, + ProductStatusEnum, +} from 'src/types/interfaces/interface'; import { NgoParams } from 'src/types/parameters/NgoParammeters'; -import { Repository } from 'typeorm'; -import { FamilyEntity } from '../../entities/user.entity'; +import { Brackets, Repository, UpdateResult } from 'typeorm'; @Injectable() export class NgoService { - constructor( - @InjectRepository(NgoEntity) - private ngoRepository: Repository, + constructor( + @InjectRepository(NgoEntity) + private ngoRepository: Repository, + @InjectRepository(NgoArrivalEntity) + private ngoArrivalRepository: Repository, + @InjectRepository(NGO, 'flaskPostgres') + private ngoFlaskRepository: Repository, + @InjectRepository(Need, 'flaskPostgres') + private needFlaskRepository: Repository, + @InjectRepository(SocialWorker, 'flaskPostgres') + private flaskSocialWorkerRepository: Repository, + ) { } - ) { } + getNgos(): Promise { + return this.ngoRepository.find(); + } - getNgos(): Promise { - return this.ngoRepository.find(); + async updateNgoArrivals( + ngo: NgoEntity, + deliveryCode: string, + arrivalCode: string, + ): Promise { + const nestNgoArrival = await this.ngoArrivalRepository.findOne({ + where: { + deliveryCode, + }, + }); + if (!nestNgoArrival) { + console.log('Creating NgoArrivals...\n'); + const ngoArrival = this.ngoArrivalRepository.create({ + arrivalCode, + deliveryCode, + ngo, + }); + return this.ngoArrivalRepository.save(ngoArrival); + } else { + console.log('Updating NgoArrivals...\n'); + return this.ngoArrivalRepository.update(nestNgoArrival.id, { + id: nestNgoArrival.id, + arrivalCode, + }); } + } + async getNgoArrivals(socialWorker: number, swIds: number[]) { + const today = new Date(); + const daysAgo = today.setDate(today.getDate() - 30); - getNgo(flaskNgoId: number): Promise { - const user = this.ngoRepository.findOne({ - where: { - flaskNgoId: flaskNgoId, - }, - }); - return user; + const needs = await this.needFlaskRepository + .createQueryBuilder('need') + .leftJoinAndMapOne( + 'need.child', + Child, + 'child', + 'child.id = need.child_id', + ) + .leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo') + .where( + new Brackets((qb) => { + qb.where('need.type = :typeProduct', { + typeProduct: NeedTypeEnum.PRODUCT, + }) + // .andWhere('need.status = :productStatus', { + // productStatus: ProductStatusEnum.PURCHASED_PRODUCT, + // }); + }), + ) + .where('child.isConfirmed = :childConfirmed', { childConfirmed: true }) + .andWhere('need.isConfirmed = :needConfirmed', { needConfirmed: true }) + .andWhere('need.expected_delivery_date > :startDate', { + startDate: new Date(daysAgo), + }) + .andWhere('need.isDeleted = :needDeleted', { needDeleted: false }) + .andWhere('need.created_by_id IN (:...swIds)', { + swIds: socialWorker ? [socialWorker] : [...swIds], + }) + .andWhere('need.deliveryCode IS NOT NULL') + + .select([ + 'need.id', + 'ngo.name', + 'child.id', + 'child.id_ngo', + 'need.deliveryCode', + 'need.type', + 'need.status', + 'need.created_by_id', + 'need.purchase_date', + 'need.expected_delivery_date', + ]) + .getMany(); + + // return codes + const codesArray = needs.map( + (n: { deliveryCode: string }) => n.deliveryCode, + ); + const uniqueCodes = Array.from(new Set(codesArray)); + + const arrivalCodes = []; + for await (const c of uniqueCodes) { + const arrival = await this.ngoArrivalRepository.findOne({ + where: { + deliveryCode: c, + }, + }); + arrivalCodes.push(arrival); } + // we get the max date to ignore codes with wrong date / help find same codes with different dates + const arrivals = uniqueCodes.map((c) => { + return { + deliveryCode: c, + maxDate: Math.min( + ...needs + .filter((n) => n.deliveryCode === c) + .map((n) => Date.parse(String(n.expected_delivery_date))), + ), + ngoId: needs + .filter((n) => n.deliveryCode === c) + .map((n: any) => n.child.id_ngo)[0], + + ngoName: needs + .filter((n) => n.deliveryCode === c) + .map((n: any) => n.child.ngo.name)[0], + + arrivalCode: arrivalCodes.find((a) => a && a.deliveryCode === c) + ? arrivalCodes.find((a) => a && a.deliveryCode === c).arrivalCode + : '', + + itemCount: needs.filter((n) => n.deliveryCode === c).length, + }; + }); + + arrivals.sort(function (a, b) { + return b.maxDate - a.maxDate; + }); + + return [...arrivals]; + } - createNgo(ngoDetails: NgoParams): Promise { - const newNgo = this.ngoRepository.create({ - ...ngoDetails, + getFlaskNgos(): Promise { + return this.ngoFlaskRepository + .createQueryBuilder('ngo') + .andWhere('ngo.id NOT IN (:...testNgoIds)', { + testNgoIds: [3, 14], + }) + .cache(10000) + .getMany(); + } + + getAllFlaskNgos(): Promise { + return this.ngoFlaskRepository + .createQueryBuilder('ngo') + .cache(10000) + .getMany(); + } + + getFlaskNgo(flaskNgoId: number): Promise { + return this.ngoFlaskRepository.findOne({ + where: { id: flaskNgoId }, + }); + } + + getNgoById(flaskNgoId: number): Promise { + const ngo = this.ngoRepository.findOne({ + where: { + flaskNgoId: flaskNgoId, + }, + }); + return ngo; + } + + createNgo(ngoDetails: NgoParams, city: LocationEntity): Promise { + const newNgo = this.ngoRepository.create({ + ...ngoDetails, + flaskCityId: ngoDetails.flaskCityId, + location: city, + }); + + return this.ngoRepository.save({ id: newNgo.id, ...newNgo }); + } + + getFlaskNGOSws( + ngoId: number, + flaskSwId: number, + typeId: FlaskUserTypesEnum, + ): Promise { + if (ngoId > 0) { + if ( + typeId === FlaskUserTypesEnum.NGO_SUPERVISOR || + typeId === FlaskUserTypesEnum.ADMIN || + typeId === FlaskUserTypesEnum.SUPER_ADMIN + ) { + return this.flaskSocialWorkerRepository.find({ + where: { + ngo_id: ngoId, + }, }); - return this.ngoRepository.save(newNgo); + } else if (ngoId && typeId === FlaskUserTypesEnum.SOCIAL_WORKER) { + return this.flaskSocialWorkerRepository.find({ + where: { + id: flaskSwId, + ngo_id: ngoId, + }, + }); + } + } else if ( + !ngoId && + (typeId === FlaskUserTypesEnum.SUPER_ADMIN || + typeId === FlaskUserTypesEnum.ADMIN) + ) { + return this.flaskSocialWorkerRepository.find(); } + } + + async updateNgo( + ngoId: string, + ngoDetails: NgoParams, + city: LocationEntity, + ): Promise { + return this.ngoRepository.update(ngoId, { + ...ngoDetails, + location: city, + }); + } } diff --git a/src/features/payment/middlewares/payment.middleware.ts b/src/features/payment/middlewares/payment.middleware.ts new file mode 100644 index 0000000000..45d9fb7230 --- /dev/null +++ b/src/features/payment/middlewares/payment.middleware.ts @@ -0,0 +1,36 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class PaymentMiddleware implements NestMiddleware { + private readonly logger = new Logger(PaymentMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/payment/payment.controller.ts b/src/features/payment/payment.controller.ts index 41d66d3fff..ca692dd893 100644 --- a/src/features/payment/payment.controller.ts +++ b/src/features/payment/payment.controller.ts @@ -1,16 +1,232 @@ -import { Controller, Get } from '@nestjs/common'; -import { ApiOperation, ApiTags } from '@nestjs/swagger'; +import { + Body, + Controller, + ForbiddenException, + Get, + Param, + Post, + Query, + Req, + UseInterceptors, + UsePipes, + ValidationPipe, +} from '@nestjs/common'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; import { PaymentService } from './payment.service'; +import { isAuthenticated } from 'src/utils/auth'; +import { FlaskUserTypesEnum } from 'src/types/interfaces/interface'; +import config from 'src/config'; +import axios from 'axios'; +import { ValidatePaymentPipe } from './pipes/validate-campaign.pipe'; +import { + CreateFlaskCartPaymentDto, + CreateFlaskPaymentDto, + VerifyFlaskPaymentDto, +} from 'src/types/dtos/CreatePayment.dto'; +import { ServerError } from 'src/filters/server-exception.filter'; @ApiTags('Payments') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) +@UsePipes(new ValidationPipe()) @Controller('payment') export class PaymentController { - constructor(private paymentService: PaymentService, - ) { } + constructor(private paymentService: PaymentService) {} - @Get(`all`) - @ApiOperation({ description: 'Get all needs from flask' }) - async getPayments() { - return await this.paymentService.getPayments() + @Post(`new`) + @ApiOperation({ description: 'Create new payment' }) + async newPayment( + @Req() req: Request, + @Body(ValidatePaymentPipe) body: CreateFlaskPaymentDto, + ) { + const dappFlaskUserId = Number(req.headers['dappFlaskUserId']); + + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } + + const token = + config().dataCache.fetchDappAuthentication(dappFlaskUserId).token; + const configs = { + headers: { + 'Content-Type': 'application/json', + Authorization: token, + }, + }; + try { + // create flask payment + const { data } = await axios.post( + 'https://api.sayapp.company/api/v2/payment', + { + need_id: Number(body.needId), + amount: Number(body.amount), + donate: Number(body.donation), + use_credit: body.useCredit, + gateWay: Number(body.gateWay), + }, + configs, + ); + return data; + } catch (e) { + console.log(e); + } + } + + @Get(`verify`) + @ApiOperation({ description: 'Zibal calls this callback' }) + async verifyPayment( + @Req() req: Request, + // callback: https://yourcallbackurl.com/callback?trackId=9900&success=1&status=2&orderId=1 + @Query('trackId') trackId: string, + @Query('orderId') orderId: string, + ) { + try { + const { data } = await axios.get( + `https://api.sayapp.company/api/v2/payment/verify?trackId=${trackId}&orderId=${orderId}`, + ); + return data; + } catch (e) { + console.log(e); + } + } + + @Post(`new/cart`) + @ApiOperation({ description: 'Create new cart payment' }) + async newCartPayment( + @Req() req: Request, + @Body(ValidatePaymentPipe) body: CreateFlaskCartPaymentDto, + ) { + const dappFlaskUserId = Number(req.headers['dappFlaskUserId']); + + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } + + const token = + config().dataCache.fetchDappAuthentication(dappFlaskUserId).token; + const configs = { + headers: { + 'Content-Type': 'application/json', + Authorization: token, + }, + }; + try { + // create flask payment + const { data } = await axios.post( + 'https://api.sayapp.company/api/v2/mycart/payment', + { + donation: Number(body.donation), + use_credit: body.useCredit, + gateWay: Number(body.gateWay), + }, + configs, + ); + return data; + } catch (e) { + console.log(e); + } + } + + @Get(`verify/cart`) + @ApiOperation({ description: 'Zibal calls this callback' }) + async verifyCartPayment( + @Req() req: Request, + // callback: https://yourcallbackurl.com/callback?trackId=9900&success=1&status=2&orderId=1 + @Query('trackId') trackId: string, + @Query('orderId') orderId: string, + ) { + try { + const { data } = await axios.get( + `https://api.sayapp.company/api/v2/mycart/payment/verify?trackId=${trackId}&orderId=${orderId}`, + ); + return data; + } catch (e) { + console.log(e); + } + } + @Get(`all`) + @ApiOperation({ description: 'Get all needs payments' }) + async getPayments(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.paymentService.getPayments(); + } + + @Get(`user/all/:flaskUserId`) + @ApiOperation({ description: 'Get all needs payments' }) + async getUserPayments( + @Req() req: Request, + @Param('flaskUserId') flaskUserId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.paymentService.getUserPayments(flaskUserId); + } + + @Get(`all/:flaskNeedId`) + @ApiOperation({ description: 'Get all need payments' }) + async getNeedPayments( + @Req() req: Request, + @Param('flaskNeedId') flaskNeedId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.paymentService.getNeedPayments(flaskNeedId); + } + + @Get(`:flaskPaymentId`) + @ApiOperation({ description: 'Get all need payments' }) + async getPayment( + @Req() req: Request, + @Param('flaskPaymentId') flaskPaymentId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.paymentService.getPaymentByFlaskId(flaskPaymentId); + } + + @Get(`flask/all/:flaskNeedId`) + @ApiOperation({ description: 'Get all need payments from flask' }) + async getFlaskNeedPayments( + @Req() req: Request, + @Param('flaskNeedId') flaskNeedId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); } + return await this.paymentService.getFlaskNeedPayments(flaskNeedId); + } } diff --git a/src/features/payment/payment.module.ts b/src/features/payment/payment.module.ts index 8659885e09..c01add59f5 100644 --- a/src/features/payment/payment.module.ts +++ b/src/features/payment/payment.module.ts @@ -1,6 +1,11 @@ -import { Module } from '@nestjs/common'; +import { + MiddlewareConsumer, + Module, + NestModule, + RequestMethod, +} from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { FamilyEntity, SocialWorkerEntity } from '../../entities/user.entity'; +import { AllUserEntity } from '../../entities/user.entity'; import { NeedEntity } from '../../entities/need.entity'; import { PaymentEntity } from '../../entities/payment.entity'; import { NeedService } from '../need/need.service'; @@ -9,11 +14,56 @@ import { PaymentService } from './payment.service'; import { ChildrenEntity } from '../../entities/children.entity'; import { ChildrenService } from '../children/children.service'; import { PaymentController } from './payment.controller'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { PaymentMiddleware } from './middlewares/payment.middleware'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; @Module({ - imports: [TypeOrmModule.forFeature([PaymentEntity, NeedEntity, FamilyEntity, SocialWorkerEntity, ChildrenEntity])], - controllers: [PaymentController], - providers: [PaymentService, UserService, NeedService, ChildrenService], + imports: [ + TypeOrmModule.forFeature( + [ + Need, + SocialWorker, + Child, + Payment, + UserFamily, + Family, + User, + Receipt, + NeedReceipt, + ], + 'flaskPostgres', + ), + TypeOrmModule.forFeature([ + PaymentEntity, + NeedEntity, + VariableEntity, + AllUserEntity, + ContributorEntity, + ChildrenEntity, + EthereumAccountEntity, + ChildrenPreRegisterEntity, + ]), + ], + controllers: [PaymentController], + providers: [PaymentService, UserService, NeedService, ChildrenService], }) - -export class PaymentModule { } +export class PaymentModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer + .apply(PaymentMiddleware) + .exclude({ path: 'payment/new/cart', method: RequestMethod.POST }) + .exclude({ path: 'payment/verify(.*)', method: RequestMethod.GET }) + .forRoutes(PaymentController); + } +} diff --git a/src/features/payment/payment.service.ts b/src/features/payment/payment.service.ts index 9171bf5bfc..80fd0bfb96 100644 --- a/src/features/payment/payment.service.ts +++ b/src/features/payment/payment.service.ts @@ -1,37 +1,152 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { Repository } from 'typeorm'; +import { Brackets, Repository, UpdateResult } from 'typeorm'; import { PaymentEntity } from '../../entities/payment.entity'; import { PaymentParams } from '../../types/parameters/PaymentParameters'; -import { FamilyEntity } from '../../entities/user.entity'; +import { AllUserEntity } from '../../entities/user.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { + NeedTypeEnum, + ProductStatusEnum, + SAY_DAPP_ID, + ServiceStatusEnum, +} from 'src/types/interfaces/interface'; @Injectable() export class PaymentService { - constructor( - @InjectRepository(PaymentEntity) - private paymentRepository: Repository, - - ) { } - - getPayments(): Promise { - return this.paymentRepository.find({ - }); - } - - - getPayment(payment_id: number): Promise { - const user = this.paymentRepository.findOne({ - where: { - flaskPaymentId: payment_id, - }, - }); - return user; - } - - createPayment(paymentDetails: PaymentParams): Promise { - const newPayment = this.paymentRepository.create({ - ...paymentDetails, - }); - return this.paymentRepository.save(newPayment); - } + constructor( + @InjectRepository(Payment, 'flaskPostgres') + private flaskPaymentRepository: Repository, + @InjectRepository(PaymentEntity) + private paymentRepository: Repository, + ) {} + + getPayments(): Promise { + return this.paymentRepository.find(); + } + + getUserPayments(flaskUserId: number): Promise { + return this.paymentRepository.find({ + where: { + flaskUserId, + }, + }); + } + getPaymentByFlaskId(flaskId: number): Promise { + const user = this.paymentRepository.findOne({ + where: { + flaskId: flaskId, + }, + relations: { + need: true, + }, + }); + return user; + } + + getNeedPayments(flaskNeedId: number): Promise { + const user = this.paymentRepository.find({ + where: { + flaskNeedId: flaskNeedId, + }, + }); + return user; + } + + getFlaskNeedPayments(flaskNeedId: number): Promise { + const user = this.flaskPaymentRepository.find({ + where: { + id_need: flaskNeedId, + }, + }); + return user; + } + + createPayment( + paymentDetails: PaymentParams, + familyMember: AllUserEntity, + ): Promise { + const newPayment = this.paymentRepository.create({ + ...paymentDetails, + familyMember: familyMember, + }); + return this.paymentRepository.save({ id: newPayment.id, ...newPayment }); + } + + updatePayment( + paymentId: string, + paymentDetails: PaymentParams, + familyMember: AllUserEntity, + ): Promise { + return this.paymentRepository.update(paymentId, { + ...paymentDetails, + familyMember: familyMember, + }); + } + + async getPaymentsInRange( + paymentDate: Date, + needCategory: number, + needType: number, + month: number, + ): Promise<[Payment[], number]> { + const d = new Date(paymentDate); + d.setMonth(d.getMonth() - month); // 1 months ago + + const d2 = new Date(paymentDate); + d2.setMonth(d2.getMonth() + month); // 1 months after + + return await this.flaskPaymentRepository + .createQueryBuilder('payment') + .leftJoinAndMapOne( + 'payment.need', + Need, + 'need', + 'need.id = payment.id_need', + ) + .where( + new Brackets((qb) => { + qb.where('need.type = :typeProduct', { + typeProduct: NeedTypeEnum.PRODUCT, + }) + .andWhere('need.status = :productStatus', { + productStatus: ProductStatusEnum.DELIVERED, + }) + .orWhere('need.type = :typeService', { + typeService: NeedTypeEnum.SERVICE, + }) + .andWhere('need.status = :serviceStatus', { + serviceStatus: ServiceStatusEnum.DELIVERED, + }); + }), + ) + .andWhere('need.category = :needCategory', { needCategory }) + .andWhere('need.type = :needType', { needType }) + .andWhere('payment.created > :startDate', { + startDate: new Date(d), + }) + .andWhere('payment.created <= :endDate', { + endDate: new Date(d2), + }) + .andWhere('payment.need_amount > :amount', { amount: 0 }) // only positive amounts + .andWhere('payment.id_user != :sayId', { sayId: SAY_DAPP_ID }) + .andWhere('payment.id_need IS NOT NULL') + .andWhere('payment.id IS NOT NULL') + .andWhere('payment.verified IS NOT NULL') + .select(['payment', 'need']) + .getManyAndCount(); + } + + getFamilyCredit(flaskUserId: number): Promise { + return ( + this.flaskPaymentRepository + .createQueryBuilder('payment') + .andWhere('payment.id_user = :flaskUserId', { flaskUserId }) + .andWhere('payment.verified IS NOT NULL') + // .andWhere('payment.id_need IS NOT NULL') // payments with id_need null are just credit payments - positive credits (used credits) , negative (can use) + .select('SUM(Payment.credit_amount)', 'credit') + .getRawOne() + ); + } } diff --git a/src/features/payment/pipes/validate-campaign.pipe.ts b/src/features/payment/pipes/validate-campaign.pipe.ts new file mode 100644 index 0000000000..660bad4e70 --- /dev/null +++ b/src/features/payment/pipes/validate-campaign.pipe.ts @@ -0,0 +1,10 @@ +import { ArgumentMetadata, Injectable, PipeTransform } from '@nestjs/common'; + +@Injectable() +export class ValidatePaymentPipe implements PipeTransform { + transform(value: any, metadata: ArgumentMetadata) { + console.log('Validating Payment...'); + + return value; + } +} diff --git a/src/features/provider/middlewares/provider.image.middleware.ts.ts b/src/features/provider/middlewares/provider.image.middleware.ts.ts new file mode 100644 index 0000000000..bd6b3f2ade --- /dev/null +++ b/src/features/provider/middlewares/provider.image.middleware.ts.ts @@ -0,0 +1,27 @@ +import { + HttpException, + HttpStatus, + Injectable, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; + +@Injectable() +export class ProviderImageMiddleware implements NestMiddleware { + + async use(@Request() req, @Response() res, next: NextFunction) { + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/provider/middlewares/provider.middleware.ts b/src/features/provider/middlewares/provider.middleware.ts new file mode 100644 index 0000000000..e176e41490 --- /dev/null +++ b/src/features/provider/middlewares/provider.middleware.ts @@ -0,0 +1,36 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class ProviderMiddleware implements NestMiddleware { + private readonly logger = new Logger(ProviderMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/provider/provider.controller.ts b/src/features/provider/provider.controller.ts index 2bc742662c..a8175fd108 100644 --- a/src/features/provider/provider.controller.ts +++ b/src/features/provider/provider.controller.ts @@ -1,115 +1,316 @@ -import { Body, Controller, Delete, Get, HttpException, HttpStatus, Param, Patch, Post, Query, Res, UploadedFile, UseInterceptors, UsePipes, ValidationPipe } from '@nestjs/common'; -import { ApiOperation, ApiTags } from '@nestjs/swagger'; +import { + BadRequestException, + Body, + Controller, + Delete, + ForbiddenException, + Get, + HttpException, + HttpStatus, + Param, + Patch, + Post, + Req, + Res, + UploadedFile, + UseInterceptors, + UsePipes, + ValidationPipe, +} from '@nestjs/common'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; import { ProviderService } from './provider.service'; import { ProviderEntity } from '../../entities/provider.entity'; import { ServerError } from '../../filters/server-exception.filter'; -import { CreateProviderDto } from '../../types/dtos/CreateProvider.dto'; -import { Observable, of } from 'rxjs'; +import { + CreateProviderDto, + CreateProviderJoinNeedDto, +} from '../../types/dtos/CreateProvider.dto'; +import { Observable } from 'rxjs'; import { FileInterceptor } from '@nestjs/platform-express'; -import { storage } from '../../storage'; +import { providerStorage } from '../../storage/providerStorage'; import { UpdateResult } from 'typeorm'; -import { NeedTypeDefinitionEnum, NeedTypeEnum } from '../../types/interface'; +import { + FlaskUserTypesEnum, + NeedTypeDefinitionEnum, + NeedTypeEnum, +} from '../../types/interfaces/interface'; import { ValidateProviderPipe } from './pipes/validate-provider.pipe'; +import { ProviderJoinNeedEntity } from 'src/entities/provider.Join.need..entity'; +import { isAuthenticated } from 'src/utils/auth'; +import { NeedService } from '../need/need.service'; @ApiTags('Provider') @Controller('providers') export class ProviderController { - constructor(private providerService: ProviderService, - ) { } + constructor( + private providerService: ProviderService, + private needService: NeedService, + ) {} - @Get(`all`) - @ApiOperation({ description: 'Get all providers' }) - async getProviders() { - return await this.providerService.getProviders() + @Get(`all`) + @ApiSecurity('flask-access-token') + @ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, + }) + @ApiOperation({ description: 'Get all providers' }) + async getProviders(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized'); } + return await this.providerService.getProviders(); + } - @Get(`:id`) - @ApiOperation({ description: 'Get one by id' }) - async getOneProvider(@Param('id') id: string) { - let provider: ProviderEntity - if (id) { - try { - provider = await this.providerService.getProviderById(id) - } catch (e) { - throw new ServerError(e); - } - return provider; - } else { - throw new HttpException('you need to provide id', HttpStatus.BAD_REQUEST) - - } + @Get(`:id`) + @ApiSecurity('flask-access-token') + @ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, + }) + @ApiOperation({ description: 'Get one by id' }) + async getOneProvider(@Req() req: Request, @Param('id') id: string) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized'); + } + let provider: ProviderEntity; + if (id) { + try { + provider = await this.providerService.getProviderById(id); + } catch (e) { + throw new ServerError(e.message, e.status); + } + return provider; + } else { + throw new HttpException('you need to provide id', HttpStatus.BAD_REQUEST); + } + } + @Post('join') + @ApiSecurity('flask-access-token') + @ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, + }) + @ApiOperation({ description: 'Create one provider' }) + async createRelation( + @Req() req: Request, + @Body() body: CreateProviderJoinNeedDto, + ): Promise { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized'); } + let relation: ProviderJoinNeedEntity; + try { + relation = await this.providerService.getProviderNeedRelationById( + body.flaskNeedId, + ); + + if (!relation) { + relation = await this.providerService.createRelation( + body.flaskNeedId, + body.nestProviderId, + ); + console.log("relation1"); + console.log(relation.id); + } else { + console.log("relation2"); + console.log(relation.id); + await this.providerService.updateProviderRelation( + relation.id, + body.flaskNeedId, + body.nestProviderId, + ); + relation = await this.providerService.getProviderNeedRelationById( + body.flaskNeedId, + ); - @Post('add') - @UsePipes(new ValidationPipe()) // validation for dto files - @UseInterceptors(FileInterceptor('file', storage)) - @ApiOperation({ description: 'Create one provider' }) - async createProvider(@UploadedFile() file, @Body(ValidateProviderPipe) request: CreateProviderDto): Promise { - let provider: ProviderEntity - const newProvider = { - name: request.name, - description: request?.description, - type: - request.type === 0 - ? NeedTypeEnum.SERVICE - : NeedTypeEnum.PRODUCT, - typeName: - request.type === 0 - ? NeedTypeDefinitionEnum.SERVICE - : NeedTypeDefinitionEnum.PRODUCT, - website: request.website, - city: request?.city, - state: request?.state, - country: request.country, - logoUrl: file?.filename, - isActive: request?.isActive, - }; + const provider = await this.providerService.getProviderById( + relation.nestProviderId, + ); - try { - provider = await this.providerService.createProvider(newProvider) - } catch (e) { - throw new ServerError(e); - } + const need = await this.needService.getNeedByFlaskId(body.flaskNeedId); + console.log("relation2"); + console.log(body.flaskNeedId); + console.log(need.id); + console.log("end"); + await this.needService.updateNeedProvider(need.id, provider); + } + } catch (e) { + throw new ServerError(e.message, e.status); + } + return relation; + } + + @Get('need/:needId') + @ApiSecurity('flask-access-token') + @ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, + }) + @ApiOperation({ description: 'Create one provider' }) + async getProviderByNeed( + @Req() req: Request, + @Param('needId') needId, + ): Promise { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized'); + } + let provider: ProviderEntity; + try { + const relation = await this.providerService.getProviderNeedRelationById( + needId, + ); + if (relation) { + provider = await this.providerService.getProviderById( + relation.nestProviderId, + ); return provider; + } else { + throw new BadRequestException('No provider relation for this need'); + } + } catch (e) { + throw new ServerError(e.message, e.status); } + } - @Patch('update/:id') - @UsePipes(new ValidationPipe()) // validation for dto files - @UseInterceptors(FileInterceptor('file', storage)) - async updateProvider(@Param('id') id, @UploadedFile() file, @Body(ValidateProviderPipe) request: CreateProviderDto): Promise { - const newProvider = { - name: request?.name, - description: request?.description, - type: - request.type === 0 - ? NeedTypeEnum.SERVICE - : NeedTypeEnum.PRODUCT, - typeName: - request.type === 0 - ? NeedTypeDefinitionEnum.SERVICE - : NeedTypeDefinitionEnum.PRODUCT, - website: request?.website, - city: request?.city, - state: request?.state, - country: request?.country, - logoUrl: file?.filename, - isActive: Boolean(request.isActive) - }; - console.log(request) - console.log(newProvider) - return this.providerService.updateProvider(id, newProvider) + @Post('add') + @ApiSecurity('flask-access-token') + @ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, + }) + @UsePipes(new ValidationPipe()) // validation for dto files + @UseInterceptors(FileInterceptor('file', providerStorage)) + @ApiOperation({ description: 'Create one provider' }) + async createProvider( + @Req() req: Request, + @UploadedFile() file, + @Body(ValidateProviderPipe) request: CreateProviderDto, + ): Promise { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized'); } - @Delete(':id') - deleteOne(@Param('id') id: number): Observable { - return this.providerService.deleteOne(id); + let provider: ProviderEntity; + provider = await this.providerService.getProviderByName(request.name); + if ( + provider && + provider.city == request.city && + provider.country == request.country + ) { + throw new BadRequestException('Already exist!'); } + const newProvider = { + name: request.name, + description: request?.description, + address: request?.address, + type: + parseInt(request.type) === 0 + ? NeedTypeEnum.SERVICE + : NeedTypeEnum.PRODUCT, + typeName: + parseInt(request.type) === 0 + ? NeedTypeDefinitionEnum.SERVICE + : NeedTypeDefinitionEnum.PRODUCT, + website: request.website, + city: request?.city, + state: request?.state, + country: request.country, + logoUrl: file?.filename, + isActive: true, + }; + + try { + provider = await this.providerService.createProvider(newProvider); + } catch (e) { + throw new ServerError(e.message, e.status); + } + return provider; + } + + @Patch('update/:id') + @ApiSecurity('flask-access-token') + @ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, + }) + @UsePipes(new ValidationPipe()) // validation for dto files + @UseInterceptors(FileInterceptor('file', providerStorage)) + async updateProvider( + @Req() req: Request, + @Param('id') id, + @UploadedFile() file, + @Body(ValidateProviderPipe) request: CreateProviderDto, + ): Promise { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized'); + } + + const newProvider = { + name: request?.name, + description: request?.description, + address: request?.address, + type: + parseInt(request.type) === 0 + ? NeedTypeEnum.SERVICE + : NeedTypeEnum.PRODUCT, + typeName: + parseInt(request.type) === 0 + ? NeedTypeDefinitionEnum.SERVICE + : NeedTypeDefinitionEnum.PRODUCT, + website: request?.website, + city: request?.city, + state: request?.state, + country: request?.country, + logoUrl: file?.filename, + isActive: Boolean(request.isActive), + }; + return this.providerService.updateProvider(id, newProvider); + } - @Get('images/:fileId') - async serveAvatar(@Param('fileId') fileId, @Res() res: any): Promise { - res.sendFile(fileId, { root: './uploads/providers/logos' }); + @Delete(':id') + @ApiSecurity('flask-access-token') + @ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, + }) + deleteOne(@Req() req: Request, @Param('id') id: number): Observable { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); } + return this.providerService.deleteOne(id); + } -} \ No newline at end of file + @Get('images/:fileName') + async serveAvatar( + @Param('fileName') fileName: string, + @Res() res: any, + ): Promise { + res.sendFile(fileName, { root: './uploads/providers/logos' }); + } +} diff --git a/src/features/provider/provider.module.ts b/src/features/provider/provider.module.ts index b5dbf3a40d..51071b1517 100644 --- a/src/features/provider/provider.module.ts +++ b/src/features/provider/provider.module.ts @@ -1,14 +1,39 @@ -import { Module } from '@nestjs/common'; +import { + MiddlewareConsumer, + Module, + NestModule, + RequestMethod, +} from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; import { ProviderEntity } from '../../entities/provider.entity'; import { ProviderService } from './provider.service'; import { ProviderController } from './provider.controller'; +import { ProviderJoinNeedEntity } from 'src/entities/provider.Join.need..entity'; +import { ProviderMiddleware } from './middlewares/provider.middleware'; +import { NeedService } from '../need/need.service'; +import { NeedEntity } from 'src/entities/need.entity'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { VariableEntity } from 'src/entities/variable.entity'; @Module({ - imports: [TypeOrmModule.forFeature([ProviderEntity])], - controllers: [ProviderController], - providers: [ProviderService], + imports: [ + TypeOrmModule.forFeature([Need], 'flaskPostgres'), + TypeOrmModule.forFeature([ + ProviderEntity, + ProviderJoinNeedEntity, + ProviderEntity, + NeedEntity, + VariableEntity, + ]), + ], + controllers: [ProviderController], + providers: [ProviderService, NeedService], }) -export class ProviderModule { - +export class ProviderModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer + .apply(ProviderMiddleware) + .exclude('providers/images/:fileName') + .forRoutes(ProviderController); + } } diff --git a/src/features/provider/provider.service.ts b/src/features/provider/provider.service.ts index 7c0255f969..c19e35d2c3 100644 --- a/src/features/provider/provider.service.ts +++ b/src/features/provider/provider.service.ts @@ -4,59 +4,114 @@ import { ProviderEntity } from '../../entities/provider.entity'; import { Repository } from 'typeorm'; import { ProviderParams } from '../../types/parameters/ProviderParams'; import { from, Observable } from 'rxjs'; - +import { ProviderJoinNeedEntity } from 'src/entities/provider.Join.need..entity'; +import { capitalizeFirstLetter } from 'src/utils/helpers'; @Injectable() export class ProviderService { - constructor( - @InjectRepository(ProviderEntity) - private providerRepository: Repository, - ) { } - - async getProviders( - ): Promise { - return this.providerRepository.find() - } + constructor( + @InjectRepository(ProviderEntity) + private providerRepository: Repository, + @InjectRepository(ProviderJoinNeedEntity) + private providerJoinNeedRepository: Repository, + ) {} - getProviderById(id: string): Promise { - const provider = this.providerRepository.findOne({ - where: { - id, - } - }); - return provider; - } + async getProviders(): Promise { + return this.providerRepository.find({ + order: { + type: 'DESC', + }, + }); + } - createProvider( - providerDetails: ProviderParams, - ): Promise { - const newProvider = this.providerRepository.create({ - name: providerDetails.name, - description: providerDetails.description, - type: providerDetails.type, - typeName: providerDetails.typeName, - website: providerDetails.website, - city: providerDetails.city, - state: providerDetails.state, - country: providerDetails.country, - logoUrl: providerDetails.logoUrl, - isActive: providerDetails.isActive, - }); - return this.providerRepository.save(newProvider); - } + getProviderById(id: string): Promise { + const provider = this.providerRepository.findOne({ + where: { + id, + }, + }); + return provider; + } - updateProvider( - id: string, - updateProviderDetails: ProviderParams, - ) { - return this.providerRepository.update( - id, - { ...updateProviderDetails }, - ); + getProviderByName(name: string): Promise { + let provider = this.providerRepository.findOne({ + where: { + name, + }, + }); + if (!provider) { + provider = this.providerRepository.findOne({ + where: { + name: name.toLowerCase(), + }, + }); } - - deleteOne(id: number): Observable { - return from(this.providerRepository.delete(id)); + if (!provider) { + provider = this.providerRepository.findOne({ + where: { + name: capitalizeFirstLetter(name), + }, + }); } + return provider; + } + + // --------------------------------- to add providers for older needs before panel version 2.0.0 ----------------------------------------------- // + + async getProviderNeedRelationById( + flaskNeedId: number, + ): Promise { + return await this.providerJoinNeedRepository.findOne({ + where: { + flaskNeedId, + }, + }); + } + + createRelation( + flaskNeedId: number, + nestProviderId: string, + ): Promise { + const rel = this.providerJoinNeedRepository.create({ + flaskNeedId, + nestProviderId, + }); + return this.providerJoinNeedRepository.save(rel); + } + + updateProviderRelation( + id: string, + flaskNeedId: number, + nestProviderId: string, + ) { + return this.providerJoinNeedRepository.update(id, { + flaskNeedId, + nestProviderId, + }); + } + // -------------------------------------------------------------------------------- // + createProvider(providerDetails: ProviderParams): Promise { + const newProvider = this.providerRepository.create({ + name: providerDetails.name, + description: providerDetails.description, + address: providerDetails.address, + type: providerDetails.type, + typeName: providerDetails.typeName, + website: providerDetails.website, + city: providerDetails.city, + state: providerDetails.state, + country: providerDetails.country, + logoUrl: providerDetails.logoUrl, + isActive: providerDetails.isActive, + }); + return this.providerRepository.save(newProvider); + } + + updateProvider(id: string, updateProviderDetails: ProviderParams) { + return this.providerRepository.update(id, { ...updateProviderDetails }); + } + deleteOne(id: number): Observable { + return from(this.providerRepository.delete(id)); + } } diff --git a/src/features/receipt/middlewares/receipt.middleware.ts b/src/features/receipt/middlewares/receipt.middleware.ts new file mode 100644 index 0000000000..f6f705297c --- /dev/null +++ b/src/features/receipt/middlewares/receipt.middleware.ts @@ -0,0 +1,36 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class ReceiptMiddleware implements NestMiddleware { + private readonly logger = new Logger(ReceiptMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/receipt/receipt.controller.ts b/src/features/receipt/receipt.controller.ts index b078ea7c16..b0c7bd8f69 100644 --- a/src/features/receipt/receipt.controller.ts +++ b/src/features/receipt/receipt.controller.ts @@ -1,16 +1,55 @@ -import { Controller, Get } from '@nestjs/common'; -import { ApiOperation, ApiTags } from '@nestjs/swagger'; +import { + Controller, + ForbiddenException, + Get, + Param, + Req, +} from '@nestjs/common'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; import { ReceiptService } from './receipt.service'; +import { isAuthenticated } from 'src/utils/auth'; +import { FlaskUserTypesEnum } from 'src/types/interfaces/interface'; @ApiTags('Receipts') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) @Controller('receipt') export class ReceiptController { - constructor(private receiptService: ReceiptService, - ) { } + constructor(private receiptService: ReceiptService) { } - @Get(`all`) - @ApiOperation({ description: 'Get all needs from flask' }) - async getReceipts() { - return await this.receiptService.getReceipts() + @Get(`all`) + @ApiOperation({ description: 'Get all needs from flask' }) + async getReceipts() { + return await this.receiptService.getReceipts(); + } + + @Get(`flask/need/:needId`) + @ApiOperation({ description: 'Get all needs from flask' }) + async getFlaskReceipts(@Req() req: Request, @Param('needId') needId: number) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + const dappFlaskUserId = req.headers['dappFlaskUserId']; + if (panelFlaskUserId) { + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized'); + } + } + if (dappFlaskUserId) { + if (isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException('You Are not authorized'); + } } + + const accessToken = req.headers['authorization']; + return await this.receiptService.getFlaskReceipts( + { + accessToken: accessToken, + }, + needId, + ); + } } diff --git a/src/features/receipt/receipt.module.ts b/src/features/receipt/receipt.module.ts index 9f3f565e70..10ee1a1bba 100644 --- a/src/features/receipt/receipt.module.ts +++ b/src/features/receipt/receipt.module.ts @@ -1,17 +1,38 @@ -import { Module } from '@nestjs/common'; +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { SocialWorkerEntity } from '../../entities/user.entity'; import { NeedEntity } from '../../entities/need.entity'; import { ReceiptEntity } from '../../entities/receipt.entity'; import { NeedService } from '../need/need.service'; import { ReceiptController } from './receipt.controller'; import { ReceiptService } from './receipt.service'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { SocialWorker } from 'src/entities/flaskEntities/user.entity'; +import { ReceiptMiddleware } from './middlewares/receipt.middleware'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; @Module({ - imports: [TypeOrmModule.forFeature([ReceiptEntity, NeedEntity, SocialWorkerEntity])], - controllers: [ReceiptController], - providers: [ReceiptService, NeedService], + imports: [ + TypeOrmModule.forFeature( + [Need, Child, Payment, SocialWorker, Receipt, NeedReceipt], + 'flaskPostgres', + ), + TypeOrmModule.forFeature([ + ReceiptEntity, + NeedEntity, + ContributorEntity, + VariableEntity, + ]), + ], + controllers: [ReceiptController], + providers: [ReceiptService, NeedService], }) -export class ReceiptModule { - +export class ReceiptModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer.apply(ReceiptMiddleware).forRoutes('receipt'); + } } diff --git a/src/features/receipt/receipt.service.ts b/src/features/receipt/receipt.service.ts index 54985bc53a..c3a31c11d7 100644 --- a/src/features/receipt/receipt.service.ts +++ b/src/features/receipt/receipt.service.ts @@ -1,36 +1,56 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { Repository } from 'typeorm'; +// import { id } from 'ethers'; +import { NeedAPIApi, NeedReceipt } from 'src/generated-sources/openapi'; +import { HeaderOptions } from 'src/types/interfaces/interface'; +import { Repository, UpdateResult } from 'typeorm'; import { ReceiptEntity } from '../../entities/receipt.entity'; import { ReceiptParams } from '../../types/parameters/ReceiptParameter'; -import { NeedService } from '../need/need.service'; @Injectable() export class ReceiptService { - constructor( - @InjectRepository(ReceiptEntity) - private receiptRepository: Repository, - private needService: NeedService, - ) { } + constructor( + @InjectRepository(ReceiptEntity) + private receiptRepository: Repository, + ) { } - getReceipts(): Promise { - return this.receiptRepository.find(); - } + getReceipts(): Promise { + return this.receiptRepository.find(); + } + getReceiptById(flaskReceiptId: number): Promise { + const user = this.receiptRepository.findOne({ + where: { + flaskReceiptId: flaskReceiptId, + }, + }); + return user; + } - getReceipt(flaskReceiptId: number): Promise { - const user = this.receiptRepository.findOne({ - where: { - flaskReceiptId: flaskReceiptId, - }, - }); - return user; - } + async createReceipt(receiptDetails: ReceiptParams): Promise { + const newReceipt = this.receiptRepository.create({ + ...receiptDetails, + }); + return this.receiptRepository.save({ id: newReceipt.id, ...newReceipt }); + } - async createReceipt(receiptDetails: ReceiptParams): Promise { - const newReceipt = this.receiptRepository.create({ - ...receiptDetails, - }); - return this.receiptRepository.save(newReceipt); - } + async updateReceipt( + receiptDetails: ReceiptParams, + receipt: ReceiptEntity, + ): Promise { + return this.receiptRepository.update( + { id: receipt.id }, + { ...receiptDetails }, + ); + } + + async getFlaskReceipts( + options: HeaderOptions, + needId: number, + ): Promise { + const publicApi = new NeedAPIApi(); + const needReceipts: Promise = + publicApi.apiV2NeedsIdReceiptsGet(needId, options.accessToken); + return needReceipts; + } } diff --git a/src/features/schedule/backup.js b/src/features/schedule/backup.js new file mode 100644 index 0000000000..1430699124 --- /dev/null +++ b/src/features/schedule/backup.js @@ -0,0 +1,55 @@ +import { execute } from "@getvim/execute"; +import 'dotenv/config'; + +console.log('Backing up data base using ~.pgpass file...'); + +// getting db connection parameters from environment file +const username = process.env.DB_FLASK_USER; +const database = process.env.DB_FLASK_NAME; +const dbHost = process.env.DB_FLASK_HOST; +const dbPort = process.env.DB_FLASK_PORT; + +// defining backup file name +const date = new Date(); +const today = `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`; +const backupFile = `../../backup/flask/pg-flask-backup-${today}.tar`; + +// writing postgresql backup function +const takePGBackup = () => { + execute( + `pg_dump -U ${username} -h ${dbHost} -p ${dbPort} -f ${backupFile} -F t -d ${database} -v`, + ).then(async () => { + console.log(`Backup created successfully`); + }).catch((err) => { + console.log(err); + }); +}; + +const getListOfFiles = () => { + execute( + `pg_restore -l -f list.toc db.dump`, + ).then(async () => { + console.log(`Backup created successfully`); + }).catch((err) => { + console.log(err); + }); +}; + +function sendToBackupServer(fileName = fileNameGzip) { + const form = new FormData(); + form.append('file', fileName); + axios.post('', form, { headers: form.getHeaders(), }).then(result => { + // Handle result… + fs.unlinkSync(fileNameGzip); + console.log(result.data); + }).catch(err => { + console.error(err); + }); +} + + +// First, get the TOC list of objects to be restored: +// getListOfFiles(); + +// calling postgresql backup function +takePGBackup(); diff --git a/src/features/schedule/schedule.module.ts b/src/features/schedule/schedule.module.ts new file mode 100644 index 0000000000..ffeea5bb3d --- /dev/null +++ b/src/features/schedule/schedule.module.ts @@ -0,0 +1,64 @@ +import { Module } from '@nestjs/common'; +import { ScheduleService } from './schedule.service'; +import { NeedService } from '../need/need.service'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { NeedEntity } from 'src/entities/need.entity'; +import { FamilyService } from '../family/family.service'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { AnalyticService } from '../analytic/analytic.service'; +import { NGO } from 'src/entities/flaskEntities/ngo.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { PaymentEntity } from 'src/entities/payment.entity'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; +import { NgoService } from '../ngo/ngo.service'; +import { UserService } from '../user/user.service'; +import { NgoArrivalEntity, NgoEntity } from 'src/entities/ngo.entity'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; + +@Module({ + imports: [ + TypeOrmModule.forFeature( + [ + Need, + SocialWorker, + Child, + User, + Family, + NGO, + Payment, + UserFamily, + Receipt, + NeedReceipt, + ], + 'flaskPostgres', + ), + TypeOrmModule.forFeature([ + NeedEntity, + VariableEntity, + PaymentEntity, + NgoEntity, + NgoArrivalEntity, + ContributorEntity, + AllUserEntity, + EthereumAccountEntity + ]), + ], + controllers: [], + providers: [ + NeedService, + FamilyService, + AnalyticService, + NgoService, + UserService, + ScheduleService, + ], +}) +export class ScheduleTaskModule {} diff --git a/src/features/schedule/schedule.service.ts b/src/features/schedule/schedule.service.ts new file mode 100644 index 0000000000..22870979a4 --- /dev/null +++ b/src/features/schedule/schedule.service.ts @@ -0,0 +1,237 @@ +import { Injectable, Logger } from '@nestjs/common'; +import { Cron, CronExpression, Timeout } from '@nestjs/schedule'; +import { VirtualFamilyRole } from 'src/types/interfaces/interface'; +import config from 'src/config'; +import { FamilyService } from '../family/family.service'; +import { AnalyticService } from '../analytic/analytic.service'; +import { CampaignService } from '../campaign/campaign.service'; +import { persianDay } from 'src/utils/helpers'; +import { execute } from '@getvim/execute'; + +@Injectable() +export class ScheduleService { + constructor( + private campaignService: CampaignService, + private familyService: FamilyService, + private analyticService: AnalyticService, + ) {} + private readonly logger = new Logger(ScheduleService.name); + + async completePays() { + const father = await this.familyService.getFamilyRoleCompletePay( + VirtualFamilyRole.FATHER, + 0, + ); + const mother = await this.familyService.getFamilyRoleCompletePay( + VirtualFamilyRole.MOTHER, + 0, + ); + const amoo = await this.familyService.getFamilyRoleCompletePay( + VirtualFamilyRole.AMOO, + 0, + ); + const khaleh = await this.familyService.getFamilyRoleCompletePay( + VirtualFamilyRole.KHALEH, + 0, + ); + const daei = await this.familyService.getFamilyRoleCompletePay( + VirtualFamilyRole.DAEI, + 0, + ); + const amme = await this.familyService.getFamilyRoleCompletePay( + VirtualFamilyRole.AMME, + 0, + ); + + config().dataCache.storeFamilyData({ + fathersData: father[0], + mothersData: mother[0], + amoosData: amoo[0], + khalehsData: khaleh[0], + daeisData: daei[0], + ammesData: amme[0], + }); + } + + async rolesCount() { + // total count (e.g how many fathers in our ecosystem) + const fathersCount = await this.familyService.getFamilyRolesCount( + VirtualFamilyRole.FATHER, + ); + const mothersCount = await this.familyService.getFamilyRolesCount( + VirtualFamilyRole.MOTHER, + ); + const amoosCount = await this.familyService.getFamilyRolesCount( + VirtualFamilyRole.AMOO, + ); + const khalehsCount = await this.familyService.getFamilyRolesCount( + VirtualFamilyRole.KHALEH, + ); + const daeisCount = await this.familyService.getFamilyRolesCount( + VirtualFamilyRole.DAEI, + ); + const ammesCount = await this.familyService.getFamilyRolesCount( + VirtualFamilyRole.AMME, + ); + + config().dataCache.storeRolesCount({ + fathersCount, + mothersCount, + amoosCount, + khalehsCount, + daeisCount, + ammesCount, + }); + } + + @Timeout(15000) + async handleCronOnce() { + this.logger.debug( + 'Called only once after 15 seconds of the server initiation', + ); + await this.campaignService.childrenWithNoNeed(); + this.completePays(); + this.rolesCount(); + } + + + @Cron(CronExpression.EVERY_WEEK, { + name: 'ActiveFamilies', + timeZone: 'Asia/Tehran', + }) + async handleMonthlyCron() { + this.logger.debug( + 'Active Families (One and Three months report) Called every Month', + ); + // how many amoos? ammes? + this.rolesCount(); + // active families + let actives = config().dataCache.fetchActiveFamilies(); + if (!actives) { + actives = await this.analyticService.getChildrenFamilyAnalytic(); + config().dataCache.storeActiveFamilies(actives); + } else { + this.logger.debug('Reading from cache'); + } + } + + @Cron(CronExpression.EVERY_WEEK, { + name: 'CompletePayments', + timeZone: 'Asia/Tehran', + }) + async handleWeeklyCron() { + this.logger.debug(' Complete payments of families Called every Week'); + const data = config().dataCache.fetchFamilyAll(); + if (!data) { + this.completePays(); + } else { + this.logger.debug('Reading from cache'); + } + } + + // ERROR [Scheduler] ServerError: Can't send mail - all recipients were rejected: 550 No such user here + @Cron('30 09 * * Mon', { + name: 'MonthlyCampaigns try At 09:00 on Sunday.', // we try every week and only send to those who did not receive (because their child have no needs, etc.) + timeZone: 'Asia/Tehran', + }) + async handleMonthlyCampaignsCron() { + const farsiDay = persianDay(new Date()); + if (farsiDay > 20) { + this.logger.warn( + `We are near the end of this month let's skip one more week`, + ); + return; + } + // ############## BE CAREFUL ################# + if (process.env.NODE_ENV === 'production') { + this.logger.debug( + 'Sending user Campaigns at 01:00 PM, only on Thursdays', + ); + // await this.campaignService.sendUserMonthlyCampaigns(); + } + } + + @Cron('30 8 * * Sat', { + name: 'Reminders At 08:30 on Saturday.', + timeZone: 'Asia/Tehran', + }) + async handleChildNoNeedReminderMailCron() { + if (process.env.NODE_ENV === 'production') { + this.logger.debug('Sending Reminder to Social workers'); + await this.campaignService.sendSwChildNoNeedReminder(); + } + } + + @Cron('50 9 * * Wed', { + name: 'Reminders to announce arrivals At 9:50 on Wednesday.', + timeZone: 'Asia/Tehran', + }) + async handleAnnounceArrivalCron() { + if (process.env.NODE_ENV === 'production') { + this.logger.debug( + 'Sending Reminder to Social workers to announce arrivals', + ); + await this.campaignService.sendSwAnnounceReminder(); + } + } + + @Cron('00 10 * * *', { + name: 'Backup.', + timeZone: 'Asia/Tehran', + }) + async handleBackupCron() { + if (process.env.NODE_ENV === 'development') { + this.logger.debug('Backing up data base ...'); + + // getting db connection parameters from environment file + const username_flask = process.env.DB_FLASK_USER; + const database_flask = process.env.DB_FLASK_NAME; + const dbHost_flask = process.env.DB_FLASK_HOST; + const dbPort_flask = process.env.DB_FLASK_PORT; + + const username_nest = process.env.DB_USER; + const database_nest = process.env.DB_NAME; + const dbPort_nest = 3000; + + // defining backup file name + const date = new Date(); + const today = `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`; + const backupFileFlask = `../../backup/flask/pg-flask-backup-${today}.tar`; + const backupFileNest = `../../backup/nest/pg-nest-backup-${today}.tar`; + + // flask + const flaskPGBackup = () => { + execute( + `pg_dump -U ${username_flask} -h ${dbHost_flask} -p ${dbPort_flask} -f ${backupFileFlask} -F t -d ${database_flask}`, + ) + .then(async () => { + console.log(`Backup created successfully`); + }) + .catch((err) => { + console.log(err); + }); + }; + + //nest + const nestPGBackup = () => { + console.log( + `pg_dump -U ${username_nest} -h ${dbHost_flask} -p ${dbPort_nest} -f ${backupFileNest} -F t -d ${database_nest}`, + ); + + execute( + `pg_dump -U ${username_nest} -h ${dbHost_flask} -p ${dbPort_nest} -f ${backupFileNest} -F t -d ${database_nest}`, + ) + .then(async () => { + console.log(`Backup created successfully`); + }) + .catch((err) => { + console.log(err); + }); + }; + + // calling postgresql backup function + // nestPGBackup(); + flaskPGBackup(); + } + } +} diff --git a/src/features/signature/signature.controller.ts b/src/features/signature/signature.controller.ts deleted file mode 100644 index f9ba2bf6d3..0000000000 --- a/src/features/signature/signature.controller.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Body, Controller, Get, Post, UsePipes, ValidationPipe } from '@nestjs/common'; -import { ApiOperation, ApiTags } from '@nestjs/swagger'; -import { ServerError } from '../../filters/server-exception.filter'; -import { SwSignatureResult } from '../../types/interface'; -import { SwCreateSwSignatureDto } from '../../types/dtos/CreateSignature.dto'; -import { ValidateSignaturePipe } from './pipes/validate-signature.pipe'; -import { SignatureService } from './signature.service'; -import { NeedService } from '../need/need.service'; -import { ChildrenService } from '../children/children.service'; - -@ApiTags('Signature') -@Controller('signature') -export class SignatureController { - constructor(private signatureService: SignatureService, - private needService: NeedService, - private childrenService: ChildrenService, - ) { } - - @Get(`all`) - @ApiOperation({ description: 'Get a single transaction by ID' }) - async getTransaction() { - return await this.signatureService.getSignatures(); - } - - @Post(`sw/generate`) - @UsePipes(new ValidationPipe()) // validation for dto files - async swSignTransaction(@Body(ValidateSignaturePipe) request: SwCreateSwSignatureDto) { - let transaction: SwSignatureResult; - try { - const need = await this.needService.getNeedById(request.flaskNeedId); - const child = await this.childrenService.getChildById(need.flaskChildId); - const isCreator = need.socialWorker.flaskSwId === request.flaskSwId; // request.userId - if (isCreator) { - const list = []; - for (let i = 0; i < need.receipts.length; i++) { - list.push(need.receipts[i].title); - } - const receiptsTitles = list[0] - ? list.join(', ') - : 'No receipts is provided!'; - transaction = await this.signatureService.swSignTransaction(request, need, child, receiptsTitles); - } - } catch (e) { - console.log(e) - throw new ServerError(e); - } - return transaction; - } -} diff --git a/src/features/signature/signature.module.ts b/src/features/signature/signature.module.ts deleted file mode 100644 index b7cf6f2588..0000000000 --- a/src/features/signature/signature.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { SignatureController } from './signature.controller'; -import { SignatureEntity } from '../../entities/signature.entity'; -import { SignatureService } from './signature.service'; -import { NeedService } from '../need/need.service'; -import { UserService } from '../user/user.service'; -import { ChildrenService } from '../children/children.service'; -import { NeedEntity } from '../../entities/need.entity'; -import { ChildrenEntity } from '../../entities/children.entity'; -import { FamilyEntity, SocialWorkerEntity } from '../../entities/user.entity'; -import { PaymentService } from '../payment/payment.service'; -import { PaymentEntity } from '../../entities/payment.entity'; - -@Module({ - imports: [TypeOrmModule.forFeature([PaymentEntity, SignatureEntity, NeedEntity, ChildrenEntity, FamilyEntity, SocialWorkerEntity])], - controllers: [SignatureController], - providers: [SignatureService, NeedService, PaymentService, UserService, ChildrenService], -}) -export class SignatureModule { } diff --git a/src/features/signature/signature.service.ts b/src/features/signature/signature.service.ts deleted file mode 100644 index 68b36bb4bc..0000000000 --- a/src/features/signature/signature.service.ts +++ /dev/null @@ -1,203 +0,0 @@ -import { ethers } from 'ethers'; -import { Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; -import { SignatureEntity } from '../../entities/signature.entity'; -import { Repository } from 'typeorm'; -import { - Domain, - SwSignatureResult, - VoucherTypes, - NeedTypeEnum, - CategoryDefinitionEnum, - CategoryEnum, - SwProductVoucher, - SwServiceVoucher, -} from '../../types/interface'; -import { NeedService } from '../need/need.service'; -import { UserService } from '../user/user.service'; -import { ChildrenService } from '../children/children.service'; -import VerifyVoucher from '../../contracts/tokens/ERC721/VerifyVoucher.sol/VerifyVoucher.json'; -import { verifyContractAddress } from '../../contracts/network-settings.json'; -import { ChildrenEntity } from '../../entities/children.entity'; -import { NeedEntity } from '../../entities/need.entity'; -import { SwCreateSwSignatureDto } from '../../types/dtos/CreateSignature.dto'; - -@Injectable() -export class SignatureService { - constructor( - @InjectRepository(SignatureEntity) - private signatureRepository: Repository, - private needService: NeedService, - private userService: UserService, - private childService: ChildrenService, - ) { } - - async getSignatures(): Promise { - return await this.signatureRepository.find(); - } - - async createSignature(signature: string): Promise { - const saved = await this.signatureRepository.save({ - hash: signature, - }); - return saved; - } - - async designDomain(verifyContractAddress: string): Promise { - const SIGNING_DOMAIN_NAME = 'SAY-DAO'; - const SIGNING_DOMAIN_VERSION = '1'; - - const url = process.env.ALCHEMY_GOERLI; - const customHttpProvider = new ethers.providers.JsonRpcProvider(url); - - const verifyingContract = new ethers.Contract( - verifyContractAddress, - VerifyVoucher.abi, - customHttpProvider, - ); - - const chainId = await verifyingContract.getChainID(); - console.log(`chainId from signature service: ${chainId.toString()}`); - - return { - name: SIGNING_DOMAIN_NAME, - version: SIGNING_DOMAIN_VERSION, - verifyingContract: verifyingContract.address, - chainId, - }; - } - - async swSignTransaction( - request: SwCreateSwSignatureDto, - need: NeedEntity, - child: ChildrenEntity, - receiptsTitles: string - ): Promise { - const impacts = 4; - let productVoucher: SwProductVoucher - let serviceVoucher: SwServiceVoucher - let types: VoucherTypes - - // define your data types - if (need.type === NeedTypeEnum.SERVICE) { - serviceVoucher = { - title: need.title || 'No Title', - category: - need.category === CategoryEnum.GROWTH - ? CategoryDefinitionEnum.GROWTH - : need.category === CategoryEnum.HEALTH - ? CategoryDefinitionEnum.HEALTH - : need.category === CategoryEnum.JOY - ? CategoryDefinitionEnum.JOY - : CategoryDefinitionEnum.SURROUNDING, - child: child.sayName || String(child.flaskChildId), - receipts: receiptsTitles, - bankTrackId: need.bankTrackId, - signerAddress: request.signerAddress, - content: `Your ${impacts} impacts will be ready for a friend to mint!`, - }; - types = { - Voucher: [ - { name: 'title', type: 'string' }, - { name: 'category', type: 'string' }, - { name: 'child', type: 'string' }, - { name: 'receipts', type: 'string' }, - { name: 'bankTrackId', type: 'string' }, - { name: 'signerAddress', type: 'address' }, - { name: 'content', type: 'string' }, - ], - }; - } - if (need.type === NeedTypeEnum.PRODUCT) { - productVoucher = { - title: need.title || 'No Title', - category: - need.category === CategoryEnum.GROWTH - ? CategoryDefinitionEnum.GROWTH - : need.category === CategoryEnum.HEALTH - ? CategoryDefinitionEnum.HEALTH - : need.category === CategoryEnum.JOY - ? CategoryDefinitionEnum.JOY - : CategoryDefinitionEnum.SURROUNDING, - child: child.sayName || String(child.flaskChildId), - receipts: receiptsTitles, - signerAddress: request.signerAddress, - content: `Your ${impacts} impacts will be ready for a friend to mint!`, - }; - - types = { - Voucher: [ - { name: 'title', type: 'string' }, - { name: 'category', type: 'string' }, - { name: 'child', type: 'string' }, - { name: 'receipts', type: 'string' }, - { name: 'signerAddress', type: 'address' }, - { name: 'content', type: 'string' }, - ], - }; - } - - const domain = await this.designDomain(verifyContractAddress); - return { - SocialWorkerVoucher: productVoucher || serviceVoucher, - types, - domain, - }; - } - - // async familySignTransaction(request: SwCreateSwSignatureDto): Promise { - // let SocialWorkerVoucher: SocialWorkerVoucher; - // let FamilyVoucher: FamilyVoucher; - // let types: { Voucher: { name: string; type: string; }[]; }; - // const need = await this.needService.getNeedById(request.flaskNeedId); - // const user = await this.userService.getFamily(request.flaskSwId); - // const child = await this.childService.getChildById(need.child.childId); - - // const isCreator = need.createdById === 13; // request.userId - // const IsParticipant = need.payments.filter( - // (p) => (p.user.userId = request.flaskSwId), - // ); - - // const impacts = 4 - - // if (isCreator) { - // SocialWorkerVoucher = { - // flaskNeedId: need.flaskNeedId, - // userId: user && user.userId || request.flaskSwId, // we do not have any users available at begining - // child: child.sayName, - // provider: need.provider && need.provider.name || 'digikala', - // wallet: request.signerAddress, - // content: `Your ${impacts} impacts will be ready for a friend to mint!`, - // }; - // // define your data types - // types = { - // Voucher: [ - // { name: 'flaskNeedId', type: 'uint256' }, - // { name: 'userId', type: 'uint256' }, - // { name: 'child', type: 'string' }, - // { name: 'provider', type: 'string' }, - // { name: 'wallet', type: 'address' }, - // { name: 'content', type: 'string' }, - // ], - // }; - // } else if (IsParticipant) { - // FamilyVoucher = { - // flaskNeedId: need.flaskNeedId, - // userId: user && user.userId || request.flaskSwId, // we do not have any users available at begining - // child: need.child.childId, - // wallet: request.signerAddress, - // content: `Your ${impacts} impacts will be ready for a friend to mint!`, - // }; - // } - - // const domain = await this.designDomain( - // verifyContractAddress - // ); - - // return { - // SocialWorkerVoucher, - // types, - // domain, - // }; - // } -} diff --git a/src/features/status/middlewares/status.middleware.ts b/src/features/status/middlewares/status.middleware.ts new file mode 100644 index 0000000000..83326792c9 --- /dev/null +++ b/src/features/status/middlewares/status.middleware.ts @@ -0,0 +1,36 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class StatusMiddleware implements NestMiddleware { + private readonly logger = new Logger(StatusMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/status/status.controller.ts b/src/features/status/status.controller.ts new file mode 100644 index 0000000000..aa1aa8969c --- /dev/null +++ b/src/features/status/status.controller.ts @@ -0,0 +1,16 @@ +import { Controller} from '@nestjs/common'; +import { StatusService } from './status.service'; +import { ApiHeader, ApiSecurity, ApiTags } from '@nestjs/swagger'; + +@ApiTags('Status') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) +@Controller('status') +export class StatusController { + constructor(private readonly statusService: StatusService) {} + +} diff --git a/src/features/status/status.module.ts b/src/features/status/status.module.ts new file mode 100644 index 0000000000..1b4af9b722 --- /dev/null +++ b/src/features/status/status.module.ts @@ -0,0 +1,17 @@ +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; +import { StatusService } from './status.service'; +import { StatusController } from './status.controller'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { StatusEntity } from 'src/entities/status.entity'; +import { StatusMiddleware } from './middlewares/status.middleware'; + +@Module({ + imports: [TypeOrmModule.forFeature([StatusEntity ])], + controllers: [StatusController], + providers: [StatusService,], +}) +export class StatusModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer.apply(StatusMiddleware).forRoutes('status'); + } +} diff --git a/src/features/status/status.service.ts b/src/features/status/status.service.ts new file mode 100644 index 0000000000..e44edf0fe3 --- /dev/null +++ b/src/features/status/status.service.ts @@ -0,0 +1,70 @@ +import { Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { StatusEntity } from 'src/entities/status.entity'; +import { + NeedStatusUpdateModel, + NeedStatusUpdatesAPIApi, +} from 'src/generated-sources/openapi'; +import { HeaderOptions } from 'src/types/interfaces/interface'; +import { StatusParams } from 'src/types/parameters/StausParameters'; +import { Repository, UpdateResult } from 'typeorm'; + +@Injectable() +export class StatusService { + constructor( + @InjectRepository(StatusEntity) + private statusRepository: Repository, + ) { } + + findAll() { + return `This action returns all status`; + } + + getStatusById(flaskId: number): Promise { + const user = this.statusRepository.findOne({ + where: { + flaskId: flaskId, + }, + }); + return user; + } + + async getFlaskStatuses( + options: HeaderOptions, + needId: number, + swId: number, + ): Promise { + const publicApi = new NeedStatusUpdatesAPIApi(); + const needRStatus: Promise = + publicApi.apiV2NeedStatusUpdatesGet( + options.accessToken, + null, + null, + null, + needId, + swId, + ); + return needRStatus; + } + + + async createStatus(statusDetails: StatusParams): Promise { + const newStatus = this.statusRepository.create({ + ...statusDetails, + }); + return this.statusRepository.save({ id: newStatus.id, ...newStatus }); + } + + updateStatus( + statusId: string, + statusDetails: StatusParams + ): Promise { + return this.statusRepository.update(statusId, { + ...statusDetails, + }); + } + + remove(id: number) { + return `This action removes a #${id} status`; + } +} diff --git a/src/features/sync/guards/auth.guard.ts b/src/features/sync/guards/auth.guard.ts deleted file mode 100644 index 9bdf538125..0000000000 --- a/src/features/sync/guards/auth.guard.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common'; -import { Request } from 'express'; -import { Observable } from 'rxjs'; - -@Injectable() -export class AuthGuard implements CanActivate { - canActivate( - context: ExecutionContext, - ): boolean | Promise | Observable { - console.log('Guarding Sync request...') - const request = context.switchToHttp().getRequest() as Request; - console.log(request.headers) - // TODO: check user auth and return false if not authorized - return true; - } -} diff --git a/src/features/sync/middlewares/sync.middleware.ts b/src/features/sync/middlewares/sync.middleware.ts deleted file mode 100644 index d91c04458a..0000000000 --- a/src/features/sync/middlewares/sync.middleware.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { HttpException, HttpStatus, Injectable, NestMiddleware } from '@nestjs/common'; -import { NextFunction, Request, Response } from 'express'; - -@Injectable() -export class SyncMiddleware implements NestMiddleware { - use(req: Request, res: Response, next: NextFunction) { - console.log('Dapp Sync MiddleWare...') - next(); - } -} diff --git a/src/features/sync/pipes/validate-sync-multi.pipe.ts b/src/features/sync/pipes/validate-sync-multi.pipe.ts deleted file mode 100644 index d65d1308d2..0000000000 --- a/src/features/sync/pipes/validate-sync-multi.pipe.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { ArgumentMetadata, HttpException, HttpStatus, Injectable, PipeTransform } from '@nestjs/common'; -import { SyncRequestDto } from '../../../types/dtos/SyncRequest.dto'; - diff --git a/src/features/sync/pipes/validate-sync-one.pipe.ts b/src/features/sync/pipes/validate-sync-one.pipe.ts deleted file mode 100644 index c28404b803..0000000000 --- a/src/features/sync/pipes/validate-sync-one.pipe.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ArgumentMetadata, HttpException, HttpStatus, Injectable, PipeTransform } from '@nestjs/common'; -import { NeedDto } from '../../../types/dtos/CreateNeed.dto'; - -@Injectable() -export class ValidateSyncOnePipe implements PipeTransform { - transform(value: NeedDto, metadata: ArgumentMetadata) { - console.log("Validating sync one...") - - const parseTypeInt = parseInt(value.type.toString()) - if (parseTypeInt !== 0 && parseTypeInt !== 1) { - console.log(`${value.type} is not a correct!`) - throw new HttpException('invalid data type', HttpStatus.BAD_REQUEST) - } - return value - } -} diff --git a/src/features/sync/sync.controller.ts b/src/features/sync/sync.controller.ts deleted file mode 100644 index a1f89aae2c..0000000000 --- a/src/features/sync/sync.controller.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { - Body, - Controller, - Post, - UseGuards, - UsePipes, - ValidationPipe, -} from '@nestjs/common'; -import { ApiTags } from '@nestjs/swagger'; -import { ChildrenService } from '../children/children.service'; -import { NeedService } from '../need/need.service'; -import { SyncRequestDto } from '../../types/dtos/SyncRequest.dto'; -import { ChildrenEntity } from '../../entities/children.entity'; -import { NeedEntity } from '../../entities/need.entity'; -import { AuthGuard } from './guards/auth.guard'; -import { ServerError } from '../../filters/server-exception.filter'; -import { AllExceptionsFilter } from '../../filters/all-exception.filter'; -import { ObjectForbidden } from '../../filters/forbidden-exception.filter'; -import { UserService } from '../user/user.service'; -import { PaymentService } from '../payment/payment.service'; -import { UpdateResult } from 'typeorm'; -import { NeedParams } from '../../types/parameters/NeedParameters'; -import { SocialWorkerParams, FamilyParams } from '../../types/parameters/UserParameters'; -import { PaymentParams } from '../../types/parameters/PaymentParameters'; -import { NeedTypeEnum, RolesEnum } from '../../types/interface'; -import { NeedDto } from '../../types/dtos/CreateNeed.dto'; -import { ValidateSyncOnePipe } from './pipes/validate-sync-one.pipe'; -import { ReceiptService } from '../receipt/receipt.service'; -import { ReceiptParams } from '../../types/parameters/ReceiptParameter'; -import { NgoService } from '../ngo/ngo.service'; -import { NgoParams } from 'src/types/parameters/NgoParammeters'; -@ApiTags('Sync') -@Controller('sync') -@UseGuards(AuthGuard) -export class SyncController { - // panel usage - constructor( - private needService: NeedService, - private childrenService: ChildrenService, - private userService: UserService, - private ngoService: NgoService, - private paymentService: PaymentService, - private receiptService: ReceiptService, - ) { } - - @Post('update/latest') - @UsePipes(new ValidationPipe()) - async fetchLatest() { - return await this.needService.getLastNeed() - } - - - - - -} diff --git a/src/features/sync/sync.module.ts b/src/features/sync/sync.module.ts index cf3fa75ed2..b15e6cd944 100644 --- a/src/features/sync/sync.module.ts +++ b/src/features/sync/sync.module.ts @@ -1,5 +1,4 @@ -import { MiddlewareConsumer, Module, NestModule, RequestMethod } from '@nestjs/common'; -import { SyncController } from './sync.controller'; +import { Module } from '@nestjs/common'; import { NeedEntity } from '../../entities/need.entity'; import { HttpModule } from '@nestjs/axios'; import { ScheduleModule } from '@nestjs/schedule'; @@ -10,27 +9,86 @@ import { ChildrenEntity } from '../../entities/children.entity'; import { PaymentEntity } from '../../entities/payment.entity'; import { PaymentService } from '../payment/payment.service'; import { UserService } from '../user/user.service'; -import { FamilyEntity, SocialWorkerEntity } from '../../entities/user.entity'; -import { SyncMiddleware } from './middlewares/sync.middleware'; import { ReceiptService } from '../receipt/receipt.service'; import { ReceiptEntity } from '../../entities/receipt.entity'; -import { NgoEntity } from '../../entities/ngo.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { SyncService } from './sync.service'; import { NgoService } from '../ngo/ngo.service'; +import { NgoArrivalEntity, NgoEntity } from 'src/entities/ngo.entity'; +import { StatusService } from '../status/status.service'; +import { StatusEntity } from 'src/entities/status.entity'; +import { LocationEntity } from 'src/entities/location.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { NGO } from 'src/entities/flaskEntities/ngo.entity'; +import { LocationService } from '../location/location.service'; +import { Cities } from 'src/entities/flaskEntities/cities.entity'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { ProviderService } from '../provider/provider.service'; +import { ProviderEntity } from 'src/entities/provider.entity'; +import { ProviderJoinNeedEntity } from 'src/entities/provider.Join.need..entity'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { Countries } from 'src/entities/flaskEntities/countries.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; @Module({ imports: [ - TypeOrmModule.forFeature([ChildrenEntity, NeedEntity, PaymentEntity, ReceiptEntity, FamilyEntity, SocialWorkerEntity, NgoEntity]), // add entity and services to be available in the module + TypeOrmModule.forFeature( + [ + SocialWorker, + Countries, + Need, + NGO, + Cities, + Child, + Payment, + UserFamily, + Family, + User, + Receipt, + NeedReceipt, + ], + 'flaskPostgres', + ), + TypeOrmModule.forFeature([ + ChildrenEntity, + NgoEntity, + NgoArrivalEntity, + VariableEntity, + NeedEntity, + PaymentEntity, + ReceiptEntity, + ContributorEntity, + AllUserEntity, + StatusEntity, + LocationEntity, + EthereumAccountEntity, + ProviderJoinNeedEntity, + ProviderEntity, + ChildrenPreRegisterEntity, + ]), // add entity and services to be available in the module ScheduleModule.forRoot(), HttpModule, ], - controllers: [SyncController], - providers: [ChildrenService, NeedService, PaymentService, ReceiptService, UserService, NgoService], // add entity and services to be available in the module + controllers: [], + providers: [ + LocationService, + SyncService, + NgoService, + ChildrenService, + NeedService, + PaymentService, + ReceiptService, + UserService, + StatusService, + ProviderService, + ], // add entity and services to be available in the module }) -export class SyncModule implements NestModule { - configure(consumer: MiddlewareConsumer) { - consumer.apply(SyncMiddleware).forRoutes({ - path: 'sync/update', - method: RequestMethod.POST - }) - } -} +export class SyncModule {} diff --git a/src/features/sync/sync.service.ts b/src/features/sync/sync.service.ts new file mode 100644 index 0000000000..896761c53e --- /dev/null +++ b/src/features/sync/sync.service.ts @@ -0,0 +1,914 @@ +import { BadRequestException, Injectable } from '@nestjs/common'; +import { LocationEntity } from 'src/entities/location.entity'; +import { NgoEntity } from 'src/entities/ngo.entity'; +import { PaymentEntity } from 'src/entities/payment.entity'; +import { ReceiptEntity } from 'src/entities/receipt.entity'; +import { StatusEntity } from 'src/entities/status.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { + NeedTypeDefinitionEnum, + NeedTypeEnum, + PanelContributors, + PaymentStatusEnum, + SchoolTypeEnum, +} from 'src/types/interfaces/interface'; +import { NgoParams } from 'src/types/parameters/NgoParammeters'; +import { PaymentParams } from 'src/types/parameters/PaymentParameters'; +import { ReceiptParams } from 'src/types/parameters/ReceiptParameter'; +import { StatusParams } from 'src/types/parameters/StausParameters'; +import { convertFlaskToSayPanelRoles } from 'src/utils/helpers'; +import { ChildrenService } from '../children/children.service'; +import { NeedService } from '../need/need.service'; +import { NgoService } from '../ngo/ngo.service'; +import { PaymentService } from '../payment/payment.service'; +import { ReceiptService } from '../receipt/receipt.service'; +import { StatusService } from '../status/status.service'; +import { UserService } from '../user/user.service'; +import { AllExceptionsFilter } from 'src/filters/all-exception.filter'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { SocialWorker } from 'src/entities/flaskEntities/user.entity'; +import { LocationService } from '../location/location.service'; +import { UserParams } from 'src/types/parameters/UserParameters'; +import { ObjectNotFound } from 'src/filters/notFound-expectation.filter'; +import { ProviderService } from '../provider/provider.service'; +import { ProviderEntity } from 'src/entities/provider.entity'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { CreateReceiptDto } from 'src/types/dtos/CreateReceipt.dto'; +import { CreatePaymentDto } from 'src/types/dtos/CreatePayment.dto'; +import { CreateStatusDto } from 'src/types/dtos/CreateStatus.dto'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { ChildrenEntity } from 'src/entities/children.entity'; + +@Injectable() +export class SyncService { + constructor( + private needService: NeedService, + private ngoService: NgoService, + private userService: UserService, + private childrenService: ChildrenService, + private receiptService: ReceiptService, + private paymentService: PaymentService, + private statusService: StatusService, + private locationService: LocationService, + private providerService: ProviderService, + ) {} + + async syncContributorNgo(flaskUser: SocialWorker) { + console.log('\x1b[36m%s\x1b[0m', 'Syncing NGO and contributor ...'); + try { + ///--------------------------------------------NGO------------------------------------- + let nestNgo = await this.ngoService.getNgoById(flaskUser.ngo_id); + let nestCallerNgoCity: LocationEntity; + let callerNgoDetails: NgoParams; + // Do no update NGOs frequently + + if (!nestNgo) { + const flaskNgo = await this.ngoService.getFlaskNgo(flaskUser.ngo_id); + const { city_id, id: FlaskNgoId, ...ngoOtherParams } = flaskNgo; + + const flaskCity = await this.locationService.getFlaskCity(city_id); + const { + id: flaskId, + name, + state_id, + state_code, + state_name, + country_id, + country_code, + country_name, + latitude, + longitude, + } = flaskCity; + nestCallerNgoCity = await this.locationService.getCityById(city_id); + if (!nestCallerNgoCity) { + console.log('\x1b[36m%s\x1b[0m', 'Creating a Location ...'); + nestCallerNgoCity = await this.locationService.createLocation({ + flaskCityId: flaskId, + name, + stateId: state_id, + stateCode: state_code, + stateName: state_name, + countryId: country_id, + countryCode: country_code, + countryName: country_name, + latitude, + longitude, + }); + console.log('\x1b[36m%s\x1b[0m', 'Created a Location ...'); + } + callerNgoDetails = { + ...ngoOtherParams, + registerDate: new Date(ngoOtherParams.registerDate), + updated: new Date(ngoOtherParams.updated), + flaskCityId: flaskCity.id, + flaskCountryId: flaskCity.country_id, + flaskStateId: flaskCity.state_id, + flaskNgoId: FlaskNgoId, + }; + + console.log('\x1b[36m%s\x1b[0m', 'Creating an NGO ...\n'); + nestNgo = await this.ngoService.createNgo( + callerNgoDetails, + nestCallerNgoCity, + ); + + console.log('\x1b[36m%s\x1b[0m', 'Created an NGO ...\n'); + } else if (nestNgo) { + await this.ngoService + .updateNgo(nestNgo.id, callerNgoDetails, nestCallerNgoCity) + .then(); + nestNgo = await this.ngoService.getNgoById(nestNgo.flaskNgoId); + console.log('\x1b[36m%s\x1b[0m', 'NGO updated ...\n'); + } else { + console.log('\x1b[36m%s\x1b[0m', 'Skipped NGO ...\n'); + } + return nestNgo; + } catch (e) { + throw new AllExceptionsFilter(e); + } + } + + async syncNeed( + flaskNeed: Need, + childId: number, + callerId: number, + receipts_: CreateReceiptDto[], + payments: CreatePaymentDto[], + statuses: CreateStatusDto[], + ) { + //-------------------------------------------- Controller Caller------------------------------------- + const flaskCaller = await this.userService.getFlaskSocialWorker(callerId); + let nestCaller = await this.userService.getContributorByFlaskId( + callerId, + convertFlaskToSayPanelRoles(flaskCaller.type_id), + ); + + const callerDetails = { + typeId: flaskCaller.type_id, + firstName: flaskCaller.firstName, + lastName: flaskCaller.lastName, + avatarUrl: flaskCaller.avatar_url, + flaskUserId: flaskCaller.id, + birthDate: flaskCaller.birth_date && new Date(flaskCaller.birth_date), + panelRole: convertFlaskToSayPanelRoles(flaskCaller.type_id), + userName: flaskCaller.userName, + }; + + if (!nestCaller) { + console.log( + '\x1b[36m%s\x1b[0m', + 'Syncing NGO and Caller ...\n', + flaskCaller.id, + ); + const CallerNgo = await this.syncContributorNgo(flaskCaller); + console.log( + '\x1b[36m%s\x1b[0m', + 'Synced NGO and Caller ...\n', + flaskCaller.id, + ); + console.log('\x1b[36m%s\x1b[0m', 'Creating a Caller ...\n'); + nestCaller = await this.userService.createContributor( + callerDetails, + CallerNgo, + ); + console.log('\x1b[36m%s\x1b[0m', 'Created a Caller ...\n'); + } else if (nestCaller) { + await this.userService + .updateContributor(nestCaller.id, callerDetails) + .then(); + nestCaller = await this.userService.getContributorByFlaskId( + callerId, + convertFlaskToSayPanelRoles(flaskCaller.type_id), + ); + console.log('\x1b[36m%s\x1b[0m', 'Caller updated ...\n'); + } else { + console.log('\x1b[36m%s\x1b[0m', 'Skipped Caller updating ...\n'); + } + + //-------------------------------------------- Social worker------------------------------------- + let nestSocialWorker: AllUserEntity; + let swNgo: NgoEntity; + nestSocialWorker = await this.userService.getContributorByFlaskId( + flaskNeed.created_by_id, + PanelContributors.SOCIAL_WORKER, + ); + + const flaskSocialWorker = await this.userService.getFlaskSocialWorker( + flaskNeed.created_by_id, + ); + + const swDetails = { + typeId: flaskSocialWorker.type_id, + firstName: flaskSocialWorker.firstName, + lastName: flaskSocialWorker.lastName, + avatarUrl: flaskSocialWorker.avatar_url, + flaskUserId: flaskSocialWorker.id, + birthDate: + flaskSocialWorker.birth_date && new Date(flaskSocialWorker.birth_date), + panelRole: PanelContributors.SOCIAL_WORKER, + userName: flaskSocialWorker.userName, + isActive: flaskSocialWorker.is_active, + }; + + if (!nestSocialWorker) { + swNgo = await this.syncContributorNgo(flaskSocialWorker); + console.log('\x1b[36m%s\x1b[0m', 'Creating a Social Worker ...\n'); + nestSocialWorker = await this.userService.createContributor( + swDetails, + swNgo, + ); + console.log('\x1b[36m%s\x1b[0m', 'Created a Social Worker ...\n'); + } else if (nestSocialWorker) { + swNgo = nestSocialWorker.contributions.find( + (c) => c.flaskUserId == nestSocialWorker.flaskUserId, + ).ngo; + await this.userService + .updateContributor(nestSocialWorker.id, swDetails) + .then(); + nestSocialWorker = await this.userService.getContributorByFlaskId( + flaskNeed.created_by_id, + PanelContributors.SOCIAL_WORKER, + ); + console.log('\x1b[36m%s\x1b[0m', 'Social Worker updated ...\n'); + } else { + swNgo = nestSocialWorker.contributions.find( + (c) => c.flaskUserId == nestSocialWorker.flaskUserId, + ).ngo; + console.log('\x1b[36m%s\x1b[0m', 'Skipped Social Worker updating ...\n'); + } + //--------------------------------------------Auditor------------------------------------- + let nestAuditor: AllUserEntity; + let auditorDetails: UserParams; + try { + if (flaskNeed.isConfirmed) { + nestAuditor = await this.userService.getContributorByFlaskId( + flaskNeed.confirmUser, + PanelContributors.AUDITOR, + ); + + const flaskAuditor = await this.userService.getFlaskSocialWorker( + flaskNeed.confirmUser, + ); + + auditorDetails = { + typeId: flaskAuditor.type_id, + firstName: flaskAuditor.firstName, + lastName: flaskAuditor.lastName, + avatarUrl: flaskAuditor.avatar_url, + flaskUserId: flaskAuditor.id, + birthDate: + flaskAuditor.birth_date && new Date(flaskAuditor.birth_date), + panelRole: PanelContributors.AUDITOR, + userName: flaskAuditor.userName, + }; + if (!nestAuditor) { + const auditorNgo = await this.syncContributorNgo(flaskAuditor); + console.log('\x1b[36m%s\x1b[0m', 'Creating an auditor ...\n'); + nestAuditor = await this.userService.createContributor( + auditorDetails, + auditorNgo, + ); + console.log('\x1b[36m%s\x1b[0m', 'Created an auditor ...\n'); + } else { + console.log('\x1b[36m%s\x1b[0m', 'Skipped auditor updating ...\n'); + } + } else if (nestAuditor) { + await this.userService + .updateContributor(nestAuditor.id, auditorDetails) + .then(); + + nestAuditor = await this.userService.getContributorByFlaskId( + flaskNeed.confirmUser, + PanelContributors.AUDITOR, + ); + console.log('\x1b[36m%s\x1b[0m', 'Auditor updated ...\n'); + } else { + console.log( + '\x1b[36m%s\x1b[0m', + 'Not Confirmed, skipping auditor ...\n', + ); + } + } catch (e) { + console.log(e); + throw new ServerError(e.statusText, e.status); + } + + //--------------------------------------------Purchaser------------------------------------- + let nestPurchaser: AllUserEntity; + if ( + flaskNeed.type === NeedTypeEnum.PRODUCT && + flaskNeed.status > PaymentStatusEnum.COMPLETE_PAY + ) { + let purchaserId: number; + if (!statuses || !statuses[0]) { + // we do not have a history of purchaser id before implementing our new features + if (new Date(flaskNeed.doneAt).getFullYear() < 2023) { + purchaserId = 31; // Nyaz + } + if ( + new Date(flaskNeed.doneAt).getFullYear() === 2023 && + new Date(flaskNeed.doneAt).getMonth() <= 3 + ) { + purchaserId = 21; // Neda + } + } else { + purchaserId = statuses.find( + (s) => s.old_status === PaymentStatusEnum.COMPLETE_PAY, + )?.sw_id; + } + nestPurchaser = await this.userService.getContributorByFlaskId( + purchaserId, + PanelContributors.PURCHASER, + ); + + const flaskPurchaser = await this.userService.getFlaskSocialWorker( + purchaserId, + ); + + const purchaserDetails = { + typeId: flaskPurchaser.type_id, + firstName: flaskPurchaser.firstName, + lastName: flaskPurchaser.lastName, + avatarUrl: flaskPurchaser.avatar_url, + flaskUserId: flaskPurchaser.id, + birthDate: + flaskPurchaser.birth_date && new Date(flaskPurchaser.birth_date), + panelRole: PanelContributors.PURCHASER, + userName: flaskPurchaser.userName, + }; + if (!nestPurchaser) { + const purchaserNgo = await this.syncContributorNgo(flaskPurchaser); + // Create User + console.log('\x1b[36m%s\x1b[0m', 'Creating a purchaser ...\n'); + nestPurchaser = await this.userService.createContributor( + purchaserDetails, + purchaserNgo, + ); + console.log('\x1b[36m%s\x1b[0m', 'Created a purchaser ...\n'); + } else if (nestPurchaser) { + await this.userService + .updateContributor(nestPurchaser.id, purchaserDetails) + .then(); + + nestPurchaser = await this.userService.getContributorByFlaskId( + purchaserId, + PanelContributors.PURCHASER, + ); + console.log('\x1b[36m%s\x1b[0m', 'Purchaser updated ...\n'); + } else { + console.log('\x1b[36m%s\x1b[0m', 'Skipped Purchaser updating ...\n'); + } + } else { + console.log( + '\x1b[36m%s\x1b[0m', + 'Not Purchased, skipping Purchaser ...\n', + ); + } + //--------------------------------------------Child------------------------------------- + let nestChild = await this.childrenService.getChildById(childId); + const flaskChild = await this.childrenService.getFlaskChild(childId); + + const childDetails = { + flaskId: flaskChild.id, + sayName: flaskChild.sayname_translations.en, + sayNameTranslations: flaskChild.sayname_translations, + nationality: flaskChild.nationality, + country: flaskChild.country, + city: flaskChild.city, + awakeAvatarUrl: flaskChild.awakeAvatarUrl, + sleptAvatarUrl: flaskChild.sleptAvatarUrl, + adultAvatarUrl: flaskChild.adult_avatar_url, + bioSummaryTranslations: flaskChild.bio_summary_translations, + bioTranslations: flaskChild.bio_translations, + voiceUrl: flaskChild.voiceUrl, + birthPlace: flaskChild.birthPlace, + housingStatus: flaskChild.housingStatus, + familyCount: flaskChild.familyCount, + sayFamilyCount: flaskChild.sayFamilyCount, + education: flaskChild.education, + created: flaskChild.created, + updated: flaskChild.updated, + isDeleted: flaskChild.isDeleted, + isConfirmed: flaskChild.isConfirmed, + flaskConfirmUser: flaskChild.confirmUser, + confirmDate: flaskChild.confirmDate, + existenceStatus: flaskChild.existence_status, + generatedCode: flaskChild.generatedCode, + isMigrated: flaskChild.isMigrated, + migratedId: flaskChild.migratedId, + birthDate: flaskChild.birthDate && new Date(flaskChild.birthDate), + migrateDate: flaskChild.migrateDate && new Date(flaskChild.migrateDate), + }; + + if (!nestChild) { + // Create Child + console.log('\x1b[36m%s\x1b[0m', 'Creating a Child ...\n'); + + if (!nestSocialWorker || !nestSocialWorker.contributions) { + throw new ObjectNotFound( + 'Something went wrong while trying to create a child!', + ); + } + const childNgo = await this.ngoService.getNgoById( + nestSocialWorker.contributions.find( + (c) => c.flaskUserId == nestSocialWorker.flaskUserId, + ).flaskNgoId, + ); + nestChild = await this.childrenService.createChild( + childDetails, + childNgo, + nestSocialWorker.contributions.find( + (c) => c.flaskUserId == nestSocialWorker.flaskUserId, + ), + ); + console.log('\x1b[36m%s\x1b[0m', 'Created a Child ...\n'); + } else if (nestChild && nestChild.updated !== flaskChild.updated) { + await this.childrenService.updateChild(childDetails, nestChild).then(); + nestChild = await this.childrenService.getChildById(childId); + + console.log('\x1b[36m%s\x1b[0m', 'Child updated ...\n'); + } else { + console.log('\x1b[36m%s\x1b[0m', 'Skipped Child updating ...\n'); + } + + //--------------------------------------------Receipt------------------------------------- + let nestReceipt: ReceiptEntity; + const nestReceipts = []; + let receiptDetails: ReceiptParams; + if (receipts_) { + for (let r = 0; r < receipts_.length; r++) { + nestReceipt = await this.receiptService.getReceiptById( + receipts_[r].receipt[0].id, + ); + receiptDetails = { + title: receipts_[r].receipt[0].title || receipts_[r].receipt[0].code, + description: receipts_[r].receipt[0].description, + attachment: receipts_[r].receipt[0].attachment, + code: receipts_[r].receipt[0].code, + flaskSwId: receipts_[r].receipt[0].owner_id, + needStatus: receipts_[r].receipt[0].need_status, + flaskReceiptId: receipts_[r].receipt[0].id, + deleted: receipts_[r].receipt[0].deleted, + flaskNeedId: flaskNeed.id, + }; + + if (!nestReceipt && receipts_) { + // Create Receipt + console.log('\x1b[36m%s\x1b[0m', 'Creating a Receipt ...\n' + r); + nestReceipt = await this.receiptService.createReceipt(receiptDetails); + nestReceipts.push(nestReceipt); + console.log('\x1b[36m%s\x1b[0m', 'Created a Receipt ...\n'); + } else if (nestReceipt) { + await this.receiptService + .updateReceipt(receiptDetails, nestReceipt) + .then(); + nestReceipt = await this.receiptService.getReceiptById( + receiptDetails.flaskReceiptId, + ); + console.log('\x1b[36m%s\x1b[0m', 'Receipt updated ...\n'); + } + } + } else { + console.log('\x1b[36m%s\x1b[0m', 'Skipped Receipts ...\n'); + } + + //--------------------------------------------Payments------------------------------------- + let paymentDetails: PaymentParams; + let nestPayment: PaymentEntity; + let nestFamilyMember: AllUserEntity; + const nestPayments = []; + if (payments) { + for (let p = 0; p < payments.length; p++) { + nestPayment = await this.paymentService.getPaymentByFlaskId( + payments[p].id, + ); + + const { + id: paymentFlaskId, + verified: verified, + id_need: flaskNeedId, + id_user: flaskUserId, + order_id: orderId, + credit_amount: creditAmount, + donation_amount: donationAmount, + card_no: cardNumber, + gateway_payment_id: gatewayPaymentId, + gateway_track_id: gatewayTrackId, + need_amount: needAmount, + transaction_date: transactionDate, + created: created, + updated: updated, + } = payments[p]; + + paymentDetails = { + flaskId: paymentFlaskId, + flaskNeedId: flaskNeedId, + flaskUserId: flaskUserId, + orderId: orderId, + verified: verified, + needAmount: needAmount, + donationAmount: donationAmount, + creditAmount: creditAmount, + cardNumber: cardNumber, + gatewayPaymentId: gatewayPaymentId, + gatewayTrackId: gatewayTrackId, + transactionDate: transactionDate, + created: created, + updated: updated, + }; + nestFamilyMember = await this.userService.getFamilyByFlaskId( + payments[p].id_user, + ); + if (!nestFamilyMember) { + // Create Family + console.log('\x1b[36m%s\x1b[0m', 'Creating a Family ...\n'); + nestFamilyMember = await this.userService.createFamily( + payments[p].id_user, + ); + } else if (nestFamilyMember) { + await this.userService + .updateFamily(nestFamilyMember.id, payments[p].id_user) + .then(); + nestFamilyMember = await this.userService.getFamilyByFlaskId( + payments[p].id_user, + ); + console.log('\x1b[36m%s\x1b[0m', 'Family updated ...\n'); + } else { + console.log('\x1b[36m%s\x1b[0m', 'Skipped Family updating ...\n'); + } + if (!nestPayment) { + console.log('\x1b[36m%s\x1b[0m', 'Creating a Payment ...\n' + p); + nestPayment = await this.paymentService.createPayment( + paymentDetails, + nestFamilyMember, + ); + nestPayments.push(nestPayment); + console.log('\x1b[36m%s\x1b[0m', 'Created a Payment ...\n'); + } else if (nestPayment) { + await this.paymentService + .updatePayment(nestPayment.id, paymentDetails, nestFamilyMember) + .then(); + nestPayment = await this.paymentService.getPaymentByFlaskId( + payments[p].id, + ); + console.log('\x1b[36m%s\x1b[0m', 'Payment updated ...\n'); + } else { + console.log('\x1b[36m%s\x1b[0m', 'Skipped Payment updating ...\n'); + } + } + } else { + console.log('\x1b[36m%s\x1b[0m', 'Skipped Payments ...\n'); + } + + //--------------------------------------------Statuses------------------------------------- + let statusDetails: StatusParams; + let nestStatus: StatusEntity; + const nestStatuses = []; + if (statuses) { + for (let s = 0; s < statuses.length; s++) { + nestStatus = await this.statusService.getStatusById(statuses[s].id); + const { + id: statusFlaskId, + need_id: flaskNeedId, + sw_id: swId, + new_status: newStatus, + old_status: oldStatus, + } = statuses[s]; + + statusDetails = { + flaskId: statusFlaskId, + flaskNeedId: flaskNeedId, + swId: swId, + newStatus: newStatus, + oldStatus: oldStatus, + }; + if (!nestStatus) { + console.log('\x1b[36m%s\x1b[0m', 'Creating a Status ...\n' + s); + nestStatus = await this.statusService.createStatus(statusDetails); + nestStatuses.push(nestStatus); + console.log('\x1b[36m%s\x1b[0m', 'Created a Status ...\n'); + } else if (nestStatus.newStatus !== flaskNeed.status) { + await this.statusService + .updateStatus(nestStatus.id, statusDetails) + .then(); + nestStatus = await this.statusService.getStatusById(statuses[s].id); + console.log('\x1b[36m%s\x1b[0m', 'Status updated ...\n'); + } else { + console.log('\x1b[36m%s\x1b[0m', 'Skipped Status updating ...\n'); + } + } + } else { + console.log('\x1b[36m%s\x1b[0m', 'Skipped Status Updates ...\n'); + } + + //--------------------------------------------Provider------------------------------------- + // Social worker adds the relationship when adding flask need at panel. + // We fetch the created relation to attach that provider to the nest need + let theNestProvider: ProviderEntity; + const nestProviderNeedRelation = + await this.providerService.getProviderNeedRelationById(flaskNeed.id); + + // Needs before panel version 2.0.0 do not have providers, we create them here! sry :( + if (flaskNeed.type === NeedTypeEnum.PRODUCT) { + if (!nestProviderNeedRelation) { + theNestProvider = await this.providerService.getProviderByName( + 'Digikala', + ); + if (!theNestProvider) { + console.log('\x1b[36m%s\x1b[0m', 'Creating a provider ...\n'); + + theNestProvider = await this.providerService.createProvider({ + name: 'Digikala', + description: 'N/A', + address: 'N/A', + website: 'https://digikala.com', + type: NeedTypeEnum.PRODUCT, + typeName: NeedTypeDefinitionEnum.PRODUCT, + city: 135129, + state: 3945, + country: 103, + logoUrl: 'N/A', + isActive: true, + }); + console.log('\x1b[36m%s\x1b[0m', 'Created a provider ...\n'); + } + } else if (nestProviderNeedRelation) { + theNestProvider = await this.providerService.getProviderById( + nestProviderNeedRelation.nestProviderId, + ); + } else if (theNestProvider) { + console.log('\x1b[36m%s\x1b[0m', 'Skipped provider ...\n'); + } + } else if (flaskNeed.type === NeedTypeEnum.SERVICE) { + if (!nestProviderNeedRelation) { + theNestProvider = await this.providerService.getProviderByName( + 'NoName', + ); + if (!theNestProvider) { + console.log('\x1b[36m%s\x1b[0m', 'Creating a provider ...\n'); + + theNestProvider = await this.providerService.createProvider({ + name: 'NoName', + description: 'N/A', + address: 'N/A', + website: 'https://saydao.org', + type: NeedTypeEnum.SERVICE, + typeName: NeedTypeDefinitionEnum.SERVICE, + city: 135129, + state: 3945, + country: 103, + logoUrl: 'N/A', + isActive: true, + }); + console.log('\x1b[36m%s\x1b[0m', 'Created a provider ...\n'); + } + } else if (nestProviderNeedRelation) { + theNestProvider = await this.providerService.getProviderById( + nestProviderNeedRelation.nestProviderId, + ); + console.log('\x1b[36m%s\x1b[0m', 'got the provider ...'); + } else if (theNestProvider) { + console.log('\x1b[36m%s\x1b[0m', 'Skipped provider ...\n'); + } + } else { + throw new BadRequestException('Something wring with Provider'); + } + + //--------------------------------------------Need------------------------------------- + let nestNeed = await this.needService.getNeedByFlaskId(flaskNeed.id); + if (!nestSocialWorker || !nestSocialWorker.contributions) { + throw new ObjectNotFound( + 'Something went wrong while trying to create the Need!', + ); + } + const needDetails = { + name: flaskNeed.name_translations.fa, + nameTranslations: flaskNeed.name_translations, + descriptionTranslations: flaskNeed.description_translations, + title: flaskNeed.title, + status: flaskNeed.status, + category: flaskNeed.category, + type: flaskNeed.type, + isUrgent: flaskNeed.isUrgent, + affiliateLinkUrl: flaskNeed.affiliateLinkUrl, + link: flaskNeed.link, + doingDuration: flaskNeed.doing_duration, + needRetailerImg: flaskNeed.img, + purchaseCost: flaskNeed.purchase_cost, + cost: flaskNeed._cost, + deliveryCode: flaskNeed.deliveryCode, + doneAt: flaskNeed.doneAt, + isConfirmed: flaskNeed.isConfirmed, + deletedAt: flaskNeed.deleted_at, + unavailableFrom: flaskNeed.unavailable_from, + created: flaskNeed.created, + updated: flaskNeed.updated, + purchaseDate: flaskNeed.purchase_date, + ngoDeliveryDate: flaskNeed.ngo_delivery_date, + expectedDeliveryDate: flaskNeed.expected_delivery_date, + childDeliveryDate: flaskNeed.child_delivery_date, + bankTrackId: flaskNeed.bank_track_id, + confirmDate: flaskNeed.confirmDate, + imageUrl: flaskNeed.imageUrl, + flaskChildId: childId, + flaskId: flaskNeed.id, + details: flaskNeed.details, + information: flaskNeed.informations, + }; + + if (!nestNeed) { + console.log('\x1b[36m%s\x1b[0m', 'Creating The Need ...\n'); + const needNgo = await this.ngoService.getNgoById( + nestSocialWorker.contributions.find( + (c) => c.flaskUserId === nestSocialWorker.flaskUserId, + ).flaskNgoId, + ); + nestNeed = await this.needService.createNeed( + nestChild, + needNgo, + nestSocialWorker, + nestAuditor, + nestPurchaser, + needDetails, + nestStatuses, + nestPayments, + nestReceipts, + theNestProvider, + ); + console.log( + '\x1b[36m%s\x1b[0m', + `Created The Need ${nestNeed.flaskId} ...\n`, + ); + } else if (nestNeed && nestNeed.updated !== flaskNeed.updated) { + await this.needService + .updateNeed( + nestNeed.id, + nestChild, + swNgo, + nestSocialWorker, + nestAuditor, + nestPurchaser, + needDetails, + theNestProvider, + ) + .then(); + nestNeed = await this.needService.getNeedByFlaskId(nestNeed.flaskId); + console.log( + '\x1b[36m%s\x1b[0m', + `The Need ${nestNeed.flaskId} updated ...\n`, + ); + } else { + console.log( + '\x1b[36m%s\x1b[0m', + `Skipped ${nestNeed.flaskId} The Need updating ...\n`, + ); + } + if (!nestNeed) { + throw new ServerError('no need...', 504); + } + + if (!nestNeed.provider || !nestNeed.provider.name) { + throw new ServerError('no provider detected...', 505); + } + return { + nestCaller, + nestSocialWorker, + nestAuditor, + nestPurchaser, + need: nestNeed, + child: nestChild, + }; + } + + async syncChild( + flaskChild: Child, + addedState: number, + schoolType: SchoolTypeEnum, + ) { + //--------------------------------------------Child------------------------------------- + let nestChild = await this.childrenService.getChildById(flaskChild.id); + + const childDetails = { + flaskId: flaskChild.id, + sayName: flaskChild.sayname_translations.en, + sayNameTranslations: flaskChild.sayname_translations, + nationality: flaskChild.nationality, + country: flaskChild.country, + city: flaskChild.city, + state: addedState, + awakeAvatarUrl: flaskChild.awakeAvatarUrl, + sleptAvatarUrl: flaskChild.sleptAvatarUrl, + adultAvatarUrl: flaskChild.adult_avatar_url, + bioSummaryTranslations: flaskChild.bio_summary_translations, + bioTranslations: flaskChild.bio_translations, + voiceUrl: flaskChild.voiceUrl, + birthPlace: flaskChild.birthPlace, + housingStatus: flaskChild.housingStatus, + familyCount: flaskChild.familyCount, + sayFamilyCount: flaskChild.sayFamilyCount, + education: flaskChild.education, + created: flaskChild.created, + updated: flaskChild.updated, + isDeleted: flaskChild.isDeleted, + isConfirmed: flaskChild.isConfirmed, + flaskConfirmUser: flaskChild.confirmUser, + confirmDate: flaskChild.confirmDate, + existenceStatus: flaskChild.existence_status, + generatedCode: flaskChild.generatedCode, + isMigrated: flaskChild.isMigrated, + migratedId: flaskChild.migratedId, + birthDate: flaskChild.birthDate && new Date(flaskChild.birthDate), + migrateDate: flaskChild.migrateDate && new Date(flaskChild.migrateDate), + schoolType, + flaskNgoId: flaskChild.id_ngo, + flaskSwId: flaskChild.id_social_worker, + }; + + if (!nestChild) { + //-------------------------------------------- Social worker------------------------------------- + let nestSocialWorker: AllUserEntity; + let swNgo: NgoEntity; + nestSocialWorker = await this.userService.getContributorByFlaskId( + flaskChild.id_social_worker, + PanelContributors.SOCIAL_WORKER, + ); + + const flaskSocialWorker = await this.userService.getFlaskSocialWorker( + flaskChild.id_social_worker, + ); + + const swDetails = { + typeId: flaskSocialWorker.type_id, + firstName: flaskSocialWorker.firstName, + lastName: flaskSocialWorker.lastName, + avatarUrl: flaskSocialWorker.avatar_url, + flaskUserId: flaskSocialWorker.id, + birthDate: + flaskSocialWorker.birth_date && + new Date(flaskSocialWorker.birth_date), + panelRole: PanelContributors.SOCIAL_WORKER, + userName: flaskSocialWorker.userName, + isActive: flaskSocialWorker.is_active, + }; + + if (!nestSocialWorker) { + swNgo = await this.syncContributorNgo(flaskSocialWorker); + console.log('\x1b[36m%s\x1b[0m', 'Creating a Social Worker ...\n'); + nestSocialWorker = await this.userService.createContributor( + swDetails, + swNgo, + ); + console.log('\x1b[36m%s\x1b[0m', 'Created a Social Worker ...\n'); + } else if (nestSocialWorker) { + swNgo = nestSocialWorker.contributions.find( + (c) => c.flaskUserId == nestSocialWorker.flaskUserId, + ).ngo; + await this.userService + .updateContributor(nestSocialWorker.id, swDetails) + .then(); + nestSocialWorker = await this.userService.getContributorByFlaskId( + flaskChild.id_social_worker, + PanelContributors.SOCIAL_WORKER, + ); + console.log('\x1b[36m%s\x1b[0m', 'Social Worker updated ...\n'); + } else { + swNgo = nestSocialWorker.contributions.find( + (c) => c.flaskUserId == nestSocialWorker.flaskUserId, + ).ngo; + console.log( + '\x1b[36m%s\x1b[0m', + 'Skipped Social Worker updating ...\n', + ); + } + // Create Child + console.log('\x1b[36m%s\x1b[0m', 'Creating a Child ...\n'); + + if (!nestSocialWorker || !nestSocialWorker.contributions) { + throw new ObjectNotFound( + 'Something went wrong while trying to create a child!', + ); + } + const childNgo = await this.ngoService.getNgoById( + nestSocialWorker.contributions.find( + (c) => c.flaskUserId == nestSocialWorker.flaskUserId, + ).flaskNgoId, + ); + nestChild = await this.childrenService.createChild( + childDetails, + childNgo, + nestSocialWorker.contributions.find( + (c) => c.flaskUserId == nestSocialWorker.flaskUserId, + ), + ); + console.log('\x1b[36m%s\x1b[0m', 'Created a Child ...\n'); + } else if (nestChild && nestChild.updated !== flaskChild.updated) { + await this.childrenService.updateChild(childDetails, nestChild).then(); + nestChild = await this.childrenService.getChildById(flaskChild.id); + + console.log('\x1b[36m%s\x1b[0m', 'Child updated ...\n'); + } else { + console.log('\x1b[36m%s\x1b[0m', 'Skipped Child updating ...\n'); + } + return nestChild; + } +} diff --git a/src/features/ticket/interceptors/addTicket.interceptors.ts b/src/features/ticket/interceptors/addTicket.interceptors.ts new file mode 100644 index 0000000000..903ad33c73 --- /dev/null +++ b/src/features/ticket/interceptors/addTicket.interceptors.ts @@ -0,0 +1,19 @@ + +import { Injectable, NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common'; +import { Observable } from 'rxjs'; +import { tap } from 'rxjs/operators'; + +@Injectable() +export class AddTicketInterceptor implements NestInterceptor { + intercept(context: ExecutionContext, next: CallHandler): Observable { + console.log('Intercepting Add Ticket...'); + console.log('Before...'); + + const now = Date.now(); + return next + .handle() + .pipe( + tap(() => console.log(`After... ${Date.now() - now}ms`)), + ); + } +} \ No newline at end of file diff --git a/src/features/ticket/middlewares/ticket.middleware.ts b/src/features/ticket/middlewares/ticket.middleware.ts new file mode 100644 index 0000000000..c4261a560b --- /dev/null +++ b/src/features/ticket/middlewares/ticket.middleware.ts @@ -0,0 +1,36 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class TicketMiddleware implements NestMiddleware { + private readonly logger = new Logger(TicketMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/ticket/pipes/validate-ticket.pipe.ts b/src/features/ticket/pipes/validate-ticket.pipe.ts new file mode 100644 index 0000000000..99e34c6659 --- /dev/null +++ b/src/features/ticket/pipes/validate-ticket.pipe.ts @@ -0,0 +1,10 @@ +import { ArgumentMetadata, Injectable, PipeTransform } from '@nestjs/common'; + +@Injectable() +export class ValidateTicketPipe implements PipeTransform { + transform(value: any, metadata: ArgumentMetadata) { + console.log("Validating Ticket...") + + return value; + } +} diff --git a/src/features/ticket/ticket.controller.ts b/src/features/ticket/ticket.controller.ts new file mode 100644 index 0000000000..1e08210054 --- /dev/null +++ b/src/features/ticket/ticket.controller.ts @@ -0,0 +1,290 @@ +import { + Controller, + Get, + Post, + Body, + Param, + Delete, + Req, + UseInterceptors, + ValidationPipe, + UsePipes, + ForbiddenException, +} from '@nestjs/common'; +import { TicketService } from './ticket.service'; +import { CreateTicketDto } from '../../types/dtos/ticket/CreateTicket.dto'; +import { ApiHeader, ApiSecurity, ApiTags } from '@nestjs/swagger'; +import { + AnnouncementEnum, + FlaskUserTypesEnum, + SAYPlatformRoles, +} from 'src/types/interfaces/interface'; +import { TicketEntity } from '../../entities/ticket.entity'; +import { SyncService } from '../sync/sync.service'; +import { AddTicketInterceptor } from './interceptors/addTicket.interceptors'; +import { CreateTicketContentDto } from '../../types/dtos/ticket/CreateTicketContent.dto'; +import { + convertFlaskToSayRoles, + dateConvertToPersian, + getSAYRoleInteger, +} from 'src/utils/helpers'; +import { ValidateTicketPipe } from './pipes/validate-ticket.pipe'; +import { CreateTicketParams } from 'src/types/parameters/CreateTicketParameters'; +import { NeedService } from '../need/need.service'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { UserService } from '../user/user.service'; +import { isAuthenticated } from 'src/utils/auth'; + +@ApiTags('Tickets') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) +@Controller('tickets') +export class TicketController { + constructor( + private readonly ticketService: TicketService, + private needService: NeedService, + private readonly syncService: SyncService, + private userService: UserService, + ) {} + + @Get('all') + async findAll(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.ticketService.getTickets(); + } + + @Get('all/user') + async getUserTickets(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized!'); + } + const user = await this.userService.getFlaskSocialWorker(panelFlaskUserId); + if (convertFlaskToSayRoles(user.type_id) === SAYPlatformRoles.AUDITOR) { + return await this.ticketService.getTickets(); + } else { + return await this.ticketService.getUserTickets(panelFlaskUserId); + } + } + + @Get('ticket/:id') + async getTicketById(@Req() req: Request, @Param('id') id: string) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized!'); + } + const { ticket } = await this.ticketService.getTicketById( + id, + Number(panelFlaskTypeId), + ); + return ticket; + } + + @Post('content/add') + @UsePipes(new ValidationPipe()) // validation for dto files + async createTicketMsg( + @Req() req: Request, + @Body(ValidateTicketPipe) body: CreateTicketContentDto, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized!'); + } + try { + const { ticket } = await this.ticketService.getTicketById( + body.ticketId, + panelFlaskUserId, + ); + const msg = body.message; + const from = panelFlaskUserId; + + const contentDetails = { + message: msg, + from, + announcement: AnnouncementEnum.NONE, + }; + + await this.ticketService.updateTicketTime(ticket, panelFlaskUserId); + return await this.ticketService.createTicketContent( + contentDetails, + ticket, + ); + } catch (e) { + throw new ServerError(e.msg, 500); + } + } + + @UseInterceptors(AddTicketInterceptor) + @Post('add') + @UsePipes(new ValidationPipe()) // validation for dto files + async createTicket( + @Req() req: Request, + @Body(ValidateTicketPipe) body: CreateTicketDto, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized!'); + } + const flaskNeed = await this.needService.getFlaskNeed(body.flaskNeedId); + + console.log('\x1b[36m%s\x1b[0m', 'Syncing ...\n'); + const { nestCaller, nestSocialWorker, nestAuditor, nestPurchaser, need } = + await this.syncService.syncNeed( + flaskNeed, + flaskNeed.child_id, + body.flaskUserId, + body.receipts, + body.payments, + body.statuses, + ); + + const createTicketDetails: CreateTicketParams = { + title: body.title, + flaskNeedId: body.flaskNeedId, + need: need, + flaskUserId: body.flaskUserId, + role: convertFlaskToSayRoles(body.userTypeId), + lastAnnouncement: body.announcement, + }; + + console.log('\x1b[36m%s\x1b[0m', 'Creating Participants ...\n'); + + body.roles.find( + (role) => getSAYRoleInteger(role) === SAYPlatformRoles.AUDITOR, + ); + const participants = [ + nestCaller, + body.roles.find( + (role) => getSAYRoleInteger(role) === SAYPlatformRoles.SOCIAL_WORKER, + ) && nestSocialWorker, + body.roles.find( + (role) => getSAYRoleInteger(role) === SAYPlatformRoles.AUDITOR, + ) && nestAuditor, + body.roles.find( + (role) => getSAYRoleInteger(role) === SAYPlatformRoles.PURCHASER, + ) && nestPurchaser, + ].filter((p) => p); + + const uniqueParticipants = [ + ...new Map(participants.map((p) => [p.id, p])).values(), + ]; + + if (uniqueParticipants.length === 0) { + throw new ServerError('You are doing something wrong buddy!'); + } + + if (uniqueParticipants.length === 1) { + throw new ServerError('Two People is needed for the ticket'); + } + + if (need.ipfs) { + throw new ServerError('After IPFS upload you can not change anything.'); + } + + let ticket: TicketEntity; + ticket = await this.ticketService.getTicketByFlaskNeedId(body.flaskNeedId); + if (ticket) { + console.log('\x1b[36m%s\x1b[0m', 'Updating The Ticket ...\n'); + ticket = await this.ticketService.updateTicketContributors( + ticket, + participants, + ); + } + if (!ticket) { + console.log('\x1b[36m%s\x1b[0m', 'Creating The Ticket ...\n'); + ticket = await this.ticketService.createTicket( + createTicketDetails, + uniqueParticipants, + ); + } + + await this.ticketService.createTicketView( + createTicketDetails.flaskUserId, + ticket.id, + ); + + if (body.announcement === AnnouncementEnum.ARRIVED_AT_NGO) { + const persianDate = dateConvertToPersian(String(body.arrivalDate)); + const contentDetails = { + message: ` .به سمن رسید --- ${persianDate} --- ${`${new Date( + body.arrivalDate, + ).getFullYear()}-${ + new Date(body.arrivalDate).getMonth() + 1 + }-${new Date(body.arrivalDate).getDate()}`} `, + + from: body.flaskUserId, + announcement: AnnouncementEnum.ARRIVED_AT_NGO, + announcedArrivalDate: body.arrivalDate, + }; + + if (!body.arrivalDate) { + throw new ServerError('Date is not provided'); + } + await this.ticketService.createTicketContent(contentDetails, ticket); + } + // only when announce money received + if (body.announcement === AnnouncementEnum.NGO_RECEIVED_MONEY) { + const persianDate = dateConvertToPersian(String(body.arrivalDate)); + const contentDetails = { + message: ` .مبلغ دریافت شد--- ${persianDate} --- ${`${new Date( + body.arrivalDate, + ).getFullYear()}-${ + new Date(body.arrivalDate).getMonth() + 1 + }-${new Date(body.arrivalDate).getDate()}`} `, + + from: body.flaskUserId, + announcement: AnnouncementEnum.NGO_RECEIVED_MONEY, + announcedArrivalDate: body.arrivalDate, + }; + + if (!body.arrivalDate) { + throw new ServerError('Date is not provided'); + } + await this.ticketService.createTicketContent(contentDetails, ticket); + } + await this.ticketService.updateTicketAnnouncement( + ticket.id, + body.announcement, + ); + const { ticket: updatedTicket } = await this.ticketService.getTicketById( + ticket.id, + body.flaskUserId, + ); + return updatedTicket; + } + + @Delete(':id') + async DeleteTicket(@Req() req: Request, @Param('id') id: string) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.ticketService.DeleteTicket(id); + } + + // @Get('notifications/:flaskUserId') + // async getUserNotifications(@Param('flaskUserId') flaskUserId: number) { + // return await this.ticketService.getUserNotifications( + // Number(flaskUserId), + // ); + // } +} diff --git a/src/features/ticket/ticket.module.ts b/src/features/ticket/ticket.module.ts new file mode 100644 index 0000000000..8f475f8e74 --- /dev/null +++ b/src/features/ticket/ticket.module.ts @@ -0,0 +1,104 @@ +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; +import { TicketService } from './ticket.service'; +import { TicketController } from './ticket.controller'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { TicketEntity } from 'src/entities/ticket.entity'; +import { TicketContentEntity } from 'src/entities/ticketContent.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { TicketMiddleware } from './middlewares/ticket.middleware'; +import { NeedService } from '../need/need.service'; +import { NeedEntity } from 'src/entities/need.entity'; +import { SyncService } from '../sync/sync.service'; +import { NgoService } from '../ngo/ngo.service'; +import { UserService } from '../user/user.service'; +import { ChildrenService } from '../children/children.service'; +import { NgoArrivalEntity, NgoEntity } from 'src/entities/ngo.entity'; +import { ChildrenEntity } from 'src/entities/children.entity'; +import { ReceiptService } from '../receipt/receipt.service'; +import { ReceiptEntity } from 'src/entities/receipt.entity'; +import { PaymentService } from '../payment/payment.service'; +import { PaymentEntity } from 'src/entities/payment.entity'; +import { StatusService } from '../status/status.service'; +import { StatusEntity } from 'src/entities/status.entity'; +import { LocationEntity } from 'src/entities/location.entity'; +import { TicketViewEntity } from 'src/entities/ticketView.entity'; +import { SocialWorker, User } from '../../entities/flaskEntities/user.entity'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { NGO } from 'src/entities/flaskEntities/ngo.entity'; +import { LocationService } from '../location/location.service'; +import { Cities } from 'src/entities/flaskEntities/cities.entity'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { ProviderEntity } from 'src/entities/provider.entity'; +import { ProviderJoinNeedEntity } from 'src/entities/provider.Join.need..entity'; +import { ProviderService } from '../provider/provider.service'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { Countries } from 'src/entities/flaskEntities/countries.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; + +@Module({ + imports: [ + TypeOrmModule.forFeature( + [ + Need, + SocialWorker, + NGO, + Cities, + Child, + Payment, + UserFamily, + Family, + User, + Countries, + Receipt, + NeedReceipt, + ], + 'flaskPostgres', + ), + TypeOrmModule.forFeature([ + LocationEntity, + AllUserEntity, + TicketEntity, + TicketViewEntity, + TicketContentEntity, + NeedEntity, + VariableEntity, + NgoEntity, + NgoArrivalEntity, + ContributorEntity, + ChildrenEntity, + ReceiptEntity, + PaymentEntity, + StatusEntity, + EthereumAccountEntity, + ProviderJoinNeedEntity, + ProviderEntity, + ChildrenPreRegisterEntity, + ]), + ], + controllers: [TicketController], + providers: [ + LocationService, + PaymentService, + ReceiptService, + TicketService, + NeedService, + SyncService, + NgoService, + UserService, + ChildrenService, + StatusService, + ProviderService, + ], +}) +export class TicketModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer.apply(TicketMiddleware).forRoutes('tickets'); + } +} diff --git a/src/features/ticket/ticket.service.ts b/src/features/ticket/ticket.service.ts new file mode 100644 index 0000000000..03eb288ba4 --- /dev/null +++ b/src/features/ticket/ticket.service.ts @@ -0,0 +1,277 @@ +import { Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { NeedEntity } from 'src/entities/need.entity'; +import { TicketEntity } from 'src/entities/ticket.entity'; +import { TicketContentEntity } from 'src/entities/ticketContent.entity'; +import { TicketViewEntity } from 'src/entities/ticketView.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; +import { + AnnouncementEnum, + Colors, + ProductStatusEnum, +} from 'src/types/interfaces/interface'; +import { CreateTicketContentParams } from 'src/types/parameters/CreateTicketContentParameters'; +import { CreateTicketParams } from 'src/types/parameters/CreateTicketParameters'; +import { Repository, UpdateResult } from 'typeorm'; + +@Injectable() +export class TicketService { + constructor( + @InjectRepository(TicketEntity) + private ticketRepository: Repository, + @InjectRepository(TicketContentEntity) + private ticketContentRepository: Repository, + @InjectRepository(TicketViewEntity) + private ticketViewRepository: Repository, + @InjectRepository(Need, 'flaskPostgres') + private flaskNeedRepository: Repository, + @InjectRepository(NeedEntity) + private needRepository: Repository, + ) {} + + async createTicket( + ticketDetails: CreateTicketParams, + participants: AllUserEntity[], + ): Promise { + const newTicket = this.ticketRepository.create({ + ...ticketDetails, + color: !ticketDetails.color ? Colors.YELLOW : ticketDetails.color, // start with Warning, + }); + + newTicket.contributors = participants; + return this.ticketRepository.save(newTicket); + } + + getTicketByFlaskNeedId(flaskNeedId: number): Promise { + console.log(flaskNeedId); + + const ticket = this.ticketRepository.findOne({ + where: { + need: { + flaskId: flaskNeedId, + }, + }, + relations: { + need: true, + }, + }); + return ticket; + } + + getTicketsByNeed(id: string): Promise { + const ticket = this.ticketRepository.find({ + where: { + need: { + id, + }, + }, + relations: { + need: true, + }, + }); + return ticket; + } + + async getTicketById(id: string, flaskUserId: number) { + const ticket = await this.ticketRepository.findOne({ + where: { + id: id, + }, + relations: { + need: true, + }, + }); + + const latestView = ticket.views.find( + (v) => + Date.parse(v.viewed.toUTCString()) === + Math.max( + ...ticket.views.map((t) => Date.parse(t.viewed.toUTCString())), + ), + ); + + // create or update view + const myView = ticket.views.find( + (v) => v.flaskUserId === flaskUserId && v.ticketId === ticket.id, + ); + + if (myView) { + await this.updateTicketView(latestView.viewed, myView); + console.log('\x1b[36m%s\x1b[0m', 'Updated my view to latest ...\n'); + } else if (!myView) { + const view = await this.createTicketView(flaskUserId, ticket.id); + await this.updateTicketView(latestView.viewed, view); + console.log( + '\x1b[36m%s\x1b[0m', + 'created my view with latest time ...\n', + ); + } + + return { ticket, myView }; + } + + getTicketViewById(id: string): Promise { + const view = this.ticketViewRepository.findOne({ + where: { + id: id, + }, + }); + return view; + } + + createTicketView( + flaskUserId: number, + ticketId: string, + ): Promise { + const newView = this.ticketViewRepository.create({ + ticketId, + flaskUserId, + viewed: new Date(), + }); + return this.ticketViewRepository.save(newView); + } + + async updateTicketContributors( + ticket: TicketEntity, + participants: AllUserEntity[], + ): Promise { + const oldParticipants = ticket.contributors; + ticket.contributors = [...oldParticipants, ...participants]; + return this.ticketRepository.save(ticket); + } + + async updateTicketView( + currentTime: Date, + view: TicketViewEntity, + ): Promise { + return this.ticketViewRepository.update(view.id, { viewed: currentTime }); + } + + async updateTicketAnnouncement( + ticketId: string, + lastAnnouncement: AnnouncementEnum, + ): Promise { + return this.ticketRepository.update(ticketId, { + lastAnnouncement: lastAnnouncement, + }); + } + + async updateTicketColor( + ticketId: string, + color: Colors, + ): Promise { + return this.ticketRepository.update(ticketId, { + color: color, + }); + } + + async updateTicketTime( + ticket: TicketEntity, + flaskUserId: number, + ): Promise { + const currentTime = new Date(); + await this.ticketRepository.update(ticket.id, { + updatedAt: currentTime, + }); + if (flaskUserId) { + // create or update view + const view = ticket.views.find( + (v) => v.flaskUserId === flaskUserId && v.ticketId === ticket.id, + ); + if (view) { + await this.updateTicketView(currentTime, view); + console.log('\x1b[36m%s\x1b[0m', 'Updated my view ...\n'); + } else { + await this.createTicketView(flaskUserId, ticket.id); + console.log('\x1b[36m%s\x1b[0m', 'created my view ...\n'); + } + + return view.updatedAt; + } + } + + async createTicketContent( + contentDetails: CreateTicketContentParams, + ticket: TicketEntity, + ): Promise { + const newContent = this.ticketContentRepository.create({ + ...contentDetails, + }); + newContent.ticket = ticket; + return this.ticketContentRepository.save(newContent); + } + + getTickets(): Promise { + return this.ticketRepository.find({ + order: { + updatedAt: 'DESC', + }, + take: 250, + }); + } + + getUserTickets(flaskUserId: number): Promise { + return this.ticketRepository.find({ + where: { + contributors: { flaskUserId: flaskUserId }, + }, + take: 250, + order: { + updatedAt: 'DESC', + }, + }); + } + + async getNeedsTickets( + needIds: number[], + flaskUserId: number, + ): Promise { + const queryBuilder = this.ticketRepository + .createQueryBuilder('ticket') + .leftJoinAndSelect('ticket.contributors', 'contributor') + .where('ticket.flaskNeedId IN (:...needIds)', { needIds: needIds }) + .andWhere('contributor.flaskUserId = :flaskSwId', { + flaskSwId: flaskUserId, + }) + .cache(6000); + return await queryBuilder.getMany(); + } + + getUserOnlyArrivalTickets(flaskUserId: number): Promise { + return this.ticketRepository.find({ + relations: { + need: true, + }, + where: { + contributors: { flaskUserId: flaskUserId }, + need: { + status: ProductStatusEnum.PURCHASED_PRODUCT, + }, + }, + }); + } + + DeleteTicket(id: string) { + return this.ticketRepository.delete({ id }); + } + + // getUserNotifications(flaskUserId: number): Promise<[TicketEntity[], number]> { + // return this.ticketRepository + // .createQueryBuilder('ticketEntity') + // .leftJoinAndSelect("ticketEntity.views", "view") + // .leftJoinAndSelect("ticketEntity.ticketHistories", "ticketHistory") + // .where('ticketEntity.updatedAt > :startDate', { startDate: new Date(2019, 5, 3) }) + // .andWhere('view.viewed < ticketEntity.updatedAt') + // .where( + // new Brackets((qb) => { + // qb + // .where('view.flaskUserId = :flaskUserId', { flaskUserId: flaskUserId }) + // .andWhere("(ticketEntity.updatedAt) <= (view.viewed)") + // }), + // ) + // .leftJoinAndSelect("ticketEntity.contributors", "contributor") + // .andWhere('ticketEntity.flaskUserId = :flaskUserId', { flaskUserId: flaskUserId }) + // .getManyAndCount() + // } +} diff --git a/src/features/user/interceptors/mypage.interceptors.ts b/src/features/user/interceptors/mypage.interceptors.ts new file mode 100644 index 0000000000..7cc273cfc7 --- /dev/null +++ b/src/features/user/interceptors/mypage.interceptors.ts @@ -0,0 +1,20 @@ + +import { Injectable, NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common'; +import { Observable } from 'rxjs'; +import { tap } from 'rxjs/operators'; + +@Injectable() +export class MyPageInterceptor implements NestInterceptor { + intercept(context: ExecutionContext, next: CallHandler): Observable { + console.log('Intercepting My Page...'); + console.log('Before...'); + const request =context.getArgByIndex(0) + + const now = Date.now(); + return next + .handle() + .pipe( + tap(() => console.log(`After... ${Date.now() - now}ms`)), + ); + } +} \ No newline at end of file diff --git a/src/features/user/middlewares/user.middleware.ts b/src/features/user/middlewares/user.middleware.ts index 5836533ae6..9c6d5c73e5 100644 --- a/src/features/user/middlewares/user.middleware.ts +++ b/src/features/user/middlewares/user.middleware.ts @@ -1,19 +1,35 @@ -import { HttpException, HttpStatus, Injectable, NestMiddleware } from '@nestjs/common'; -import { NextFunction, Request, Response } from 'express'; +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; @Injectable() export class UserMiddleware implements NestMiddleware { - use(req: Request, res: Response, next: NextFunction) { - console.log('User MiddleWare...') - console.log(req.headers) - const { host, origin } = req.headers + private readonly logger = new Logger(UserMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; const origins = [ process.env.AUTHORIZED_DAPP_LOCAL, process.env.AUTHORIZED_PANEL_LOCAL, - process.env.AUTHORIZED_DOCS_LOCAL - ] + process.env.AUTHORIZED_DOCS_LOCAL, + ]; if (!origins.includes(origin) && !host) { - throw new HttpException('not an authorized origin - User middleWare', HttpStatus.FORBIDDEN) + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); } if (origins.includes(origin) || host) next(); } diff --git a/src/features/user/user.controller.ts b/src/features/user/user.controller.ts index e39f0ffbc1..7849c02591 100644 --- a/src/features/user/user.controller.ts +++ b/src/features/user/user.controller.ts @@ -1,218 +1,432 @@ -import { Controller, Get, Param, ParseIntPipe, Query, Req } from '@nestjs/common'; -import { ApiOperation, ApiTags } from '@nestjs/swagger'; -import { NeedEntity } from '../../entities/need.entity'; -import { FamilyEntity } from '../../entities/user.entity'; +import { + Controller, + Delete, + ForbiddenException, + Get, + Param, + ParseIntPipe, + Req, + UseInterceptors, +} from '@nestjs/common'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; import { UserService } from './user.service'; -import { NEEDS_URL } from '../need/need.controller'; +import { ServerError } from '../../filters/server-exception.filter'; +import { + FlaskUserTypesEnum, + SAYPlatformRoles, + SUPER_ADMIN_ID_PANEL, +} from 'src/types/interfaces/interface'; +import { + convertFlaskToSayRoles, + getOrganizedNeeds, + timeDifferenceWithComment, +} from 'src/utils/helpers'; +import { MyPageInterceptor } from './interceptors/mypage.interceptors'; +import { TicketService } from '../ticket/ticket.service'; +import { WalletService } from '../wallet/wallet.service'; +import { IpfsService } from '../ipfs/ipfs.service'; import { NeedService } from '../need/need.service'; -import { ObjectNotFound } from '../../filters/notFound-expectation.filter'; import { ChildrenService } from '../children/children.service'; -import { ChildrenEntity } from '../../entities/children.entity'; -import { NeedTypeEnum, PaymentStatusEnum, ProductStatusEnum, RolesEnum, ServiceStatusEnum } from 'src/types/interface'; -import { NeedAPIApi, NeedModel, SocialWorkerAPIApi } from 'src/generated-sources/openapi'; -import { NeedDto, NeedsDataDto } from 'src/types/dtos/CreateNeed.dto'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { Paginated } from 'nestjs-paginate'; +import { NgoService } from '../ngo/ngo.service'; +import { TicketEntity } from 'src/entities/ticket.entity'; +import { SignatureEntity } from 'src/entities/signature.entity'; +import { IpfsEntity } from 'src/entities/ipfs.entity'; +import { isAuthenticated } from 'src/utils/auth'; @ApiTags('Users') +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) @Controller('users') export class UserController { - constructor( - private userService: UserService, - private needService: NeedService, - private childrenService: ChildrenService, - ) { } - - @Get(`all`) - @ApiOperation({ description: 'Get a single transaction by ID' }) - async getFamilies() { - const families = await this.userService.getFamilies(); - const socialWorkers = await this.userService.getSocialWorkers(); - return { 'families': families, 'socialWorkers': socialWorkers } + constructor( + private userService: UserService, + private needService: NeedService, + private childrenService: ChildrenService, + private ticketService: TicketService, + private walletService: WalletService, + private ipfsService: IpfsService, + private ngoService: NgoService, + ) {} + + @Get(`all`) + @ApiOperation({ description: 'Get all users' }) + async getUsers(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); } + return await this.userService.getUsers(); + } - @Get(`done`) - @ApiOperation({ description: 'Get all done needs' }) - async getUserChildDoneNeeds( - @Query('childId', ParseIntPipe) childId: number, - @Query('userId', ParseIntPipe) userId: number, + @Get(`all/contributor`) + @ApiOperation({ description: 'Get all contributors' }) + async getContributors(@Req() req: Request) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN ) { - let user: FamilyEntity - user = await this.userService.getUserDoneNeeds(userId); - if (!user) { - user = await this.userService.createFamilyMember({ flaskUserId: userId }); - } - let filteredNeeds = []; - function isMatched(doneNeed: NeedEntity) { - return doneNeed.flaskChildId === childId; - } + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.userService.getContributors(); + } - // user is not found when there is no done needs - if (user && user.doneNeeds) { - filteredNeeds = user.doneNeeds.filter(isMatched); - } + @Get(`flask/sw/:flaskUserId`) + @ApiOperation({ description: 'Get all contributors' }) + async getFlaskSw( + @Req() req: Request, + @Param('flaskUserId', ParseIntPipe) flaskUserId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + return await this.userService.getFlaskSw(flaskUserId); + } - // urgent ==> index 0 - // growth 0 ==> index 1 - // joy 1 ==> index 2 - // health 2 ==> index 3 - // surroundings 3 ==> index 4 - // all ==> index 5 - - const needData = [[], [], [], [], [], []]; - for (let i = 0; i < filteredNeeds.length; i += 1) { - if (filteredNeeds[i].isUrgent) { - needData[0].push(filteredNeeds[i]); - } else { - needData[filteredNeeds[i].category + 1].push(filteredNeeds[i]); - } - } - needData[5].push(...filteredNeeds); - console.log(filteredNeeds); - - return { - flaskUserId: userId, - id: user.id, - flaskChildId: childId, - doneNeeds: needData, - total: filteredNeeds.length, - }; + @UseInterceptors(MyPageInterceptor) + @Get('myPage/:userId/:typeId') + @ApiOperation({ description: 'Get user My page' }) + async fetchMyPage( + @Req() req: Request, + @Param('typeId', ParseIntPipe) typeId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException('You Are not authorized!'); } + const time1 = new Date().getTime(); + const X_LIMIT = parseInt(req.headers['x-limit']); + const X_TAKE = parseInt(req.headers['x-take']); + const limit = X_LIMIT > 100 ? 100 : X_LIMIT; + const page = X_TAKE + 1; - @Get(`myPage/:ngoId/:swId`) - @ApiOperation({ description: 'Get social worker created needs' }) - async fetchMyPage(@Req() req: Request, @Param('ngoId') ngoId: number, @Param('swId') swId: number) { - const accessToken = req.headers["authorization"] - const X_SKIP = req.headers["x-skip"] - const X_TAKE = req.headers["x-take"] - let needsData: NeedsDataDto - try { + let allNeeds: Need[][]; + let notConfirmedCount: number; + let paid: Paginated; + let notPaid: Paginated; + let purchased: Paginated; + let delivered: Paginated; + let children: number; + let arrivals: any; - needsData = await this.needService.getNeeds({ accessToken, X_SKIP, X_TAKE }, { ngoId:1 }) - } catch (e) { - throw new ObjectNotFound(); - } - console.log(needsData.needs.length) - - const filteredNeeds = needsData.needs.filter((n) => n.created_by_id === 27) - - console.log(filteredNeeds.length) - - const organizedNeeds = [[], [], [], []]; // [[not paid], [payment], [purchased/delivered Ngo], [Done]] - if (filteredNeeds) { - for (let i = 0; i < filteredNeeds.length; i++) { - // not Paid - if (filteredNeeds[i].status === 0) { - organizedNeeds[0].push(filteredNeeds[i]); - } - // Payment Received - else if ( - filteredNeeds[i].status === PaymentStatusEnum.PARTIAL_PAY || - filteredNeeds[i].status === PaymentStatusEnum.COMPLETE_PAY - ) { - organizedNeeds[1].push(filteredNeeds[i]); - } - - if (filteredNeeds[i].type === NeedTypeEnum.SERVICE) { - // Payment sent to NGO - if (filteredNeeds[i].status === ServiceStatusEnum.MONEY_TO_NGO) { - organizedNeeds[2].push(filteredNeeds[i]); - } - // Delivered to child - if (filteredNeeds[i].status === ServiceStatusEnum.DELIVERED) { - organizedNeeds[3].push(filteredNeeds[i]); - } - } else if (filteredNeeds[i].type === NeedTypeEnum.PRODUCT) { - // Purchased - if (filteredNeeds[i].status === ProductStatusEnum.PURCHASED_PRODUCT) { - organizedNeeds[2].push(filteredNeeds[i]); - } - // Delivered to Ngo - if (filteredNeeds[i].status === ProductStatusEnum.DELIVERED_TO_NGO) { - organizedNeeds[2].push(filteredNeeds[i]); - } - // Delivered to child - if (filteredNeeds[i].status === ProductStatusEnum.DELIVERED) { - organizedNeeds[3].push(filteredNeeds[i]); - } - } - } - return organizedNeeds - } + const role = convertFlaskToSayRoles(typeId); + + try { + let socialWorkerId: number; + let auditorId: number; + let purchaserId: number; + let supervisorId: number; + let ngoIds: number[]; + let swIds: number[]; + + if (role === SAYPlatformRoles.SOCIAL_WORKER) { + console.log( + '\x1b[33m%s\x1b[0m', + `Role for my Page is SOCIAL_WORKER...\n`, + ); + socialWorkerId = panelFlaskUserId; + auditorId = null; + purchaserId = null; + supervisorId = null; + const socialWorker = await this.userService.getFlaskSocialWorker( + panelFlaskUserId, + ); // sw ngo + ngoIds = [socialWorker.ngo_id]; + children = await this.childrenService.countChildren(ngoIds); + } + if (role === SAYPlatformRoles.AUDITOR) { + console.log('\x1b[33m%s\x1b[0m', `Role for my Page is AUDITOR...\n`); + socialWorkerId = null; + auditorId = panelFlaskUserId; + purchaserId = null; + supervisorId = null; + + // for auditor - admin + swIds = await this.userService + .getFlaskSwIds() + .then((r) => r.map((s) => s.id)); // all ngos + ngoIds = await this.ngoService + .getFlaskNgos() + .then((r) => r.map((s) => s.id)); + children = await this.childrenService.countChildren(ngoIds); + } + if (role === SAYPlatformRoles.PURCHASER) { + console.log('\x1b[33m%s\x1b[0m', `Role for my Page is PURCHASER...\n`); + socialWorkerId = null; + auditorId = null; + purchaserId = panelFlaskUserId; + supervisorId = null; + swIds = await this.userService + .getFlaskSwIds() + .then((r) => r.map((s) => s.id)); + ngoIds = await this.ngoService + .getFlaskNgos() + .then((r) => r.map((s) => s.id)); // all ngos + children = await this.childrenService.countChildren(ngoIds); + } + + if (role === SAYPlatformRoles.NGO_SUPERVISOR) { + console.log( + '\x1b[33m%s\x1b[0m', + `Role for my Page is NGO_SUPERVISOR...\n`, + ); + socialWorkerId = null; + auditorId = null; + purchaserId = null; + supervisorId = panelFlaskUserId; + + // for ngo supervisor + const supervisor = await this.userService.getFlaskSocialWorker( + panelFlaskUserId, + ); + swIds = await this.userService + .getFlaskSocialWorkersByNgo(supervisor.ngo_id) + .then((r) => r.map((s) => s.id)); + + ngoIds = [supervisor.ngo_id]; + children = await this.childrenService.countChildren(ngoIds); + } + const allSignaturesNeedFlaskId = + await this.walletService.getSignaturesFlaskNeedId(); + const needsIdList = allSignaturesNeedFlaskId.map((s) => s.flaskNeedId); + + arrivals = await this.ngoService.getNgoArrivals(socialWorkerId, swIds); + notConfirmedCount = ( + await this.needService.getNotConfirmedNeeds( + socialWorkerId, + swIds, + ngoIds, + ) + )[1]; + + notPaid = await this.needService.getNotPaidNeeds( + { + page: page, + limit: limit, + path: '/', + }, + socialWorkerId, + auditorId, + purchaserId, + supervisorId, + swIds, + ngoIds, + ); + + paid = await this.needService.getPaidNeeds( + { + page: page, + limit: limit, + path: '', + }, + socialWorkerId, + auditorId, + purchaserId, + supervisorId, + swIds, + ngoIds, + ); + + purchased = await this.needService.getPurchasedNeeds( + { + page: page, + limit: limit, + path: '', + }, + socialWorkerId, + auditorId, + purchaserId, + supervisorId, + swIds, + ngoIds, + ); + + // to avoid seeing an SW created need by the NGO supervisor in the fourth column / Could not find ypu role / when signing + socialWorkerId = + role === SAYPlatformRoles.NGO_SUPERVISOR + ? panelFlaskUserId + : socialWorkerId; + + delivered = await this.needService.getDeliveredNeeds( + { + page: page, + limit: limit, + path: '', + }, + socialWorkerId, + auditorId, + purchaserId, + supervisorId, + swIds, + ngoIds, + needsIdList, + ); + + allNeeds = [ + [...notPaid.data], + [...paid.data], + [...purchased.data], + [...delivered.data], + ]; + + const time2 = new Date().getTime(); + timeDifferenceWithComment(time1, time2, 'Fetched Flask In '); + } catch (e) { + throw new ServerError(e.message, e.status); } - @Get(`social-worker/:flaskId/confirmedNeeds`) - @ApiOperation({ description: 'Get supervisor confirmed needs' }) - async getSwConfirmedNeeds(@Param('flaskId') flaskId: number, @Query('page') page = 1, @Query('limit') limit = 100) { - let needs: any - limit = limit > 100 ? 100 : limit; - const supervisor = await this.userService.getSocialWorker(flaskId); - - if (supervisor && supervisor.role === RolesEnum.SAY_SUPERVISOR) { - try { - needs = await this.needService.getSupervisorConfirmedNeeds(supervisor.flaskSwId, { - limit: Number(limit), - page: Number(page), - route: NEEDS_URL - }) - } catch (e) { - throw new ObjectNotFound(); + const modifiedNeedList = []; + const time3 = new Date().getTime(); + // add IPFS + tickets for every need + try { + let signatures: SignatureEntity[]; + let ipfs: IpfsEntity; + + const list: number[] = []; + allNeeds.forEach((column) => { + for (let i = 0; i < column.length; i++) { + list.push(column[i].id); + } + }); + const tickets = await this.ticketService.getNeedsTickets( + list, + panelFlaskUserId, + ); + // tickets = tickets.filter( + // (t) => + // t.contributors && + // t.contributors.find((c) => c.flaskUserId === panelFlaskUserId), + // ); + console.log( + '\x1b[33m%s\x1b[0m', + `Taking care of Need signatures + Tickets...\n`, + ); + for (let i = 0; i < allNeeds.length; i++) { + for (let k = 0; k < allNeeds[i].length; k++) { + const fetchedNeed = allNeeds[i][k]; + const needTickets = tickets.filter( + (t) => allNeeds[i][k].id === t.flaskNeedId, + ); + // signatures only at the my page last column + // UPDATE: we decided to snot show signatures on page reload since they have a dedicated page + // If you removing the code, remember need.signatures must be fixed on front-end side as well + if (i === 3) { + signatures = await this.walletService.getNeedSignatures( + fetchedNeed.id, + ); + ipfs = null; + if ( + signatures && + signatures.length > 0 && + signatures.find((s) => s.role === SAYPlatformRoles.AUDITOR) + ) { + ipfs = await this.ipfsService.getNeedIpfs(fetchedNeed.id); } + } + // End of UPDATE ------------------------------------------------------ + + const modifiedNeed = { + tickets: needTickets, + signatures, + ipfs, + ...fetchedNeed, + }; + modifiedNeedList.push(modifiedNeed); } - return needs; + } + } catch (e) { + throw new ServerError(e.message, e.status); } - @Get(`social-worker/:flaskId/confirmedChildren`) - @ApiOperation({ description: 'Get supervisor confirmed children' }) - async getSwConfirmedChildren(@Param('flaskId') flaskId: number, @Query('page') page = 1, @Query('limit') limit = 100) { - let needs: any - limit = limit > 100 ? 100 : limit; - const supervisor = await this.userService.getSocialWorker(flaskId); - - if (supervisor && supervisor.role === RolesEnum.SAY_SUPERVISOR) { - try { - needs = await this.childrenService.getSupervisorConfirmedChildren(supervisor.flaskSwId, { - limit: Number(limit), - page: Number(page), - route: NEEDS_URL - }) - } catch (e) { - throw new ObjectNotFound(); - } - } + const time4 = new Date().getTime(); + timeDifferenceWithComment(time3, time4, 'First organize In '); - return needs; - } - // Nyaz -purchasing,... - // @Get(`social-worker/:flaskId/confirmedNeeds`) - // @ApiOperation({ description: 'Get social worker created needs' }) - // async getContributorContribution(@Param('flaskId') flaskId: number, @Query('page') page = 1, @Query('limit') limit = 100) { - // let needs: any - // limit = limit > 100 ? 100 : limit; - // const socialWorker = await this.userService.getSocialWorker(flaskId); - // if (socialWorker && socialWorker.role === RolesEnum.SUPER_ADMIN) { - // try { - // needs = await this.needService.getSocialWorkerConfirmedNeeds(socialWorker.flaskSwId, { - // limit: Number(limit), - // page: Number(page), - // route: NEEDS_URL - // }) - // } catch (e) { - // throw new ObjectNotFound(); - // } - // } - // return needs; - // } -} + const time5 = new Date().getTime(); + const organizedNeeds = getOrganizedNeeds(modifiedNeedList); + const time6 = new Date().getTime(); + timeDifferenceWithComment(time5, time6, 'Second organize In '); + + const paidCount = paid.meta.totalItems; + const notPaidCount = notPaid.meta.totalItems; + const purchasedCount = purchased.meta.totalItems; + const deliveredCount = delivered.meta.totalItems; + const max = Math.max( + paidCount, + notPaidCount, + purchasedCount, + deliveredCount, + ); -// export enum RolesEnum { -// NO_ROLE = 0, -// SUPER_ADMIN = 1, -// SOCIAL_WORKER = 2, -// COORDINATOR = 3, // contributor -// NGO_SUPERVISOR = 4, -// SAY_SUPERVISOR = 5, -// ADMIN = 6, // team lead -// FAMILY = 7, -// FRIEND = 8, -// }; + return { + page, + limit, + max: + paidCount === max + ? paidCount + : notPaidCount === max + ? notPaidCount + : purchasedCount === max + ? purchasedCount + : deliveredCount, + meta: { + paid: paidCount, + notPaid: notPaidCount, + purchased: purchasedCount, + delivered: deliveredCount, + total: notPaidCount + paidCount + purchasedCount + deliveredCount, + realNotConfirmCount: notConfirmedCount, + realConfirmCount: + notPaidCount + + paidCount + + purchasedCount + + deliveredCount - + notConfirmedCount, + }, + panelFlaskUserId, + typeId, + needs: organizedNeeds, + children, + arrivals, + }; + } + + @Delete(`contributor/:flaskUserId`) + @ApiOperation({ description: 'Delete a contributor' }) + async deleteOneContributor( + @Req() req: Request, + @Param('flaskUserId') flaskUserId: number, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskUserId !== SUPER_ADMIN_ID_PANEL + ) { + throw new ForbiddenException('You Are not the Super admin'); + } + const theUser = await this.userService.getUserByFlaskId(flaskUserId); + const list = []; + theUser.contributions.forEach((c) => list.push(c.id)); + return await this.userService.deleteOneContributor(theUser.id, list); + } +} diff --git a/src/features/user/user.module.ts b/src/features/user/user.module.ts index 75b4eb653e..3880ec1707 100644 --- a/src/features/user/user.module.ts +++ b/src/features/user/user.module.ts @@ -3,25 +3,92 @@ import { TypeOrmModule } from '@nestjs/typeorm'; import { ScheduleModule } from '@nestjs/schedule'; import { HttpModule } from '@nestjs/axios'; import { UserService } from './user.service'; -import { FamilyEntity, SocialWorkerEntity } from '../../entities/user.entity'; +import { AllUserEntity } from '../../entities/user.entity'; import { UserController } from './user.controller'; import { UserMiddleware } from './middlewares/user.middleware'; import { NeedEntity } from '../../entities/need.entity'; import { NeedService } from '../need/need.service'; import { ChildrenEntity } from '../../entities/children.entity'; import { ChildrenService } from '../children/children.service'; +import { TicketService } from '../ticket/ticket.service'; +import { TicketEntity } from 'src/entities/ticket.entity'; +import { PaymentEntity } from 'src/entities/payment.entity'; +import { PaymentService } from '../payment/payment.service'; +import { TicketContentEntity } from 'src/entities/ticketContent.entity'; +import { TicketViewEntity } from 'src/entities/ticketView.entity'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { WalletService } from '../wallet/wallet.service'; +import { SignatureEntity } from 'src/entities/signature.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { IpfsService } from '../ipfs/ipfs.service'; +import { IpfsEntity } from 'src/entities/ipfs.entity'; +import { NgoService } from '../ngo/ngo.service'; +import { NgoArrivalEntity, NgoEntity } from 'src/entities/ngo.entity'; +import { NGO } from 'src/entities/flaskEntities/ngo.entity'; +import { DownloadService } from '../download/download.service'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; @Module({ imports: [ - TypeOrmModule.forFeature([FamilyEntity, SocialWorkerEntity, NeedEntity, ChildrenEntity]), + TypeOrmModule.forFeature( + [ + Need, + SocialWorker, + Child, + Payment, + NGO, + UserFamily, + Family, + User, + Receipt, + NeedReceipt, + ], + 'flaskPostgres', + ), + TypeOrmModule.forFeature([ + TicketEntity, + TicketViewEntity, + TicketContentEntity, + ContributorEntity, + VariableEntity, + NeedEntity, + ChildrenEntity, + PaymentEntity, + AllUserEntity, + SignatureEntity, + EthereumAccountEntity, + IpfsEntity, + NgoEntity, + NgoArrivalEntity, + ChildrenPreRegisterEntity, + ]), ScheduleModule.forRoot(), HttpModule, ], controllers: [UserController], - providers: [UserService, NeedService, ChildrenService], + providers: [ + UserService, + TicketService, + NeedService, + ChildrenService, + PaymentService, + WalletService, + IpfsService, + NgoService, + DownloadService, + ], }) export class UserModule implements NestModule { configure(consumer: MiddlewareConsumer) { - consumer.apply(UserMiddleware).forRoutes('users') + consumer.apply(UserMiddleware).forRoutes('users'); } } diff --git a/src/features/user/user.service.ts b/src/features/user/user.service.ts index 465b0f69c8..4fd5545b1d 100644 --- a/src/features/user/user.service.ts +++ b/src/features/user/user.service.ts @@ -1,83 +1,304 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { RolesEnum } from '../../types/interface'; -import { Repository } from 'typeorm'; -import { SocialWorkerEntity, FamilyEntity } from '../../entities/user.entity'; -import { FamilyParams, SocialWorkerParams } from '../../types/parameters/UserParameters'; -import { NeedModel, SocialWorkerAPIApi } from 'src/generated-sources/openapi'; +import { Repository, UpdateResult } from 'typeorm'; +import { AllUserEntity } from '../../entities/user.entity'; +import { UserParams } from 'src/types/parameters/UserParameters'; +import { NgoEntity } from 'src/entities/ngo.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { getSAYRoleString } from 'src/utils/helpers'; +import { PanelContributors } from 'src/types/interfaces/interface'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { from } from 'rxjs'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; @Injectable() export class UserService { constructor( - @InjectRepository(FamilyEntity) - private FamilyRepository: Repository, - @InjectRepository(SocialWorkerEntity) - private socialWorkerRepository: Repository - ) { } - - async getFamilies(): Promise { - return await this.FamilyRepository.find({ - relations: { - payments: true, + @InjectRepository(ContributorEntity) + private contributorRepository: Repository, + @InjectRepository(AllUserEntity) + private allUserRepository: Repository, + @InjectRepository(EthereumAccountEntity) + private ethereumWalletRepository: Repository, + @InjectRepository(SocialWorker, 'flaskPostgres') + private flaskSocialWorkerRepository: Repository, + @InjectRepository(User, 'flaskPostgres') + private flaskUserRepository: Repository, + ) {} + + getFlaskSwIds(): Promise { + return this.flaskSocialWorkerRepository.find({ + select: { + id: true, + is_active: true, }, }); } - async getSocialWorkers(): Promise { - return await this.socialWorkerRepository.find({ - relations: { - confirmedNeeds: true, - } + getFlaskSocialWorker(id: number): Promise { + return this.flaskSocialWorkerRepository.findOne({ + where: { id: id }, + }); + } + + async getFlaskSw(id: number): Promise { + return this.flaskSocialWorkerRepository.findOne({ + where: { id: id }, + }); + } + + getFlaskSocialWorkersByNgo(ngoId: number): Promise { + return this.flaskSocialWorkerRepository.find({ + where: { ngo_id: ngoId }, }); } - async getFamily(flaskId: number): Promise { - const user = await this.FamilyRepository.findOne({ + getUsers(): Promise { + return this.allUserRepository.find(); + } + + getActiveFlaskSws(): Promise { + return this.flaskSocialWorkerRepository.find({ where: { - flaskUserId: flaskId, + is_active: true, }, }); - return user; } - async getSocialWorker(flaskSwId: number): Promise { - const socialWorker = await this.socialWorkerRepository.findOne({ + getFlaskUsers(): Promise { + return this.flaskUserRepository.find(); + } + + getContributors(): Promise { + return this.allUserRepository.find({ where: { - flaskSwId: flaskSwId, + isContributor: true, }, }); - return socialWorker; } - async getUserDoneNeeds(flaskUserId: number): Promise { - return await this.FamilyRepository.findOne({ + createUserWallet( + address: string, + chainId: number, + user: AllUserEntity, + ): Promise { + const newWallet = this.ethereumWalletRepository.create({ + address, + chainId, + user, + }); + return this.ethereumWalletRepository.save(newWallet); + } + + async createContributor( + userDetails: UserParams, + ngo: NgoEntity, + ): Promise { + const theUser = await this.getUserByFlaskId(userDetails.flaskUserId); + if (!theUser) { + console.log('\x1b[36m%s\x1b[0m', 'Creating a user ...'); + + const theUser = await this.allUserRepository.save({ + ...userDetails, + flaskUserId: userDetails.flaskUserId, + isContributor: true, + }); + + if (userDetails.panelRole >= PanelContributors.NO_ROLE) { + console.log('\x1b[33m%s\x1b[0m', 'Creating a contribution ...\n'); + const newContribution = this.contributorRepository.create({ + flaskUserId: userDetails.flaskUserId, + flaskNgoId: ngo.flaskNgoId, + ngo: ngo, + panelRole: userDetails.panelRole, + panelRoleName: getSAYRoleString(userDetails.panelRole), + user: theUser, + }); + + await this.contributorRepository.save(newContribution); + console.log('\x1b[33m%s\x1b[0m', 'Saved a contribution ...\n'); + } + return await this.getUserByFlaskId(userDetails.flaskUserId); + } else if ( + theUser && + userDetails.panelRole >= PanelContributors.NO_ROLE && + theUser.contributions && + !theUser.contributions.find((c) => c.panelRole == userDetails.panelRole) + ) { + console.log('\x1b[36m%s\x1b[0m', 'Updating a user ...'); + console.log('\x1b[33m%s\x1b[0m', 'Creating a contribution ...\n'); + const newContribution = this.contributorRepository.create({ + flaskUserId: userDetails.flaskUserId, + flaskNgoId: ngo.flaskNgoId, + ngo: ngo, + panelRole: userDetails.panelRole, + panelRoleName: getSAYRoleString(userDetails.panelRole), + user: theUser, + }); + const theContribution = await this.contributorRepository.save( + newContribution, + ); + console.log('\x1b[33m%s\x1b[0m', 'Saved a contribution ...\n'); + theUser.contributions = [...theUser.contributions, theContribution]; + await this.allUserRepository.save(theUser); + return await this.getUserByFlaskId(userDetails.flaskUserId); + } else if ( + theUser.contributions && + theUser.contributions.find((c) => c.panelRole == userDetails.panelRole) + ) { + const theUserDetails = this.allUserRepository.create({ + typeId: userDetails.typeId, + firstName: userDetails.firstName, + lastName: userDetails.lastName, + avatarUrl: userDetails.avatarUrl, + flaskUserId: userDetails.flaskUserId, + birthDate: userDetails.birthDate, + userName: userDetails.userName, + }); + + await this.updateContributor(theUser.id, theUserDetails); + return await this.getUserByFlaskId(userDetails.flaskUserId); + } + } + + async updateContributor( + userId: string, + userDetails: UserParams, + ): Promise { + if (userDetails.panelRole >= PanelContributors.NO_ROLE) { + const theUSer = await this.allUserRepository.update(userId, { + typeId: userDetails.typeId, + birthDate: userDetails.birthDate, + flaskUserId: userDetails.flaskUserId, + firstName: userDetails.firstName, + lastName: userDetails.lastName, + avatarUrl: userDetails.avatarUrl, + userName: userDetails.userName, + }); + const updatedUser = await this.getUserByFlaskId(userDetails.flaskUserId); + + if ( + !updatedUser.contributions.find( + (c) => c.panelRole == userDetails.panelRole, + ) + ) { + const contribution = this.contributorRepository.create({ + flaskUserId: userDetails.flaskUserId, + panelRole: userDetails.panelRole, + panelRoleName: getSAYRoleString(userDetails.panelRole), + user: updatedUser, + }); + + await this.contributorRepository.save(contribution); + } + + return theUSer; + } + } + + getContributorByFlaskId( + flaskSwId: number, + panelRole: PanelContributors, + ): Promise { + const user = this.allUserRepository.findOne({ where: { - flaskUserId, - }, - relations: { - doneNeeds: true, + flaskUserId: flaskSwId, + isContributor: true, + contributions: { + panelRole, + }, }, }); + return user; + } + + async createFamily(flaskUserId: number): Promise { + const flaskUser = await this.flaskUserRepository + .createQueryBuilder('user') + .where('user.id = :userId', { userId: flaskUserId }) + .getOne(); + + const userDetails: UserParams = { + birthDate: flaskUser.birthDate, + flaskUserId: flaskUser.flaskUserId, + wallet: flaskUser.wallet, + firstName: flaskUser.firstName, + lastName: flaskUser.lastName, + avatarUrl: flaskUser.avatarUrl, + userName: flaskUser.userName, + }; + const newUser = this.allUserRepository.create({ + ...userDetails, + flaskUserId: flaskUserId, + isContributor: false, + }); + return this.allUserRepository.save({ id: newUser.id, ...newUser }); } - createFamilyMember(userDetails: FamilyParams): Promise { - const newUser = this.FamilyRepository.create({ + async updateFamily( + userId: string, + flaskUserId: number, + ): Promise { + const flaskUser = await this.flaskUserRepository + .createQueryBuilder('user') + .where('user.id = :userId', { userId: flaskUserId }) + .getOne(); + + const userDetails: UserParams = { + birthDate: flaskUser.birthDate, + flaskUserId: flaskUser.flaskUserId, + wallet: flaskUser.wallet, + firstName: flaskUser.firstName, + lastName: flaskUser.lastName, + avatarUrl: flaskUser.avatarUrl, + userName: flaskUser.userName, + }; + return this.allUserRepository.update(userId, { + ...userDetails, flaskUserId: userDetails.flaskUserId, - avatarUrl: userDetails.avatarUrl, - role: RolesEnum.FAMILY, - isActive: userDetails.isActive, + isContributor: false, }); - return this.FamilyRepository.save(newUser); } - fetchMyPage(accessToken: any, swId: number, pagination - ): Promise { - const socialWorkerApi = new SocialWorkerAPIApi(); - const needs: Promise = socialWorkerApi.apiV2SocialworkersIdCreatedNeedsGet(accessToken, swId, pagination.X_SKIP, pagination.X_TAKE).then((r) => r - ).catch((e) => e) - return needs; + getFamilyByFlaskId(flaskFamilyId: number): Promise { + const familyMember = this.allUserRepository.findOne({ + where: { + flaskUserId: flaskFamilyId, + isContributor: false, + }, + }); + return familyMember; } + getUserByFlaskId(flaskId: number): Promise { + const user = this.allUserRepository.findOne({ + where: { + flaskUserId: flaskId, + }, + }); + return user; + } + async getFlaskUser(id: number): Promise { + return this.flaskUserRepository.findOne({ + where: { id: id }, + }); + } -} \ No newline at end of file + getFamilyById(id: string): Promise { + const user = this.allUserRepository.findOne({ + where: { + id, + isContributor: false, + }, + }); + return user; + } + + async deleteOneContributor(userId: string, contIds: string[]) { + for await (const id of contIds) { + from(this.contributorRepository.delete(id)); + } + return from(this.allUserRepository.delete(userId)); + } +} diff --git a/src/features/wallet/interceptors/wallet.interceptors.ts b/src/features/wallet/interceptors/wallet.interceptors.ts new file mode 100644 index 0000000000..ea0459b44e --- /dev/null +++ b/src/features/wallet/interceptors/wallet.interceptors.ts @@ -0,0 +1,18 @@ + +import { Injectable, NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common'; +import { Observable } from 'rxjs'; +import { tap } from 'rxjs/operators'; + +@Injectable() +export class WalletInterceptor implements NestInterceptor { + intercept(context: ExecutionContext, next: CallHandler): Observable { + console.log('Intercepting Wallet...'); + console.log('Before...'); + const now = Date.now(); + return next + .handle() + .pipe( + tap(() => console.log(`After... ${Date.now() - now}ms`)), + ); + } +} \ No newline at end of file diff --git a/src/features/wallet/middlewares/wallet.middleware.ts b/src/features/wallet/middlewares/wallet.middleware.ts new file mode 100644 index 0000000000..1ed78db957 --- /dev/null +++ b/src/features/wallet/middlewares/wallet.middleware.ts @@ -0,0 +1,36 @@ +import { + HttpException, + HttpStatus, + Injectable, + Logger, + NestMiddleware, + Request, + Response, +} from '@nestjs/common'; +import { NextFunction } from 'express'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { updateFlaskCacheAuthentication } from 'src/utils/auth'; + +@Injectable() +export class WalletMiddleware implements NestMiddleware { + private readonly logger = new Logger(WalletMiddleware.name); + + async use(@Request() req, @Response() res, next: NextFunction) { + try { + await updateFlaskCacheAuthentication(req, this.logger); + } catch (e) { + throw new ServerError(e.message, e.status); + } + + const { host, origin } = req.headers; + const origins = [ + process.env.AUTHORIZED_DAPP_LOCAL, + process.env.AUTHORIZED_PANEL_LOCAL, + process.env.AUTHORIZED_DOCS_LOCAL, + ]; + if (!origins.includes(origin) && !host) { + throw new HttpException('not an authorized origin', HttpStatus.FORBIDDEN); + } + if (origins.includes(origin) || host) next(); + } +} diff --git a/src/features/signature/pipes/validate-signature.pipe.ts b/src/features/wallet/pipes/validate-wallet.pipe.ts similarity index 65% rename from src/features/signature/pipes/validate-signature.pipe.ts rename to src/features/wallet/pipes/validate-wallet.pipe.ts index 41a0b30920..09db57c727 100644 --- a/src/features/signature/pipes/validate-signature.pipe.ts +++ b/src/features/wallet/pipes/validate-wallet.pipe.ts @@ -1,9 +1,8 @@ import { ArgumentMetadata, Injectable, PipeTransform } from '@nestjs/common'; -import { SwCreateSwSignatureDto } from '../../../types/dtos/CreateSignature.dto'; @Injectable() export class ValidateSignaturePipe implements PipeTransform { - transform(value: SwCreateSwSignatureDto, metadata: ArgumentMetadata) { + transform(value: any, metadata: ArgumentMetadata) { console.log("Validating signature data...") // use pipes to transform request data to a desireable type return value diff --git a/src/features/wallet/wallet.controller.ts b/src/features/wallet/wallet.controller.ts new file mode 100644 index 0000000000..daa526422c --- /dev/null +++ b/src/features/wallet/wallet.controller.ts @@ -0,0 +1,853 @@ +import { + Body, + Controller, + Delete, + Get, + Logger, + NotFoundException, + Param, + ParseIntPipe, + Post, + Req, + Request, + Res, + Session, + UseInterceptors, + UsePipes, + ValidationPipe, +} from '@nestjs/common'; +import { ApiHeader, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; +import { + AnnouncementEnum, + AppContributors, + FlaskUserTypesEnum, + PanelContributors, + SAYPlatformRoles, + SUPER_ADMIN_ID_PANEL, + SwSignatureResult, + eEthereumNetworkChainId, +} from '../../types/interfaces/interface'; +import { + CreateSignatureDto, + PrepareDappSignatureDto, + PreparePanelSignatureDto, + VerifySignatureDto, + VerifyWalletDto, +} from '../../types/dtos/CreateSignature.dto'; +import { ValidateSignaturePipe } from './pipes/validate-wallet.pipe'; +import { WalletService } from './wallet.service'; +import { SyncService } from '../sync/sync.service'; +import { generateNonce, SiweErrorType, SiweMessage } from 'siwe'; +import { WalletExceptionFilter } from 'src/filters/wallet-exception.filter'; +import { IpfsService } from '../ipfs/ipfs.service'; +import { WalletInterceptor } from './interceptors/wallet.interceptors'; +import { UserService } from '../user/user.service'; +import { + convertFlaskToSayAppRoles, + convertFlaskToSayPanelRoles, + convertFlaskToSayRoles, +} from 'src/utils/helpers'; +import { NeedService } from '../need/need.service'; +import { SocialWorkerAPIApi, UserAPIApi } from 'src/generated-sources/openapi'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { TicketService } from '../ticket/ticket.service'; +import config from 'src/config'; +import { isAuthenticated } from 'src/utils/auth'; +import { ObjectNotFound } from 'src/filters/notFound-expectation.filter'; + +@UseInterceptors(WalletInterceptor) +@ApiSecurity('flask-access-token') +@ApiHeader({ + name: 'flaskId', + description: 'to use cache and flask authentication', + required: true, +}) +@ApiTags('Wallet') +@Controller('wallet') +export class WalletController { + private readonly logger = new Logger(WalletController.name); + + constructor( + private walletService: WalletService, + private syncService: SyncService, + private ipfsService: IpfsService, + private userService: UserService, + private needService: NeedService, + private ticketService: TicketService, + ) {} + + @Get('nonce/:typeId') + @ApiOperation({ description: 'Get SIWE nonce' }) + async getNonce( + @Res() res, + @Request() req, + @Session() session: Record, + @Param('typeId', ParseIntPipe) typeId: FlaskUserTypesEnum, + ) { + const role = convertFlaskToSayRoles(typeId); + + try { + if ( + role === SAYPlatformRoles.SOCIAL_WORKER || + role === SAYPlatformRoles.AUDITOR || + role === SAYPlatformRoles.PURCHASER || + role === SAYPlatformRoles.NGO_SUPERVISOR + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + if (!isAuthenticated(panelFlaskUserId, typeId)) { + throw new WalletExceptionFilter(403, 'You are not authenticated!'); + } + const flaskApi = new SocialWorkerAPIApi(); + const socialWorker = await flaskApi.apiV2SocialworkersIdGet( + config().dataCache.fetchPanelAuthentication(panelFlaskUserId).token, + panelFlaskUserId, + ); + + if (socialWorker.id === panelFlaskUserId) { + if (!session.nonce) { + session.nonce = generateNonce(); + session.save(); + } + res.setHeader('Content-Type', 'application/json'); + res + .status(200) + .send({ nonce: session.nonce, expiry: session.cookie._expires }); + } + } + if (role === SAYPlatformRoles.FAMILY) { + const dappFlaskUserId = req.headers['dappFlaskUserId']; + if (!isAuthenticated(dappFlaskUserId, typeId)) { + throw new WalletExceptionFilter(403, 'You are not authenticated!'); + } + const flaskApi = new UserAPIApi(); + const familyMember = await flaskApi.apiV2UserUserIduserIdGet( + config().dataCache.fetchDappAuthentication(dappFlaskUserId).token, + 'me', + ); + if (familyMember.id === dappFlaskUserId) { + if (!session.nonce) { + session.nonce = generateNonce(); + session.save(); + } + + res.setHeader('Content-Type', 'application/json'); + res + .status(200) + .send({ nonce: session.nonce, expiry: session.cookie._expires }); + } + } + } catch (e) { + req.session.destroy(); + throw new ServerError(e.message, e.status); + } + } + + @Post(`verify/:userId/:typeId`) + @ApiOperation({ description: 'Verify SIWE' }) + async verifySiwe( + @Param('userId', ParseIntPipe) userId: number, + @Param('typeId', ParseIntPipe) typeId: FlaskUserTypesEnum, + @Session() session, + @Request() req, + @Body(ValidateSignaturePipe) body: VerifyWalletDto, + ) { + try { + if (!body.message) { + throw new WalletExceptionFilter( + 422, + 'Expected prepareMessage object as body.', + ); + } + + const message = new SiweMessage(body.message); + + const fields = await message.validate(body.signature); + if (fields.nonce !== session.nonce) { + throw new WalletExceptionFilter(422, `Invalid nonce.`); + } + + session.siwe = fields; + session.siwe.flaskUserId = userId; + session.siwe.flaskTypeId = typeId; + // session.cookie._expires = new Date(fields.expirationTime); + // session.clear(); + session.save(); + const panelRole = convertFlaskToSayPanelRoles(typeId); + if ( + panelRole === PanelContributors.SOCIAL_WORKER || + panelRole === PanelContributors.AUDITOR || + panelRole === PanelContributors.PURCHASER || + panelRole === PanelContributors.NGO_SUPERVISOR + ) { + let nestContributor = await this.userService.getContributorByFlaskId( + userId, + panelRole, + ); + if (!nestContributor) { + const flaskCaller = await this.userService.getFlaskSocialWorker( + userId, + ); + console.log( + '\x1b[36m%s\x1b[0m', + 'Syncing NGO and Caller ...\n' + flaskCaller.id, + ); + const CallerNgo = await this.syncService.syncContributorNgo( + flaskCaller, + ); + console.log( + '\x1b[36m%s\x1b[0m', + 'Synced NGO and Caller ...\n' + flaskCaller.id, + ); + + const { + id: callerFlaskId, + ngo_id: callerFlaskNgoId, + ...callerOtherParams + } = flaskCaller; + + const callerDetails = { + ...callerOtherParams, + typeId: flaskCaller.type_id, + firstName: flaskCaller.firstName, + lastName: flaskCaller.lastName, + avatarUrl: flaskCaller.avatar_url, + flaskUserId: callerFlaskId, + flaskNgoId: callerFlaskNgoId, + birthDate: + flaskCaller.birth_date && new Date(flaskCaller.birth_date), + panelRole: convertFlaskToSayPanelRoles(flaskCaller.type_id), + userName: flaskCaller.userName, + }; + console.log('\x1b[36m%s\x1b[0m', 'Creating a user ...\n'); + nestContributor = await this.userService.createContributor( + callerDetails, + CallerNgo, + ); + console.log('\x1b[36m%s\x1b[0m', 'Created a user ...\n'); + } + + return session.nonce; + } + + const appRole = convertFlaskToSayAppRoles(typeId); + if ( + appRole === AppContributors.FAMILY || + appRole === AppContributors.RELATIVE + ) { + } + } catch (e) { + session.siwe = null; + session.nonce = null; + req.session.destroy(); + + switch (e) { + case SiweErrorType.EXPIRED_MESSAGE: { + session.save(); + throw new WalletExceptionFilter(e.status, e.message); + } + case SiweErrorType.INVALID_SIGNATURE: { + session.save(); + throw new WalletExceptionFilter(e.status, e.message); + } + default: { + session.save(); + throw new WalletExceptionFilter(e.status, e.message); + } + } + } + } + + @Get(`personal_information`) + @ApiOperation({ description: 'Get SIWE personal data' }) + async getPersonalInformation(@Session() session: Record) { + if (!session.siwe) { + throw new WalletExceptionFilter(401, 'You have to first sign_in'); + } + return session.siwe; + } + + @Post(`signature/panel/prepare`) + @UsePipes(new ValidationPipe()) // validation for dto files + async preparePanelSignature( + @Body(ValidateSignaturePipe) body: PreparePanelSignatureDto, + @Session() session: Record, + ) { + if (body.chainId !== eEthereumNetworkChainId.mainnet) { + throw new ServerError('Please connect to Mainnet!', 500); + } + if (!session.siwe) { + throw new WalletExceptionFilter(401, 'You have to first sign_in'); + } + + let transaction: SwSignatureResult; + try { + const flaskUserId = session.siwe.flaskUserId; + let counter = 0; + + const purchasedNeeds = await this.needService.getPurchasedNeedsCount( + flaskUserId, + ); + purchasedNeeds.forEach(async (need) => { + const ticket = await this.ticketService.getTicketByFlaskNeedId(need.id); + if ( + ticket.ticketHistories.find( + (h) => h.announcement == AnnouncementEnum.ARRIVED_AT_NGO, + ) + ) { + counter++; + } + }); + + if (body.arrivedColumnNumber - counter > 3) { + throw new WalletExceptionFilter( + 418, + 'You have to announce arrivals first!', + ); + } + const flaskNeed = await this.needService.getFlaskNeed(body.flaskNeedId); + const { need } = await this.syncService.syncNeed( + flaskNeed, + flaskNeed.child_id, + session.siwe.flaskUserId, + body.receipts, + body.payments, + body.statuses, + ); + console.log('\x1b[36m%s\x1b[0m', 'Preparing signature data ...\n'); + + transaction = await this.walletService.prepareSignature( + session.siwe.address, + need, + flaskUserId, + ); + console.log('\x1b[36m%s\x1b[0m', 'Storing the wallet address ...\n'); + const flaskTypeId = session.siwe.flaskTypeId; + + const panelRole = convertFlaskToSayPanelRoles(flaskTypeId); + + const nestContributor = await this.userService.getContributorByFlaskId( + flaskUserId, + panelRole, + ); + + if ( + nestContributor.wallets.length === 0 || + !nestContributor.wallets.find((w) => w.address === session.siwe.address) + ) { + await this.userService.createUserWallet( + session.siwe.address, + session.siwe.chainId, + nestContributor, + ); + } + + return transaction; + } catch (e) { + throw new ServerError(e.message, e.status); + } + } + + @Post(`signature/dapp/prepare`) + @UsePipes(new ValidationPipe()) // validation for dto files + async prepareDappSignature( + @Body(ValidateSignaturePipe) body: PrepareDappSignatureDto, + @Session() session: Record, + ) { + if (body.chainId !== eEthereumNetworkChainId.mainnet) { + throw new ServerError('Please connect to Mainnet!', 500); + } + if (!session.siwe) { + throw new WalletExceptionFilter(401, 'You have to first sign_in'); + } + + let transaction: SwSignatureResult; + try { + const flaskUserId = session.siwe.flaskUserId; + const need = await this.needService.getNeedById(body.needId); + + if (!need.variables.find((v) => v.flaskUserId === flaskUserId)) { + this.needService.updateNeedRatios( + need, + body.variables.distanceRatio, + body.variables.difficultyRatio, + body.variables.contributionRatio, + flaskUserId, + ); + } + + const socialWorker = need.signatures.find( + (s) => s.flaskUserId === need.socialWorker.flaskUserId, + ); + + if (!socialWorker) { + throw new WalletExceptionFilter( + 403, + 'Hmmm, could not find social worker signature', + ); + } + + console.log('\x1b[36m%s\x1b[0m', 'Preparing signature data ...\n'); + + transaction = await this.walletService.prepareSignature( + session.siwe.address, + need, + flaskUserId, + ); + + return transaction; + } catch (e) { + throw new ServerError(e.message, e.status); + } + } + + @Post(`signature/create/:signature`) + @ApiOperation({ description: 'Create a signature db' }) + async createSignature( + @Param('signature') signature: string, + @Body(ValidateSignaturePipe) body: CreateSignatureDto, + @Session() session: Record, + ) { + if (!session.siwe) { + throw new WalletExceptionFilter(401, 'You have to first sign_in'); + } + this.logger.log('Initiating signature creation'); + + try { + const sessionFlaskUserId = session.siwe.flaskUserId; + const need = await this.needService.getNeedByFlaskId(body.flaskNeedId); + + const foundSwId = need.socialWorker.flaskUserId; + const foundAuditorId = need.auditor.flaskUserId; + const foundPurchaserId = need.purchaser.flaskUserId; + const foundPayments = need.verifiedPayments.length > 0; + + if ( + !foundSwId || + !foundPayments || + !foundAuditorId || + !foundPurchaserId + ) { + throw new WalletExceptionFilter( + 400, + 'At least one of the roles are missing here!', + ); + } + if (!need) { + throw new NotFoundException(404, 'Need was not found!'); + } + + if (body.sayRoles) { + if ( + !need.signatures[0] && + body.sayRoles.includes(SAYPlatformRoles.SOCIAL_WORKER) + ) { + this.logger.log('This is a social worker signature creation'); + if (foundSwId !== Number(sessionFlaskUserId)) { + throw new WalletExceptionFilter( + 403, + 'Could not match the social worker!', + ); + } + + console.log( + '\x1b[36m%s\x1b[0m', + 'Creating Social Worker Signature ...', + ); + const initialSignature = await this.walletService.createSignature( + signature, + need.flaskId, + SAYPlatformRoles.SOCIAL_WORKER, + sessionFlaskUserId, + body.verifyVoucherAddress, + session.siwe.address, + ); + + const swDetails = { + firstName: need.socialWorker.firstName, + lastName: need.socialWorker.lastName, + avatarUrl: need.socialWorker.avatarUrl, + flaskUserId: need.socialWorker.contributions.find( + (c) => c.flaskUserId == need.socialWorker.flaskUserId, + ).flaskUserId, + birthDate: + need.socialWorker.birthDate && + new Date(need.socialWorker.birthDate), + panelRole: need.socialWorker.contributions.find( + (c) => c.flaskUserId == need.socialWorker.flaskUserId, + ).panelRole, + need, + userName: need.socialWorker.userName, + }; + await this.userService.updateContributor( + need.socialWorker.id, + swDetails, + ); + + return { signature: initialSignature }; + } else if ( + !need.signatures && + !body.sayRoles.includes(SAYPlatformRoles.SOCIAL_WORKER) + ) { + throw new WalletExceptionFilter( + 403, + 'This need is not signed by social worker!', + ); + } else { + const initialSignature = need.signatures.find( + (s) => + s.flaskUserId === + need.socialWorker.contributions.find( + (c) => c.flaskUserId == need.socialWorker.flaskUserId, + ).flaskUserId, + ); + if (initialSignature && initialSignature.flaskUserId === foundSwId) { + if (body.sayRoles.includes(SAYPlatformRoles.FAMILY)) { + this.logger.log('This is the family signature creation'); + const foundFamily = need.verifiedPayments.find( + (p) => p.flaskUserId === Number(sessionFlaskUserId), + ); + + const foundFamilyId = foundFamily + ? foundFamily.flaskUserId + : null; + + if (foundFamilyId !== Number(sessionFlaskUserId)) { + throw new WalletExceptionFilter( + 403, + 'Could not match the family!', + ); + } + + console.log( + '\x1b[36m%s\x1b[0m', + 'Creating Virtual Family Signatures ...', + ); + const familySignature = await this.walletService.createSignature( + signature, + body.flaskNeedId, + SAYPlatformRoles.FAMILY, + sessionFlaskUserId, + body.verifyVoucherAddress, + session.siwe.address, + ); + return { signature: familySignature }; + } else if (body.sayRoles.includes(SAYPlatformRoles.AUDITOR)) { + this.logger.log('This is the auditor signature creation'); + const auditorSignature = need.signatures.find( + (s) => + s.flaskUserId === + need.auditor.contributions.find( + (c) => c.flaskUserId == need.auditor.flaskUserId, + ).flaskUserId, + ); + + if (!auditorSignature) { + const familySignature = need.signatures.find((s) => + need.verifiedPayments.find( + (p) => p.familyMember.flaskUserId == s.flaskUserId, + ), + ); + if ( + foundAuditorId !== Number(sessionFlaskUserId) || + !familySignature + ) { + throw new WalletExceptionFilter( + 403, + 'We need the family signature!', + ); + } + console.log('\x1b[36m%s\x1b[0m', 'Uploading to IPFS ...'); + const ipfs = await this.ipfsService.handleIpfs(signature, need); + + console.log( + '\x1b[36m%s\x1b[0m', + 'Creating Auditor Signature ...', + ); + const auditorSignature = + await this.walletService.createSignature( + signature, + need.flaskId, + SAYPlatformRoles.AUDITOR, + sessionFlaskUserId, + body.verifyVoucherAddress, + session.siwe.address, + ); + + const auditorDetails = { + firstName: need.auditor.firstName, + lastName: need.auditor.lastName, + avatarUrl: need.auditor.avatarUrl, + flaskUserId: need.auditor.contributions.find( + (c) => c.flaskUserId == need.auditor.flaskUserId, + ).flaskUserId, + birthDate: + need.auditor.birthDate && new Date(need.auditor.birthDate), + panelRole: need.auditor.contributions.find( + (c) => c.flaskUserId == need.auditor.flaskUserId, + ).panelRole, + need, + userName: need.auditor.userName, + }; + await this.userService.updateContributor( + need.auditor.id, + auditorDetails, + ); + return { ipfs, signature: auditorSignature }; + } else if (auditorSignature) { + throw new WalletExceptionFilter( + 403, + 'Auditor has already signed!', + ); + } + } else if (body.sayRoles.includes(SAYPlatformRoles.PURCHASER)) { + this.logger.log('This is the purchaser signature creation'); + const familySignature = need.signatures.find((s) => + need.verifiedPayments.find( + (p) => p.familyMember.flaskUserId == s.flaskUserId, + ), + ); + const auditorSignature = need.signatures.find( + (s) => + s.flaskUserId === + need.auditor.contributions.find( + (c) => c.flaskUserId == need.auditor.flaskUserId, + ).flaskUserId, + ); + const purchaserSignature = need.signatures.find( + (s) => + s.flaskUserId === + need.purchaser.contributions.find( + (c) => c.flaskUserId == need.purchaser.flaskUserId, + ).flaskUserId, + ); + + if (!purchaserSignature) { + if ( + foundPurchaserId !== Number(sessionFlaskUserId) || + !auditorSignature || + !familySignature + ) { + throw new WalletExceptionFilter( + 403, + 'Could not match one of signers!', + ); + } + + console.log( + '\x1b[36m%s\x1b[0m', + 'Creating Purchaser Signature ...', + ); + const purchaserSignature = + await this.walletService.createSignature( + signature, + need.flaskId, + SAYPlatformRoles.PURCHASER, + sessionFlaskUserId, + body.verifyVoucherAddress, + session.siwe.address, + ); + + const purchaserDetails = { + firstName: need.purchaser.firstName, + lastName: need.purchaser.lastName, + avatarUrl: need.purchaser.avatarUrl, + flaskUserId: need.purchaser.contributions.find( + (c) => c.flaskUserId == need.purchaser.flaskUserId, + ).flaskUserId, + birthDate: + need.purchaser.birthDate && + new Date(need.purchaser.birthDate), + panelRole: need.purchaser.contributions.find( + (c) => c.flaskUserId == need.purchaser.flaskUserId, + ).panelRole, + need, + userName: need.purchaser.userName, + }; + await this.userService.updateContributor( + need.purchaser.id, + purchaserDetails, + ); + return { signature: purchaserSignature }; + } else if (purchaserSignature) { + throw new WalletExceptionFilter( + 403, + 'Purchaser has already signed!', + ); + } + } else { + throw new WalletExceptionFilter( + 403, + 'could not find your role in this need !', + ); + } + } else { + throw new WalletExceptionFilter( + 403, + 'could not find initial signature !', + ); + } + } + } else { + throw new WalletExceptionFilter(403, 'Bad request!'); + } + } catch (e) { + const theSignature = await this.walletService.getSignature(signature); + if (theSignature) { + await this.walletService.deleteOne(theSignature); + } + throw new WalletExceptionFilter(e.status, e.message); + } + } + + @Post(`signature/verify`) + @UsePipes(new ValidationPipe()) // validation for dto files + async verifySignature( + @Body(ValidateSignaturePipe) body: VerifySignatureDto, + @Session() session: Record, + ) { + if (body.chainId !== eEthereumNetworkChainId.mainnet) { + throw new ServerError('Please connect to Ethereum Mainnet!', 500); + } + if (!session.siwe) { + throw new WalletExceptionFilter(401, 'You have to first sign_in'); + } + + let transaction: SwSignatureResult; + try { + const need = await this.needService.getNeedByFlaskId(body.flaskNeedId); + + console.log('\x1b[36m%s\x1b[0m', 'Preparing signature data ...\n'); + + transaction = await this.walletService.prepareSignature( + session.siwe.address, + need, + need.socialWorker.flaskUserId, + ); + return transaction; + } catch (e) { + throw new ServerError(e.message, e.status); + } + } + + @Get(`signature/:signature`) + @ApiOperation({ description: 'Get a signature' }) + async getSignature( + @Req() req: Request, + @Session() session: Record, + @Param('signature') signature: string, + ) { + const dappFlaskUserId = req.headers['dappFlaskUserId']; + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + + if (!session.siwe) { + throw new WalletExceptionFilter(401, 'You have to first sign_in'); + } + const signatureEntity = await this.walletService.getSignature(signature); + // dapp + if ( + signatureEntity && + signatureEntity.role === SAYPlatformRoles.FAMILY && + dappFlaskUserId !== signatureEntity.flaskUserId && + !isAuthenticated(panelFlaskUserId, FlaskUserTypesEnum.FAMILY) + ) { + throw new ObjectNotFound('Not Your signature'); + } + // panel + if ( + signatureEntity && + signatureEntity.role !== convertFlaskToSayRoles(panelFlaskTypeId) && + panelFlaskUserId !== signatureEntity.flaskUserId && + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) + ) { + throw new ObjectNotFound('Not Your signature'); + } + + return signatureEntity; + } + + @Get(`all/signatures`) + @ApiOperation({ description: 'Get all signatures' }) + async getSignatures(@Req() req: Request) { + const panelFlaskUserId = Number(req.headers['panelFlaskUserId']); + const panelFlaskTypeId = Number(req.headers['panelFlaskTypeId']); + + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + !( + panelFlaskTypeId === FlaskUserTypesEnum.ADMIN || + panelFlaskTypeId === FlaskUserTypesEnum.SUPER_ADMIN + ) || + !panelFlaskUserId + ) { + throw new WalletExceptionFilter(401, 'You are not the admin'); + } + try { + const X_LIMIT = parseInt(req.headers['x-limit']); + const X_TAKE = parseInt(req.headers['x-take']); + const limit = X_LIMIT > 100 ? 100 : X_LIMIT; + const page = X_TAKE * limit; + + const allSignatures = await this.walletService.getSignatures({ + skip: page, + take: limit, + }); + return { + signatures: allSignatures[0], + total: allSignatures[1], + }; + } catch (e) { + throw new ServerError(e.message); + } + } + + @Get(`signatures/:flaskUserId`) + @ApiOperation({ description: 'Get contributors signatures' }) + async getContributorSignatures( + @Req() req: Request, + @Param('flaskUserId') flaskUserId: number, + ) { + const panelFlaskUserId = Number(req.headers['panelFlaskUserId']); + if (panelFlaskUserId !== Number(flaskUserId)) { + throw new WalletExceptionFilter(401, 'You only can get your signatures'); + } + + const X_LIMIT = parseInt(req.headers['x-limit']); + const X_TAKE = parseInt(req.headers['x-take']); + const limit = X_LIMIT > 100 ? 100 : X_LIMIT; + const page = X_TAKE * limit; + + const userSignatures = await this.walletService.getContributorSignatures( + { + skip: page || 0, + take: limit || 10, + }, + panelFlaskUserId, + ); + + return { + signatures: userSignatures[0], + total: userSignatures[1], + }; + } + + @Delete(`signature/:signatureHash`) + @ApiOperation({ description: 'Delete a signatures' }) + async deleteSignature( + @Req() req: Request, + @Param('signatureHash') signatureHash: string, + ) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if ( + !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || + panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN || + panelFlaskUserId !== SUPER_ADMIN_ID_PANEL + ) { + throw new WalletExceptionFilter(403, 'You Are not the Super admin'); + } + const theSignature = await this.walletService.getSignature(signatureHash); + await this.walletService.deleteOne(theSignature.id); + return theSignature.id; + } +} diff --git a/src/features/wallet/wallet.module.ts b/src/features/wallet/wallet.module.ts new file mode 100644 index 0000000000..8b7b7977aa --- /dev/null +++ b/src/features/wallet/wallet.module.ts @@ -0,0 +1,128 @@ +import { MiddlewareConsumer, Module } from '@nestjs/common'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { WalletController } from './wallet.controller'; +import { SignatureEntity } from '../../entities/signature.entity'; +import { WalletService } from './wallet.service'; +import { NeedService } from '../need/need.service'; +import { UserService } from '../user/user.service'; +import { ChildrenService } from '../children/children.service'; +import { NeedEntity } from '../../entities/need.entity'; +import { ChildrenEntity } from '../../entities/children.entity'; +import { AllUserEntity } from '../../entities/user.entity'; +import { PaymentService } from '../payment/payment.service'; +import { PaymentEntity } from '../../entities/payment.entity'; +import { WalletMiddleware } from './middlewares/wallet.middleware'; +import { EthersModule } from 'nestjs-ethers'; +import { NgoService } from '../ngo/ngo.service'; +import { NgoArrivalEntity, NgoEntity } from 'src/entities/ngo.entity'; +import { SyncService } from '../sync/sync.service'; +import { ReceiptService } from '../receipt/receipt.service'; +import { ReceiptEntity } from 'src/entities/receipt.entity'; +import { StatusEntity } from 'src/entities/status.entity'; +import { StatusService } from '../status/status.service'; +import { LocationEntity } from 'src/entities/location.entity'; +import { SocialWorker, User } from 'src/entities/flaskEntities/user.entity'; +import { HttpModule } from '@nestjs/axios'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { IpfsService } from '../ipfs/ipfs.service'; +import { IpfsEntity } from 'src/entities/ipfs.entity'; +import { NGO } from 'src/entities/flaskEntities/ngo.entity'; +import { LocationService } from '../location/location.service'; +import { Cities } from 'src/entities/flaskEntities/cities.entity'; +import { ContributorEntity } from 'src/entities/contributor.entity'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; +import { Child } from 'src/entities/flaskEntities/child.entity'; +import { Payment } from 'src/entities/flaskEntities/payment.entity'; +import { ProviderService } from '../provider/provider.service'; +import { ProviderEntity } from 'src/entities/provider.entity'; +import { ProviderJoinNeedEntity } from 'src/entities/provider.Join.need..entity'; +import { DownloadService } from '../download/download.service'; +import { UserFamily } from 'src/entities/flaskEntities/userFamily.entity'; +import { Family } from 'src/entities/flaskEntities/family.entity'; +import { TicketService } from '../ticket/ticket.service'; +import { TicketEntity } from 'src/entities/ticket.entity'; +import { TicketContentEntity } from 'src/entities/ticketContent.entity'; +import { TicketViewEntity } from 'src/entities/ticketView.entity'; +import { VariableEntity } from 'src/entities/variable.entity'; +import { ChildrenPreRegisterEntity } from 'src/entities/childrenPreRegister.entity'; +import { Countries } from 'src/entities/flaskEntities/countries.entity'; +import { Receipt } from 'src/entities/flaskEntities/receipt.entity'; +import { NeedReceipt } from 'src/entities/flaskEntities/needReceipt.entity'; + +@Module({ + imports: [ + HttpModule.register({ + timeout: 5000, + maxRedirects: 5, + }), + EthersModule.forRoot({ + network: 1, + infura: process.env.INFURA_KEY, + cloudflare: false, + // * Optional parameter the number of backends that must agree. default: 2 for mainnet, 1 for testnets) + quorum: 2, + useDefaultProvider: process.env.INFURA_KEY ? false : true, + }), + TypeOrmModule.forFeature( + [ + SocialWorker, + Need, + NGO, + Cities, + Child, + Payment, + UserFamily, + Family, + User, + Countries, + Receipt, + NeedReceipt, + ], + 'flaskPostgres', + ), + TypeOrmModule.forFeature([ + PaymentEntity, + SignatureEntity, + VariableEntity, + NeedEntity, + ChildrenEntity, + ContributorEntity, + AllUserEntity, + NgoEntity, + NgoArrivalEntity, + ReceiptEntity, + StatusEntity, + LocationEntity, + IpfsEntity, + EthereumAccountEntity, + ProviderJoinNeedEntity, + ProviderEntity, + TicketEntity, + TicketContentEntity, + TicketViewEntity, + ChildrenPreRegisterEntity, + ]), + ], + controllers: [WalletController], + providers: [ + LocationService, + WalletService, + NeedService, + PaymentService, + UserService, + ChildrenService, + NgoService, + SyncService, + ReceiptService, + StatusService, + IpfsService, + ProviderService, + DownloadService, + TicketService, + ], +}) +export class WalletModule { + configure(consumer: MiddlewareConsumer) { + consumer.apply(WalletMiddleware).forRoutes('wallet'); + } +} diff --git a/src/features/wallet/wallet.service.ts b/src/features/wallet/wallet.service.ts new file mode 100644 index 0000000000..3b40e9d4bd --- /dev/null +++ b/src/features/wallet/wallet.service.ts @@ -0,0 +1,323 @@ +import { Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { SignatureEntity } from '../../entities/signature.entity'; +import { FindManyOptions, Repository } from 'typeorm'; +import { + Domain, + SwSignatureResult, + NeedTypeEnum, + CategoryDefinitionPersianEnum, + CategoryEnum, + SwProductVoucher, + SwServiceVoucher, + SAYPlatformRoles, + serviceSignatureTypes, + productSignatureTypes, +} from '../../types/interfaces/interface'; +import { NeedService } from '../need/need.service'; +import VerifyVoucherContract from '../../contracts/needModule/VerifyVoucher.sol/VerifyVoucher.json'; +import { mainnet } from '../../contracts/network-settings.json'; +import { ChildrenEntity } from '../../entities/children.entity'; +import { + EthersContract, + InjectSignerProvider, + EthersSigner, +} from 'nestjs-ethers'; +import { NeedEntity } from 'src/entities/need.entity'; +import { daysDifference, getSAYRolePersian } from 'src/utils/helpers'; +import { UserService } from '../user/user.service'; +import { from, Observable } from 'rxjs'; +import { WalletExceptionFilter } from 'src/filters/wallet-exception.filter'; +import { + fetchProductMessageContent, + fetchServiceMessageContent, +} from 'src/utils/signatures'; + +@Injectable() +export class WalletService { + constructor( + @InjectRepository(SignatureEntity) + private signatureRepository: Repository, + private needService: NeedService, + private userService: UserService, + @InjectSignerProvider() + private readonly ethersSigner: EthersSigner, + private readonly ethersContract: EthersContract, + ) {} + + async getSignature(signatureHash: string): Promise { + return await this.signatureRepository.findOne({ + where: { + hash: signatureHash, + user: { + wallets: true, + }, + need: { + variables: true, + }, + }, + }); + } + + async getNeedSignatures(flaskNeedId: number): Promise { + return await this.signatureRepository.find({ + where: { + flaskNeedId, + }, + relations: { + need: { + socialWorker: { + wallets: true, + }, + purchaser: { + wallets: true, + }, + auditor: { + wallets: true, + }, + }, + }, + order: { createdAt: 'DESC' }, + }); + } + async getContributorSignatures( + options: FindManyOptions, + flaskUserId: number, + ): Promise<[SignatureEntity[], number]> { + return await this.signatureRepository.findAndCount({ + where: { + flaskUserId, + role: SAYPlatformRoles.SOCIAL_WORKER, + }, + relations: { + need: { + socialWorker: { + wallets: true, + }, + purchaser: { + wallets: true, + }, + auditor: { + wallets: true, + }, + }, + }, + order: { createdAt: 'DESC' }, + take: options.take, + skip: options.skip, + }); + } + + async getSignatures( + options: FindManyOptions, + ): Promise<[SignatureEntity[], number]> { + return await this.signatureRepository.findAndCount({ + relations: { + need: { + verifiedPayments: true, + statusUpdates: true, + receipts: true, + socialWorker: { + wallets: true, + }, + purchaser: { + wallets: true, + }, + auditor: { + wallets: true, + }, + }, + }, + where: { + role: SAYPlatformRoles.SOCIAL_WORKER, + }, + order: { createdAt: 'DESC' }, + take: options.take, + skip: options.skip, + }); + } + + async getSignaturesFlaskNeedId() { + return await this.signatureRepository.find({ + select: { + id: true, + flaskNeedId: true, + }, + }); + } + + async designDomain( + verifyContractAddress: string, + signerAddress: string, + ): Promise { + const SIGNING_DOMAIN_NAME = 'SAY-DAO'; + const SIGNING_DOMAIN_VERSION = '1'; + + // https://docs.ethers.org/v5/api/signer/#VoidSigner + const wallet = this.ethersSigner.createVoidSigner(signerAddress); + + const verifyingContract = this.ethersContract.create( + verifyContractAddress, + VerifyVoucherContract.abi, + wallet, + ); + console.log(`Getting chain id...`); + + // const tx = await verifyingContract.deployed() + const chainId = await verifyingContract.getChainID(); + console.log(`chainId from signature service: ${chainId}`); + + return { + name: SIGNING_DOMAIN_NAME, + version: SIGNING_DOMAIN_VERSION, + verifyingContract: verifyingContract.address, + chainId: chainId.toNumber(), + }; + } + + async prepareSignature( + signerAddress: string, + need: NeedEntity, + flaskUserId: number, + ): Promise { + const needRoles = { + socialWorker: need.socialWorker.flaskUserId, + auditor: need.auditor.flaskUserId, + purchaser: need.purchaser.flaskUserId, + familyMembers: need.verifiedPayments.map((p) => p.flaskUserId), + }; + let role: string; + const allRoles = []; + + // could have multiple roles e.g. [Auditor, SocialWorker] + if (needRoles.socialWorker === flaskUserId) { + role = getSAYRolePersian(SAYPlatformRoles.SOCIAL_WORKER).toString(); + allRoles.push(SAYPlatformRoles.SOCIAL_WORKER); + } + if (needRoles.auditor === flaskUserId) { + role = getSAYRolePersian(SAYPlatformRoles.AUDITOR).toString(); + allRoles.push(SAYPlatformRoles.AUDITOR); + } + if (needRoles.purchaser === flaskUserId) { + role = getSAYRolePersian(SAYPlatformRoles.PURCHASER).toString(); + allRoles.push(SAYPlatformRoles.PURCHASER); + } + if (needRoles.familyMembers.includes(flaskUserId)) { + role = getSAYRolePersian(SAYPlatformRoles.FAMILY).toString(); + allRoles.push(SAYPlatformRoles.FAMILY); + } + + if (!role) { + throw new WalletExceptionFilter( + 403, + 'could not find your role in this need!', + ); + } + let serviceResult: { + serviceVoucher: SwServiceVoucher; + serviceTypes: serviceSignatureTypes; + }; + let productResult: { + productVoucher: SwProductVoucher; + productTypes: productSignatureTypes; + }; + const swSignature = + need.signatures && + need.signatures.find( + (s) => s.flaskUserId === need.socialWorker.flaskUserId, + ); + + let signatureVersion = 'v3'; + if (swSignature) { + // created before 2023-09-27 + if (daysDifference(swSignature.createdAt, new Date('2023-09-27')) >= 0) { + signatureVersion = 'v1'; + } + // created b/w 2023-09-27 and 2023-10-05 + if ( + daysDifference(swSignature.createdAt, new Date('2023-09-27')) < 0 && + daysDifference(swSignature.createdAt, new Date('2023-10-05')) >= 0 + ) { + signatureVersion = 'v2'; + } + // created after 2023-10-05 + if (daysDifference(swSignature.createdAt, new Date('2023-10-05')) < 0) { + signatureVersion = 'v3'; + } + } + console.log(signatureVersion); + + // define your data types + if (need.type === NeedTypeEnum.PRODUCT) { + // content of the message was changed, we need this to verify older signatures + productResult = fetchProductMessageContent( + need, + signerAddress, + role, + signatureVersion, + ); + } + if (need.type === NeedTypeEnum.SERVICE) { + // content of the message was changed, we need this to verify older signatures + serviceResult = fetchServiceMessageContent( + need, + signerAddress, + role, + signatureVersion, + ); + } + + console.log('\x1b[36m%s\x1b[0m', 'Preparing domain for signature ...\n'); + let domain: Domain; + try { + domain = await this.designDomain( + mainnet.verifyVoucherAddress, + signerAddress, + ); + } catch (e) { + throw new WalletExceptionFilter(e.status, e.message); + } + console.log('\x1b[36m%s\x1b[0m', 'Prepared the domain! ...\n'); + + return { + message: productResult.productVoucher || serviceResult.serviceVoucher, + types: + need.type === NeedTypeEnum.PRODUCT + ? productResult.productTypes + : serviceResult.serviceTypes, + domain, + sayRoles: allRoles, + }; + } + + async createSignature( + signature: string, + flaskNeedId: number, + role: SAYPlatformRoles, + flaskUserId: number, + verifyingContract: string, + signerAddress: string, + ): Promise { + const user = await this.userService.getUserByFlaskId(flaskUserId); + let theNeed: NeedEntity; + try { + theNeed = await this.needService.getNeedByFlaskId(flaskNeedId); + } catch (e) {} + const theSignature = this.signatureRepository.create({ + hash: signature, + role, + flaskUserId, + flaskNeedId, + verifyingContract, + signerAddress, + }); + theSignature.user = user; + theSignature.need = theNeed; + + return await this.signatureRepository.save(theSignature); + } + + async deleteOne(signatureId): Promise> { + return from(this.signatureRepository.delete(signatureId)); + } +} diff --git a/src/filters/server-exception.filter.ts b/src/filters/server-exception.filter.ts index 2313840cb8..072f5726b5 100644 --- a/src/filters/server-exception.filter.ts +++ b/src/filters/server-exception.filter.ts @@ -1,5 +1,4 @@ -import { Catch, HttpStatus, HttpException, ArgumentsHost, ExceptionFilter } from '@nestjs/common'; -import { Request, Response } from 'express'; +import { Catch, HttpStatus, HttpException, } from '@nestjs/common'; @Catch(HttpException) export class ServerError extends HttpException { diff --git a/src/filters/socket-exception.filter.ts b/src/filters/socket-exception.filter.ts new file mode 100644 index 0000000000..b9db9bee22 --- /dev/null +++ b/src/filters/socket-exception.filter.ts @@ -0,0 +1,11 @@ +import { Catch, BadRequestException, ArgumentsHost } from '@nestjs/common'; +import { BaseWsExceptionFilter, WsException } from '@nestjs/websockets'; + +@Catch(BadRequestException) +export class BadRequestTransformationFilter extends BaseWsExceptionFilter { + catch(exception: BadRequestException, host: ArgumentsHost) { + const properError = new WsException(exception.getResponse()); + console.log(properError) + super.catch(properError, host); + } +} \ No newline at end of file diff --git a/src/filters/wallet-exception.filter.ts b/src/filters/wallet-exception.filter.ts new file mode 100644 index 0000000000..7122a8f0c7 --- /dev/null +++ b/src/filters/wallet-exception.filter.ts @@ -0,0 +1,8 @@ +import { Catch, HttpException, HttpStatus } from '@nestjs/common'; + +@Catch(HttpException) +export class WalletExceptionFilter extends HttpException { + constructor(status: HttpStatus, msg: string) { + super(msg, status || HttpStatus.BAD_REQUEST); + } +} diff --git a/src/generated-sources/openapi/.swagger-codegen/VERSION b/src/generated-sources/openapi/.swagger-codegen/VERSION index 5ccbb5bb76..96ab4a5a85 100644 --- a/src/generated-sources/openapi/.swagger-codegen/VERSION +++ b/src/generated-sources/openapi/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.29 \ No newline at end of file +2.4.30 \ No newline at end of file diff --git a/src/generated-sources/openapi/api.ts b/src/generated-sources/openapi/api.ts index 59af4a2a09..d03bbd277b 100644 --- a/src/generated-sources/openapi/api.ts +++ b/src/generated-sources/openapi/api.ts @@ -12,22 +12,21 @@ * Do not edit the class manually. */ +import * as url from 'url'; +import portableFetch from 'portable-fetch'; +import { Configuration } from './configuration'; -import * as url from "url"; -import portableFetch from "portable-fetch"; -import { Configuration } from "./configuration"; - -const BASE_PATH = "https://api.sayapp.company/".replace(/\/+$/, ""); +const BASE_PATH = 'https://api.sayapp.company/'.replace(/\/+$/, ''); /** * * @export */ export const COLLECTION_FORMATS = { - csv: ",", - ssv: " ", - tsv: "\t", - pipes: "|", + csv: ',', + ssv: ' ', + tsv: '\t', + pipes: '|', }; /** @@ -36,7 +35,7 @@ export const COLLECTION_FORMATS = { * @interface FetchAPI */ export interface FetchAPI { - (url: string, init?: any): Promise; + (url: string, init?: any): Promise; } /** @@ -45,8 +44,8 @@ export interface FetchAPI { * @interface FetchArgs */ export interface FetchArgs { - url: string; - options: any; + url: string; + options: any; } /** @@ -55,15 +54,19 @@ export interface FetchArgs { * @class BaseAPI */ export class BaseAPI { - protected configuration: Configuration; - - constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) { - if (configuration) { - this.configuration = configuration; - this.basePath = configuration.basePath || this.basePath; - } + protected configuration: Configuration; + + constructor( + configuration?: Configuration, + protected basePath: string = BASE_PATH, + protected fetch: FetchAPI = portableFetch, + ) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; } -}; + } +} /** * @@ -72,10 +75,10 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" - constructor(public field: string, msg?: string) { - super(msg); - } + name: 'RequiredError'; + constructor(public field: string, msg?: string) { + super(msg); + } } /** @@ -84,12 +87,12 @@ export class RequiredError extends Error { * @interface Body */ export interface Body { - /** - * - * @type {Array} - * @memberof Body - */ - needIds?: Array; + /** + * + * @type {Array} + * @memberof Body + */ + needIds?: Array; } /** @@ -98,42 +101,42 @@ export interface Body { * @interface Cart */ export interface Cart { - /** - * - * @type {number} - * @memberof Cart - */ - id?: number; - /** - * - * @type {number} - * @memberof Cart - */ - userId?: number; - /** - * - * @type {Date} - * @memberof Cart - */ - created?: Date; - /** - * - * @type {Date} - * @memberof Cart - */ - updated?: Date; - /** - * - * @type {number} - * @memberof Cart - */ - totalAmount?: number; - /** - * - * @type {Array} - * @memberof Cart - */ - needs?: Array; + /** + * + * @type {number} + * @memberof Cart + */ + id?: number; + /** + * + * @type {number} + * @memberof Cart + */ + userId?: number; + /** + * + * @type {Date} + * @memberof Cart + */ + created?: Date; + /** + * + * @type {Date} + * @memberof Cart + */ + updated?: Date; + /** + * + * @type {number} + * @memberof Cart + */ + totalAmount?: number; + /** + * + * @type {Array} + * @memberof Cart + */ + needs?: Array; } /** @@ -142,60 +145,60 @@ export interface Cart { * @interface CartNeeds */ export interface CartNeeds { - /** - * - * @type {number} - * @memberof CartNeeds - */ - id?: number; - /** - * - * @type {number} - * @memberof CartNeeds - */ - needId?: number; - /** - * - * @type {string} - * @memberof CartNeeds - */ - name?: string; - /** - * - * @type {number} - * @memberof CartNeeds - */ - amount?: number; - /** - * - * @type {string} - * @memberof CartNeeds - */ - title?: string; - /** - * - * @type {number} - * @memberof CartNeeds - */ - cost?: number; - /** - * - * @type {number} - * @memberof CartNeeds - */ - paid?: number; - /** - * - * @type {Date} - * @memberof CartNeeds - */ - created?: Date; - /** - * - * @type {Date} - * @memberof CartNeeds - */ - deleted?: Date; + /** + * + * @type {number} + * @memberof CartNeeds + */ + id?: number; + /** + * + * @type {number} + * @memberof CartNeeds + */ + needId?: number; + /** + * + * @type {string} + * @memberof CartNeeds + */ + name?: string; + /** + * + * @type {number} + * @memberof CartNeeds + */ + amount?: number; + /** + * + * @type {string} + * @memberof CartNeeds + */ + title?: string; + /** + * + * @type {number} + * @memberof CartNeeds + */ + cost?: number; + /** + * + * @type {number} + * @memberof CartNeeds + */ + paid?: number; + /** + * + * @type {Date} + * @memberof CartNeeds + */ + created?: Date; + /** + * + * @type {Date} + * @memberof CartNeeds + */ + deleted?: Date; } /** @@ -204,108 +207,108 @@ export interface CartNeeds { * @interface CartPayment */ export interface CartPayment { - /** - * - * @type {number} - * @memberof CartPayment - */ - id?: number; - /** - * - * @type {number} - * @memberof CartPayment - */ - cartId?: number; - /** - * - * @type {string} - * @memberof CartPayment - */ - orderId?: string; - /** - * - * @type {Date} - * @memberof CartPayment - */ - created?: Date; - /** - * - * @type {Date} - * @memberof CartPayment - */ - updated?: Date; - /** - * - * @type {Date} - * @memberof CartPayment - */ - verified?: Date; - /** - * - * @type {Date} - * @memberof CartPayment - */ - transactionDate?: Date; - /** - * - * @type {number} - * @memberof CartPayment - */ - bankAmount?: number; - /** - * - * @type {number} - * @memberof CartPayment - */ - creditAmount?: number; - /** - * - * @type {number} - * @memberof CartPayment - */ - donationAmount?: number; - /** - * - * @type {number} - * @memberof CartPayment - */ - needsAmount?: number; - /** - * - * @type {number} - * @memberof CartPayment - */ - totalAmount?: number; - /** - * - * @type {string} - * @memberof CartPayment - */ - gatewayPaymentId?: string; - /** - * - * @type {string} - * @memberof CartPayment - */ - gatewayTrackId?: string; - /** - * - * @type {string} - * @memberof CartPayment - */ - link?: string; - /** - * - * @type {string} - * @memberof CartPayment - */ - cardNo?: string; - /** - * - * @type {string} - * @memberof CartPayment - */ - hashedCardNo?: string; + /** + * + * @type {number} + * @memberof CartPayment + */ + id?: number; + /** + * + * @type {number} + * @memberof CartPayment + */ + cartId?: number; + /** + * + * @type {string} + * @memberof CartPayment + */ + orderId?: string; + /** + * + * @type {Date} + * @memberof CartPayment + */ + created?: Date; + /** + * + * @type {Date} + * @memberof CartPayment + */ + updated?: Date; + /** + * + * @type {Date} + * @memberof CartPayment + */ + verified?: Date; + /** + * + * @type {Date} + * @memberof CartPayment + */ + transactionDate?: Date; + /** + * + * @type {number} + * @memberof CartPayment + */ + bankAmount?: number; + /** + * + * @type {number} + * @memberof CartPayment + */ + creditAmount?: number; + /** + * + * @type {number} + * @memberof CartPayment + */ + donationAmount?: number; + /** + * + * @type {number} + * @memberof CartPayment + */ + needsAmount?: number; + /** + * + * @type {number} + * @memberof CartPayment + */ + totalAmount?: number; + /** + * + * @type {string} + * @memberof CartPayment + */ + gatewayPaymentId?: string; + /** + * + * @type {string} + * @memberof CartPayment + */ + gatewayTrackId?: string; + /** + * + * @type {string} + * @memberof CartPayment + */ + link?: string; + /** + * + * @type {string} + * @memberof CartPayment + */ + cardNo?: string; + /** + * + * @type {string} + * @memberof CartPayment + */ + hashedCardNo?: string; } /** @@ -314,12 +317,12 @@ export interface CartPayment { * @interface CartPaymentSuccessful */ export interface CartPaymentSuccessful { - /** - * - * @type {string} - * @memberof CartPaymentSuccessful - */ - response?: string; + /** + * + * @type {string} + * @memberof CartPaymentSuccessful + */ + response?: string; } /** @@ -327,8 +330,7 @@ export interface CartPaymentSuccessful { * @export * @interface ChangeCost */ -export interface ChangeCost { -} +export interface ChangeCost {} /** * @@ -336,216 +338,216 @@ export interface ChangeCost { * @interface ChildModel */ export interface ChildModel { - /** - * the child's id - * @type {number} - * @memberof ChildModel - */ - id?: number; - /** - * the child's real first name - * @type {string} - * @memberof ChildModel - */ - firstName?: string; - /** - * the child's real last name - * @type {string} - * @memberof ChildModel - */ - lastName?: string; - /** - * the child's virtual name - * @type {string} - * @memberof ChildModel - */ - sayName?: string; - /** - * the child's phone number or a contact way - * @type {string} - * @memberof ChildModel - */ - phoneNumber?: string; - /** - * the child's nationality, the international country codes - * @type {number} - * @memberof ChildModel - */ - nationality?: number; - /** - * the child's country, the international country codes - * @type {number} - * @memberof ChildModel - */ - country?: number; - /** - * the child's city, the international city codes - * @type {number} - * @memberof ChildModel - */ - city?: number; - /** - * the child's avatar image path url - * @type {string} - * @memberof ChildModel - */ - avatarUrl?: string; - /** - * determines the child's gender, true for male and false for female - * @type {boolean} - * @memberof ChildModel - */ - gender?: boolean; - /** - * a text that describes the child - * @type {string} - * @memberof ChildModel - */ - bio?: string; - /** - * summary of bio - * @type {string} - * @memberof ChildModel - */ - bioSummary?: string; - /** - * the child's voice file path url - * @type {string} - * @memberof ChildModel - */ - voiceUrl?: string; - /** - * the child's birth place, the international city codes - * @type {number} - * @memberof ChildModel - */ - birthPlace?: number; - /** - * the child's birth date - * @type {string} - * @memberof ChildModel - */ - birthDate?: string; - /** - * the child's address - * @type {string} - * @memberof ChildModel - */ - address?: string; - /** - * describes how does the child lives - * @type {number} - * @memberof ChildModel - */ - housingStatus?: number; - /** - * number of child's real family members - * @type {number} - * @memberof ChildModel - */ - familyCount?: number; - /** - * number of child's SAY family members - * @type {number} - * @memberof ChildModel - */ - sayFamilyCount?: number; - /** - * describes the child's education level - * @type {number} - * @memberof ChildModel - */ - education?: number; - /** - * child's state of happiness - * @type {number} - * @memberof ChildModel - */ - status?: number; - /** - * number of done needs of child - * @type {number} - * @memberof ChildModel - */ - doneNeedCount?: number; - /** - * the ngo that the child is in - * @type {number} - * @memberof ChildModel - */ - ngoId?: number; - /** - * the social worker who covers the child's needs - * @type {number} - * @memberof ChildModel - */ - socialWorkerId?: number; - /** - * total credit spent on child - * @type {number} - * @memberof ChildModel - */ - spentCredit?: number; - /** - * the date that the child has been created - * @type {string} - * @memberof ChildModel - */ - created?: string; - /** - * the last date that the child has been updated - * @type {string} - * @memberof ChildModel - */ - updated?: string; - /** - * determines if the child is confirmed or not - * @type {boolean} - * @memberof ChildModel - */ - isDeleted?: boolean; - /** - * determines if the child is confirmed or not - * @type {boolean} - * @memberof ChildModel - */ - isConfirmed?: boolean; - /** - * the panel user who confirms the child - * @type {number} - * @memberof ChildModel - */ - confirmUser?: number; - /** - * the date that the child has been confirmed - * @type {string} - * @memberof ChildModel - */ - confirmDate?: string; - /** - * a unique code generated automatically from ngo id, ngo's social workers count and social worker's children count - * @type {string} - * @memberof ChildModel - */ - generatedCode?: string; - /** - * determines if the child is migrated or not - * @type {boolean} - * @memberof ChildModel - */ - isMigrated?: boolean; - /** - * the social worker whom the child is migrated to - * @type {boolean} - * @memberof ChildModel - */ - migratedId?: boolean; - /** - * the date that the child has been migrated - * @type {boolean} - * @memberof ChildModel - */ - migrateDate?: boolean; + /** + * the child's id + * @type {number} + * @memberof ChildModel + */ + id?: number; + /** + * the child's real first name + * @type {string} + * @memberof ChildModel + */ + firstName?: string; + /** + * the child's real last name + * @type {string} + * @memberof ChildModel + */ + lastName?: string; + /** + * the child's virtual name + * @type {string} + * @memberof ChildModel + */ + sayName?: string; + /** + * the child's phone number or a contact way + * @type {string} + * @memberof ChildModel + */ + phoneNumber?: string; + /** + * the child's nationality, the international country codes + * @type {number} + * @memberof ChildModel + */ + nationality?: number; + /** + * the child's country, the international country codes + * @type {number} + * @memberof ChildModel + */ + country?: number; + /** + * the child's city, the international city codes + * @type {number} + * @memberof ChildModel + */ + city?: number; + /** + * the child's avatar image path url + * @type {string} + * @memberof ChildModel + */ + avatarUrl?: string; + /** + * determines the child's gender, true for male and false for female + * @type {boolean} + * @memberof ChildModel + */ + gender?: boolean; + /** + * a text that describes the child + * @type {string} + * @memberof ChildModel + */ + bio?: string; + /** + * summary of bio + * @type {string} + * @memberof ChildModel + */ + bioSummary?: string; + /** + * the child's voice file path url + * @type {string} + * @memberof ChildModel + */ + voiceUrl?: string; + /** + * the child's birth place, the international city codes + * @type {string} + * @memberof ChildModel + */ + birthPlace?: string; + /** + * the child's birth date + * @type {string} + * @memberof ChildModel + */ + birthDate?: string; + /** + * the child's address + * @type {string} + * @memberof ChildModel + */ + address?: string; + /** + * describes how does the child lives + * @type {number} + * @memberof ChildModel + */ + housingStatus?: number; + /** + * number of child's real family members + * @type {number} + * @memberof ChildModel + */ + familyCount?: number; + /** + * number of child's SAY family members + * @type {number} + * @memberof ChildModel + */ + sayFamilyCount?: number; + /** + * describes the child's education level + * @type {number} + * @memberof ChildModel + */ + education?: number; + /** + * child's state of happiness + * @type {number} + * @memberof ChildModel + */ + status?: number; + /** + * number of done needs of child + * @type {number} + * @memberof ChildModel + */ + doneNeedCount?: number; + /** + * the ngo that the child is in + * @type {number} + * @memberof ChildModel + */ + idNgo?: number; + /** + * the social worker who covers the child's needs + * @type {number} + * @memberof ChildModel + */ + id_social_worker?: number; + /** + * total credit spent on child + * @type {number} + * @memberof ChildModel + */ + spentCredit?: number; + /** + * the date that the child has been created + * @type {string} + * @memberof ChildModel + */ + created?: string; + /** + * the last date that the child has been updated + * @type {string} + * @memberof ChildModel + */ + updated?: string; + /** + * determines if the child is confirmed or not + * @type {boolean} + * @memberof ChildModel + */ + isDeleted?: boolean; + /** + * determines if the child is confirmed or not + * @type {boolean} + * @memberof ChildModel + */ + isConfirmed?: boolean; + /** + * the panel user who confirms the child + * @type {number} + * @memberof ChildModel + */ + confirmUser?: number; + /** + * the date that the child has been confirmed + * @type {string} + * @memberof ChildModel + */ + confirmDate?: string; + /** + * a unique code generated automatically from ngo id, ngo's social workers count and social worker's children count + * @type {string} + * @memberof ChildModel + */ + generatedCode?: string; + /** + * determines if the child is migrated or not + * @type {boolean} + * @memberof ChildModel + */ + isMigrated?: boolean; + /** + * the social worker whom the child is migrated to + * @type {number} + * @memberof ChildModel + */ + migratedId?: number; + /** + * the date that the child has been migrated + * @type {string} + * @memberof ChildModel + */ + migrateDate?: string; } /** @@ -553,8 +555,7 @@ export interface ChildModel { * @export * @interface ChildrenWithFamilyMembers */ -export interface ChildrenWithFamilyMembers extends Array { -} +export type ChildrenWithFamilyMembers = Array; /** * @@ -562,30 +563,30 @@ export interface ChildrenWithFamilyMembers extends Array} - * @memberof ChildrenWithFamilyMembersInnerFamily - */ - currentMembers?: Array; + /** + * + * @type {Array} + * @memberof ChildrenWithFamilyMembersInnerFamily + */ + currentMembers?: Array; } /** @@ -608,30 +609,30 @@ export interface ChildrenWithFamilyMembersInnerFamily { * @interface ChildrenWithFamilyMembersInnerFamilyCurrentMembers */ export interface ChildrenWithFamilyMembersInnerFamilyCurrentMembers { - /** - * - * @type {number} - * @memberof ChildrenWithFamilyMembersInnerFamilyCurrentMembers - */ - id?: number; - /** - * - * @type {string} - * @memberof ChildrenWithFamilyMembersInnerFamilyCurrentMembers - */ - username?: string; - /** - * - * @type {string} - * @memberof ChildrenWithFamilyMembersInnerFamilyCurrentMembers - */ - avatarUrl?: string; - /** - * - * @type {boolean} - * @memberof ChildrenWithFamilyMembersInnerFamilyCurrentMembers - */ - isParticipated?: boolean; + /** + * + * @type {number} + * @memberof ChildrenWithFamilyMembersInnerFamilyCurrentMembers + */ + id?: number; + /** + * + * @type {string} + * @memberof ChildrenWithFamilyMembersInnerFamilyCurrentMembers + */ + username?: string; + /** + * + * @type {string} + * @memberof ChildrenWithFamilyMembersInnerFamilyCurrentMembers + */ + avatarUrl?: string; + /** + * + * @type {boolean} + * @memberof ChildrenWithFamilyMembersInnerFamilyCurrentMembers + */ + isParticipated?: boolean; } /** @@ -640,66 +641,66 @@ export interface ChildrenWithFamilyMembersInnerFamilyCurrentMembers { * @interface CityModel */ export interface CityModel { - /** - * - * @type {number} - * @memberof CityModel - */ - id?: number; - /** - * - * @type {string} - * @memberof CityModel - */ - name?: string; - /** - * - * @type {number} - * @memberof CityModel - */ - stateId?: number; - /** - * - * @type {string} - * @memberof CityModel - */ - stateName?: string; - /** - * - * @type {string} - * @memberof CityModel - */ - stateCode?: string; - /** - * - * @type {string} - * @memberof CityModel - */ - countryCode?: string; - /** - * - * @type {number} - * @memberof CityModel - */ - countryId?: number; - /** - * - * @type {string} - * @memberof CityModel - */ - countryName?: string; - /** - * - * @type {string} - * @memberof CityModel - */ - latitude?: string; - /** - * - * @type {string} - * @memberof CityModel - */ - longitude?: string; + /** + * + * @type {number} + * @memberof CityModel + */ + id?: number; + /** + * + * @type {string} + * @memberof CityModel + */ + name?: string; + /** + * + * @type {number} + * @memberof CityModel + */ + stateId?: string; + /** + * + * @type {string} + * @memberof CityModel + */ + stateName?: string; + /** + * + * @type {string} + * @memberof CityModel + */ + stateCode?: string; + /** + * + * @type {string} + * @memberof CityModel + */ + countryCode?: string; + /** + * + * @type {number} + * @memberof CityModel + */ + countryId?: string; + /** + * + * @type {string} + * @memberof CityModel + */ + countryName?: string; + /** + * + * @type {string} + * @memberof CityModel + */ + latitude?: string; + /** + * + * @type {string} + * @memberof CityModel + */ + longitude?: string; } /** @@ -708,120 +709,120 @@ export interface CityModel { * @interface CountryModel */ export interface CountryModel { - /** - * - * @type {number} - * @memberof CountryModel - */ - id?: number; - /** - * - * @type {string} - * @memberof CountryModel - */ - name?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - iso3?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - numericCode?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - phoneCode?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - capital?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - currency?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - currencyName?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - currencySymbol?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - tld?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - _native?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - region?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - subregion?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - timezones?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - translations?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - latitude?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - longitude?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - emoji?: string; - /** - * - * @type {string} - * @memberof CountryModel - */ - emojiU?: string; + /** + * + * @type {number} + * @memberof CountryModel + */ + id?: number; + /** + * + * @type {string} + * @memberof CountryModel + */ + name?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + iso3?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + numericCode?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + phoneCode?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + capital?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + currency?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + currencyName?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + currencySymbol?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + tld?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + _native?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + region?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + subregion?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + timezones?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + translations?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + latitude?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + longitude?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + emoji?: string; + /** + * + * @type {string} + * @memberof CountryModel + */ + emojiU?: string; } /** @@ -829,8 +830,7 @@ export interface CountryModel { * @export * @interface FamilyMembers */ -export interface FamilyMembers extends Array { -} +export type FamilyMembers = Array; /** * @@ -838,36 +838,36 @@ export interface FamilyMembers extends Array { * @interface FamilyMembersInner */ export interface FamilyMembersInner { - /** - * - * @type {number} - * @memberof FamilyMembersInner - */ - role?: number; - /** - * - * @type {string} - * @memberof FamilyMembersInner - */ - username?: string; - /** - * - * @type {boolean} - * @memberof FamilyMembersInner - */ - isDeleted?: boolean; - /** - * - * @type {number} - * @memberof FamilyMembersInner - */ - memberId?: number; - /** - * - * @type {string} - * @memberof FamilyMembersInner - */ - avatarurl?: string; + /** + * + * @type {number} + * @memberof FamilyMembersInner + */ + role?: number; + /** + * + * @type {string} + * @memberof FamilyMembersInner + */ + username?: string; + /** + * + * @type {boolean} + * @memberof FamilyMembersInner + */ + isDeleted?: boolean; + /** + * + * @type {number} + * @memberof FamilyMembersInner + */ + memberId?: number; + /** + * + * @type {string} + * @memberof FamilyMembersInner + */ + avatarurl?: string; } /** @@ -876,30 +876,30 @@ export interface FamilyMembersInner { * @interface FamilyModel */ export interface FamilyModel { - /** - * the user's id - * @type {number} - * @memberof FamilyModel - */ - userId?: number; - /** - * describes user role in family - * @type {number} - * @memberof FamilyModel - */ - userRole?: number; - /** - * the child's id - * @type {number} - * @memberof FamilyModel - */ - childId?: number; - /** - * the family's id - * @type {number} - * @memberof FamilyModel - */ - familyId?: number; + /** + * the user's id + * @type {number} + * @memberof FamilyModel + */ + userId?: number; + /** + * describes user role in family + * @type {number} + * @memberof FamilyModel + */ + userRole?: number; + /** + * the child's id + * @type {number} + * @memberof FamilyModel + */ + childId?: number; + /** + * the family's id + * @type {number} + * @memberof FamilyModel + */ + familyId?: number; } /** @@ -908,12 +908,12 @@ export interface FamilyModel { * @interface InlineResponse600 */ export interface InlineResponse600 { - /** - * - * @type {Array} - * @memberof InlineResponse600 - */ - invalidNeedIds?: Array; + /** + * + * @type {Array} + * @memberof InlineResponse600 + */ + invalidNeedIds?: Array; } /** @@ -922,54 +922,54 @@ export interface InlineResponse600 { * @interface InvitationV3 */ export interface InvitationV3 { - /** - * - * @type {number} - * @memberof InvitationV3 - */ - role?: number; - /** - * - * @type {number} - * @memberof InvitationV3 - */ - inviterId?: number; - /** - * - * @type {number} - * @memberof InvitationV3 - */ - familyId?: number; - /** - * - * @type {string} - * @memberof InvitationV3 - */ - text?: string; - /** - * - * @type {string} - * @memberof InvitationV3 - */ - token?: string; - /** - * - * @type {string} - * @memberof InvitationV3 - */ - link?: string; - /** - * - * @type {string} - * @memberof InvitationV3 - */ - linkV3?: string; - /** - * - * @type {UserChildModelV3} - * @memberof InvitationV3 - */ - child?: UserChildModelV3; + /** + * + * @type {number} + * @memberof InvitationV3 + */ + role?: number; + /** + * + * @type {number} + * @memberof InvitationV3 + */ + inviterId?: number; + /** + * + * @type {number} + * @memberof InvitationV3 + */ + familyId?: number; + /** + * + * @type {string} + * @memberof InvitationV3 + */ + text?: string; + /** + * + * @type {string} + * @memberof InvitationV3 + */ + token?: string; + /** + * + * @type {string} + * @memberof InvitationV3 + */ + link?: string; + /** + * + * @type {string} + * @memberof InvitationV3 + */ + linkV3?: string; + /** + * + * @type {UserChildModelV3} + * @memberof InvitationV3 + */ + child?: UserChildModelV3; } /** @@ -978,138 +978,206 @@ export interface InvitationV3 { * @interface NeedModel */ export interface NeedModel { - /** - * the need's id - * @type {number} - * @memberof NeedModel - */ - id?: number; - /** - * the need's name - * @type {string} - * @memberof NeedModel - */ - name?: string; - /** - * the need's image path - * @type {string} - * @memberof NeedModel - */ - imageUrl?: string; - /** - * the need's category (joy, love, growth, etc) - * @type {number} - * @memberof NeedModel - */ - category?: number; - /** - * determines if the need is urgent or not - * @type {boolean} - * @memberof NeedModel - */ - isUrgent?: boolean; - /** - * the need's description - * @type {string} - * @memberof NeedModel - */ - description?: string; - /** - * the summary of description - * @type {string} - * @memberof NeedModel - */ - descriptionSummary?: string; - /** - * the need's cost - * @type {number} - * @memberof NeedModel - */ - cost?: number; - /** - * the need's progress percent - * @type {number} - * @memberof NeedModel - */ - progress?: number; - /** - * paid amount for the need - * @type {number} - * @memberof NeedModel - */ - paid?: number; - /** - * the need's affiliate link - * @type {string} - * @memberof NeedModel - */ - affiliateLinkUrl?: string; - /** - * determines if the need is done or not - * @type {boolean} - * @memberof NeedModel - */ - isDone?: boolean; - /** - * determines if the need is deleted or not - * @type {boolean} - * @memberof NeedModel - */ - isDeleted?: boolean; - /** - * the date that the need has been created - * @type {string} - * @memberof NeedModel - */ - created?: string; - /** - * the need's receipts, comma separated - * @type {string} - * @memberof NeedModel - */ - receipts?: string; - /** - * determines if the need is confirmed or not - * @type {boolean} - * @memberof NeedModel - */ - isConfirmed?: boolean; - /** - * the date that the need has been confirmed - * @type {string} - * @memberof NeedModel - */ - confirmDate?: string; - /** - * id of the user who has cnfirmed the need - * @type {number} - * @memberof NeedModel - */ - confirmUser?: number; - /** - * the need's type (donate or affiliate) - * @type {number} - * @memberof NeedModel - */ - type?: number; - /** - * the last date that the need has been updated - * @type {string} - * @memberof NeedModel - */ - updated?: string; - /** - * Details - * @type {string} - * @memberof NeedModel - */ - details?: string; - /** - * - * @type {string} - * @memberof NeedModel - */ - informations?: string; + /** + * the need's id + * @type {number} + * @memberof NeedModel + */ + id?: number; + /** + * the need's name + * @type {string} + * @memberof NeedModel + */ + name?: string; + /** + * the need's image path + * @type {string} + * @memberof NeedModel + */ + imageUrl?: string; + /** + * the need's category (joy, love, growth, etc) + * @type {number} + * @memberof NeedModel + */ + category?: number; + /** + * determines if the need is urgent or not + * @type {boolean} + * @memberof NeedModel + */ + isUrgent?: boolean; + /** + * the need's description + * @type {string} + * @memberof NeedModel + */ + description?: string; + /** + * the summary of description + * @type {string} + * @memberof NeedModel + */ + descriptionSummary?: string; + /** + * the need's cost + * @type {number} + * @memberof NeedModel + */ + cost?: number; + /** + * the need's progress percent + * @type {number} + * @memberof NeedModel + */ + progress?: number; + /** + * paid amount for the need + * @type {number} + * @memberof NeedModel + */ + paid?: number; + /** + * the need's affiliate link + * @type {string} + * @memberof NeedModel + */ + affiliateLinkUrl?: string; + /** + * determines if the need is done or not + * @type {boolean} + * @memberof NeedModel + */ + isDone?: boolean; + /** + * determines if the need is deleted or not + * @type {boolean} + * @memberof NeedModel + */ + isDeleted?: boolean; + /** + * the date that the need has been created + * @type {string} + * @memberof NeedModel + */ + created?: string; + /** + * the need's receipts, comma separated + * @type {string} + * @memberof NeedModel + */ + receipts?: string; + /** + * determines if the need is confirmed or not + * @type {boolean} + * @memberof NeedModel + */ + isConfirmed?: boolean; + /** + * the date that the need has been confirmed + * @type {string} + * @memberof NeedModel + */ + confirmDate?: string; + /** + * id of the user who has cnfirmed the need + * @type {number} + * @memberof NeedModel + */ + confirmUser?: number; + /** + * the need's type (donate or affiliate) + * @type {number} + * @memberof NeedModel + */ + type?: number; + /** + * the last date that the need has been updated + * @type {string} + * @memberof NeedModel + */ + updated?: string; + /** + * Details + * @type {string} + * @memberof NeedModel + */ + details?: string; + /** + * + * @type {string} + * @memberof NeedModel + */ + informations?: string; + /** + * + * @type {number} + * @memberof NeedModel + */ + createdBy?: number; +} + +/** + * + * @export + * @interface NeedReceipt + */ +export interface NeedReceipt { + /** + * + * @type {number} + * @memberof NeedReceipt + */ + id?: number; + /** + * + * @type {Date} + * @memberof NeedReceipt + */ + deleted?: Date; + /** + * + * @type {string} + * @memberof NeedReceipt + */ + attachment?: string; + /** + * + * @type {string} + * @memberof NeedReceipt + */ + code?: string; + /** + * + * @type {string} + * @memberof NeedReceipt + */ + description?: string; + /** + * + * @type {string} + * @memberof NeedReceipt + */ + title?: string; + /** + * + * @type {boolean} + * @memberof NeedReceipt + */ + isPublic?: boolean; + /** + * + * @type {number} + * @memberof NeedReceipt + */ + ownerId?: number; + /** + * + * @type {number} + * @memberof NeedReceipt + */ + needStatus?: number; } /** @@ -1118,48 +1186,48 @@ export interface NeedModel { * @interface NeedStatusUpdateModel */ export interface NeedStatusUpdateModel { - /** - * - * @type {number} - * @memberof NeedStatusUpdateModel - */ - id?: number; - /** - * - * @type {number} - * @memberof NeedStatusUpdateModel - */ - needId?: number; - /** - * - * @type {number} - * @memberof NeedStatusUpdateModel - */ - swId?: number; - /** - * - * @type {number} - * @memberof NeedStatusUpdateModel - */ - newStatus?: number; - /** - * - * @type {number} - * @memberof NeedStatusUpdateModel - */ - oldStatus?: number; - /** - * - * @type {string} - * @memberof NeedStatusUpdateModel - */ - created?: string; - /** - * - * @type {string} - * @memberof NeedStatusUpdateModel - */ - updated?: string; + /** + * + * @type {number} + * @memberof NeedStatusUpdateModel + */ + id?: number; + /** + * + * @type {number} + * @memberof NeedStatusUpdateModel + */ + needId?: number; + /** + * + * @type {number} + * @memberof NeedStatusUpdateModel + */ + swId?: number; + /** + * + * @type {number} + * @memberof NeedStatusUpdateModel + */ + newStatus?: number; + /** + * + * @type {number} + * @memberof NeedStatusUpdateModel + */ + oldStatus?: number; + /** + * + * @type {string} + * @memberof NeedStatusUpdateModel + */ + created?: string; + /** + * + * @type {string} + * @memberof NeedStatusUpdateModel + */ + updated?: string; } /** @@ -1168,108 +1236,112 @@ export interface NeedStatusUpdateModel { * @interface NgoModel */ export interface NgoModel { - /** - * the ngo id - * @type {number} - * @memberof NgoModel - */ - id?: number; - /** - * the international code of city - * @type {number} - * @memberof NgoModel - */ - cityId?: number; - /** - * name of the ngo - * @type {string} - * @memberof NgoModel - */ - name?: string; - /** - * website of the ngo - * @type {string} - * @memberof NgoModel - */ - website?: string; - /** - * address of the ngo - * @type {string} - * @memberof NgoModel - */ - postalAddress?: string; - /** - * email of the ngo - * @type {string} - * @memberof NgoModel - */ - emailAddress?: string; - /** - * phone numbers of the ngo, comma separated - * @type {string} - * @memberof NgoModel - */ - phoneNumber?: string; - /** - * logo of the ngo as file - * @type {string} - * @memberof NgoModel - */ - logoUrl?: string; - /** - * amount of money the ngo has - * @type {number} - * @memberof NgoModel - */ - balance?: number; - /** - * count of all the social workers in history of the ngo - * @type {number} - * @memberof NgoModel - */ - socialWorkerCount?: number; - /** - * count of all the social workers in the ngo right now - * @type {number} - * @memberof NgoModel - */ - currentSocialWorkerCount?: number; - /** - * count of all the social workers in history of the ngo - * @type {number} - * @memberof NgoModel - */ - childrenCount?: number; - /** - * count of all the social workers in the ngo right now - * @type {number} - * @memberof NgoModel - */ - currentChildrenCount?: number; - /** - * registeration date - * @type {string} - * @memberof NgoModel - */ - registerDate?: string; - /** - * last update date - * @type {string} - * @memberof NgoModel - */ - updated?: string; - /** - * ngo is active or not - * @type {boolean} - * @memberof NgoModel - */ - isActive?: boolean; - /** - * ngo is deleted or not - * @type {boolean} - * @memberof NgoModel - */ - isDeleted?: boolean; + city: any; + /** + * the ngo id + * @type {number} + * @memberof NgoModel + */ + id?: number; + /** + * the international code of city + * @type {number} + * @memberof NgoModel + */ + cityId?: number; + city_id?: number; + /** + * name of the ngo + * @type {string} + * @memberof NgoModel + */ + name?: string; + /** + * website of the ngo + * @type {string} + * @memberof NgoModel + */ + website?: string; + /** + * address of the ngo + * @type {string} + * @memberof NgoModel + */ + postalAddress?: string; + /** + * email of the ngo + * @type {string} + * @memberof NgoModel + */ + emailAddress?: string; + /** + * phone numbers of the ngo, comma separated + * @type {string} + * @memberof NgoModel + */ + phoneNumber?: string; + /** + * logo of the ngo as file + * @type {string} + * @memberof NgoModel + */ + logoUrl?: string; + /** + * amount of money the ngo has + * @type {number} + * @memberof NgoModel + */ + balance?: number; + /** + * count of all the social workers in history of the ngo + * @type {number} + * @memberof NgoModel + */ + socialWorkerCount?: number; + /** + * count of all the social workers in the ngo right now + * @type {number} + * @memberof NgoModel + */ + currentSocialWorkerCount?: number; + /** + * count of all the social workers in history of the ngo + * @type {number} + * @memberof NgoModel + */ + childrenCount?: number; + /** + * count of all the social workers in the ngo right now + * @type {number} + * @memberof NgoModel + */ + currentChildrenCount?: number; + /** + * registeration date + * @type {string} + * @memberof NgoModel + */ + registerDate?: string; + /** + * last update date + * @type {string} + * @memberof NgoModel + */ + updated?: string; + /** + * ngo is active or not + * @type {boolean} + * @memberof NgoModel + */ + isActive?: boolean; + /** + * ngo is deleted or not + * @type {boolean} + * @memberof NgoModel + */ + isDeleted?: boolean; + + socialWorkers: any; } /** @@ -1277,16 +1349,14 @@ export interface NgoModel { * @export * @interface PaymentModel */ -export interface PaymentModel { -} +export interface PaymentModel {} /** * * @export * @interface PreneedSummary */ -export interface PreneedSummary { -} +export interface PreneedSummary {} /** * @@ -1294,24 +1364,24 @@ export interface PreneedSummary { * @interface PrivilegeModel */ export interface PrivilegeModel { - /** - * the privilege id - * @type {number} - * @memberof PrivilegeModel - */ - id?: number; - /** - * the privilege name - * @type {string} - * @memberof PrivilegeModel - */ - name?: string; - /** - * the privilege code - * @type {number} - * @memberof PrivilegeModel - */ - privilege?: number; + /** + * the privilege id + * @type {number} + * @memberof PrivilegeModel + */ + id?: number; + /** + * the privilege name + * @type {string} + * @memberof PrivilegeModel + */ + name?: string; + /** + * the privilege code + * @type {number} + * @memberof PrivilegeModel + */ + privilege?: number; } /** @@ -1320,72 +1390,72 @@ export interface PrivilegeModel { * @interface PublicNeed */ export interface PublicNeed { - /** - * - * @type {number} - * @memberof PublicNeed - */ - id?: number; - /** - * - * @type {string} - * @memberof PublicNeed - */ - name?: string; - /** - * - * @type {string} - * @memberof PublicNeed - */ - category?: string; - /** - * - * @type {number} - * @memberof PublicNeed - */ - cost?: number; - /** - * - * @type {string} - * @memberof PublicNeed - */ - childAvatarUrl?: string; - /** - * - * @type {string} - * @memberof PublicNeed - */ - childSayName?: string; - /** - * - * @type {string} - * @memberof PublicNeed - */ - description?: string; - /** - * - * @type {string} - * @memberof PublicNeed - */ - image?: string; - /** - * 0=service, 1=product - * @type {number} - * @memberof PublicNeed - */ - type?: number; - /** - * - * @type {string} - * @memberof PublicNeed - */ - retailerLink?: string; - /** - * - * @type {string} - * @memberof PublicNeed - */ - retailerImage?: string; + /** + * + * @type {number} + * @memberof PublicNeed + */ + id?: number; + /** + * + * @type {string} + * @memberof PublicNeed + */ + name?: string; + /** + * + * @type {string} + * @memberof PublicNeed + */ + category?: string; + /** + * + * @type {number} + * @memberof PublicNeed + */ + cost?: number; + /** + * + * @type {string} + * @memberof PublicNeed + */ + childAvatarUrl?: string; + /** + * + * @type {string} + * @memberof PublicNeed + */ + childSayName?: string; + /** + * + * @type {string} + * @memberof PublicNeed + */ + description?: string; + /** + * + * @type {string} + * @memberof PublicNeed + */ + image?: string; + /** + * 0=service, 1=product + * @type {number} + * @memberof PublicNeed + */ + type?: number; + /** + * + * @type {string} + * @memberof PublicNeed + */ + retailerLink?: string; + /** + * + * @type {string} + * @memberof PublicNeed + */ + retailerImage?: string; } /** @@ -1394,30 +1464,30 @@ export interface PublicNeed { * @interface Register */ export interface Register { - /** - * - * @type {number} - * @memberof Register - */ - needId?: number; - /** - * - * @type {number} - * @memberof Register - */ - amount?: number; - /** - * - * @type {number} - * @memberof Register - */ - donate?: number; - /** - * - * @type {boolean} - * @memberof Register - */ - useCredit?: boolean; + /** + * + * @type {number} + * @memberof Register + */ + needId?: number; + /** + * + * @type {number} + * @memberof Register + */ + amount?: number; + /** + * + * @type {number} + * @memberof Register + */ + donate?: number; + /** + * + * @type {boolean} + * @memberof Register + */ + useCredit?: boolean; } /** @@ -1425,8 +1495,7 @@ export interface Register { * @export * @interface RevokedToken */ -export interface RevokedToken { -} +export interface RevokedToken {} /** * @@ -1434,18 +1503,18 @@ export interface RevokedToken { * @interface SearchModel */ export interface SearchModel { - /** - * Invitation token, use this to get the child - * @type {string} - * @memberof SearchModel - */ - token?: string; - /** - * Type of search - * @type {string} - * @memberof SearchModel - */ - type_?: string; + /** + * Invitation token, use this to get the child + * @type {string} + * @memberof SearchModel + */ + token?: string; + /** + * Type of search + * @type {string} + * @memberof SearchModel + */ + type_?: string; } /** @@ -1454,24 +1523,24 @@ export interface SearchModel { * @interface SearchV3 */ export interface SearchV3 { - /** - * Search token - * @type {string} - * @memberof SearchV3 - */ - token?: string; - /** - * Type of search - * @type {string} - * @memberof SearchV3 - */ - type?: string; - /** - * - * @type {UserChildModelV3} - * @memberof SearchV3 - */ - child?: UserChildModelV3; + /** + * Search token + * @type {string} + * @memberof SearchV3 + */ + token?: string; + /** + * Type of search + * @type {string} + * @memberof SearchV3 + */ + type?: string; + /** + * + * @type {UserChildModelV3} + * @memberof SearchV3 + */ + child?: UserChildModelV3; } /** @@ -1480,3597 +1549,5481 @@ export interface SearchV3 { * @interface SocialWorkerModel */ export interface SocialWorkerModel { + /** + * + * @type {number} + * @memberof SocialWorkerModel + */ + cityId?: string; + /** + * + * @type {CityModel} + * @memberof SocialWorkerModel + */ + city?: CityModel; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + firstName?: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + lastName: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + birthCertificateNumber?: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + passportNumber?: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + postalAddress?: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + bankAccountNumber?: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + bankAccountShebaNumber?: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + bankAccountCardNumber?: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + birthDate?: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + telegramId: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + idNumber: string; + /** + * + * @type {boolean} + * @memberof SocialWorkerModel + */ + isCoordinator?: boolean; + /** + * + * @type {number} + * @memberof SocialWorkerModel + */ + ngoId: number; + /** + * + * @type {number} + * @memberof SocialWorkerModel + */ + typeId: number; + /** + * + * @type {boolean} + * @memberof SocialWorkerModel + */ + gender: boolean; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + phoneNumber: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + emergencyPhoneNumber: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + email: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + avatarUrl: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + idCardUrl?: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + passportUrl?: string; + /** + * + * @type {number} + * @memberof SocialWorkerModel + */ + id: number; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + username: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + generatedCode: string; + /** + * + * @type {number} + * @memberof SocialWorkerModel + */ + childCount: number; + /** + * + * @type {number} + * @memberof SocialWorkerModel + */ + currentChildCount: number; + /** + * + * @type {Date} + * @memberof SocialWorkerModel + */ + created: Date; + /** + * + * @type {Date} + * @memberof SocialWorkerModel + */ + updated: Date; + /** + * + * @type {number} + * @memberof SocialWorkerModel + */ + needCount: number; + /** + * + * @type {number} + * @memberof SocialWorkerModel + */ + currentNeedCount: number; + /** + * + * @type {Date} + * @memberof SocialWorkerModel + */ + lastLoginDate: Date; + /** + * + * @type {boolean} + * @memberof SocialWorkerModel + */ + isActive: boolean; + /** + * + * @type {boolean} + * @memberof SocialWorkerModel + */ + isDeleted: boolean; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + locale: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + typeName: string; + /** + * + * @type {string} + * @memberof SocialWorkerModel + */ + ngoName: string; +} + +/** + * + * @export + * @interface StateModel + */ +export interface StateModel { + /** + * + * @type {number} + * @memberof StateModel + */ + id?: number; + /** + * + * @type {number} + * @memberof StateModel + */ + countryId?: number; + /** + * + * @type {string} + * @memberof StateModel + */ + name?: string; + /** + * + * @type {string} + * @memberof StateModel + */ + countryCode?: string; + /** + * + * @type {string} + * @memberof StateModel + */ + countryName?: string; + /** + * + * @type {string} + * @memberof StateModel + */ + stateCode?: string; + /** + * + * @type {string} + * @memberof StateModel + */ + latitude?: string; + /** + * + * @type {string} + * @memberof StateModel + */ + longitude?: string; + /** + * + * @type {string} + * @memberof StateModel + */ + iso2?: string; + /** + * + * @type {string} + * @memberof StateModel + */ + fipsCode?: string; + /** + * + * @type {string} + * @memberof StateModel + */ + type?: string; +} + +/** + * + * @export + * @interface SwMyPage + */ +export interface SwMyPage { + /** + * + * @type {number} + * @memberof SwMyPage + */ + count?: number; + /** + * + * @type {Array} + * @memberof SwMyPage + */ + result?: Array; +} + +/** + * + * @export + * @interface SwmypageNeeds + */ +export interface SwmypageNeeds { + /** + * + * @type {number} + * @memberof SwmypageNeeds + */ + id?: number; + /** + * + * @type {number} + * @memberof SwmypageNeeds + */ + createdById?: number; + /** + * + * @type {string} + * @memberof SwmypageNeeds + */ + name?: string; + /** + * + * @type {string} + * @memberof SwmypageNeeds + */ + title?: string; + /** + * + * @type {string} + * @memberof SwmypageNeeds + */ + imageUrl?: string; + /** + * + * @type {number} + * @memberof SwmypageNeeds + */ + category?: number; + /** + * + * @type {number} + * @memberof SwmypageNeeds + */ + type?: number; + /** + * + * @type {boolean} + * @memberof SwmypageNeeds + */ + isUrgent?: boolean; + /** + * + * @type {string} + * @memberof SwmypageNeeds + */ + link?: string; + /** + * + * @type {string} + * @memberof SwmypageNeeds + */ + affiliateLinkUrl?: string; + /** + * + * @type {string} + * @memberof SwmypageNeeds + */ + bankTrackId?: string; + /** + * + * @type {number} + * @memberof SwmypageNeeds + */ + doingDuration?: number; + /** + * + * @type {number} + * @memberof SwmypageNeeds + */ + status?: number; + /** + * + * @type {string} + * @memberof SwmypageNeeds + */ + img?: string; + /** + * + * @type {number} + * @memberof SwmypageNeeds + */ + paid?: number; + /** + * + * @type {number} + * @memberof SwmypageNeeds + */ + purchaseCost?: number; + /** + * + * @type {number} + * @memberof SwmypageNeeds + */ + cost?: number; + /** + * + * @type {boolean} + * @memberof SwmypageNeeds + */ + unpayable?: boolean; + /** + * + * @type {boolean} + * @memberof SwmypageNeeds + */ + isDone?: boolean; + /** + * + * @type {boolean} + * @memberof SwmypageNeeds + */ + isConfirmed?: boolean; + /** + * + * @type {Date} + * @memberof SwmypageNeeds + */ + unpayableFrom?: Date; + /** + * + * @type {Date} + * @memberof SwmypageNeeds + */ + created?: Date; + /** + * + * @type {Date} + * @memberof SwmypageNeeds + */ + updated?: Date; + /** + * + * @type {Date} + * @memberof SwmypageNeeds + */ + confirmDate?: Date; + /** + * + * @type {number} + * @memberof SwmypageNeeds + */ + confirmedBy?: number; + /** + * + * @type {Date} + * @memberof SwmypageNeeds + */ + doneAt?: Date; + /** + * + * @type {Date} + * @memberof SwmypageNeeds + */ + ngoDeliveryDate?: Date; + /** + * + * @type {Date} + * @memberof SwmypageNeeds + */ + childDeliveryDate?: Date; + /** + * + * @type {Date} + * @memberof SwmypageNeeds + */ + purchaseDate?: Date; + /** + * + * @type {Date} + * @memberof SwmypageNeeds + */ + expectedDeliveryDate?: Date; + /** + * + * @type {Array} + * @memberof SwmypageNeeds + */ + statusUpdates?: Array; + /** + * + * @type {Array} + * @memberof SwmypageNeeds + */ + receipts_?: Array; + /** + * + * @type {Array} + * @memberof SwmypageNeeds + */ + verifiedPayments?: Array; +} + +/** + * + * @export + * @interface SwmypageReceipts_ + */ +export interface SwmypageReceipts_ { + /** + * + * @type {string} + * @memberof SwmypageReceipts_ + */ + attachment?: string; + /** + * + * @type {string} + * @memberof SwmypageReceipts_ + */ + description?: string; + /** + * + * @type {string} + * @memberof SwmypageReceipts_ + */ + title?: string; + /** + * + * @type {boolean} + * @memberof SwmypageReceipts_ + */ + isPublic?: boolean; + /** + * + * @type {string} + * @memberof SwmypageReceipts_ + */ + code?: string; + /** + * + * @type {number} + * @memberof SwmypageReceipts_ + */ + ownerId?: number; + /** + * + * @type {number} + * @memberof SwmypageReceipts_ + */ + needStatus?: number; + /** + * + * @type {number} + * @memberof SwmypageReceipts_ + */ + id?: number; + /** + * + * @type {Date} + * @memberof SwmypageReceipts_ + */ + deleted?: Date; +} + +/** + * + * @export + * @interface SwmypageResult + */ +export interface SwmypageResult { + /** + * + * @type {number} + * @memberof SwmypageResult + */ + id?: number; + /** + * + * @type {string} + * @memberof SwmypageResult + */ + sayName?: string; + /** + * + * @type {string} + * @memberof SwmypageResult + */ + firstName?: string; + /** + * + * @type {string} + * @memberof SwmypageResult + */ + lastName?: string; + /** + * + * @type {string} + * @memberof SwmypageResult + */ + birthDate?: string; + /** + * + * @type {string} + * @memberof SwmypageResult + */ + awakeAvatarUrl?: string; + /** + * + * @type {Array} + * @memberof SwmypageResult + */ + needs?: Array; +} + +/** + * + * @export + * @interface SwmypageStatusUpdates + */ +export interface SwmypageStatusUpdates { + /** + * + * @type {number} + * @memberof SwmypageStatusUpdates + */ + id?: number; + /** + * + * @type {number} + * @memberof SwmypageStatusUpdates + */ + swId?: number; + /** + * + * @type {number} + * @memberof SwmypageStatusUpdates + */ + needId?: number; + /** + * + * @type {number} + * @memberof SwmypageStatusUpdates + */ + newStatus?: number; + /** + * + * @type {number} + * @memberof SwmypageStatusUpdates + */ + oldStatus?: number; + /** + * + * @type {Date} + * @memberof SwmypageStatusUpdates + */ + created?: Date; + /** + * + * @type {Date} + * @memberof SwmypageStatusUpdates + */ + updated?: Date; +} + +/** + * + * @export + * @interface SwmypageVerifiedPayments + */ +export interface SwmypageVerifiedPayments { + /** + * + * @type {number} + * @memberof SwmypageVerifiedPayments + */ + id?: number; + /** + * + * @type {number} + * @memberof SwmypageVerifiedPayments + */ + idNeed?: number; + /** + * + * @type {number} + * @memberof SwmypageVerifiedPayments + */ + idUser?: number; + /** + * + * @type {Date} + * @memberof SwmypageVerifiedPayments + */ + verified?: Date; + /** + * + * @type {number} + * @memberof SwmypageVerifiedPayments + */ + needAmount?: number; + /** + * + * @type {number} + * @memberof SwmypageVerifiedPayments + */ + donationAmount?: number; + /** + * + * @type {number} + * @memberof SwmypageVerifiedPayments + */ + creditAmount?: number; + /** + * + * @type {boolean} + * @memberof SwmypageVerifiedPayments + */ + useCredit?: boolean; +} + +/** + * + * @export + * @interface UserChildModelV3 + */ +export interface UserChildModelV3 { + /** + * + * @type {string} + * @memberof UserChildModelV3 + */ + avatarUrl?: string; + /** + * + * @type {string} + * @memberof UserChildModelV3 + */ + bio?: string; + /** + * + * @type {string} + * @memberof UserChildModelV3 + */ + biosummary?: string; + /** + * + * @type {string} + * @memberof UserChildModelV3 + */ + birthdate?: string; + /** + * + * @type {number} + * @memberof UserChildModelV3 + */ + doneNeedsCount?: number; + /** + * + * @type {number} + * @memberof UserChildModelV3 + */ + existenceStatus?: number; + /** + * + * @type {number} + * @memberof UserChildModelV3 + */ + familyId?: number; + /** + * + * @type {string} + * @memberof UserChildModelV3 + */ + gender?: string; + /** + * + * @type {string} + * @memberof UserChildModelV3 + */ + generatedcode?: string; + /** + * + * @type {number} + * @memberof UserChildModelV3 + */ + id?: number; + /** + * + * @type {boolean} + * @memberof UserChildModelV3 + */ + isGone?: boolean; + /** + * + * @type {string} + * @memberof UserChildModelV3 + */ + sayname?: string; + /** + * + * @type {number} + * @memberof UserChildModelV3 + */ + spentCredit?: number; + /** + * + * @type {string} + * @memberof UserChildModelV3 + */ + voiceurl?: string; + /** + * + * @type {string} + * @memberof UserChildModelV3 + */ + socialWorkerGeneratedCode?: string; + /** + * + * @type {FamilyMembers} + * @memberof UserChildModelV3 + */ + childFamilyMembers?: FamilyMembers; +} + +/** + * + * @export + * @interface UserModel + */ +export interface UserModel { + /** + * the user's id + * @type {number} + * @memberof UserModel + */ + id?: number; + /** + * the user's first name + * @type {string} + * @memberof UserModel + */ + firstName?: string; + /** + * the user's last name + * @type {string} + * @memberof UserModel + */ + lastName?: string; + /** + * the user's username + * @type {string} + * @memberof UserModel + */ + userName?: string; + /** + * the user's phone number + * @type {string} + * @memberof UserModel + */ + phoneNumber?: string; + /** + * the user's credit amount in integer + * @type {number} + * @memberof UserModel + */ + credit?: number; + /** + * the user's international country code + * @type {number} + * @memberof UserModel + */ + country?: number; + /** + * the user's international city code + * @type {number} + * @memberof UserModel + */ + city?: number; + /** + * the user's avatar image path + * @type {string} + * @memberof UserModel + */ + avatarUrl?: string; + /** + * the user's gender, true for male and false for female + * @type {boolean} + * @memberof UserModel + */ + gender?: boolean; + /** + * the user's email address in correct format + * @type {string} + * @memberof UserModel + */ + emailAddress?: string; + /** + * the user's birth place international code + * @type {number} + * @memberof UserModel + */ + birthPlace?: number; + /** + * the user's birth date + * @type {string} + * @memberof UserModel + */ + birthDate?: string; + /** + * the user's password, stored as a hashed string + * @type {string} + * @memberof UserModel + */ + password?: string; + /** + * the user's total credit spent + * @type {number} + * @memberof UserModel + */ + spentCredit?: number; + /** + * the date that the user has been created + * @type {string} + * @memberof UserModel + */ + created?: string; + /** + * the last date that the user has been updated + * @type {string} + * @memberof UserModel + */ + updated?: string; + /** + * determines if the user is deleted or not + * @type {boolean} + * @memberof UserModel + */ + isDeleted?: boolean; + /** + * the last date that the user has logged in + * @type {string} + * @memberof UserModel + */ + lastLogin?: string; + /** + * the needs that user has done for their children + * @type {string} + * @memberof UserModel + */ + doneNeedCount?: string; +} + +/** + * AuthAPIApi - fetch parameter creator + * @export + */ +export const AuthAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { /** * - * @type {number} - * @memberof SocialWorkerModel + * @summary Login API + * @param {string} username + * @param {string} password + * @param {number} isInstalled + * @param {string} lang + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - cityId?: number; + apiV2AuthLoginPost( + username: string, + password: string, + isInstalled: number, + lang: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError( + 'username', + 'Required parameter username was null or undefined when calling apiV2AuthLoginPost.', + ); + } + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new RequiredError( + 'password', + 'Required parameter password was null or undefined when calling apiV2AuthLoginPost.', + ); + } + // verify required parameter 'isInstalled' is not null or undefined + if (isInstalled === null || isInstalled === undefined) { + throw new RequiredError( + 'isInstalled', + 'Required parameter isInstalled was null or undefined when calling apiV2AuthLoginPost.', + ); + } + // verify required parameter 'lang' is not null or undefined + if (lang === null || lang === undefined) { + throw new RequiredError( + 'lang', + 'Required parameter lang was null or undefined when calling apiV2AuthLoginPost.', + ); + } + const localVarPath = `/api/v2/auth/login`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (lang !== undefined) { + localVarQueryParameter['_lang'] = lang; + } + + if (username !== undefined) { + localVarFormParams.set('username', username as any); + } + + if (password !== undefined) { + localVarFormParams.set('password', password as any); + } + + if (isInstalled !== undefined) { + localVarFormParams.set('isInstalled', isInstalled as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @type {CityModel} - * @memberof SocialWorkerModel + * @summary Logout (Access Token) API + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - city?: CityModel; + apiV2AuthLogoutTokenPost( + authorization: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2AuthLogoutTokenPost.', + ); + } + const localVarPath = `/api/v2/auth/logout/token`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Confirm Reset Password API + * @param {string} token + * @param {string} password + * @param {string} confirmPassword + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - firstName?: string; + apiV2AuthPasswordResetConfirmTokentokenPost( + token: string, + password: string, + confirmPassword: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'token' is not null or undefined + if (token === null || token === undefined) { + throw new RequiredError( + 'token', + 'Required parameter token was null or undefined when calling apiV2AuthPasswordResetConfirmTokentokenPost.', + ); + } + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new RequiredError( + 'password', + 'Required parameter password was null or undefined when calling apiV2AuthPasswordResetConfirmTokentokenPost.', + ); + } + // verify required parameter 'confirmPassword' is not null or undefined + if (confirmPassword === null || confirmPassword === undefined) { + throw new RequiredError( + 'confirmPassword', + 'Required parameter confirmPassword was null or undefined when calling apiV2AuthPasswordResetConfirmTokentokenPost.', + ); + } + const localVarPath = + `/api/v2/auth/password/reset/confirm/token={token}`.replace( + `{${'token'}}`, + encodeURIComponent(String(token)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (password !== undefined) { + localVarFormParams.set('password', password as any); + } + + if (confirmPassword !== undefined) { + localVarFormParams.set('confirm_password', confirmPassword as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Reset Password API by email + * @param {string} email + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - lastName: string; + apiV2AuthPasswordResetEmailPost( + email: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'email' is not null or undefined + if (email === null || email === undefined) { + throw new RequiredError( + 'email', + 'Required parameter email was null or undefined when calling apiV2AuthPasswordResetEmailPost.', + ); + } + const localVarPath = `/api/v2/auth/password/reset/email`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (email !== undefined) { + localVarFormParams.set('email', email as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Reset Password API by sms + * @param {string} phoneNumber + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - birthCertificateNumber?: string; + apiV2AuthPasswordResetPhonePost( + phoneNumber: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'phoneNumber' is not null or undefined + if (phoneNumber === null || phoneNumber === undefined) { + throw new RequiredError( + 'phoneNumber', + 'Required parameter phoneNumber was null or undefined when calling apiV2AuthPasswordResetPhonePost.', + ); + } + const localVarPath = `/api/v2/auth/password/reset/phone`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (phoneNumber !== undefined) { + localVarFormParams.set('phoneNumber', phoneNumber as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Register API + * @param {string} username + * @param {string} phoneNumber + * @param {string} username2 + * @param {string} password + * @param {string} verifyCode + * @param {number} isInstalled + * @param {string} lang + * @param {string} [countryCode] + * @param {string} [email] + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - passportNumber?: string; + apiV2AuthRegisterPost( + username: string, + phoneNumber: string, + username2: string, + password: string, + verifyCode: string, + isInstalled: number, + lang: string, + countryCode?: string, + email?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError( + 'username', + 'Required parameter username was null or undefined when calling apiV2AuthRegisterPost.', + ); + } + // verify required parameter 'phoneNumber' is not null or undefined + if (phoneNumber === null || phoneNumber === undefined) { + throw new RequiredError( + 'phoneNumber', + 'Required parameter phoneNumber was null or undefined when calling apiV2AuthRegisterPost.', + ); + } + // verify required parameter 'username2' is not null or undefined + if (username2 === null || username2 === undefined) { + throw new RequiredError( + 'username2', + 'Required parameter username2 was null or undefined when calling apiV2AuthRegisterPost.', + ); + } + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new RequiredError( + 'password', + 'Required parameter password was null or undefined when calling apiV2AuthRegisterPost.', + ); + } + // verify required parameter 'verifyCode' is not null or undefined + if (verifyCode === null || verifyCode === undefined) { + throw new RequiredError( + 'verifyCode', + 'Required parameter verifyCode was null or undefined when calling apiV2AuthRegisterPost.', + ); + } + // verify required parameter 'isInstalled' is not null or undefined + if (isInstalled === null || isInstalled === undefined) { + throw new RequiredError( + 'isInstalled', + 'Required parameter isInstalled was null or undefined when calling apiV2AuthRegisterPost.', + ); + } + // verify required parameter 'lang' is not null or undefined + if (lang === null || lang === undefined) { + throw new RequiredError( + 'lang', + 'Required parameter lang was null or undefined when calling apiV2AuthRegisterPost.', + ); + } + const localVarPath = `/api/v2/auth/register`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (lang !== undefined) { + localVarQueryParameter['_lang'] = lang; + } + + if (username !== undefined) { + localVarFormParams.set('username', username as any); + } + + if (phoneNumber !== undefined) { + localVarFormParams.set('phoneNumber', phoneNumber as any); + } + + if (countryCode !== undefined) { + localVarFormParams.set('countryCode', countryCode as any); + } + + if (username2 !== undefined) { + localVarFormParams.set('username', username2 as any); + } + + if (email !== undefined) { + localVarFormParams.set('email', email as any); + } + + if (password !== undefined) { + localVarFormParams.set('password', password as any); + } + + if (verifyCode !== undefined) { + localVarFormParams.set('verifyCode', verifyCode as any); + } + + if (isInstalled !== undefined) { + localVarFormParams.set('isInstalled', isInstalled as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; + +/** + * AuthAPIApi - functional programming interface + * @export + */ +export const AuthAPIApiFp = function (configuration?: Configuration) { + return { /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Login API + * @param {string} username + * @param {string} password + * @param {number} isInstalled + * @param {string} lang + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - postalAddress?: string; + apiV2AuthLoginPost( + username: string, + password: string, + isInstalled: number, + lang: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = AuthAPIApiFetchParamCreator( + configuration, + ).apiV2AuthLoginPost(username, password, isInstalled, lang, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Logout (Access Token) API + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - bankAccountNumber?: string; + apiV2AuthLogoutTokenPost( + authorization: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = AuthAPIApiFetchParamCreator( + configuration, + ).apiV2AuthLogoutTokenPost(authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Confirm Reset Password API + * @param {string} token + * @param {string} password + * @param {string} confirmPassword + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - bankAccountShebaNumber?: string; + apiV2AuthPasswordResetConfirmTokentokenPost( + token: string, + password: string, + confirmPassword: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = AuthAPIApiFetchParamCreator( + configuration, + ).apiV2AuthPasswordResetConfirmTokentokenPost( + token, + password, + confirmPassword, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Reset Password API by email + * @param {string} email + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - bankAccountCardNumber?: string; + apiV2AuthPasswordResetEmailPost( + email: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = AuthAPIApiFetchParamCreator( + configuration, + ).apiV2AuthPasswordResetEmailPost(email, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Reset Password API by sms + * @param {string} phoneNumber + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - birthDate?: string; + apiV2AuthPasswordResetPhonePost( + phoneNumber: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = AuthAPIApiFetchParamCreator( + configuration, + ).apiV2AuthPasswordResetPhonePost(phoneNumber, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Register API + * @param {string} username + * @param {string} phoneNumber + * @param {string} username2 + * @param {string} password + * @param {string} verifyCode + * @param {number} isInstalled + * @param {string} lang + * @param {string} [countryCode] + * @param {string} [email] + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - telegramId: string; + apiV2AuthRegisterPost( + username: string, + phoneNumber: string, + username2: string, + password: string, + verifyCode: string, + isInstalled: number, + lang: string, + countryCode?: string, + email?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = AuthAPIApiFetchParamCreator( + configuration, + ).apiV2AuthRegisterPost( + username, + phoneNumber, + username2, + password, + verifyCode, + isInstalled, + lang, + countryCode, + email, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + }; +}; + +/** + * AuthAPIApi - factory interface + * @export + */ +export const AuthAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Login API + * @param {string} username + * @param {string} password + * @param {number} isInstalled + * @param {string} lang + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - idNumber: string; + apiV2AuthLoginPost( + username: string, + password: string, + isInstalled: number, + lang: string, + options?: any, + ) { + return AuthAPIApiFp(configuration).apiV2AuthLoginPost( + username, + password, + isInstalled, + lang, + options, + )(fetch, basePath); + }, /** * - * @type {boolean} - * @memberof SocialWorkerModel + * @summary Logout (Access Token) API + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - isCoordinator?: boolean; + apiV2AuthLogoutTokenPost(authorization: string, options?: any) { + return AuthAPIApiFp(configuration).apiV2AuthLogoutTokenPost( + authorization, + options, + )(fetch, basePath); + }, /** * - * @type {number} - * @memberof SocialWorkerModel + * @summary Confirm Reset Password API + * @param {string} token + * @param {string} password + * @param {string} confirmPassword + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - ngoId: number; + apiV2AuthPasswordResetConfirmTokentokenPost( + token: string, + password: string, + confirmPassword: string, + options?: any, + ) { + return AuthAPIApiFp( + configuration, + ).apiV2AuthPasswordResetConfirmTokentokenPost( + token, + password, + confirmPassword, + options, + )(fetch, basePath); + }, /** * - * @type {number} - * @memberof SocialWorkerModel + * @summary Reset Password API by email + * @param {string} email + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - typeId: number; + apiV2AuthPasswordResetEmailPost(email: string, options?: any) { + return AuthAPIApiFp(configuration).apiV2AuthPasswordResetEmailPost( + email, + options, + )(fetch, basePath); + }, /** * - * @type {boolean} - * @memberof SocialWorkerModel + * @summary Reset Password API by sms + * @param {string} phoneNumber + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - gender: boolean; + apiV2AuthPasswordResetPhonePost(phoneNumber: string, options?: any) { + return AuthAPIApiFp(configuration).apiV2AuthPasswordResetPhonePost( + phoneNumber, + options, + )(fetch, basePath); + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Register API + * @param {string} username + * @param {string} phoneNumber + * @param {string} username2 + * @param {string} password + * @param {string} verifyCode + * @param {number} isInstalled + * @param {string} lang + * @param {string} [countryCode] + * @param {string} [email] + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - phoneNumber: string; + apiV2AuthRegisterPost( + username: string, + phoneNumber: string, + username2: string, + password: string, + verifyCode: string, + isInstalled: number, + lang: string, + countryCode?: string, + email?: string, + options?: any, + ) { + return AuthAPIApiFp(configuration).apiV2AuthRegisterPost( + username, + phoneNumber, + username2, + password, + verifyCode, + isInstalled, + lang, + countryCode, + email, + options, + )(fetch, basePath); + }, + }; +}; + +/** + * AuthAPIApi - object-oriented interface + * @export + * @class AuthAPIApi + * @extends {BaseAPI} + */ +export class AuthAPIApi extends BaseAPI { + /** + * + * @summary Login API + * @param {string} username + * @param {string} password + * @param {number} isInstalled + * @param {string} lang + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AuthAPIApi + */ + public apiV2AuthLoginPost( + username: string, + password: string, + isInstalled: number, + lang: string, + options?: any, + ) { + return AuthAPIApiFp(this.configuration).apiV2AuthLoginPost( + username, + password, + isInstalled, + lang, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Logout (Access Token) API + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AuthAPIApi + */ + public apiV2AuthLogoutTokenPost(authorization: string, options?: any) { + return AuthAPIApiFp(this.configuration).apiV2AuthLogoutTokenPost( + authorization, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Confirm Reset Password API + * @param {string} token + * @param {string} password + * @param {string} confirmPassword + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AuthAPIApi + */ + public apiV2AuthPasswordResetConfirmTokentokenPost( + token: string, + password: string, + confirmPassword: string, + options?: any, + ) { + return AuthAPIApiFp( + this.configuration, + ).apiV2AuthPasswordResetConfirmTokentokenPost( + token, + password, + confirmPassword, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Reset Password API by email + * @param {string} email + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AuthAPIApi + */ + public apiV2AuthPasswordResetEmailPost(email: string, options?: any) { + return AuthAPIApiFp(this.configuration).apiV2AuthPasswordResetEmailPost( + email, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Reset Password API by sms + * @param {string} phoneNumber + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AuthAPIApi + */ + public apiV2AuthPasswordResetPhonePost(phoneNumber: string, options?: any) { + return AuthAPIApiFp(this.configuration).apiV2AuthPasswordResetPhonePost( + phoneNumber, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Register API + * @param {string} username + * @param {string} phoneNumber + * @param {string} username2 + * @param {string} password + * @param {string} verifyCode + * @param {number} isInstalled + * @param {string} lang + * @param {string} [countryCode] + * @param {string} [email] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AuthAPIApi + */ + public apiV2AuthRegisterPost( + username: string, + phoneNumber: string, + username2: string, + password: string, + verifyCode: string, + isInstalled: number, + lang: string, + countryCode?: string, + email?: string, + options?: any, + ) { + return AuthAPIApiFp(this.configuration).apiV2AuthRegisterPost( + username, + phoneNumber, + username2, + password, + verifyCode, + isInstalled, + lang, + countryCode, + email, + options, + )(this.fetch, this.basePath); + } +} + +/** + * CartAPIApi - fetch parameter creator + * @export + */ +export const CartAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Get Cart + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - emergencyPhoneNumber: string; + apiV2MycartGet(authorization: string, options: any = {}): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2MycartGet.', + ); + } + const localVarPath = `/api/v2/mycart`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Delete a Need from Cart + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - email: string; + apiV2MycartNeedsDelete( + authorization: string, + needId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2MycartNeedsDelete.', + ); + } + // verify required parameter 'needId' is not null or undefined + if (needId === null || needId === undefined) { + throw new RequiredError( + 'needId', + 'Required parameter needId was null or undefined when calling apiV2MycartNeedsDelete.', + ); + } + const localVarPath = `/api/v2/mycart/needs`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'DELETE' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (needId !== undefined) { + localVarFormParams.set('needId', needId as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Add a Need to Cart + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - avatarUrl: string; + apiV2MycartNeedsPost( + authorization: string, + needId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2MycartNeedsPost.', + ); + } + // verify required parameter 'needId' is not null or undefined + if (needId === null || needId === undefined) { + throw new RequiredError( + 'needId', + 'Required parameter needId was null or undefined when calling apiV2MycartNeedsPost.', + ); + } + const localVarPath = `/api/v2/mycart/needs`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (needId !== undefined) { + localVarFormParams.set('needId', needId as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Pay for Cart + * @param {string} authorization Access Token + * @param {number} [donation] + * @param {string} [useCredit] + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - idCardUrl?: string; + apiV2MycartPaymentPost( + authorization: string, + donation?: number, + useCredit?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2MycartPaymentPost.', + ); + } + const localVarPath = `/api/v2/mycart/payment`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (donation !== undefined) { + localVarFormParams.set('donation', donation as any); + } + + if (useCredit !== undefined) { + localVarFormParams.set('useCredit', useCredit as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Update Cart + * @param {string} authorization Access Token + * @param {Body} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - passportUrl?: string; + apiV2MycartPut( + authorization: string, + body: Body, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2MycartPut.', + ); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError( + 'body', + 'Required parameter body was null or undefined when calling apiV2MycartPut.', + ); + } + const localVarPath = `/api/v2/mycart`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'PUT' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + const needsSerialization = + 'Body' !== 'string' || + localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = needsSerialization + ? JSON.stringify(body || {}) + : body || ''; + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; + +/** + * CartAPIApi - functional programming interface + * @export + */ +export const CartAPIApiFp = function (configuration?: Configuration) { + return { /** * - * @type {number} - * @memberof SocialWorkerModel + * @summary Get Cart + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - id: number; + apiV2MycartGet( + authorization: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CartAPIApiFetchParamCreator( + configuration, + ).apiV2MycartGet(authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Delete a Need from Cart + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - username: string; + apiV2MycartNeedsDelete( + authorization: string, + needId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CartAPIApiFetchParamCreator( + configuration, + ).apiV2MycartNeedsDelete(authorization, needId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Add a Need to Cart + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - generatedCode: string; + apiV2MycartNeedsPost( + authorization: string, + needId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CartAPIApiFetchParamCreator( + configuration, + ).apiV2MycartNeedsPost(authorization, needId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * - * @type {number} - * @memberof SocialWorkerModel + * @summary Pay for Cart + * @param {string} authorization Access Token + * @param {number} [donation] + * @param {string} [useCredit] + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - childCount: number; + apiV2MycartPaymentPost( + authorization: string, + donation?: number, + useCredit?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CartAPIApiFetchParamCreator( + configuration, + ).apiV2MycartPaymentPost(authorization, donation, useCredit, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * - * @type {number} - * @memberof SocialWorkerModel - */ - currentChildCount: number; - /** - * - * @type {Date} - * @memberof SocialWorkerModel - */ - created: Date; - /** - * - * @type {Date} - * @memberof SocialWorkerModel - */ - updated: Date; - /** - * - * @type {number} - * @memberof SocialWorkerModel - */ - needCount: number; - /** - * - * @type {number} - * @memberof SocialWorkerModel - */ - currentNeedCount: number; - /** - * - * @type {Date} - * @memberof SocialWorkerModel + * @summary Update Cart + * @param {string} authorization Access Token + * @param {Body} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - lastLoginDate: Date; + apiV2MycartPut( + authorization: string, + body: Body, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CartAPIApiFetchParamCreator( + configuration, + ).apiV2MycartPut(authorization, body, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + }; +}; + +/** + * CartAPIApi - factory interface + * @export + */ +export const CartAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { /** * - * @type {boolean} - * @memberof SocialWorkerModel + * @summary Get Cart + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - isActive: boolean; + apiV2MycartGet(authorization: string, options?: any) { + return CartAPIApiFp(configuration).apiV2MycartGet(authorization, options)( + fetch, + basePath, + ); + }, /** * - * @type {boolean} - * @memberof SocialWorkerModel + * @summary Delete a Need from Cart + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - isDeleted: boolean; + apiV2MycartNeedsDelete( + authorization: string, + needId: number, + options?: any, + ) { + return CartAPIApiFp(configuration).apiV2MycartNeedsDelete( + authorization, + needId, + options, + )(fetch, basePath); + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Add a Need to Cart + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - locale: string; + apiV2MycartNeedsPost(authorization: string, needId: number, options?: any) { + return CartAPIApiFp(configuration).apiV2MycartNeedsPost( + authorization, + needId, + options, + )(fetch, basePath); + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Pay for Cart + * @param {string} authorization Access Token + * @param {number} [donation] + * @param {string} [useCredit] + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - typeName: string; + apiV2MycartPaymentPost( + authorization: string, + donation?: number, + useCredit?: string, + options?: any, + ) { + return CartAPIApiFp(configuration).apiV2MycartPaymentPost( + authorization, + donation, + useCredit, + options, + )(fetch, basePath); + }, /** * - * @type {string} - * @memberof SocialWorkerModel + * @summary Update Cart + * @param {string} authorization Access Token + * @param {Body} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - ngoName: string; + apiV2MycartPut(authorization: string, body: Body, options?: any) { + return CartAPIApiFp(configuration).apiV2MycartPut( + authorization, + body, + options, + )(fetch, basePath); + }, + }; +}; + +/** + * CartAPIApi - object-oriented interface + * @export + * @class CartAPIApi + * @extends {BaseAPI} + */ +export class CartAPIApi extends BaseAPI { + /** + * + * @summary Get Cart + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CartAPIApi + */ + public apiV2MycartGet(authorization: string, options?: any) { + return CartAPIApiFp(this.configuration).apiV2MycartGet( + authorization, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Delete a Need from Cart + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CartAPIApi + */ + public apiV2MycartNeedsDelete( + authorization: string, + needId: number, + options?: any, + ) { + return CartAPIApiFp(this.configuration).apiV2MycartNeedsDelete( + authorization, + needId, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Add a Need to Cart + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CartAPIApi + */ + public apiV2MycartNeedsPost( + authorization: string, + needId: number, + options?: any, + ) { + return CartAPIApiFp(this.configuration).apiV2MycartNeedsPost( + authorization, + needId, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Pay for Cart + * @param {string} authorization Access Token + * @param {number} [donation] + * @param {string} [useCredit] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CartAPIApi + */ + public apiV2MycartPaymentPost( + authorization: string, + donation?: number, + useCredit?: string, + options?: any, + ) { + return CartAPIApiFp(this.configuration).apiV2MycartPaymentPost( + authorization, + donation, + useCredit, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Update Cart + * @param {string} authorization Access Token + * @param {Body} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CartAPIApi + */ + public apiV2MycartPut(authorization: string, body: Body, options?: any) { + return CartAPIApiFp(this.configuration).apiV2MycartPut( + authorization, + body, + options, + )(this.fetch, this.basePath); + } } /** - * + * ChangeCostAPIApi - fetch parameter creator * @export - * @interface StateModel */ -export interface StateModel { +export const ChangeCostAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { /** * - * @type {number} - * @memberof StateModel - */ - id?: number; - /** - * - * @type {number} - * @memberof StateModel + * @summary List of pending change cost requests + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - countryId?: number; + apiV2ChangeCostPendingGet( + authorization: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2ChangeCostPendingGet.', + ); + } + const localVarPath = `/api/v2/change_cost/pending`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @type {string} - * @memberof StateModel + * @summary List of Change Cost for a specific need + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - name?: string; + apiV2NeedNeedIdChangeCostGet( + authorization: string, + needId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NeedNeedIdChangeCostGet.', + ); + } + // verify required parameter 'needId' is not null or undefined + if (needId === null || needId === undefined) { + throw new RequiredError( + 'needId', + 'Required parameter needId was null or undefined when calling apiV2NeedNeedIdChangeCostGet.', + ); + } + const localVarPath = `/api/v2/need/{need_id}/change_cost`.replace( + `{${'need_id'}}`, + encodeURIComponent(String(needId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @type {string} - * @memberof StateModel + * @summary Accept a change cost of a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {number} id + * @param {number} [to] 0 to 2147483647 + * @param {string} [description] max len: 128 + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - countryCode?: string; + apiV2NeedNeedIdChangeCostIdAcceptPost( + authorization: string, + needId: number, + id: number, + to?: number, + description?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NeedNeedIdChangeCostIdAcceptPost.', + ); + } + // verify required parameter 'needId' is not null or undefined + if (needId === null || needId === undefined) { + throw new RequiredError( + 'needId', + 'Required parameter needId was null or undefined when calling apiV2NeedNeedIdChangeCostIdAcceptPost.', + ); + } + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2NeedNeedIdChangeCostIdAcceptPost.', + ); + } + const localVarPath = `/api/v2/need/{need_id}/change_cost/{id}/accept` + .replace(`{${'need_id'}}`, encodeURIComponent(String(needId))) + .replace(`{${'id'}}`, encodeURIComponent(String(id))); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (to !== undefined) { + localVarFormParams.set('to', to as any); + } + + if (description !== undefined) { + localVarFormParams.set('description', description as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @type {string} - * @memberof StateModel + * @summary Reject a change cost of a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {number} id + * @param {string} [rejectCause] + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - countryName?: string; + apiV2NeedNeedIdChangeCostIdRejectPost( + authorization: string, + needId: number, + id: number, + rejectCause?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NeedNeedIdChangeCostIdRejectPost.', + ); + } + // verify required parameter 'needId' is not null or undefined + if (needId === null || needId === undefined) { + throw new RequiredError( + 'needId', + 'Required parameter needId was null or undefined when calling apiV2NeedNeedIdChangeCostIdRejectPost.', + ); + } + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2NeedNeedIdChangeCostIdRejectPost.', + ); + } + const localVarPath = `/api/v2/need/{need_id}/change_cost/{id}/reject` + .replace(`{${'need_id'}}`, encodeURIComponent(String(needId))) + .replace(`{${'id'}}`, encodeURIComponent(String(id))); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (rejectCause !== undefined) { + localVarFormParams.set('rejectCause', rejectCause as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @type {string} - * @memberof StateModel + * @summary Request to change cost of a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {number} to 0 to 2147483647 + * @param {string} [description] max len: 128 + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - stateCode?: string; + apiV2NeedNeedIdChangeCostPut( + authorization: string, + needId: number, + to: number, + description?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NeedNeedIdChangeCostPut.', + ); + } + // verify required parameter 'needId' is not null or undefined + if (needId === null || needId === undefined) { + throw new RequiredError( + 'needId', + 'Required parameter needId was null or undefined when calling apiV2NeedNeedIdChangeCostPut.', + ); + } + // verify required parameter 'to' is not null or undefined + if (to === null || to === undefined) { + throw new RequiredError( + 'to', + 'Required parameter to was null or undefined when calling apiV2NeedNeedIdChangeCostPut.', + ); + } + const localVarPath = `/api/v2/need/{need_id}/change_cost`.replace( + `{${'need_id'}}`, + encodeURIComponent(String(needId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'PUT' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (to !== undefined) { + localVarFormParams.set('to', to as any); + } + + if (description !== undefined) { + localVarFormParams.set('description', description as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; + +/** + * ChangeCostAPIApi - functional programming interface + * @export + */ +export const ChangeCostAPIApiFp = function (configuration?: Configuration) { + return { /** * - * @type {string} - * @memberof StateModel + * @summary List of pending change cost requests + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - latitude?: string; + apiV2ChangeCostPendingGet( + authorization: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ChangeCostAPIApiFetchParamCreator( + configuration, + ).apiV2ChangeCostPendingGet(authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * - * @type {string} - * @memberof StateModel + * @summary List of Change Cost for a specific need + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - longitude?: string; + apiV2NeedNeedIdChangeCostGet( + authorization: string, + needId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ChangeCostAPIApiFetchParamCreator( + configuration, + ).apiV2NeedNeedIdChangeCostGet(authorization, needId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * - * @type {string} - * @memberof StateModel + * @summary Accept a change cost of a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {number} id + * @param {number} [to] 0 to 2147483647 + * @param {string} [description] max len: 128 + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - iso2?: string; + apiV2NeedNeedIdChangeCostIdAcceptPost( + authorization: string, + needId: number, + id: number, + to?: number, + description?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ChangeCostAPIApiFetchParamCreator( + configuration, + ).apiV2NeedNeedIdChangeCostIdAcceptPost( + authorization, + needId, + id, + to, + description, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * - * @type {string} - * @memberof StateModel + * @summary Reject a change cost of a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {number} id + * @param {string} [rejectCause] + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - fipsCode?: string; + apiV2NeedNeedIdChangeCostIdRejectPost( + authorization: string, + needId: number, + id: number, + rejectCause?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ChangeCostAPIApiFetchParamCreator( + configuration, + ).apiV2NeedNeedIdChangeCostIdRejectPost( + authorization, + needId, + id, + rejectCause, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * - * @type {string} - * @memberof StateModel + * @summary Request to change cost of a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {number} to 0 to 2147483647 + * @param {string} [description] max len: 128 + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - type?: string; -} + apiV2NeedNeedIdChangeCostPut( + authorization: string, + needId: number, + to: number, + description?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ChangeCostAPIApiFetchParamCreator( + configuration, + ).apiV2NeedNeedIdChangeCostPut( + authorization, + needId, + to, + description, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + }; +}; /** - * + * ChangeCostAPIApi - factory interface * @export - * @interface UserChildModelV3 */ -export interface UserChildModelV3 { - /** - * - * @type {string} - * @memberof UserChildModelV3 - */ - avatarUrl?: string; - /** - * - * @type {string} - * @memberof UserChildModelV3 - */ - bio?: string; +export const ChangeCostAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { /** * - * @type {string} - * @memberof UserChildModelV3 + * @summary List of pending change cost requests + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - biosummary?: string; + apiV2ChangeCostPendingGet(authorization: string, options?: any) { + return ChangeCostAPIApiFp(configuration).apiV2ChangeCostPendingGet( + authorization, + options, + )(fetch, basePath); + }, /** * - * @type {string} - * @memberof UserChildModelV3 + * @summary List of Change Cost for a specific need + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - birthdate?: string; + apiV2NeedNeedIdChangeCostGet( + authorization: string, + needId: number, + options?: any, + ) { + return ChangeCostAPIApiFp(configuration).apiV2NeedNeedIdChangeCostGet( + authorization, + needId, + options, + )(fetch, basePath); + }, /** * - * @type {number} - * @memberof UserChildModelV3 + * @summary Accept a change cost of a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {number} id + * @param {number} [to] 0 to 2147483647 + * @param {string} [description] max len: 128 + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - doneNeedsCount?: number; + apiV2NeedNeedIdChangeCostIdAcceptPost( + authorization: string, + needId: number, + id: number, + to?: number, + description?: string, + options?: any, + ) { + return ChangeCostAPIApiFp( + configuration, + ).apiV2NeedNeedIdChangeCostIdAcceptPost( + authorization, + needId, + id, + to, + description, + options, + )(fetch, basePath); + }, /** * - * @type {number} - * @memberof UserChildModelV3 + * @summary Reject a change cost of a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {number} id + * @param {string} [rejectCause] + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - existenceStatus?: number; + apiV2NeedNeedIdChangeCostIdRejectPost( + authorization: string, + needId: number, + id: number, + rejectCause?: string, + options?: any, + ) { + return ChangeCostAPIApiFp( + configuration, + ).apiV2NeedNeedIdChangeCostIdRejectPost( + authorization, + needId, + id, + rejectCause, + options, + )(fetch, basePath); + }, /** * - * @type {number} - * @memberof UserChildModelV3 + * @summary Request to change cost of a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {number} to 0 to 2147483647 + * @param {string} [description] max len: 128 + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - familyId?: number; + apiV2NeedNeedIdChangeCostPut( + authorization: string, + needId: number, + to: number, + description?: string, + options?: any, + ) { + return ChangeCostAPIApiFp(configuration).apiV2NeedNeedIdChangeCostPut( + authorization, + needId, + to, + description, + options, + )(fetch, basePath); + }, + }; +}; + +/** + * ChangeCostAPIApi - object-oriented interface + * @export + * @class ChangeCostAPIApi + * @extends {BaseAPI} + */ +export class ChangeCostAPIApi extends BaseAPI { + /** + * + * @summary List of pending change cost requests + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChangeCostAPIApi + */ + public apiV2ChangeCostPendingGet(authorization: string, options?: any) { + return ChangeCostAPIApiFp(this.configuration).apiV2ChangeCostPendingGet( + authorization, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary List of Change Cost for a specific need + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChangeCostAPIApi + */ + public apiV2NeedNeedIdChangeCostGet( + authorization: string, + needId: number, + options?: any, + ) { + return ChangeCostAPIApiFp(this.configuration).apiV2NeedNeedIdChangeCostGet( + authorization, + needId, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Accept a change cost of a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {number} id + * @param {number} [to] 0 to 2147483647 + * @param {string} [description] max len: 128 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChangeCostAPIApi + */ + public apiV2NeedNeedIdChangeCostIdAcceptPost( + authorization: string, + needId: number, + id: number, + to?: number, + description?: string, + options?: any, + ) { + return ChangeCostAPIApiFp( + this.configuration, + ).apiV2NeedNeedIdChangeCostIdAcceptPost( + authorization, + needId, + id, + to, + description, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Reject a change cost of a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {number} id + * @param {string} [rejectCause] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChangeCostAPIApi + */ + public apiV2NeedNeedIdChangeCostIdRejectPost( + authorization: string, + needId: number, + id: number, + rejectCause?: string, + options?: any, + ) { + return ChangeCostAPIApiFp( + this.configuration, + ).apiV2NeedNeedIdChangeCostIdRejectPost( + authorization, + needId, + id, + rejectCause, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Request to change cost of a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {number} to 0 to 2147483647 + * @param {string} [description] max len: 128 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChangeCostAPIApi + */ + public apiV2NeedNeedIdChangeCostPut( + authorization: string, + needId: number, + to: number, + description?: string, + options?: any, + ) { + return ChangeCostAPIApiFp(this.configuration).apiV2NeedNeedIdChangeCostPut( + authorization, + needId, + to, + description, + options, + )(this.fetch, this.basePath); + } +} + +/** + * CheckAPIApi - fetch parameter creator + * @export + */ +export const CheckAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { /** * - * @type {string} - * @memberof UserChildModelV3 + * @summary Check Email status + * @param {string} email + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - gender?: string; + apiV2CheckEmailEmailGet(email: string, options: any = {}): FetchArgs { + // verify required parameter 'email' is not null or undefined + if (email === null || email === undefined) { + throw new RequiredError( + 'email', + 'Required parameter email was null or undefined when calling apiV2CheckEmailEmailGet.', + ); + } + const localVarPath = `/api/v2/check/email/{email}`.replace( + `{${'email'}}`, + encodeURIComponent(String(email)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @type {string} - * @memberof UserChildModelV3 + * @summary Check Phone status + * @param {string} phone + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - generatedcode?: string; + apiV2CheckPhonePhoneGet(phone: string, options: any = {}): FetchArgs { + // verify required parameter 'phone' is not null or undefined + if (phone === null || phone === undefined) { + throw new RequiredError( + 'phone', + 'Required parameter phone was null or undefined when calling apiV2CheckPhonePhoneGet.', + ); + } + const localVarPath = `/api/v2/check/phone/{phone}`.replace( + `{${'phone'}}`, + encodeURIComponent(String(phone)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @type {number} - * @memberof UserChildModelV3 + * @summary Check Username status + * @param {string} username + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - id?: number; + apiV2CheckUsernameUsernameGet( + username: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError( + 'username', + 'Required parameter username was null or undefined when calling apiV2CheckUsernameUsernameGet.', + ); + } + const localVarPath = `/api/v2/check/username/{username}`.replace( + `{${'username'}}`, + encodeURIComponent(String(username)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; + +/** + * CheckAPIApi - functional programming interface + * @export + */ +export const CheckAPIApiFp = function (configuration?: Configuration) { + return { /** * - * @type {boolean} - * @memberof UserChildModelV3 + * @summary Check Email status + * @param {string} email + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - isGone?: boolean; + apiV2CheckEmailEmailGet( + email: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CheckAPIApiFetchParamCreator( + configuration, + ).apiV2CheckEmailEmailGet(email, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, /** * - * @type {string} - * @memberof UserChildModelV3 + * @summary Check Phone status + * @param {string} phone + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - sayname?: string; + apiV2CheckPhonePhoneGet( + phone: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CheckAPIApiFetchParamCreator( + configuration, + ).apiV2CheckPhonePhoneGet(phone, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, /** * - * @type {number} - * @memberof UserChildModelV3 + * @summary Check Username status + * @param {string} username + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - spentCredit?: number; + apiV2CheckUsernameUsernameGet( + username: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CheckAPIApiFetchParamCreator( + configuration, + ).apiV2CheckUsernameUsernameGet(username, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + }; +}; + +/** + * CheckAPIApi - factory interface + * @export + */ +export const CheckAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { /** * - * @type {string} - * @memberof UserChildModelV3 + * @summary Check Email status + * @param {string} email + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - voiceurl?: string; + apiV2CheckEmailEmailGet(email: string, options?: any) { + return CheckAPIApiFp(configuration).apiV2CheckEmailEmailGet( + email, + options, + )(fetch, basePath); + }, /** * - * @type {string} - * @memberof UserChildModelV3 + * @summary Check Phone status + * @param {string} phone + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - socialWorkerGeneratedCode?: string; + apiV2CheckPhonePhoneGet(phone: string, options?: any) { + return CheckAPIApiFp(configuration).apiV2CheckPhonePhoneGet( + phone, + options, + )(fetch, basePath); + }, /** * - * @type {FamilyMembers} - * @memberof UserChildModelV3 + * @summary Check Username status + * @param {string} username + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - childFamilyMembers?: FamilyMembers; + apiV2CheckUsernameUsernameGet(username: string, options?: any) { + return CheckAPIApiFp(configuration).apiV2CheckUsernameUsernameGet( + username, + options, + )(fetch, basePath); + }, + }; +}; + +/** + * CheckAPIApi - object-oriented interface + * @export + * @class CheckAPIApi + * @extends {BaseAPI} + */ +export class CheckAPIApi extends BaseAPI { + /** + * + * @summary Check Email status + * @param {string} email + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CheckAPIApi + */ + public apiV2CheckEmailEmailGet(email: string, options?: any) { + return CheckAPIApiFp(this.configuration).apiV2CheckEmailEmailGet( + email, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Check Phone status + * @param {string} phone + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CheckAPIApi + */ + public apiV2CheckPhonePhoneGet(phone: string, options?: any) { + return CheckAPIApiFp(this.configuration).apiV2CheckPhonePhoneGet( + phone, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Check Username status + * @param {string} username + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CheckAPIApi + */ + public apiV2CheckUsernameUsernameGet(username: string, options?: any) { + return CheckAPIApiFp(this.configuration).apiV2CheckUsernameUsernameGet( + username, + options, + )(this.fetch, this.basePath); + } } /** - * + * ChildAPIApi - fetch parameter creator * @export - * @interface UserModel */ -export interface UserModel { - /** - * the user's id - * @type {number} - * @memberof UserModel - */ - id?: number; - /** - * the user's first name - * @type {string} - * @memberof UserModel - */ - firstName?: string; - /** - * the user's last name - * @type {string} - * @memberof UserModel - */ - lastName?: string; - /** - * the user's username - * @type {string} - * @memberof UserModel - */ - userName?: string; - /** - * the user's phone number - * @type {string} - * @memberof UserModel - */ - phoneNumber?: string; - /** - * the user's credit amount in integer - * @type {number} - * @memberof UserModel - */ - credit?: number; - /** - * the user's international country code - * @type {number} - * @memberof UserModel - */ - country?: number; - /** - * the user's international city code - * @type {number} - * @memberof UserModel - */ - city?: number; - /** - * the user's avatar image path - * @type {string} - * @memberof UserModel - */ - avatarUrl?: string; - /** - * the user's gender, true for male and false for female - * @type {boolean} - * @memberof UserModel - */ - gender?: boolean; - /** - * the user's email address in correct format - * @type {string} - * @memberof UserModel - */ - emailAddress?: string; - /** - * the user's birth date - * @type {string} - * @memberof UserModel - */ - birthDate?: string; - /** - * the user's password, stored as a hashed string - * @type {string} - * @memberof UserModel - */ - password?: string; - /** - * the user's total credit spent - * @type {number} - * @memberof UserModel - */ - spentCredit?: number; - /** - * the date that the user has been created - * @type {string} - * @memberof UserModel - */ - created?: string; - /** - * the last date that the user has been updated - * @type {string} - * @memberof UserModel - */ - updated?: string; - /** - * determines if the user is deleted or not - * @type {boolean} - * @memberof UserModel - */ - isDeleted?: boolean; - /** - * the last date that the user has logged in - * @type {string} - * @memberof UserModel - */ - lastLogin?: string; - /** - * the needs that user has done for their children - * @type {string} - * @memberof UserModel - */ - doneNeedCount?: string; -} - - -/** - * AuthAPIApi - fetch parameter creator - * @export - */ -export const AuthAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Login API - * @param {string} username - * @param {string} password - * @param {number} isInstalled - * @param {string} lang - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthLoginPost(username: string, password: string, isInstalled: number, lang: string, options: any = {}): FetchArgs { - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username', 'Required parameter username was null or undefined when calling apiV2AuthLoginPost.'); - } - // verify required parameter 'password' is not null or undefined - if (password === null || password === undefined) { - throw new RequiredError('password', 'Required parameter password was null or undefined when calling apiV2AuthLoginPost.'); - } - // verify required parameter 'isInstalled' is not null or undefined - if (isInstalled === null || isInstalled === undefined) { - throw new RequiredError('isInstalled', 'Required parameter isInstalled was null or undefined when calling apiV2AuthLoginPost.'); - } - // verify required parameter 'lang' is not null or undefined - if (lang === null || lang === undefined) { - throw new RequiredError('lang', 'Required parameter lang was null or undefined when calling apiV2AuthLoginPost.'); - } - const localVarPath = `/api/v2/auth/login`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (lang !== undefined) { - localVarQueryParameter['_lang'] = lang; - } - - if (username !== undefined) { - localVarFormParams.set('username', username as any); - } - - if (password !== undefined) { - localVarFormParams.set('password', password as any); - } - - if (isInstalled !== undefined) { - localVarFormParams.set('isInstalled', isInstalled as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Logout (Access Token) API - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthLogoutTokenPost(authorization: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2AuthLogoutTokenPost.'); - } - const localVarPath = `/api/v2/auth/logout/token`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Confirm Reset Password API - * @param {string} token - * @param {string} password - * @param {string} confirmPassword - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthPasswordResetConfirmTokentokenPost(token: string, password: string, confirmPassword: string, options: any = {}): FetchArgs { - // verify required parameter 'token' is not null or undefined - if (token === null || token === undefined) { - throw new RequiredError('token', 'Required parameter token was null or undefined when calling apiV2AuthPasswordResetConfirmTokentokenPost.'); - } - // verify required parameter 'password' is not null or undefined - if (password === null || password === undefined) { - throw new RequiredError('password', 'Required parameter password was null or undefined when calling apiV2AuthPasswordResetConfirmTokentokenPost.'); - } - // verify required parameter 'confirmPassword' is not null or undefined - if (confirmPassword === null || confirmPassword === undefined) { - throw new RequiredError('confirmPassword', 'Required parameter confirmPassword was null or undefined when calling apiV2AuthPasswordResetConfirmTokentokenPost.'); - } - const localVarPath = `/api/v2/auth/password/reset/confirm/token={token}` - .replace(`{${"token"}}`, encodeURIComponent(String(token))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (password !== undefined) { - localVarFormParams.set('password', password as any); - } - - if (confirmPassword !== undefined) { - localVarFormParams.set('confirm_password', confirmPassword as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Reset Password API by email - * @param {string} email - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthPasswordResetEmailPost(email: string, options: any = {}): FetchArgs { - // verify required parameter 'email' is not null or undefined - if (email === null || email === undefined) { - throw new RequiredError('email', 'Required parameter email was null or undefined when calling apiV2AuthPasswordResetEmailPost.'); - } - const localVarPath = `/api/v2/auth/password/reset/email`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (email !== undefined) { - localVarFormParams.set('email', email as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Reset Password API by sms - * @param {string} phoneNumber - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthPasswordResetPhonePost(phoneNumber: string, options: any = {}): FetchArgs { - // verify required parameter 'phoneNumber' is not null or undefined - if (phoneNumber === null || phoneNumber === undefined) { - throw new RequiredError('phoneNumber', 'Required parameter phoneNumber was null or undefined when calling apiV2AuthPasswordResetPhonePost.'); - } - const localVarPath = `/api/v2/auth/password/reset/phone`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (phoneNumber !== undefined) { - localVarFormParams.set('phoneNumber', phoneNumber as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Register API - * @param {string} username - * @param {string} phoneNumber - * @param {string} username2 - * @param {string} password - * @param {string} verifyCode - * @param {number} isInstalled - * @param {string} lang - * @param {number} [cityId] - * @param {string} [email] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthRegisterPost(username: string, phoneNumber: string, username2: string, password: string, verifyCode: string, isInstalled: number, lang: string, cityId?: number, email?: string, options: any = {}): FetchArgs { - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username', 'Required parameter username was null or undefined when calling apiV2AuthRegisterPost.'); - } - // verify required parameter 'phoneNumber' is not null or undefined - if (phoneNumber === null || phoneNumber === undefined) { - throw new RequiredError('phoneNumber', 'Required parameter phoneNumber was null or undefined when calling apiV2AuthRegisterPost.'); - } - // verify required parameter 'username2' is not null or undefined - if (username2 === null || username2 === undefined) { - throw new RequiredError('username2', 'Required parameter username2 was null or undefined when calling apiV2AuthRegisterPost.'); - } - // verify required parameter 'password' is not null or undefined - if (password === null || password === undefined) { - throw new RequiredError('password', 'Required parameter password was null or undefined when calling apiV2AuthRegisterPost.'); - } - // verify required parameter 'verifyCode' is not null or undefined - if (verifyCode === null || verifyCode === undefined) { - throw new RequiredError('verifyCode', 'Required parameter verifyCode was null or undefined when calling apiV2AuthRegisterPost.'); - } - // verify required parameter 'isInstalled' is not null or undefined - if (isInstalled === null || isInstalled === undefined) { - throw new RequiredError('isInstalled', 'Required parameter isInstalled was null or undefined when calling apiV2AuthRegisterPost.'); - } - // verify required parameter 'lang' is not null or undefined - if (lang === null || lang === undefined) { - throw new RequiredError('lang', 'Required parameter lang was null or undefined when calling apiV2AuthRegisterPost.'); - } - const localVarPath = `/api/v2/auth/register`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (lang !== undefined) { - localVarQueryParameter['_lang'] = lang; - } - - if (username !== undefined) { - localVarFormParams.set('username', username as any); - } - - if (phoneNumber !== undefined) { - localVarFormParams.set('phoneNumber', phoneNumber as any); - } - - if (cityId !== undefined) { - localVarFormParams.set('cityId', cityId as any); - } - - if (username2 !== undefined) { - localVarFormParams.set('username', username2 as any); - } - - if (email !== undefined) { - localVarFormParams.set('email', email as any); - } - - if (password !== undefined) { - localVarFormParams.set('password', password as any); - } - - if (verifyCode !== undefined) { - localVarFormParams.set('verifyCode', verifyCode as any); - } - - if (isInstalled !== undefined) { - localVarFormParams.set('isInstalled', isInstalled as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * AuthAPIApi - functional programming interface - * @export - */ -export const AuthAPIApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Login API - * @param {string} username - * @param {string} password - * @param {number} isInstalled - * @param {string} lang - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthLoginPost(username: string, password: string, isInstalled: number, lang: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = AuthAPIApiFetchParamCreator(configuration).apiV2AuthLoginPost(username, password, isInstalled, lang, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Logout (Access Token) API - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthLogoutTokenPost(authorization: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = AuthAPIApiFetchParamCreator(configuration).apiV2AuthLogoutTokenPost(authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Confirm Reset Password API - * @param {string} token - * @param {string} password - * @param {string} confirmPassword - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthPasswordResetConfirmTokentokenPost(token: string, password: string, confirmPassword: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = AuthAPIApiFetchParamCreator(configuration).apiV2AuthPasswordResetConfirmTokentokenPost(token, password, confirmPassword, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Reset Password API by email - * @param {string} email - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthPasswordResetEmailPost(email: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = AuthAPIApiFetchParamCreator(configuration).apiV2AuthPasswordResetEmailPost(email, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Reset Password API by sms - * @param {string} phoneNumber - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthPasswordResetPhonePost(phoneNumber: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = AuthAPIApiFetchParamCreator(configuration).apiV2AuthPasswordResetPhonePost(phoneNumber, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Register API - * @param {string} username - * @param {string} phoneNumber - * @param {string} username2 - * @param {string} password - * @param {string} verifyCode - * @param {number} isInstalled - * @param {string} lang - * @param {number} [cityId] - * @param {string} [email] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthRegisterPost(username: string, phoneNumber: string, username2: string, password: string, verifyCode: string, isInstalled: number, lang: string, cityId?: number, email?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = AuthAPIApiFetchParamCreator(configuration).apiV2AuthRegisterPost(username, phoneNumber, username2, password, verifyCode, isInstalled, lang, cityId, email, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - } -}; - -/** - * AuthAPIApi - factory interface - * @export - */ -export const AuthAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * - * @summary Login API - * @param {string} username - * @param {string} password - * @param {number} isInstalled - * @param {string} lang - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthLoginPost(username: string, password: string, isInstalled: number, lang: string, options?: any) { - return AuthAPIApiFp(configuration).apiV2AuthLoginPost(username, password, isInstalled, lang, options)(fetch, basePath); - }, - /** - * - * @summary Logout (Access Token) API - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthLogoutTokenPost(authorization: string, options?: any) { - return AuthAPIApiFp(configuration).apiV2AuthLogoutTokenPost(authorization, options)(fetch, basePath); - }, - /** - * - * @summary Confirm Reset Password API - * @param {string} token - * @param {string} password - * @param {string} confirmPassword - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthPasswordResetConfirmTokentokenPost(token: string, password: string, confirmPassword: string, options?: any) { - return AuthAPIApiFp(configuration).apiV2AuthPasswordResetConfirmTokentokenPost(token, password, confirmPassword, options)(fetch, basePath); - }, - /** - * - * @summary Reset Password API by email - * @param {string} email - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthPasswordResetEmailPost(email: string, options?: any) { - return AuthAPIApiFp(configuration).apiV2AuthPasswordResetEmailPost(email, options)(fetch, basePath); - }, - /** - * - * @summary Reset Password API by sms - * @param {string} phoneNumber - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthPasswordResetPhonePost(phoneNumber: string, options?: any) { - return AuthAPIApiFp(configuration).apiV2AuthPasswordResetPhonePost(phoneNumber, options)(fetch, basePath); - }, - /** - * - * @summary Register API - * @param {string} username - * @param {string} phoneNumber - * @param {string} username2 - * @param {string} password - * @param {string} verifyCode - * @param {number} isInstalled - * @param {string} lang - * @param {number} [cityId] - * @param {string} [email] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthRegisterPost(username: string, phoneNumber: string, username2: string, password: string, verifyCode: string, isInstalled: number, lang: string, cityId?: number, email?: string, options?: any) { - return AuthAPIApiFp(configuration).apiV2AuthRegisterPost(username, phoneNumber, username2, password, verifyCode, isInstalled, lang, cityId, email, options)(fetch, basePath); - }, - }; -}; - -/** - * AuthAPIApi - object-oriented interface - * @export - * @class AuthAPIApi - * @extends {BaseAPI} - */ -export class AuthAPIApi extends BaseAPI { +export const ChildAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { /** * - * @summary Login API - * @param {string} username - * @param {string} password - * @param {number} isInstalled - * @param {string} lang + * @summary Get all active children + * @param {string} authorization Access Token * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof AuthAPIApi */ - public apiV2AuthLoginPost(username: string, password: string, isInstalled: number, lang: string, options?: any) { - return AuthAPIApiFp(this.configuration).apiV2AuthLoginPost(username, password, isInstalled, lang, options)(this.fetch, this.basePath); - } - + apiV2ChildActivesGet(authorization: string, options: any = {}): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2ChildActivesGet.', + ); + } + const localVarPath = `/api/v2/child/actives`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** - * - * @summary Logout (Access Token) API + * Adds a new child.
Calling this API affects child and social_worker tables.
Adding firstName, lastName, nationality, birthPlace, address, housingStatus, familyCount, education and status are optional.
For awakeAvatarUrl and voiceUrl you have to upload a file; for avatar in png, jpg or jpeg and for voice in wav, m4a, wma, mp3, aac or ogg format.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities and the same rule is applied for nationality and birthPlace.
Here is a guide for the codes used in this API:
gender: [true]male, [false]female
housingStatus: [0]homeless, [1]rent, [2]has home, [3]with relatives
education: [-1]uneducated, [0]pre-school, [1]1st grade, [2]2nd grade, ...
(no code has been assigned to status yet)
+ * @summary add a child * @param {string} authorization Access Token + * @param {any} awakeAvatarUrl + * @param {any} sleptAvatarUrl + * @param {any} voiceUrl + * @param {string} saynameTranslations {\"en\": \"Bob\", \"fa\": \"بابک\"} + * @param {string} bioTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {string} bioSummaryTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {string} phoneNumber + * @param {number} country + * @param {number} city + * @param {boolean} gender + * @param {number} [ngoId] + * @param {number} [swId] + * @param {string} [firstNameTranslations] + * @param {string} [lastNameTranslations] + * @param {number} [nationality] + * @param {string} [birthPlace] + * @param {string} [birthDate] + * @param {string} [address] + * @param {number} [housingStatus] + * @param {number} [familyCount] + * @param {number} [education] + * @param {number} [status] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof AuthAPIApi */ - public apiV2AuthLogoutTokenPost(authorization: string, options?: any) { - return AuthAPIApiFp(this.configuration).apiV2AuthLogoutTokenPost(authorization, options)(this.fetch, this.basePath); - } - + apiV2ChildAddPost( + authorization: string, + awakeAvatarUrl: any, + sleptAvatarUrl: any, + voiceUrl: any, + saynameTranslations: string, + bioTranslations: string, + bioSummaryTranslations: string, + phoneNumber: string, + country: number, + city: number, + gender: boolean, + ngoId?: number, + swId?: number, + firstNameTranslations?: string, + lastNameTranslations?: string, + nationality?: number, + birthPlace?: string, + birthDate?: string, + address?: string, + housingStatus?: number, + familyCount?: number, + education?: number, + status?: number, + options: any = {}, + ): FetchArgs { + + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2ChildAddPost.', + ); + } + // verify required parameter 'awakeAvatarUrl' is not null or undefined + if (awakeAvatarUrl === null || awakeAvatarUrl === undefined) { + throw new RequiredError( + 'awakeAvatarUrl', + 'Required parameter awakeAvatarUrl was null or undefined when calling apiV2ChildAddPost.', + ); + } + // verify required parameter 'sleptAvatarUrl' is not null or undefined + if (sleptAvatarUrl === null || sleptAvatarUrl === undefined) { + throw new RequiredError( + 'sleptAvatarUrl', + 'Required parameter sleptAvatarUrl was null or undefined when calling apiV2ChildAddPost.', + ); + } + // verify required parameter 'voiceUrl' is not null or undefined + if (voiceUrl === null || voiceUrl === undefined) { + throw new RequiredError( + 'voiceUrl', + 'Required parameter voiceUrl was null or undefined when calling apiV2ChildAddPost.', + ); + } + // verify required parameter 'saynameTranslations' is not null or undefined + if (saynameTranslations === null || saynameTranslations === undefined) { + throw new RequiredError( + 'saynameTranslations', + 'Required parameter saynameTranslations was null or undefined when calling apiV2ChildAddPost.', + ); + } + // verify required parameter 'bioTranslations' is not null or undefined + if (bioTranslations === null || bioTranslations === undefined) { + throw new RequiredError( + 'bioTranslations', + 'Required parameter bioTranslations was null or undefined when calling apiV2ChildAddPost.', + ); + } + // verify required parameter 'bioSummaryTranslations' is not null or undefined + if ( + bioSummaryTranslations === null || + bioSummaryTranslations === undefined + ) { + throw new RequiredError( + 'bioSummaryTranslations', + 'Required parameter bioSummaryTranslations was null or undefined when calling apiV2ChildAddPost.', + ); + } + // verify required parameter 'phoneNumber' is not null or undefined + if (phoneNumber === null || phoneNumber === undefined) { + throw new RequiredError( + 'phoneNumber', + 'Required parameter phoneNumber was null or undefined when calling apiV2ChildAddPost.', + ); + } + // verify required parameter 'country' is not null or undefined + if (country === null || country === undefined) { + throw new RequiredError( + 'country', + 'Required parameter country was null or undefined when calling apiV2ChildAddPost.', + ); + } + // verify required parameter 'city' is not null or undefined + if (city === null || city === undefined) { + throw new RequiredError( + 'city', + 'Required parameter city was null or undefined when calling apiV2ChildAddPost.', + ); + } + // verify required parameter 'gender' is not null or undefined + if (gender === null || gender === undefined) { + throw new RequiredError( + 'gender', + 'Required parameter gender was null or undefined when calling apiV2ChildAddPost.', + ); + } + + + const localVarPath = `/api/v2/child/add/`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (ngoId !== undefined) { + localVarFormParams.set('ngo_id', ngoId as any); + } + + if (swId !== undefined) { + localVarFormParams.set('sw_id', swId as any); + } + + if (awakeAvatarUrl !== undefined) { + localVarFormParams.set('awakeAvatarUrl', awakeAvatarUrl as any); + } + + if (sleptAvatarUrl !== undefined) { + localVarFormParams.set('sleptAvatarUrl', sleptAvatarUrl as any); + } + + if (voiceUrl !== undefined) { + localVarFormParams.set('voiceUrl', voiceUrl as any); + } + + if (firstNameTranslations !== undefined) { + localVarFormParams.set( + 'firstName_translations', + firstNameTranslations as any, + ); + } + + if (lastNameTranslations !== undefined) { + localVarFormParams.set( + 'lastName_translations', + lastNameTranslations as any, + ); + } + + if (saynameTranslations !== undefined) { + localVarFormParams.set( + 'sayname_translations', + saynameTranslations as any, + ); + } + + if (bioTranslations !== undefined) { + localVarFormParams.set('bio_translations', bioTranslations as any); + } + + if (bioSummaryTranslations !== undefined) { + localVarFormParams.set( + 'bio_summary_translations', + bioSummaryTranslations as any, + ); + } + + if (phoneNumber !== undefined) { + localVarFormParams.set('phoneNumber', phoneNumber as any); + } + + if (nationality !== undefined) { + localVarFormParams.set('nationalityId', nationality as any); + } + + if (country !== undefined) { + localVarFormParams.set('country', country as any); + } + + if (city !== undefined) { + localVarFormParams.set('city', city as any); + } + + if (gender !== undefined) { + localVarFormParams.set('gender', gender as any); + } + + if (birthPlace !== undefined) { + localVarFormParams.set('birthPlaceId', birthPlace as any); + } + + if (birthDate !== undefined) { + localVarFormParams.set('birthDate', birthDate as any); + } + + if (address !== undefined) { + localVarFormParams.set('address', address as any); + } + + if (housingStatus !== undefined) { + localVarFormParams.set('housingStatus', housingStatus as any); + } + + if (familyCount !== undefined) { + localVarFormParams.set('familyCount', familyCount as any); + } + + if (education !== undefined) { + localVarFormParams.set('education', education as any); + } + + if (status !== undefined) { + localVarFormParams.set('status', status as any); + } + + console.log(localVarFormParams); + + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** - * - * @summary Confirm Reset Password API - * @param {string} token - * @param {string} password - * @param {string} confirmPassword + * Returns information of all children as a json object.
Json key is child id and json value is children data.
Calling this API affects on child, need, child_need, need_family and user tables.
It contains children info, their needs and participants of those needs. Confirm tag determines the type of output:
[0]for not confirmed children only, [1]for confirmed children only, [2]for both confirmed and not confirmed children
+ * @summary get all children + * @param {string} authorization Access Token + * @param {number} confirm + * @param {any} [ngoId] + * @param {any} [swId] + * @param {any} [take] + * @param {any} [skip] + * @param {any} [existenceStatus] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof AuthAPIApi */ - public apiV2AuthPasswordResetConfirmTokentokenPost(token: string, password: string, confirmPassword: string, options?: any) { - return AuthAPIApiFp(this.configuration).apiV2AuthPasswordResetConfirmTokentokenPost(token, password, confirmPassword, options)(this.fetch, this.basePath); - } - + apiV2ChildAllConfirmconfirmGet( + authorization: string, + confirm: number, + ngoId?: any, + swId?: any, + take?: any, + skip?: any, + existenceStatus?: any, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2ChildAllConfirmconfirmGet.', + ); + } + // verify required parameter 'confirm' is not null or undefined + if (confirm === null || confirm === undefined) { + throw new RequiredError( + 'confirm', + 'Required parameter confirm was null or undefined when calling apiV2ChildAllConfirmconfirmGet.', + ); + } + const localVarPath = `/api/v2/child/all/confirm={confirm}`.replace( + `{${'confirm'}}`, + encodeURIComponent(String(confirm)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (ngoId !== undefined) { + localVarQueryParameter['ngo_id'] = ngoId; + } + + if (swId !== undefined) { + localVarQueryParameter['sw_id'] = swId; + } + + if (take !== undefined) { + localVarQueryParameter['take'] = take; + } + + if (skip !== undefined) { + localVarQueryParameter['skip'] = skip; + } + + if (existenceStatus !== undefined) { + localVarQueryParameter['existence_status'] = existenceStatus; + } + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @summary Reset Password API by email - * @param {string} email + * @summary get child needs summary + * @param {string} authorization Access Token + * @param {number} childId + * @param {boolean} [isDone] + * @param {number} [status] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof AuthAPIApi */ - public apiV2AuthPasswordResetEmailPost(email: string, options?: any) { - return AuthAPIApiFp(this.configuration).apiV2AuthPasswordResetEmailPost(email, options)(this.fetch, this.basePath); - } - + apiV2ChildChildIdNeedsSummaryGet( + authorization: string, + childId: number, + isDone?: boolean, + status?: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2ChildChildIdNeedsSummaryGet.', + ); + } + // verify required parameter 'childId' is not null or undefined + if (childId === null || childId === undefined) { + throw new RequiredError( + 'childId', + 'Required parameter childId was null or undefined when calling apiV2ChildChildIdNeedsSummaryGet.', + ); + } + const localVarPath = `/api/v2/child/{child_id}/needs/summary`.replace( + `{${'child_id'}}`, + encodeURIComponent(String(childId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (isDone !== undefined) { + localVarQueryParameter['isDone'] = isDone; + } + + if (status !== undefined) { + localVarQueryParameter['status'] = status; + } + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @summary Reset Password API by sms - * @param {string} phoneNumber + * @summary get child needs + * @param {string} authorization Access Token + * @param {number} childId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof AuthAPIApi */ - public apiV2AuthPasswordResetPhonePost(phoneNumber: string, options?: any) { - return AuthAPIApiFp(this.configuration).apiV2AuthPasswordResetPhonePost(phoneNumber, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Register API - * @param {string} username - * @param {string} phoneNumber - * @param {string} username2 - * @param {string} password - * @param {string} verifyCode - * @param {number} isInstalled - * @param {string} lang - * @param {number} [cityId] - * @param {string} [email] + apiV2ChildChildIdchildIdNeedsGet( + authorization: string, + childId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2ChildChildIdchildIdNeedsGet.', + ); + } + // verify required parameter 'childId' is not null or undefined + if (childId === null || childId === undefined) { + throw new RequiredError( + 'childId', + 'Required parameter childId was null or undefined when calling apiV2ChildChildIdchildIdNeedsGet.', + ); + } + const localVarPath = `/api/v2/child/childId={child_id}/needs`.replace( + `{${'child_id'}}`, + encodeURIComponent(String(childId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns information of a child with given id as a json object.
Calling this API affects on child, need, child_need and need_family and user tables.
It contains child info, its needs and participants of those needs.
Confirm parameter determines how do you want the result:
[0]not confirmed, [1] confirmed, [2]both
+ * @summary get child by id + * @param {string} authorization Access Token + * @param {number} childId + * @param {number} confirm * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof AuthAPIApi */ - public apiV2AuthRegisterPost(username: string, phoneNumber: string, username2: string, password: string, verifyCode: string, isInstalled: number, lang: string, cityId?: number, email?: string, options?: any) { - return AuthAPIApiFp(this.configuration).apiV2AuthRegisterPost(username, phoneNumber, username2, password, verifyCode, isInstalled, lang, cityId, email, options)(this.fetch, this.basePath); - } - -} - -/** - * CartAPIApi - fetch parameter creator - * @export - */ -export const CartAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Get Cart - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2MycartGet(authorization: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2MycartGet.'); - } - const localVarPath = `/api/v2/mycart`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Delete a Need from Cart - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2MycartNeedsDelete(authorization: string, needId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2MycartNeedsDelete.'); - } - // verify required parameter 'needId' is not null or undefined - if (needId === null || needId === undefined) { - throw new RequiredError('needId', 'Required parameter needId was null or undefined when calling apiV2MycartNeedsDelete.'); - } - const localVarPath = `/api/v2/mycart/needs`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'DELETE' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (needId !== undefined) { - localVarFormParams.set('needId', needId as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Add a Need to Cart - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2MycartNeedsPost(authorization: string, needId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2MycartNeedsPost.'); - } - // verify required parameter 'needId' is not null or undefined - if (needId === null || needId === undefined) { - throw new RequiredError('needId', 'Required parameter needId was null or undefined when calling apiV2MycartNeedsPost.'); - } - const localVarPath = `/api/v2/mycart/needs`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (needId !== undefined) { - localVarFormParams.set('needId', needId as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Pay for Cart - * @param {string} authorization Access Token - * @param {number} [donation] - * @param {string} [useCredit] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2MycartPaymentPost(authorization: string, donation?: number, useCredit?: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2MycartPaymentPost.'); - } - const localVarPath = `/api/v2/mycart/payment`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (donation !== undefined) { - localVarFormParams.set('donation', donation as any); - } - - if (useCredit !== undefined) { - localVarFormParams.set('useCredit', useCredit as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Update Cart - * @param {string} authorization Access Token - * @param {Body} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2MycartPut(authorization: string, body: Body, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2MycartPut.'); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body', 'Required parameter body was null or undefined when calling apiV2MycartPut.'); - } - const localVarPath = `/api/v2/mycart`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PUT' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - const needsSerialization = ("Body" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (body || ""); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * CartAPIApi - functional programming interface - * @export - */ -export const CartAPIApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Get Cart - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2MycartGet(authorization: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CartAPIApiFetchParamCreator(configuration).apiV2MycartGet(authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Delete a Need from Cart - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2MycartNeedsDelete(authorization: string, needId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CartAPIApiFetchParamCreator(configuration).apiV2MycartNeedsDelete(authorization, needId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Add a Need to Cart - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2MycartNeedsPost(authorization: string, needId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CartAPIApiFetchParamCreator(configuration).apiV2MycartNeedsPost(authorization, needId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Pay for Cart - * @param {string} authorization Access Token - * @param {number} [donation] - * @param {string} [useCredit] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2MycartPaymentPost(authorization: string, donation?: number, useCredit?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CartAPIApiFetchParamCreator(configuration).apiV2MycartPaymentPost(authorization, donation, useCredit, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Update Cart - * @param {string} authorization Access Token - * @param {Body} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2MycartPut(authorization: string, body: Body, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CartAPIApiFetchParamCreator(configuration).apiV2MycartPut(authorization, body, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - } -}; - -/** - * CartAPIApi - factory interface - * @export - */ -export const CartAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * - * @summary Get Cart - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2MycartGet(authorization: string, options?: any) { - return CartAPIApiFp(configuration).apiV2MycartGet(authorization, options)(fetch, basePath); - }, - /** - * - * @summary Delete a Need from Cart - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2MycartNeedsDelete(authorization: string, needId: number, options?: any) { - return CartAPIApiFp(configuration).apiV2MycartNeedsDelete(authorization, needId, options)(fetch, basePath); - }, - /** - * - * @summary Add a Need to Cart - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2MycartNeedsPost(authorization: string, needId: number, options?: any) { - return CartAPIApiFp(configuration).apiV2MycartNeedsPost(authorization, needId, options)(fetch, basePath); - }, - /** - * - * @summary Pay for Cart - * @param {string} authorization Access Token - * @param {number} [donation] - * @param {string} [useCredit] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2MycartPaymentPost(authorization: string, donation?: number, useCredit?: string, options?: any) { - return CartAPIApiFp(configuration).apiV2MycartPaymentPost(authorization, donation, useCredit, options)(fetch, basePath); - }, - /** - * - * @summary Update Cart - * @param {string} authorization Access Token - * @param {Body} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2MycartPut(authorization: string, body: Body, options?: any) { - return CartAPIApiFp(configuration).apiV2MycartPut(authorization, body, options)(fetch, basePath); - }, - }; -}; - -/** - * CartAPIApi - object-oriented interface - * @export - * @class CartAPIApi - * @extends {BaseAPI} - */ -export class CartAPIApi extends BaseAPI { + apiV2ChildChildIdchildIdconfirmconfirmGet( + authorization: string, + childId: number, + confirm: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2ChildChildIdchildIdconfirmconfirmGet.', + ); + } + // verify required parameter 'childId' is not null or undefined + if (childId === null || childId === undefined) { + throw new RequiredError( + 'childId', + 'Required parameter childId was null or undefined when calling apiV2ChildChildIdchildIdconfirmconfirmGet.', + ); + } + // verify required parameter 'confirm' is not null or undefined + if (confirm === null || confirm === undefined) { + throw new RequiredError( + 'confirm', + 'Required parameter confirm was null or undefined when calling apiV2ChildChildIdchildIdconfirmconfirmGet.', + ); + } + const localVarPath = `/api/v2/child/childId={child_id}&confirm={confirm}` + .replace(`{${'child_id'}}`, encodeURIComponent(String(childId))) + .replace(`{${'confirm'}}`, encodeURIComponent(String(confirm))); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** - * - * @summary Get Cart + * Confirms a child, so you cannot delete it anymore but you can add needs to it.
Calling this API affect child, ngo, social_worker, child_need and family tables.
+ * @summary confirm a child * @param {string} authorization Access Token + * @param {number} childId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof CartAPIApi */ - public apiV2MycartGet(authorization: string, options?: any) { - return CartAPIApiFp(this.configuration).apiV2MycartGet(authorization, options)(this.fetch, this.basePath); - } - + apiV2ChildConfirmChildIdchildIdPatch( + authorization: string, + childId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2ChildConfirmChildIdchildIdPatch.', + ); + } + // verify required parameter 'childId' is not null or undefined + if (childId === null || childId === undefined) { + throw new RequiredError( + 'childId', + 'Required parameter childId was null or undefined when calling apiV2ChildConfirmChildIdchildIdPatch.', + ); + } + const localVarPath = `/api/v2/child/confirm/childId={child_id}`.replace( + `{${'child_id'}}`, + encodeURIComponent(String(childId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** - * - * @summary Delete a Need from Cart + * This API deletes a specific child. Only not confirmed children can be deleted.
Calling this API affects family table by updating a row and set isDeleted tag true, social_worker and ngo table by decreasing their currentChildrenCount field by 1 and child by setting isDeleted tag true for some rows.
We do not fully delete any rows.
+ * @summary delete a child * @param {string} authorization Access Token - * @param {number} needId + * @param {number} childId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof CartAPIApi */ - public apiV2MycartNeedsDelete(authorization: string, needId: number, options?: any) { - return CartAPIApiFp(this.configuration).apiV2MycartNeedsDelete(authorization, needId, options)(this.fetch, this.basePath); - } - + apiV2ChildDeleteChildIdchildIdPatch( + authorization: string, + childId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2ChildDeleteChildIdchildIdPatch.', + ); + } + // verify required parameter 'childId' is not null or undefined + if (childId === null || childId === undefined) { + throw new RequiredError( + 'childId', + 'Required parameter childId was null or undefined when calling apiV2ChildDeleteChildIdchildIdPatch.', + ); + } + const localVarPath = `/api/v2/child/delete/childId={child_id}`.replace( + `{${'child_id'}}`, + encodeURIComponent(String(childId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @summary Add a Need to Cart - * @param {string} authorization Access Token - * @param {number} needId + * @summary get child by invitation token + * @param {string} token + * @param {string} [authorization] Access Token * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof CartAPIApi */ - public apiV2MycartNeedsPost(authorization: string, needId: number, options?: any) { - return CartAPIApiFp(this.configuration).apiV2MycartNeedsPost(authorization, needId, options)(this.fetch, this.basePath); - } - + apiV2ChildInvitationsTokenGet( + token: string, + authorization?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'token' is not null or undefined + if (token === null || token === undefined) { + throw new RequiredError( + 'token', + 'Required parameter token was null or undefined when calling apiV2ChildInvitationsTokenGet.', + ); + } + const localVarPath = `/api/v2/child/invitations/{token}`.replace( + `{${'token'}}`, + encodeURIComponent(String(token)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** - * - * @summary Pay for Cart + * This API migrates a child.
It means that from the moment after migration, another social worker will cover the child's need.
The records of child will migrate too, so nothing is going to be missed or deleted.
Calling this API affects on child, social_worker, ngo, child_need, need and family tables.
It inserts a new record int child table for the migrated child and deactives the previous child's record.
+ * @summary migrate a child * @param {string} authorization Access Token - * @param {number} [donation] - * @param {string} [useCredit] + * @param {number} childId + * @param {number} newSwId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof CartAPIApi */ - public apiV2MycartPaymentPost(authorization: string, donation?: number, useCredit?: string, options?: any) { - return CartAPIApiFp(this.configuration).apiV2MycartPaymentPost(authorization, donation, useCredit, options)(this.fetch, this.basePath); - } - + apiV2ChildMigrateChildIdchildIdPatch( + authorization: string, + childId: number, + newSwId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2ChildMigrateChildIdchildIdPatch.', + ); + } + // verify required parameter 'childId' is not null or undefined + if (childId === null || childId === undefined) { + throw new RequiredError( + 'childId', + 'Required parameter childId was null or undefined when calling apiV2ChildMigrateChildIdchildIdPatch.', + ); + } + // verify required parameter 'newSwId' is not null or undefined + if (newSwId === null || newSwId === undefined) { + throw new RequiredError( + 'newSwId', + 'Required parameter newSwId was null or undefined when calling apiV2ChildMigrateChildIdchildIdPatch.', + ); + } + const localVarPath = `/api/v2/child/migrate/childId={child_id}`.replace( + `{${'child_id'}}`, + encodeURIComponent(String(childId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (newSwId !== undefined) { + localVarFormParams.set('new_sw_id', newSwId as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** - * - * @summary Update Cart + * All the fields are optional. You can fill every field you want to change, and it will update the desired child.
Calling this API only affects child table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
The same rule applied for nationality and birthPlace.
For voiceUrl and awakeAvatarUrl you have to upload a file; for avatar in png, jpg or jpeg and for voice in wav, m4a, wma, mp3, aac or ogg format.
Social workers can change their NGO by editing ngoId field.
+ * @summary update a child * @param {string} authorization Access Token - * @param {Body} body + * @param {number} childId + * @param {any} [awakeAvatarUrl] + * @param {any} [sleptAvatarUrl] + * @param {any} [voiceUrl] + * @param {string} [firstNameTranslations] + * @param {string} [saynameTranslations] {\"en\": \"Bob\", \"fa\": \"بابک\"} + * @param {string} [bioTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {string} [bioSummaryTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {string} [lastNameTranslations] + * @param {string} [sayName] + * @param {string} [phoneNumber] + * @param {number} [nationality] + * @param {number} [country] + * @param {number} [city] + * @param {boolean} [gender] + * @param {string} [birthPlace] + * @param {string} [birthDate] + * @param {string} [address] + * @param {number} [housingStatus] + * @param {number} [familyCount] + * @param {number} [education] + * @param {number} [status] + * @param {number} [existenceStatus] 0 dead :( | 1 alive and present | 2 alive but gone | 3 Temporarry gone * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof CartAPIApi */ - public apiV2MycartPut(authorization: string, body: Body, options?: any) { - return CartAPIApiFp(this.configuration).apiV2MycartPut(authorization, body, options)(this.fetch, this.basePath); - } - -} + apiV2ChildUpdateChildIdchildIdPatch( + authorization: string, + childId: number, + awakeAvatarUrl?: any, + sleptAvatarUrl?: any, + voiceUrl?: any, + firstNameTranslations?: string, + saynameTranslations?: string, + bioTranslations?: string, + bioSummaryTranslations?: string, + lastNameTranslations?: string, + sayName?: string, + phoneNumber?: string, + nationality?: number, + country?: number, + city?: number, + gender?: boolean, + birthPlace?: string, + birthDate?: string, + address?: string, + housingStatus?: number, + familyCount?: number, + education?: number, + status?: number, + existenceStatus?: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2ChildUpdateChildIdchildIdPatch.', + ); + } + // verify required parameter 'childId' is not null or undefined + if (childId === null || childId === undefined) { + throw new RequiredError( + 'childId', + 'Required parameter childId was null or undefined when calling apiV2ChildUpdateChildIdchildIdPatch.', + ); + } + const localVarPath = `/api/v2/child/update/childId={child_id}`.replace( + `{${'child_id'}}`, + encodeURIComponent(String(childId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (awakeAvatarUrl !== undefined) { + localVarFormParams.set('awakeAvatarUrl', awakeAvatarUrl as any); + } + + if (sleptAvatarUrl !== undefined) { + localVarFormParams.set('sleptAvatarUrl', sleptAvatarUrl as any); + } + + if (voiceUrl !== undefined) { + localVarFormParams.set('voiceUrl', voiceUrl as any); + } + + if (firstNameTranslations !== undefined) { + localVarFormParams.set( + 'firstName_translations', + firstNameTranslations as any, + ); + } + + if (saynameTranslations !== undefined) { + localVarFormParams.set( + 'sayname_translations', + saynameTranslations as any, + ); + } + + if (bioTranslations !== undefined) { + localVarFormParams.set('bio_translations', bioTranslations as any); + } + + if (bioSummaryTranslations !== undefined) { + localVarFormParams.set( + 'bio_summary_translations', + bioSummaryTranslations as any, + ); + } + + if (lastNameTranslations !== undefined) { + localVarFormParams.set( + 'lastName_translations', + lastNameTranslations as any, + ); + } + + if (sayName !== undefined) { + localVarFormParams.set('sayName', sayName as any); + } + + if (phoneNumber !== undefined) { + localVarFormParams.set('phoneNumber', phoneNumber as any); + } + + if (nationality !== undefined) { + localVarFormParams.set('nationality', nationality as any); + } + + if (country !== undefined) { + localVarFormParams.set('country', country as any); + } + + if (city !== undefined) { + localVarFormParams.set('city', city as any); + } + + if (gender !== undefined) { + localVarFormParams.set('gender', gender as any); + } + + if (birthPlace !== undefined) { + localVarFormParams.set('birthPlace', birthPlace as any); + } + + if (birthDate !== undefined) { + localVarFormParams.set('birthDate', birthDate as any); + } + + if (address !== undefined) { + localVarFormParams.set('address', address as any); + } + + if (housingStatus !== undefined) { + localVarFormParams.set('housingStatus', housingStatus as any); + } + + if (familyCount !== undefined) { + localVarFormParams.set('familyCount', familyCount as any); + } + + if (education !== undefined) { + localVarFormParams.set('education', education as any); + } + + if (status !== undefined) { + localVarFormParams.set('status', status as any); + } + + if (existenceStatus !== undefined) { + localVarFormParams.set('existence_status', existenceStatus as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; /** - * ChangeCostAPIApi - fetch parameter creator + * ChildAPIApi - functional programming interface * @export */ -export const ChangeCostAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary List of pending change cost requests - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChangeCostPendingGet(authorization: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2ChangeCostPendingGet.'); - } - const localVarPath = `/api/v2/change_cost/pending`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary List of Change Cost for a specific need - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedNeedIdChangeCostGet(authorization: string, needId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NeedNeedIdChangeCostGet.'); - } - // verify required parameter 'needId' is not null or undefined - if (needId === null || needId === undefined) { - throw new RequiredError('needId', 'Required parameter needId was null or undefined when calling apiV2NeedNeedIdChangeCostGet.'); - } - const localVarPath = `/api/v2/need/{need_id}/change_cost` - .replace(`{${"need_id"}}`, encodeURIComponent(String(needId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Accept a change cost of a need - * @param {string} authorization Access Token - * @param {number} needId - * @param {number} id - * @param {number} [to] 0 to 2147483647 - * @param {string} [description] max len: 128 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedNeedIdChangeCostIdAcceptPost(authorization: string, needId: number, id: number, to?: number, description?: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NeedNeedIdChangeCostIdAcceptPost.'); - } - // verify required parameter 'needId' is not null or undefined - if (needId === null || needId === undefined) { - throw new RequiredError('needId', 'Required parameter needId was null or undefined when calling apiV2NeedNeedIdChangeCostIdAcceptPost.'); - } - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2NeedNeedIdChangeCostIdAcceptPost.'); - } - const localVarPath = `/api/v2/need/{need_id}/change_cost/{id}/accept` - .replace(`{${"need_id"}}`, encodeURIComponent(String(needId))) - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (to !== undefined) { - localVarFormParams.set('to', to as any); - } - - if (description !== undefined) { - localVarFormParams.set('description', description as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Reject a change cost of a need - * @param {string} authorization Access Token - * @param {number} needId - * @param {number} id - * @param {string} [rejectCause] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedNeedIdChangeCostIdRejectPost(authorization: string, needId: number, id: number, rejectCause?: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NeedNeedIdChangeCostIdRejectPost.'); - } - // verify required parameter 'needId' is not null or undefined - if (needId === null || needId === undefined) { - throw new RequiredError('needId', 'Required parameter needId was null or undefined when calling apiV2NeedNeedIdChangeCostIdRejectPost.'); - } - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2NeedNeedIdChangeCostIdRejectPost.'); - } - const localVarPath = `/api/v2/need/{need_id}/change_cost/{id}/reject` - .replace(`{${"need_id"}}`, encodeURIComponent(String(needId))) - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (rejectCause !== undefined) { - localVarFormParams.set('rejectCause', rejectCause as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Request to change cost of a need - * @param {string} authorization Access Token - * @param {number} needId - * @param {number} to 0 to 2147483647 - * @param {string} [description] max len: 128 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedNeedIdChangeCostPut(authorization: string, needId: number, to: number, description?: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NeedNeedIdChangeCostPut.'); - } - // verify required parameter 'needId' is not null or undefined - if (needId === null || needId === undefined) { - throw new RequiredError('needId', 'Required parameter needId was null or undefined when calling apiV2NeedNeedIdChangeCostPut.'); - } - // verify required parameter 'to' is not null or undefined - if (to === null || to === undefined) { - throw new RequiredError('to', 'Required parameter to was null or undefined when calling apiV2NeedNeedIdChangeCostPut.'); - } - const localVarPath = `/api/v2/need/{need_id}/change_cost` - .replace(`{${"need_id"}}`, encodeURIComponent(String(needId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PUT' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (to !== undefined) { - localVarFormParams.set('to', to as any); - } - - if (description !== undefined) { - localVarFormParams.set('description', description as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * ChangeCostAPIApi - functional programming interface - * @export - */ -export const ChangeCostAPIApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary List of pending change cost requests - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChangeCostPendingGet(authorization: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ChangeCostAPIApiFetchParamCreator(configuration).apiV2ChangeCostPendingGet(authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary List of Change Cost for a specific need - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedNeedIdChangeCostGet(authorization: string, needId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ChangeCostAPIApiFetchParamCreator(configuration).apiV2NeedNeedIdChangeCostGet(authorization, needId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Accept a change cost of a need - * @param {string} authorization Access Token - * @param {number} needId - * @param {number} id - * @param {number} [to] 0 to 2147483647 - * @param {string} [description] max len: 128 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedNeedIdChangeCostIdAcceptPost(authorization: string, needId: number, id: number, to?: number, description?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ChangeCostAPIApiFetchParamCreator(configuration).apiV2NeedNeedIdChangeCostIdAcceptPost(authorization, needId, id, to, description, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Reject a change cost of a need - * @param {string} authorization Access Token - * @param {number} needId - * @param {number} id - * @param {string} [rejectCause] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedNeedIdChangeCostIdRejectPost(authorization: string, needId: number, id: number, rejectCause?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ChangeCostAPIApiFetchParamCreator(configuration).apiV2NeedNeedIdChangeCostIdRejectPost(authorization, needId, id, rejectCause, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Request to change cost of a need - * @param {string} authorization Access Token - * @param {number} needId - * @param {number} to 0 to 2147483647 - * @param {string} [description] max len: 128 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedNeedIdChangeCostPut(authorization: string, needId: number, to: number, description?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ChangeCostAPIApiFetchParamCreator(configuration).apiV2NeedNeedIdChangeCostPut(authorization, needId, to, description, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - } -}; - -/** - * ChangeCostAPIApi - factory interface - * @export - */ -export const ChangeCostAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * - * @summary List of pending change cost requests - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChangeCostPendingGet(authorization: string, options?: any) { - return ChangeCostAPIApiFp(configuration).apiV2ChangeCostPendingGet(authorization, options)(fetch, basePath); - }, - /** - * - * @summary List of Change Cost for a specific need - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedNeedIdChangeCostGet(authorization: string, needId: number, options?: any) { - return ChangeCostAPIApiFp(configuration).apiV2NeedNeedIdChangeCostGet(authorization, needId, options)(fetch, basePath); - }, - /** - * - * @summary Accept a change cost of a need - * @param {string} authorization Access Token - * @param {number} needId - * @param {number} id - * @param {number} [to] 0 to 2147483647 - * @param {string} [description] max len: 128 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedNeedIdChangeCostIdAcceptPost(authorization: string, needId: number, id: number, to?: number, description?: string, options?: any) { - return ChangeCostAPIApiFp(configuration).apiV2NeedNeedIdChangeCostIdAcceptPost(authorization, needId, id, to, description, options)(fetch, basePath); - }, - /** - * - * @summary Reject a change cost of a need - * @param {string} authorization Access Token - * @param {number} needId - * @param {number} id - * @param {string} [rejectCause] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedNeedIdChangeCostIdRejectPost(authorization: string, needId: number, id: number, rejectCause?: string, options?: any) { - return ChangeCostAPIApiFp(configuration).apiV2NeedNeedIdChangeCostIdRejectPost(authorization, needId, id, rejectCause, options)(fetch, basePath); - }, - /** - * - * @summary Request to change cost of a need - * @param {string} authorization Access Token - * @param {number} needId - * @param {number} to 0 to 2147483647 - * @param {string} [description] max len: 128 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedNeedIdChangeCostPut(authorization: string, needId: number, to: number, description?: string, options?: any) { - return ChangeCostAPIApiFp(configuration).apiV2NeedNeedIdChangeCostPut(authorization, needId, to, description, options)(fetch, basePath); - }, - }; -}; - -/** - * ChangeCostAPIApi - object-oriented interface - * @export - * @class ChangeCostAPIApi - * @extends {BaseAPI} - */ -export class ChangeCostAPIApi extends BaseAPI { +export const ChildAPIApiFp = function (configuration?: Configuration) { + return { /** * - * @summary List of pending change cost requests + * @summary Get all active children * @param {string} authorization Access Token * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ChangeCostAPIApi */ - public apiV2ChangeCostPendingGet(authorization: string, options?: any) { - return ChangeCostAPIApiFp(this.configuration).apiV2ChangeCostPendingGet(authorization, options)(this.fetch, this.basePath); - } - + apiV2ChildActivesGet( + authorization: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ChildAPIApiFetchParamCreator( + configuration, + ).apiV2ChildActivesGet(authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** - * - * @summary List of Change Cost for a specific need + * Adds a new child.
Calling this API affects child and social_worker tables.
Adding firstName, lastName, nationality, birthPlace, address, housingStatus, familyCount, education and status are optional.
For awakeAvatarUrl and voiceUrl you have to upload a file; for avatar in png, jpg or jpeg and for voice in wav, m4a, wma, mp3, aac or ogg format.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities and the same rule is applied for nationality and birthPlace.
Here is a guide for the codes used in this API:
gender: [true]male, [false]female
housingStatus: [0]homeless, [1]rent, [2]has home, [3]with relatives
education: [-1]uneducated, [0]pre-school, [1]1st grade, [2]2nd grade, ...
(no code has been assigned to status yet)
+ * @summary add a child * @param {string} authorization Access Token - * @param {number} needId + * @param {any} awakeAvatarUrl + * @param {any} sleptAvatarUrl + * @param {any} voiceUrl + * @param {string} saynameTranslations {\"en\": \"Bob\", \"fa\": \"بابک\"} + * @param {string} bioTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {string} bioSummaryTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {string} phoneNumber + * @param {number} country + * @param {number} city + * @param {boolean} gender + * @param {number} [ngoId] + * @param {number} [swId] + * @param {string} [firstNameTranslations] + * @param {string} [lastNameTranslations] + * @param {number} [nationality] + * @param {string} [birthPlace] + * @param {string} [birthDate] + * @param {string} [address] + * @param {number} [housingStatus] + * @param {number} [familyCount] + * @param {number} [education] + * @param {number} [status] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ChangeCostAPIApi */ - public apiV2NeedNeedIdChangeCostGet(authorization: string, needId: number, options?: any) { - return ChangeCostAPIApiFp(this.configuration).apiV2NeedNeedIdChangeCostGet(authorization, needId, options)(this.fetch, this.basePath); - } - + apiV2ChildAddPost( + authorization: string, + awakeAvatarUrl: any, + sleptAvatarUrl: any, + voiceUrl: any, + saynameTranslations: string, + bioTranslations: string, + bioSummaryTranslations: string, + phoneNumber: string, + country: number, + city: number, + gender: boolean, + ngoId?: number, + swId?: number, + firstNameTranslations?: string, + lastNameTranslations?: string, + nationality?: number, + birthPlace?: string, + birthDate?: string, + address?: string, + housingStatus?: number, + familyCount?: number, + education?: number, + status?: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + + const localVarFetchArgs = ChildAPIApiFetchParamCreator( + configuration, + ).apiV2ChildAddPost( + authorization, + awakeAvatarUrl, + sleptAvatarUrl, + voiceUrl, + saynameTranslations, + bioTranslations, + bioSummaryTranslations, + phoneNumber, + country, + city, + gender, + ngoId, + swId, + firstNameTranslations, + lastNameTranslations, + nationality, + birthPlace, + birthDate, + address, + housingStatus, + familyCount, + education, + status, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, /** - * - * @summary Accept a change cost of a need + * Returns information of all children as a json object.
Json key is child id and json value is children data.
Calling this API affects on child, need, child_need, need_family and user tables.
It contains children info, their needs and participants of those needs. Confirm tag determines the type of output:
[0]for not confirmed children only, [1]for confirmed children only, [2]for both confirmed and not confirmed children
+ * @summary get all children * @param {string} authorization Access Token - * @param {number} needId - * @param {number} id - * @param {number} [to] 0 to 2147483647 - * @param {string} [description] max len: 128 + * @param {number} confirm + * @param {any} [ngoId] + * @param {any} [swId] + * @param {any} [take] + * @param {any} [skip] + * @param {any} [existenceStatus] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ChangeCostAPIApi */ - public apiV2NeedNeedIdChangeCostIdAcceptPost(authorization: string, needId: number, id: number, to?: number, description?: string, options?: any) { - return ChangeCostAPIApiFp(this.configuration).apiV2NeedNeedIdChangeCostIdAcceptPost(authorization, needId, id, to, description, options)(this.fetch, this.basePath); - } - + apiV2ChildAllConfirmconfirmGet( + authorization: string, + confirm: number, + ngoId?: any, + swId?: any, + take?: any, + skip?: any, + existenceStatus?: any, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ChildAPIApiFetchParamCreator( + configuration, + ).apiV2ChildAllConfirmconfirmGet( + authorization, + confirm, + ngoId, + swId, + take, + skip, + existenceStatus, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * - * @summary Reject a change cost of a need + * @summary get child needs summary * @param {string} authorization Access Token - * @param {number} needId - * @param {number} id - * @param {string} [rejectCause] + * @param {number} childId + * @param {boolean} [isDone] + * @param {number} [status] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ChangeCostAPIApi */ - public apiV2NeedNeedIdChangeCostIdRejectPost(authorization: string, needId: number, id: number, rejectCause?: string, options?: any) { - return ChangeCostAPIApiFp(this.configuration).apiV2NeedNeedIdChangeCostIdRejectPost(authorization, needId, id, rejectCause, options)(this.fetch, this.basePath); - } - + apiV2ChildChildIdNeedsSummaryGet( + authorization: string, + childId: number, + isDone?: boolean, + status?: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ChildAPIApiFetchParamCreator( + configuration, + ).apiV2ChildChildIdNeedsSummaryGet( + authorization, + childId, + isDone, + status, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * - * @summary Request to change cost of a need + * @summary get child needs * @param {string} authorization Access Token - * @param {number} needId - * @param {number} to 0 to 2147483647 - * @param {string} [description] max len: 128 + * @param {number} childId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ChangeCostAPIApi */ - public apiV2NeedNeedIdChangeCostPut(authorization: string, needId: number, to: number, description?: string, options?: any) { - return ChangeCostAPIApiFp(this.configuration).apiV2NeedNeedIdChangeCostPut(authorization, needId, to, description, options)(this.fetch, this.basePath); - } - -} - -/** - * CheckAPIApi - fetch parameter creator - * @export - */ -export const CheckAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Check Email status - * @param {string} email - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CheckEmailEmailGet(email: string, options: any = {}): FetchArgs { - // verify required parameter 'email' is not null or undefined - if (email === null || email === undefined) { - throw new RequiredError('email', 'Required parameter email was null or undefined when calling apiV2CheckEmailEmailGet.'); - } - const localVarPath = `/api/v2/check/email/{email}` - .replace(`{${"email"}}`, encodeURIComponent(String(email))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Check Phone status - * @param {string} phone - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CheckPhonePhoneGet(phone: string, options: any = {}): FetchArgs { - // verify required parameter 'phone' is not null or undefined - if (phone === null || phone === undefined) { - throw new RequiredError('phone', 'Required parameter phone was null or undefined when calling apiV2CheckPhonePhoneGet.'); - } - const localVarPath = `/api/v2/check/phone/{phone}` - .replace(`{${"phone"}}`, encodeURIComponent(String(phone))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Check Username status - * @param {string} username - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CheckUsernameUsernameGet(username: string, options: any = {}): FetchArgs { - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username', 'Required parameter username was null or undefined when calling apiV2CheckUsernameUsernameGet.'); - } - const localVarPath = `/api/v2/check/username/{username}` - .replace(`{${"username"}}`, encodeURIComponent(String(username))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * CheckAPIApi - functional programming interface - * @export - */ -export const CheckAPIApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Check Email status - * @param {string} email - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CheckEmailEmailGet(email: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CheckAPIApiFetchParamCreator(configuration).apiV2CheckEmailEmailGet(email, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Check Phone status - * @param {string} phone - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CheckPhonePhoneGet(phone: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CheckAPIApiFetchParamCreator(configuration).apiV2CheckPhonePhoneGet(phone, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Check Username status - * @param {string} username - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CheckUsernameUsernameGet(username: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CheckAPIApiFetchParamCreator(configuration).apiV2CheckUsernameUsernameGet(username, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - } -}; - -/** - * CheckAPIApi - factory interface - * @export - */ -export const CheckAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * - * @summary Check Email status - * @param {string} email - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CheckEmailEmailGet(email: string, options?: any) { - return CheckAPIApiFp(configuration).apiV2CheckEmailEmailGet(email, options)(fetch, basePath); - }, - /** - * - * @summary Check Phone status - * @param {string} phone - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CheckPhonePhoneGet(phone: string, options?: any) { - return CheckAPIApiFp(configuration).apiV2CheckPhonePhoneGet(phone, options)(fetch, basePath); - }, - /** - * - * @summary Check Username status - * @param {string} username - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CheckUsernameUsernameGet(username: string, options?: any) { - return CheckAPIApiFp(configuration).apiV2CheckUsernameUsernameGet(username, options)(fetch, basePath); - }, - }; -}; - -/** - * CheckAPIApi - object-oriented interface - * @export - * @class CheckAPIApi - * @extends {BaseAPI} - */ -export class CheckAPIApi extends BaseAPI { + apiV2ChildChildIdchildIdNeedsGet( + authorization: string, + childId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ChildAPIApiFetchParamCreator( + configuration, + ).apiV2ChildChildIdchildIdNeedsGet(authorization, childId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * Returns information of a child with given id as a json object.
Calling this API affects on child, need, child_need and need_family and user tables.
It contains child info, its needs and participants of those needs.
Confirm parameter determines how do you want the result:
[0]not confirmed, [1] confirmed, [2]both
+ * @summary get child by id + * @param {string} authorization Access Token + * @param {number} childId + * @param {number} confirm + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ChildChildIdchildIdconfirmconfirmGet( + authorization: string, + childId: number, + confirm: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ChildAPIApiFetchParamCreator( + configuration, + ).apiV2ChildChildIdchildIdconfirmconfirmGet( + authorization, + childId, + confirm, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** - * - * @summary Check Email status - * @param {string} email + * Confirms a child, so you cannot delete it anymore but you can add needs to it.
Calling this API affect child, ngo, social_worker, child_need and family tables.
+ * @summary confirm a child + * @param {string} authorization Access Token + * @param {number} childId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof CheckAPIApi */ - public apiV2CheckEmailEmailGet(email: string, options?: any) { - return CheckAPIApiFp(this.configuration).apiV2CheckEmailEmailGet(email, options)(this.fetch, this.basePath); - } - + apiV2ChildConfirmChildIdchildIdPatch( + authorization: string, + childId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ChildAPIApiFetchParamCreator( + configuration, + ).apiV2ChildConfirmChildIdchildIdPatch(authorization, childId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** - * - * @summary Check Phone status - * @param {string} phone + * This API deletes a specific child. Only not confirmed children can be deleted.
Calling this API affects family table by updating a row and set isDeleted tag true, social_worker and ngo table by decreasing their currentChildrenCount field by 1 and child by setting isDeleted tag true for some rows.
We do not fully delete any rows.
+ * @summary delete a child + * @param {string} authorization Access Token + * @param {number} childId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof CheckAPIApi */ - public apiV2CheckPhonePhoneGet(phone: string, options?: any) { - return CheckAPIApiFp(this.configuration).apiV2CheckPhonePhoneGet(phone, options)(this.fetch, this.basePath); - } - + apiV2ChildDeleteChildIdchildIdPatch( + authorization: string, + childId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ChildAPIApiFetchParamCreator( + configuration, + ).apiV2ChildDeleteChildIdchildIdPatch(authorization, childId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, /** * - * @summary Check Username status - * @param {string} username + * @summary get child by invitation token + * @param {string} token + * @param {string} [authorization] Access Token * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof CheckAPIApi */ - public apiV2CheckUsernameUsernameGet(username: string, options?: any) { - return CheckAPIApiFp(this.configuration).apiV2CheckUsernameUsernameGet(username, options)(this.fetch, this.basePath); - } - -} - -/** - * ChildAPIApi - fetch parameter creator - * @export - */ -export const ChildAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Get all active children - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildActivesGet(authorization: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2ChildActivesGet.'); - } - const localVarPath = `/api/v2/child/actives`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Adds a new child.
Calling this API affects child and social_worker tables.
Adding firstName, lastName, nationality, birthPlace, address, housingStatus, familyCount, education and status are optional.
For awakeAvatarUrl and voiceUrl you have to upload a file; for avatar in png, jpg or jpeg and for voice in wav, m4a, wma, mp3, aac or ogg format.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities and the same rule is applied for nationality and birthPlace.
Here is a guide for the codes used in this API:
gender: [true]male, [false]female
housingStatus: [0]homeless, [1]rent, [2]has home, [3]with relatives
education: [-1]uneducated, [0]pre-school, [1]1st grade, [2]2nd grade, ...
(no code has been assigned to status yet)
- * @summary add a child - * @param {string} authorization Access Token - * @param {any} awakeAvatarUrl - * @param {any} sleptAvatarUrl - * @param {any} voiceUrl - * @param {string} saynameTranslations {\"en\": \"Bob\", \"fa\": \"بابک\"} - * @param {string} bioTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {string} bioSummaryTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {string} phoneNumber - * @param {number} country - * @param {number} city - * @param {boolean} gender - * @param {number} [ngoId] - * @param {number} [swId] - * @param {string} [firstNameTranslations] - * @param {string} [lastNameTranslations] - * @param {number} [nationality] - * @param {string} [birthPlace] - * @param {string} [birthDate] - * @param {string} [address] - * @param {number} [housingStatus] - * @param {number} [familyCount] - * @param {number} [education] - * @param {number} [status] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildAddPost(authorization: string, awakeAvatarUrl: any, sleptAvatarUrl: any, voiceUrl: any, saynameTranslations: string, bioTranslations: string, bioSummaryTranslations: string, phoneNumber: string, country: number, city: number, gender: boolean, ngoId?: number, swId?: number, firstNameTranslations?: string, lastNameTranslations?: string, nationality?: number, birthPlace?: string, birthDate?: string, address?: string, housingStatus?: number, familyCount?: number, education?: number, status?: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2ChildAddPost.'); - } - // verify required parameter 'awakeAvatarUrl' is not null or undefined - if (awakeAvatarUrl === null || awakeAvatarUrl === undefined) { - throw new RequiredError('awakeAvatarUrl', 'Required parameter awakeAvatarUrl was null or undefined when calling apiV2ChildAddPost.'); - } - // verify required parameter 'sleptAvatarUrl' is not null or undefined - if (sleptAvatarUrl === null || sleptAvatarUrl === undefined) { - throw new RequiredError('sleptAvatarUrl', 'Required parameter sleptAvatarUrl was null or undefined when calling apiV2ChildAddPost.'); - } - // verify required parameter 'voiceUrl' is not null or undefined - if (voiceUrl === null || voiceUrl === undefined) { - throw new RequiredError('voiceUrl', 'Required parameter voiceUrl was null or undefined when calling apiV2ChildAddPost.'); - } - // verify required parameter 'saynameTranslations' is not null or undefined - if (saynameTranslations === null || saynameTranslations === undefined) { - throw new RequiredError('saynameTranslations', 'Required parameter saynameTranslations was null or undefined when calling apiV2ChildAddPost.'); - } - // verify required parameter 'bioTranslations' is not null or undefined - if (bioTranslations === null || bioTranslations === undefined) { - throw new RequiredError('bioTranslations', 'Required parameter bioTranslations was null or undefined when calling apiV2ChildAddPost.'); - } - // verify required parameter 'bioSummaryTranslations' is not null or undefined - if (bioSummaryTranslations === null || bioSummaryTranslations === undefined) { - throw new RequiredError('bioSummaryTranslations', 'Required parameter bioSummaryTranslations was null or undefined when calling apiV2ChildAddPost.'); - } - // verify required parameter 'phoneNumber' is not null or undefined - if (phoneNumber === null || phoneNumber === undefined) { - throw new RequiredError('phoneNumber', 'Required parameter phoneNumber was null or undefined when calling apiV2ChildAddPost.'); - } - // verify required parameter 'country' is not null or undefined - if (country === null || country === undefined) { - throw new RequiredError('country', 'Required parameter country was null or undefined when calling apiV2ChildAddPost.'); - } - // verify required parameter 'city' is not null or undefined - if (city === null || city === undefined) { - throw new RequiredError('city', 'Required parameter city was null or undefined when calling apiV2ChildAddPost.'); - } - // verify required parameter 'gender' is not null or undefined - if (gender === null || gender === undefined) { - throw new RequiredError('gender', 'Required parameter gender was null or undefined when calling apiV2ChildAddPost.'); - } - const localVarPath = `/api/v2/child/add/`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (ngoId !== undefined) { - localVarFormParams.set('ngo_id', ngoId as any); - } - - if (swId !== undefined) { - localVarFormParams.set('sw_id', swId as any); - } - - if (awakeAvatarUrl !== undefined) { - localVarFormParams.set('awakeAvatarUrl', awakeAvatarUrl as any); - } - - if (sleptAvatarUrl !== undefined) { - localVarFormParams.set('sleptAvatarUrl', sleptAvatarUrl as any); - } - - if (voiceUrl !== undefined) { - localVarFormParams.set('voiceUrl', voiceUrl as any); - } - - if (firstNameTranslations !== undefined) { - localVarFormParams.set('firstName_translations', firstNameTranslations as any); - } - - if (lastNameTranslations !== undefined) { - localVarFormParams.set('lastName_translations', lastNameTranslations as any); - } - - if (saynameTranslations !== undefined) { - localVarFormParams.set('sayname_translations', saynameTranslations as any); - } - - if (bioTranslations !== undefined) { - localVarFormParams.set('bio_translations', bioTranslations as any); - } - - if (bioSummaryTranslations !== undefined) { - localVarFormParams.set('bio_summary_translations', bioSummaryTranslations as any); - } - - if (phoneNumber !== undefined) { - localVarFormParams.set('phoneNumber', phoneNumber as any); - } - - if (nationality !== undefined) { - localVarFormParams.set('nationality', nationality as any); - } - - if (country !== undefined) { - localVarFormParams.set('country', country as any); - } - - if (city !== undefined) { - localVarFormParams.set('city', city as any); - } - - if (gender !== undefined) { - localVarFormParams.set('gender', gender as any); - } - - if (birthPlace !== undefined) { - localVarFormParams.set('birthPlace', birthPlace as any); - } - - if (birthDate !== undefined) { - localVarFormParams.set('birthDate', birthDate as any); - } - - if (address !== undefined) { - localVarFormParams.set('address', address as any); - } - - if (housingStatus !== undefined) { - localVarFormParams.set('housingStatus', housingStatus as any); - } - - if (familyCount !== undefined) { - localVarFormParams.set('familyCount', familyCount as any); - } - - if (education !== undefined) { - localVarFormParams.set('education', education as any); - } - - if (status !== undefined) { - localVarFormParams.set('status', status as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns information of all children as a json object.
Json key is child id and json value is children data.
Calling this API affects on child, need, child_need, need_family and user tables.
It contains children info, their needs and participants of those needs. Confirm tag determines the type of output:
[0]for not confirmed children only, [1]for confirmed children only, [2]for both confirmed and not confirmed children
- * @summary get all children - * @param {string} authorization Access Token - * @param {number} confirm - * @param {any} [ngoId] - * @param {any} [swId] - * @param {any} [take] - * @param {any} [skip] - * @param {any} [existenceStatus] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildAllConfirmconfirmGet(authorization: string, confirm: number, ngoId?: any, swId?: any, take?: any, skip?: any, existenceStatus?: any, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2ChildAllConfirmconfirmGet.'); - } - // verify required parameter 'confirm' is not null or undefined - if (confirm === null || confirm === undefined) { - throw new RequiredError('confirm', 'Required parameter confirm was null or undefined when calling apiV2ChildAllConfirmconfirmGet.'); - } - const localVarPath = `/api/v2/child/all/confirm={confirm}` - .replace(`{${"confirm"}}`, encodeURIComponent(String(confirm))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (ngoId !== undefined) { - localVarQueryParameter['ngo_id'] = ngoId; - } - - if (swId !== undefined) { - localVarQueryParameter['sw_id'] = swId; - } - - if (take !== undefined) { - localVarQueryParameter['take'] = take; - } - - if (skip !== undefined) { - localVarQueryParameter['skip'] = skip; - } - - if (existenceStatus !== undefined) { - localVarQueryParameter['existence_status'] = existenceStatus; - } - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary get child needs summary - * @param {string} authorization Access Token - * @param {number} childId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildChildIdNeedsSummaryGet(authorization: string, childId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2ChildChildIdNeedsSummaryGet.'); - } - // verify required parameter 'childId' is not null or undefined - if (childId === null || childId === undefined) { - throw new RequiredError('childId', 'Required parameter childId was null or undefined when calling apiV2ChildChildIdNeedsSummaryGet.'); - } - const localVarPath = `/api/v2/child/{child_id}/needs/summary` - .replace(`{${"child_id"}}`, encodeURIComponent(String(childId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary get child needs - * @param {string} authorization Access Token - * @param {number} childId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildChildIdchildIdNeedsGet(authorization: string, childId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2ChildChildIdchildIdNeedsGet.'); - } - // verify required parameter 'childId' is not null or undefined - if (childId === null || childId === undefined) { - throw new RequiredError('childId', 'Required parameter childId was null or undefined when calling apiV2ChildChildIdchildIdNeedsGet.'); - } - const localVarPath = `/api/v2/child/childId={child_id}/needs` - .replace(`{${"child_id"}}`, encodeURIComponent(String(childId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns information of a child with given id as a json object.
Calling this API affects on child, need, child_need and need_family and user tables.
It contains child info, its needs and participants of those needs.
Confirm parameter determines how do you want the result:
[0]not onfirmed, [1] confirmed, [2]both
- * @summary get child by id - * @param {string} authorization Access Token - * @param {number} childId - * @param {number} confirm - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildChildIdchildIdconfirmconfirmGet(authorization: string, childId: number, confirm: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2ChildChildIdchildIdconfirmconfirmGet.'); - } - // verify required parameter 'childId' is not null or undefined - if (childId === null || childId === undefined) { - throw new RequiredError('childId', 'Required parameter childId was null or undefined when calling apiV2ChildChildIdchildIdconfirmconfirmGet.'); - } - // verify required parameter 'confirm' is not null or undefined - if (confirm === null || confirm === undefined) { - throw new RequiredError('confirm', 'Required parameter confirm was null or undefined when calling apiV2ChildChildIdchildIdconfirmconfirmGet.'); - } - const localVarPath = `/api/v2/child/childId={child_id}&confirm={confirm}` - .replace(`{${"child_id"}}`, encodeURIComponent(String(childId))) - .replace(`{${"confirm"}}`, encodeURIComponent(String(confirm))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Confirms a child, so you cannot delete it anymore but you can add needs to it.
Calling this API affect child, ngo, social_worker, child_need and family tables.
- * @summary confirm a child - * @param {string} authorization Access Token - * @param {number} childId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildConfirmChildIdchildIdPatch(authorization: string, childId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2ChildConfirmChildIdchildIdPatch.'); - } - // verify required parameter 'childId' is not null or undefined - if (childId === null || childId === undefined) { - throw new RequiredError('childId', 'Required parameter childId was null or undefined when calling apiV2ChildConfirmChildIdchildIdPatch.'); - } - const localVarPath = `/api/v2/child/confirm/childId={child_id}` - .replace(`{${"child_id"}}`, encodeURIComponent(String(childId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * This API deletes a specific child. Only not confirmed children can be deleted.
Calling this API affects family table by updating a row and set isDeleted tag true, social_worker and ngo table by decreasing their currentChildrenCount field by 1 and child by setting isDeleted tag true for some rows.
We do not fully delete any rows.
- * @summary delete a child - * @param {string} authorization Access Token - * @param {number} childId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildDeleteChildIdchildIdPatch(authorization: string, childId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2ChildDeleteChildIdchildIdPatch.'); - } - // verify required parameter 'childId' is not null or undefined - if (childId === null || childId === undefined) { - throw new RequiredError('childId', 'Required parameter childId was null or undefined when calling apiV2ChildDeleteChildIdchildIdPatch.'); - } - const localVarPath = `/api/v2/child/delete/childId={child_id}` - .replace(`{${"child_id"}}`, encodeURIComponent(String(childId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary get child by invitation token - * @param {string} token - * @param {string} [authorization] Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildInvitationsTokenGet(token: string, authorization?: string, options: any = {}): FetchArgs { - // verify required parameter 'token' is not null or undefined - if (token === null || token === undefined) { - throw new RequiredError('token', 'Required parameter token was null or undefined when calling apiV2ChildInvitationsTokenGet.'); - } - const localVarPath = `/api/v2/child/invitations/{token}` - .replace(`{${"token"}}`, encodeURIComponent(String(token))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * This API migrates a child.
It means that from the moment after migration, another social worker will cover the child's need.
The records of child will migrate too, so nothing is going to be missed or deleted.
Calling this API affects on child, social_worker, ngo, child_need, need and family tables.
It inserts a new record int child table for the migrated child and deactives the previous child's record.
- * @summary migrate a child - * @param {string} authorization Access Token - * @param {number} childId - * @param {number} newSwId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildMigrateChildIdchildIdPatch(authorization: string, childId: number, newSwId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2ChildMigrateChildIdchildIdPatch.'); - } - // verify required parameter 'childId' is not null or undefined - if (childId === null || childId === undefined) { - throw new RequiredError('childId', 'Required parameter childId was null or undefined when calling apiV2ChildMigrateChildIdchildIdPatch.'); - } - // verify required parameter 'newSwId' is not null or undefined - if (newSwId === null || newSwId === undefined) { - throw new RequiredError('newSwId', 'Required parameter newSwId was null or undefined when calling apiV2ChildMigrateChildIdchildIdPatch.'); - } - const localVarPath = `/api/v2/child/migrate/childId={child_id}` - .replace(`{${"child_id"}}`, encodeURIComponent(String(childId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (newSwId !== undefined) { - localVarFormParams.set('new_sw_id', newSwId as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * All the fields are optional. You can fill every field you want to change, and it will update the desired child.
Calling this API only affects child table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
The same rule applied for nationality and birthPlace.
For voiceUrl and awakeAvatarUrl you have to upload a file; for avatar in png, jpg or jpeg and for voice in wav, m4a, wma, mp3, aac or ogg format.
Social workers can change their NGO by editing ngoId field.
- * @summary update a child - * @param {string} authorization Access Token - * @param {number} childId - * @param {any} [awakeAvatarUrl] - * @param {any} [sleptAvatarUrl] - * @param {any} [voiceUrl] - * @param {string} [firstNameTranslations] - * @param {string} [saynameTranslations] {\"en\": \"Bob\", \"fa\": \"بابک\"} - * @param {string} [bioTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {string} [bioSummaryTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {string} [lastNameTranslations] - * @param {string} [sayName] - * @param {string} [phoneNumber] - * @param {number} [nationality] - * @param {number} [country] - * @param {number} [city] - * @param {boolean} [gender] - * @param {string} [birthPlace] - * @param {string} [birthDate] - * @param {string} [address] - * @param {number} [housingStatus] - * @param {number} [familyCount] - * @param {number} [education] - * @param {number} [status] - * @param {number} [existenceStatus] 0 dead :( | 1 alive and present | 2 alive but gone | 3 Temporarry gone - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildUpdateChildIdchildIdPatch(authorization: string, childId: number, awakeAvatarUrl?: any, sleptAvatarUrl?: any, voiceUrl?: any, firstNameTranslations?: string, saynameTranslations?: string, bioTranslations?: string, bioSummaryTranslations?: string, lastNameTranslations?: string, sayName?: string, phoneNumber?: string, nationality?: number, country?: number, city?: number, gender?: boolean, birthPlace?: string, birthDate?: string, address?: string, housingStatus?: number, familyCount?: number, education?: number, status?: number, existenceStatus?: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2ChildUpdateChildIdchildIdPatch.'); - } - // verify required parameter 'childId' is not null or undefined - if (childId === null || childId === undefined) { - throw new RequiredError('childId', 'Required parameter childId was null or undefined when calling apiV2ChildUpdateChildIdchildIdPatch.'); - } - const localVarPath = `/api/v2/child/update/childId={child_id}` - .replace(`{${"child_id"}}`, encodeURIComponent(String(childId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (awakeAvatarUrl !== undefined) { - localVarFormParams.set('awakeAvatarUrl', awakeAvatarUrl as any); - } - - if (sleptAvatarUrl !== undefined) { - localVarFormParams.set('sleptAvatarUrl', sleptAvatarUrl as any); - } - - if (voiceUrl !== undefined) { - localVarFormParams.set('voiceUrl', voiceUrl as any); - } - - if (firstNameTranslations !== undefined) { - localVarFormParams.set('firstName_translations', firstNameTranslations as any); - } - - if (saynameTranslations !== undefined) { - localVarFormParams.set('sayname_translations', saynameTranslations as any); - } - - if (bioTranslations !== undefined) { - localVarFormParams.set('bio_translations', bioTranslations as any); - } - - if (bioSummaryTranslations !== undefined) { - localVarFormParams.set('bio_summary_translations', bioSummaryTranslations as any); - } - - if (lastNameTranslations !== undefined) { - localVarFormParams.set('lastName_translations', lastNameTranslations as any); - } - - if (sayName !== undefined) { - localVarFormParams.set('sayName', sayName as any); - } - - if (phoneNumber !== undefined) { - localVarFormParams.set('phoneNumber', phoneNumber as any); - } - - if (nationality !== undefined) { - localVarFormParams.set('nationality', nationality as any); - } - - if (country !== undefined) { - localVarFormParams.set('country', country as any); - } - - if (city !== undefined) { - localVarFormParams.set('city', city as any); - } - - if (gender !== undefined) { - localVarFormParams.set('gender', gender as any); - } - - if (birthPlace !== undefined) { - localVarFormParams.set('birthPlace', birthPlace as any); - } - - if (birthDate !== undefined) { - localVarFormParams.set('birthDate', birthDate as any); - } - - if (address !== undefined) { - localVarFormParams.set('address', address as any); - } - - if (housingStatus !== undefined) { - localVarFormParams.set('housingStatus', housingStatus as any); - } - - if (familyCount !== undefined) { - localVarFormParams.set('familyCount', familyCount as any); - } - - if (education !== undefined) { - localVarFormParams.set('education', education as any); - } - - if (status !== undefined) { - localVarFormParams.set('status', status as any); - } - - if (existenceStatus !== undefined) { - localVarFormParams.set('existence_status', existenceStatus as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * ChildAPIApi - functional programming interface - * @export - */ -export const ChildAPIApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Get all active children - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildActivesGet(authorization: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ChildAPIApiFetchParamCreator(configuration).apiV2ChildActivesGet(authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Adds a new child.
Calling this API affects child and social_worker tables.
Adding firstName, lastName, nationality, birthPlace, address, housingStatus, familyCount, education and status are optional.
For awakeAvatarUrl and voiceUrl you have to upload a file; for avatar in png, jpg or jpeg and for voice in wav, m4a, wma, mp3, aac or ogg format.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities and the same rule is applied for nationality and birthPlace.
Here is a guide for the codes used in this API:
gender: [true]male, [false]female
housingStatus: [0]homeless, [1]rent, [2]has home, [3]with relatives
education: [-1]uneducated, [0]pre-school, [1]1st grade, [2]2nd grade, ...
(no code has been assigned to status yet)
- * @summary add a child - * @param {string} authorization Access Token - * @param {any} awakeAvatarUrl - * @param {any} sleptAvatarUrl - * @param {any} voiceUrl - * @param {string} saynameTranslations {\"en\": \"Bob\", \"fa\": \"بابک\"} - * @param {string} bioTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {string} bioSummaryTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {string} phoneNumber - * @param {number} country - * @param {number} city - * @param {boolean} gender - * @param {number} [ngoId] - * @param {number} [swId] - * @param {string} [firstNameTranslations] - * @param {string} [lastNameTranslations] - * @param {number} [nationality] - * @param {string} [birthPlace] - * @param {string} [birthDate] - * @param {string} [address] - * @param {number} [housingStatus] - * @param {number} [familyCount] - * @param {number} [education] - * @param {number} [status] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildAddPost(authorization: string, awakeAvatarUrl: any, sleptAvatarUrl: any, voiceUrl: any, saynameTranslations: string, bioTranslations: string, bioSummaryTranslations: string, phoneNumber: string, country: number, city: number, gender: boolean, ngoId?: number, swId?: number, firstNameTranslations?: string, lastNameTranslations?: string, nationality?: number, birthPlace?: string, birthDate?: string, address?: string, housingStatus?: number, familyCount?: number, education?: number, status?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ChildAPIApiFetchParamCreator(configuration).apiV2ChildAddPost(authorization, awakeAvatarUrl, sleptAvatarUrl, voiceUrl, saynameTranslations, bioTranslations, bioSummaryTranslations, phoneNumber, country, city, gender, ngoId, swId, firstNameTranslations, lastNameTranslations, nationality, birthPlace, birthDate, address, housingStatus, familyCount, education, status, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * Returns information of all children as a json object.
Json key is child id and json value is children data.
Calling this API affects on child, need, child_need, need_family and user tables.
It contains children info, their needs and participants of those needs. Confirm tag determines the type of output:
[0]for not confirmed children only, [1]for confirmed children only, [2]for both confirmed and not confirmed children
- * @summary get all children - * @param {string} authorization Access Token - * @param {number} confirm - * @param {any} [ngoId] - * @param {any} [swId] - * @param {any} [take] - * @param {any} [skip] - * @param {any} [existenceStatus] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildAllConfirmconfirmGet(authorization: string, confirm: number, ngoId?: any, swId?: any, take?: any, skip?: any, existenceStatus?: any, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ChildAPIApiFetchParamCreator(configuration).apiV2ChildAllConfirmconfirmGet(authorization, confirm, ngoId, swId, take, skip, existenceStatus, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary get child needs summary - * @param {string} authorization Access Token - * @param {number} childId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildChildIdNeedsSummaryGet(authorization: string, childId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ChildAPIApiFetchParamCreator(configuration).apiV2ChildChildIdNeedsSummaryGet(authorization, childId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary get child needs - * @param {string} authorization Access Token - * @param {number} childId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildChildIdchildIdNeedsGet(authorization: string, childId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ChildAPIApiFetchParamCreator(configuration).apiV2ChildChildIdchildIdNeedsGet(authorization, childId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Returns information of a child with given id as a json object.
Calling this API affects on child, need, child_need and need_family and user tables.
It contains child info, its needs and participants of those needs.
Confirm parameter determines how do you want the result:
[0]not onfirmed, [1] confirmed, [2]both
- * @summary get child by id - * @param {string} authorization Access Token - * @param {number} childId - * @param {number} confirm - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildChildIdchildIdconfirmconfirmGet(authorization: string, childId: number, confirm: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ChildAPIApiFetchParamCreator(configuration).apiV2ChildChildIdchildIdconfirmconfirmGet(authorization, childId, confirm, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Confirms a child, so you cannot delete it anymore but you can add needs to it.
Calling this API affect child, ngo, social_worker, child_need and family tables.
- * @summary confirm a child - * @param {string} authorization Access Token - * @param {number} childId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildConfirmChildIdchildIdPatch(authorization: string, childId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ChildAPIApiFetchParamCreator(configuration).apiV2ChildConfirmChildIdchildIdPatch(authorization, childId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * This API deletes a specific child. Only not confirmed children can be deleted.
Calling this API affects family table by updating a row and set isDeleted tag true, social_worker and ngo table by decreasing their currentChildrenCount field by 1 and child by setting isDeleted tag true for some rows.
We do not fully delete any rows.
- * @summary delete a child - * @param {string} authorization Access Token - * @param {number} childId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildDeleteChildIdchildIdPatch(authorization: string, childId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ChildAPIApiFetchParamCreator(configuration).apiV2ChildDeleteChildIdchildIdPatch(authorization, childId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary get child by invitation token - * @param {string} token - * @param {string} [authorization] Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildInvitationsTokenGet(token: string, authorization?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ChildAPIApiFetchParamCreator(configuration).apiV2ChildInvitationsTokenGet(token, authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * This API migrates a child.
It means that from the moment after migration, another social worker will cover the child's need.
The records of child will migrate too, so nothing is going to be missed or deleted.
Calling this API affects on child, social_worker, ngo, child_need, need and family tables.
It inserts a new record int child table for the migrated child and deactives the previous child's record.
- * @summary migrate a child - * @param {string} authorization Access Token - * @param {number} childId - * @param {number} newSwId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildMigrateChildIdchildIdPatch(authorization: string, childId: number, newSwId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ChildAPIApiFetchParamCreator(configuration).apiV2ChildMigrateChildIdchildIdPatch(authorization, childId, newSwId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * All the fields are optional. You can fill every field you want to change, and it will update the desired child.
Calling this API only affects child table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
The same rule applied for nationality and birthPlace.
For voiceUrl and awakeAvatarUrl you have to upload a file; for avatar in png, jpg or jpeg and for voice in wav, m4a, wma, mp3, aac or ogg format.
Social workers can change their NGO by editing ngoId field.
- * @summary update a child - * @param {string} authorization Access Token - * @param {number} childId - * @param {any} [awakeAvatarUrl] - * @param {any} [sleptAvatarUrl] - * @param {any} [voiceUrl] - * @param {string} [firstNameTranslations] - * @param {string} [saynameTranslations] {\"en\": \"Bob\", \"fa\": \"بابک\"} - * @param {string} [bioTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {string} [bioSummaryTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {string} [lastNameTranslations] - * @param {string} [sayName] - * @param {string} [phoneNumber] - * @param {number} [nationality] - * @param {number} [country] - * @param {number} [city] - * @param {boolean} [gender] - * @param {string} [birthPlace] - * @param {string} [birthDate] - * @param {string} [address] - * @param {number} [housingStatus] - * @param {number} [familyCount] - * @param {number} [education] - * @param {number} [status] - * @param {number} [existenceStatus] 0 dead :( | 1 alive and present | 2 alive but gone | 3 Temporarry gone - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildUpdateChildIdchildIdPatch(authorization: string, childId: number, awakeAvatarUrl?: any, sleptAvatarUrl?: any, voiceUrl?: any, firstNameTranslations?: string, saynameTranslations?: string, bioTranslations?: string, bioSummaryTranslations?: string, lastNameTranslations?: string, sayName?: string, phoneNumber?: string, nationality?: number, country?: number, city?: number, gender?: boolean, birthPlace?: string, birthDate?: string, address?: string, housingStatus?: number, familyCount?: number, education?: number, status?: number, existenceStatus?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ChildAPIApiFetchParamCreator(configuration).apiV2ChildUpdateChildIdchildIdPatch(authorization, childId, awakeAvatarUrl, sleptAvatarUrl, voiceUrl, firstNameTranslations, saynameTranslations, bioTranslations, bioSummaryTranslations, lastNameTranslations, sayName, phoneNumber, nationality, country, city, gender, birthPlace, birthDate, address, housingStatus, familyCount, education, status, existenceStatus, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - } + apiV2ChildInvitationsTokenGet( + token: string, + authorization?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ChildAPIApiFetchParamCreator( + configuration, + ).apiV2ChildInvitationsTokenGet(token, authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * This API migrates a child.
It means that from the moment after migration, another social worker will cover the child's need.
The records of child will migrate too, so nothing is going to be missed or deleted.
Calling this API affects on child, social_worker, ngo, child_need, need and family tables.
It inserts a new record int child table for the migrated child and deactives the previous child's record.
+ * @summary migrate a child + * @param {string} authorization Access Token + * @param {number} childId + * @param {number} newSwId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ChildMigrateChildIdchildIdPatch( + authorization: string, + childId: number, + newSwId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ChildAPIApiFetchParamCreator( + configuration, + ).apiV2ChildMigrateChildIdchildIdPatch( + authorization, + childId, + newSwId, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * All the fields are optional. You can fill every field you want to change, and it will update the desired child.
Calling this API only affects child table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
The same rule applied for nationality and birthPlace.
For voiceUrl and awakeAvatarUrl you have to upload a file; for avatar in png, jpg or jpeg and for voice in wav, m4a, wma, mp3, aac or ogg format.
Social workers can change their NGO by editing ngoId field.
+ * @summary update a child + * @param {string} authorization Access Token + * @param {number} childId + * @param {any} [awakeAvatarUrl] + * @param {any} [sleptAvatarUrl] + * @param {any} [voiceUrl] + * @param {string} [firstNameTranslations] + * @param {string} [saynameTranslations] {\"en\": \"Bob\", \"fa\": \"بابک\"} + * @param {string} [bioTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {string} [bioSummaryTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {string} [lastNameTranslations] + * @param {string} [sayName] + * @param {string} [phoneNumber] + * @param {number} [nationality] + * @param {number} [country] + * @param {number} [city] + * @param {boolean} [gender] + * @param {string} [birthPlace] + * @param {string} [birthDate] + * @param {string} [address] + * @param {number} [housingStatus] + * @param {number} [familyCount] + * @param {number} [education] + * @param {number} [status] + * @param {number} [existenceStatus] 0 dead :( | 1 alive and present | 2 alive but gone | 3 Temporarry gone + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ChildUpdateChildIdchildIdPatch( + authorization: string, + childId: number, + awakeAvatarUrl?: any, + sleptAvatarUrl?: any, + voiceUrl?: any, + firstNameTranslations?: string, + saynameTranslations?: string, + bioTranslations?: string, + bioSummaryTranslations?: string, + lastNameTranslations?: string, + sayName?: string, + phoneNumber?: string, + nationality?: number, + country?: number, + city?: number, + gender?: boolean, + birthPlace?: string, + birthDate?: string, + address?: string, + housingStatus?: number, + familyCount?: number, + education?: number, + status?: number, + existenceStatus?: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ChildAPIApiFetchParamCreator( + configuration, + ).apiV2ChildUpdateChildIdchildIdPatch( + authorization, + childId, + awakeAvatarUrl, + sleptAvatarUrl, + voiceUrl, + firstNameTranslations, + saynameTranslations, + bioTranslations, + bioSummaryTranslations, + lastNameTranslations, + sayName, + phoneNumber, + nationality, + country, + city, + gender, + birthPlace, + birthDate, + address, + housingStatus, + familyCount, + education, + status, + existenceStatus, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + }; }; /** * ChildAPIApi - factory interface * @export */ -export const ChildAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * - * @summary Get all active children - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildActivesGet(authorization: string, options?: any) { - return ChildAPIApiFp(configuration).apiV2ChildActivesGet(authorization, options)(fetch, basePath); - }, - /** - * Adds a new child.
Calling this API affects child and social_worker tables.
Adding firstName, lastName, nationality, birthPlace, address, housingStatus, familyCount, education and status are optional.
For awakeAvatarUrl and voiceUrl you have to upload a file; for avatar in png, jpg or jpeg and for voice in wav, m4a, wma, mp3, aac or ogg format.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities and the same rule is applied for nationality and birthPlace.
Here is a guide for the codes used in this API:
gender: [true]male, [false]female
housingStatus: [0]homeless, [1]rent, [2]has home, [3]with relatives
education: [-1]uneducated, [0]pre-school, [1]1st grade, [2]2nd grade, ...
(no code has been assigned to status yet)
- * @summary add a child - * @param {string} authorization Access Token - * @param {any} awakeAvatarUrl - * @param {any} sleptAvatarUrl - * @param {any} voiceUrl - * @param {string} saynameTranslations {\"en\": \"Bob\", \"fa\": \"بابک\"} - * @param {string} bioTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {string} bioSummaryTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {string} phoneNumber - * @param {number} country - * @param {number} city - * @param {boolean} gender - * @param {number} [ngoId] - * @param {number} [swId] - * @param {string} [firstNameTranslations] - * @param {string} [lastNameTranslations] - * @param {number} [nationality] - * @param {string} [birthPlace] - * @param {string} [birthDate] - * @param {string} [address] - * @param {number} [housingStatus] - * @param {number} [familyCount] - * @param {number} [education] - * @param {number} [status] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildAddPost(authorization: string, awakeAvatarUrl: any, sleptAvatarUrl: any, voiceUrl: any, saynameTranslations: string, bioTranslations: string, bioSummaryTranslations: string, phoneNumber: string, country: number, city: number, gender: boolean, ngoId?: number, swId?: number, firstNameTranslations?: string, lastNameTranslations?: string, nationality?: number, birthPlace?: string, birthDate?: string, address?: string, housingStatus?: number, familyCount?: number, education?: number, status?: number, options?: any) { - return ChildAPIApiFp(configuration).apiV2ChildAddPost(authorization, awakeAvatarUrl, sleptAvatarUrl, voiceUrl, saynameTranslations, bioTranslations, bioSummaryTranslations, phoneNumber, country, city, gender, ngoId, swId, firstNameTranslations, lastNameTranslations, nationality, birthPlace, birthDate, address, housingStatus, familyCount, education, status, options)(fetch, basePath); - }, - /** - * Returns information of all children as a json object.
Json key is child id and json value is children data.
Calling this API affects on child, need, child_need, need_family and user tables.
It contains children info, their needs and participants of those needs. Confirm tag determines the type of output:
[0]for not confirmed children only, [1]for confirmed children only, [2]for both confirmed and not confirmed children
- * @summary get all children - * @param {string} authorization Access Token - * @param {number} confirm - * @param {any} [ngoId] - * @param {any} [swId] - * @param {any} [take] - * @param {any} [skip] - * @param {any} [existenceStatus] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildAllConfirmconfirmGet(authorization: string, confirm: number, ngoId?: any, swId?: any, take?: any, skip?: any, existenceStatus?: any, options?: any) { - return ChildAPIApiFp(configuration).apiV2ChildAllConfirmconfirmGet(authorization, confirm, ngoId, swId, take, skip, existenceStatus, options)(fetch, basePath); - }, - /** - * - * @summary get child needs summary - * @param {string} authorization Access Token - * @param {number} childId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildChildIdNeedsSummaryGet(authorization: string, childId: number, options?: any) { - return ChildAPIApiFp(configuration).apiV2ChildChildIdNeedsSummaryGet(authorization, childId, options)(fetch, basePath); - }, - /** - * - * @summary get child needs - * @param {string} authorization Access Token - * @param {number} childId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildChildIdchildIdNeedsGet(authorization: string, childId: number, options?: any) { - return ChildAPIApiFp(configuration).apiV2ChildChildIdchildIdNeedsGet(authorization, childId, options)(fetch, basePath); - }, - /** - * Returns information of a child with given id as a json object.
Calling this API affects on child, need, child_need and need_family and user tables.
It contains child info, its needs and participants of those needs.
Confirm parameter determines how do you want the result:
[0]not onfirmed, [1] confirmed, [2]both
- * @summary get child by id - * @param {string} authorization Access Token - * @param {number} childId - * @param {number} confirm - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildChildIdchildIdconfirmconfirmGet(authorization: string, childId: number, confirm: number, options?: any) { - return ChildAPIApiFp(configuration).apiV2ChildChildIdchildIdconfirmconfirmGet(authorization, childId, confirm, options)(fetch, basePath); - }, - /** - * Confirms a child, so you cannot delete it anymore but you can add needs to it.
Calling this API affect child, ngo, social_worker, child_need and family tables.
- * @summary confirm a child - * @param {string} authorization Access Token - * @param {number} childId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildConfirmChildIdchildIdPatch(authorization: string, childId: number, options?: any) { - return ChildAPIApiFp(configuration).apiV2ChildConfirmChildIdchildIdPatch(authorization, childId, options)(fetch, basePath); - }, - /** - * This API deletes a specific child. Only not confirmed children can be deleted.
Calling this API affects family table by updating a row and set isDeleted tag true, social_worker and ngo table by decreasing their currentChildrenCount field by 1 and child by setting isDeleted tag true for some rows.
We do not fully delete any rows.
- * @summary delete a child - * @param {string} authorization Access Token - * @param {number} childId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildDeleteChildIdchildIdPatch(authorization: string, childId: number, options?: any) { - return ChildAPIApiFp(configuration).apiV2ChildDeleteChildIdchildIdPatch(authorization, childId, options)(fetch, basePath); - }, - /** - * - * @summary get child by invitation token - * @param {string} token - * @param {string} [authorization] Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildInvitationsTokenGet(token: string, authorization?: string, options?: any) { - return ChildAPIApiFp(configuration).apiV2ChildInvitationsTokenGet(token, authorization, options)(fetch, basePath); - }, - /** - * This API migrates a child.
It means that from the moment after migration, another social worker will cover the child's need.
The records of child will migrate too, so nothing is going to be missed or deleted.
Calling this API affects on child, social_worker, ngo, child_need, need and family tables.
It inserts a new record int child table for the migrated child and deactives the previous child's record.
- * @summary migrate a child - * @param {string} authorization Access Token - * @param {number} childId - * @param {number} newSwId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildMigrateChildIdchildIdPatch(authorization: string, childId: number, newSwId: number, options?: any) { - return ChildAPIApiFp(configuration).apiV2ChildMigrateChildIdchildIdPatch(authorization, childId, newSwId, options)(fetch, basePath); - }, - /** - * All the fields are optional. You can fill every field you want to change, and it will update the desired child.
Calling this API only affects child table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
The same rule applied for nationality and birthPlace.
For voiceUrl and awakeAvatarUrl you have to upload a file; for avatar in png, jpg or jpeg and for voice in wav, m4a, wma, mp3, aac or ogg format.
Social workers can change their NGO by editing ngoId field.
- * @summary update a child - * @param {string} authorization Access Token - * @param {number} childId - * @param {any} [awakeAvatarUrl] - * @param {any} [sleptAvatarUrl] - * @param {any} [voiceUrl] - * @param {string} [firstNameTranslations] - * @param {string} [saynameTranslations] {\"en\": \"Bob\", \"fa\": \"بابک\"} - * @param {string} [bioTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {string} [bioSummaryTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {string} [lastNameTranslations] - * @param {string} [sayName] - * @param {string} [phoneNumber] - * @param {number} [nationality] - * @param {number} [country] - * @param {number} [city] - * @param {boolean} [gender] - * @param {string} [birthPlace] - * @param {string} [birthDate] - * @param {string} [address] - * @param {number} [housingStatus] - * @param {number} [familyCount] - * @param {number} [education] - * @param {number} [status] - * @param {number} [existenceStatus] 0 dead :( | 1 alive and present | 2 alive but gone | 3 Temporarry gone - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ChildUpdateChildIdchildIdPatch(authorization: string, childId: number, awakeAvatarUrl?: any, sleptAvatarUrl?: any, voiceUrl?: any, firstNameTranslations?: string, saynameTranslations?: string, bioTranslations?: string, bioSummaryTranslations?: string, lastNameTranslations?: string, sayName?: string, phoneNumber?: string, nationality?: number, country?: number, city?: number, gender?: boolean, birthPlace?: string, birthDate?: string, address?: string, housingStatus?: number, familyCount?: number, education?: number, status?: number, existenceStatus?: number, options?: any) { - return ChildAPIApiFp(configuration).apiV2ChildUpdateChildIdchildIdPatch(authorization, childId, awakeAvatarUrl, sleptAvatarUrl, voiceUrl, firstNameTranslations, saynameTranslations, bioTranslations, bioSummaryTranslations, lastNameTranslations, sayName, phoneNumber, nationality, country, city, gender, birthPlace, birthDate, address, housingStatus, familyCount, education, status, existenceStatus, options)(fetch, basePath); - }, - }; -}; - -/** - * ChildAPIApi - object-oriented interface - * @export - * @class ChildAPIApi - * @extends {BaseAPI} - */ -export class ChildAPIApi extends BaseAPI { +export const ChildAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { /** * * @summary Get all active children * @param {string} authorization Access Token * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ChildAPIApi */ - public apiV2ChildActivesGet(authorization: string, options?: any) { - return ChildAPIApiFp(this.configuration).apiV2ChildActivesGet(authorization, options)(this.fetch, this.basePath); - } - + apiV2ChildActivesGet(authorization: string, options?: any) { + return ChildAPIApiFp(configuration).apiV2ChildActivesGet( + authorization, + options, + )(fetch, basePath); + }, /** * Adds a new child.
Calling this API affects child and social_worker tables.
Adding firstName, lastName, nationality, birthPlace, address, housingStatus, familyCount, education and status are optional.
For awakeAvatarUrl and voiceUrl you have to upload a file; for avatar in png, jpg or jpeg and for voice in wav, m4a, wma, mp3, aac or ogg format.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities and the same rule is applied for nationality and birthPlace.
Here is a guide for the codes used in this API:
gender: [true]male, [false]female
housingStatus: [0]homeless, [1]rent, [2]has home, [3]with relatives
education: [-1]uneducated, [0]pre-school, [1]1st grade, [2]2nd grade, ...
(no code has been assigned to status yet)
* @summary add a child @@ -5099,12 +7052,60 @@ export class ChildAPIApi extends BaseAPI { * @param {number} [status] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ChildAPIApi */ - public apiV2ChildAddPost(authorization: string, awakeAvatarUrl: any, sleptAvatarUrl: any, voiceUrl: any, saynameTranslations: string, bioTranslations: string, bioSummaryTranslations: string, phoneNumber: string, country: number, city: number, gender: boolean, ngoId?: number, swId?: number, firstNameTranslations?: string, lastNameTranslations?: string, nationality?: number, birthPlace?: string, birthDate?: string, address?: string, housingStatus?: number, familyCount?: number, education?: number, status?: number, options?: any) { - return ChildAPIApiFp(this.configuration).apiV2ChildAddPost(authorization, awakeAvatarUrl, sleptAvatarUrl, voiceUrl, saynameTranslations, bioTranslations, bioSummaryTranslations, phoneNumber, country, city, gender, ngoId, swId, firstNameTranslations, lastNameTranslations, nationality, birthPlace, birthDate, address, housingStatus, familyCount, education, status, options)(this.fetch, this.basePath); - } - + apiV2ChildAddPost( + authorization: string, + awakeAvatarUrl: any, + sleptAvatarUrl: any, + voiceUrl: any, + saynameTranslations: string, + bioTranslations: string, + bioSummaryTranslations: string, + phoneNumber: string, + country: number, + city: number, + gender: boolean, + ngoId?: number, + swId?: number, + firstNameTranslations?: string, + lastNameTranslations?: string, + nationality?: number, + birthPlace?: string, + birthDate?: string, + address?: string, + housingStatus?: number, + familyCount?: number, + education?: number, + status?: number, + options?: any, + ) { + return ChildAPIApiFp(configuration).apiV2ChildAddPost( + authorization, + awakeAvatarUrl, + sleptAvatarUrl, + voiceUrl, + saynameTranslations, + bioTranslations, + bioSummaryTranslations, + phoneNumber, + country, + city, + gender, + ngoId, + swId, + firstNameTranslations, + lastNameTranslations, + nationality, + birthPlace, + birthDate, + address, + housingStatus, + familyCount, + education, + status, + options, + )(fetch, basePath); + }, /** * Returns information of all children as a json object.
Json key is child id and json value is children data.
Calling this API affects on child, need, child_need, need_family and user tables.
It contains children info, their needs and participants of those needs. Confirm tag determines the type of output:
[0]for not confirmed children only, [1]for confirmed children only, [2]for both confirmed and not confirmed children
* @summary get all children @@ -5117,25 +7118,53 @@ export class ChildAPIApi extends BaseAPI { * @param {any} [existenceStatus] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ChildAPIApi */ - public apiV2ChildAllConfirmconfirmGet(authorization: string, confirm: number, ngoId?: any, swId?: any, take?: any, skip?: any, existenceStatus?: any, options?: any) { - return ChildAPIApiFp(this.configuration).apiV2ChildAllConfirmconfirmGet(authorization, confirm, ngoId, swId, take, skip, existenceStatus, options)(this.fetch, this.basePath); - } - + apiV2ChildAllConfirmconfirmGet( + authorization: string, + confirm: number, + ngoId?: any, + swId?: any, + take?: any, + skip?: any, + existenceStatus?: any, + options?: any, + ) { + return ChildAPIApiFp(configuration).apiV2ChildAllConfirmconfirmGet( + authorization, + confirm, + ngoId, + swId, + take, + skip, + existenceStatus, + options, + )(fetch, basePath); + }, /** * * @summary get child needs summary * @param {string} authorization Access Token * @param {number} childId + * @param {boolean} [isDone] + * @param {number} [status] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ChildAPIApi */ - public apiV2ChildChildIdNeedsSummaryGet(authorization: string, childId: number, options?: any) { - return ChildAPIApiFp(this.configuration).apiV2ChildChildIdNeedsSummaryGet(authorization, childId, options)(this.fetch, this.basePath); - } - + apiV2ChildChildIdNeedsSummaryGet( + authorization: string, + childId: number, + isDone?: boolean, + status?: number, + options?: any, + ) { + return ChildAPIApiFp(configuration).apiV2ChildChildIdNeedsSummaryGet( + authorization, + childId, + isDone, + status, + options, + )(fetch, basePath); + }, /** * * @summary get child needs @@ -5143,26 +7172,42 @@ export class ChildAPIApi extends BaseAPI { * @param {number} childId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ChildAPIApi */ - public apiV2ChildChildIdchildIdNeedsGet(authorization: string, childId: number, options?: any) { - return ChildAPIApiFp(this.configuration).apiV2ChildChildIdchildIdNeedsGet(authorization, childId, options)(this.fetch, this.basePath); - } - - /** - * Returns information of a child with given id as a json object.
Calling this API affects on child, need, child_need and need_family and user tables.
It contains child info, its needs and participants of those needs.
Confirm parameter determines how do you want the result:
[0]not onfirmed, [1] confirmed, [2]both
+ apiV2ChildChildIdchildIdNeedsGet( + authorization: string, + childId: number, + options?: any, + ) { + return ChildAPIApiFp(configuration).apiV2ChildChildIdchildIdNeedsGet( + authorization, + childId, + options, + )(fetch, basePath); + }, + /** + * Returns information of a child with given id as a json object.
Calling this API affects on child, need, child_need and need_family and user tables.
It contains child info, its needs and participants of those needs.
Confirm parameter determines how do you want the result:
[0]not confirmed, [1] confirmed, [2]both
* @summary get child by id * @param {string} authorization Access Token * @param {number} childId * @param {number} confirm * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ChildAPIApi */ - public apiV2ChildChildIdchildIdconfirmconfirmGet(authorization: string, childId: number, confirm: number, options?: any) { - return ChildAPIApiFp(this.configuration).apiV2ChildChildIdchildIdconfirmconfirmGet(authorization, childId, confirm, options)(this.fetch, this.basePath); - } - + apiV2ChildChildIdchildIdconfirmconfirmGet( + authorization: string, + childId: number, + confirm: number, + options?: any, + ) { + return ChildAPIApiFp( + configuration, + ).apiV2ChildChildIdchildIdconfirmconfirmGet( + authorization, + childId, + confirm, + options, + )(fetch, basePath); + }, /** * Confirms a child, so you cannot delete it anymore but you can add needs to it.
Calling this API affect child, ngo, social_worker, child_need and family tables.
* @summary confirm a child @@ -5170,12 +7215,18 @@ export class ChildAPIApi extends BaseAPI { * @param {number} childId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ChildAPIApi */ - public apiV2ChildConfirmChildIdchildIdPatch(authorization: string, childId: number, options?: any) { - return ChildAPIApiFp(this.configuration).apiV2ChildConfirmChildIdchildIdPatch(authorization, childId, options)(this.fetch, this.basePath); - } - + apiV2ChildConfirmChildIdchildIdPatch( + authorization: string, + childId: number, + options?: any, + ) { + return ChildAPIApiFp(configuration).apiV2ChildConfirmChildIdchildIdPatch( + authorization, + childId, + options, + )(fetch, basePath); + }, /** * This API deletes a specific child. Only not confirmed children can be deleted.
Calling this API affects family table by updating a row and set isDeleted tag true, social_worker and ngo table by decreasing their currentChildrenCount field by 1 and child by setting isDeleted tag true for some rows.
We do not fully delete any rows.
* @summary delete a child @@ -5183,12 +7234,18 @@ export class ChildAPIApi extends BaseAPI { * @param {number} childId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ChildAPIApi */ - public apiV2ChildDeleteChildIdchildIdPatch(authorization: string, childId: number, options?: any) { - return ChildAPIApiFp(this.configuration).apiV2ChildDeleteChildIdchildIdPatch(authorization, childId, options)(this.fetch, this.basePath); - } - + apiV2ChildDeleteChildIdchildIdPatch( + authorization: string, + childId: number, + options?: any, + ) { + return ChildAPIApiFp(configuration).apiV2ChildDeleteChildIdchildIdPatch( + authorization, + childId, + options, + )(fetch, basePath); + }, /** * * @summary get child by invitation token @@ -5196,12 +7253,18 @@ export class ChildAPIApi extends BaseAPI { * @param {string} [authorization] Access Token * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ChildAPIApi */ - public apiV2ChildInvitationsTokenGet(token: string, authorization?: string, options?: any) { - return ChildAPIApiFp(this.configuration).apiV2ChildInvitationsTokenGet(token, authorization, options)(this.fetch, this.basePath); - } - + apiV2ChildInvitationsTokenGet( + token: string, + authorization?: string, + options?: any, + ) { + return ChildAPIApiFp(configuration).apiV2ChildInvitationsTokenGet( + token, + authorization, + options, + )(fetch, basePath); + }, /** * This API migrates a child.
It means that from the moment after migration, another social worker will cover the child's need.
The records of child will migrate too, so nothing is going to be missed or deleted.
Calling this API affects on child, social_worker, ngo, child_need, need and family tables.
It inserts a new record int child table for the migrated child and deactives the previous child's record.
* @summary migrate a child @@ -5210,12 +7273,20 @@ export class ChildAPIApi extends BaseAPI { * @param {number} newSwId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ChildAPIApi */ - public apiV2ChildMigrateChildIdchildIdPatch(authorization: string, childId: number, newSwId: number, options?: any) { - return ChildAPIApiFp(this.configuration).apiV2ChildMigrateChildIdchildIdPatch(authorization, childId, newSwId, options)(this.fetch, this.basePath); - } - + apiV2ChildMigrateChildIdchildIdPatch( + authorization: string, + childId: number, + newSwId: number, + options?: any, + ) { + return ChildAPIApiFp(configuration).apiV2ChildMigrateChildIdchildIdPatch( + authorization, + childId, + newSwId, + options, + )(fetch, basePath); + }, /** * All the fields are optional. You can fill every field you want to change, and it will update the desired child.
Calling this API only affects child table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
The same rule applied for nationality and birthPlace.
For voiceUrl and awakeAvatarUrl you have to upload a file; for avatar in png, jpg or jpeg and for voice in wav, m4a, wma, mp3, aac or ogg format.
Social workers can change their NGO by editing ngoId field.
* @summary update a child @@ -5245,53 +7316,517 @@ export class ChildAPIApi extends BaseAPI { * @param {number} [existenceStatus] 0 dead :( | 1 alive and present | 2 alive but gone | 3 Temporarry gone * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ChildAPIApi */ - public apiV2ChildUpdateChildIdchildIdPatch(authorization: string, childId: number, awakeAvatarUrl?: any, sleptAvatarUrl?: any, voiceUrl?: any, firstNameTranslations?: string, saynameTranslations?: string, bioTranslations?: string, bioSummaryTranslations?: string, lastNameTranslations?: string, sayName?: string, phoneNumber?: string, nationality?: number, country?: number, city?: number, gender?: boolean, birthPlace?: string, birthDate?: string, address?: string, housingStatus?: number, familyCount?: number, education?: number, status?: number, existenceStatus?: number, options?: any) { - return ChildAPIApiFp(this.configuration).apiV2ChildUpdateChildIdchildIdPatch(authorization, childId, awakeAvatarUrl, sleptAvatarUrl, voiceUrl, firstNameTranslations, saynameTranslations, bioTranslations, bioSummaryTranslations, lastNameTranslations, sayName, phoneNumber, nationality, country, city, gender, birthPlace, birthDate, address, housingStatus, familyCount, education, status, existenceStatus, options)(this.fetch, this.basePath); - } + apiV2ChildUpdateChildIdchildIdPatch( + authorization: string, + childId: number, + awakeAvatarUrl?: any, + sleptAvatarUrl?: any, + voiceUrl?: any, + firstNameTranslations?: string, + saynameTranslations?: string, + bioTranslations?: string, + bioSummaryTranslations?: string, + lastNameTranslations?: string, + sayName?: string, + phoneNumber?: string, + nationality?: number, + country?: number, + city?: number, + gender?: boolean, + birthPlace?: string, + birthDate?: string, + address?: string, + housingStatus?: number, + familyCount?: number, + education?: number, + status?: number, + existenceStatus?: number, + options?: any, + ) { + return ChildAPIApiFp(configuration).apiV2ChildUpdateChildIdchildIdPatch( + authorization, + childId, + awakeAvatarUrl, + sleptAvatarUrl, + voiceUrl, + firstNameTranslations, + saynameTranslations, + bioTranslations, + bioSummaryTranslations, + lastNameTranslations, + sayName, + phoneNumber, + nationality, + country, + city, + gender, + birthPlace, + birthDate, + address, + housingStatus, + familyCount, + education, + status, + existenceStatus, + options, + )(fetch, basePath); + }, + }; +}; +/** + * ChildAPIApi - object-oriented interface + * @export + * @class ChildAPIApi + * @extends {BaseAPI} + */ +export class ChildAPIApi extends BaseAPI { + /** + * + * @summary Get all active children + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChildAPIApi + */ + public apiV2ChildActivesGet(authorization: string, options?: any) { + return ChildAPIApiFp(this.configuration).apiV2ChildActivesGet( + authorization, + options, + )(this.fetch, this.basePath); + } + + /** + * Adds a new child.
Calling this API affects child and social_worker tables.
Adding firstName, lastName, nationality, birthPlace, address, housingStatus, familyCount, education and status are optional.
For awakeAvatarUrl and voiceUrl you have to upload a file; for avatar in png, jpg or jpeg and for voice in wav, m4a, wma, mp3, aac or ogg format.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities and the same rule is applied for nationality and birthPlace.
Here is a guide for the codes used in this API:
gender: [true]male, [false]female
housingStatus: [0]homeless, [1]rent, [2]has home, [3]with relatives
education: [-1]uneducated, [0]pre-school, [1]1st grade, [2]2nd grade, ...
(no code has been assigned to status yet)
+ * @summary add a child + * @param {string} authorization Access Token + * @param {any} awakeAvatarUrl + * @param {any} sleptAvatarUrl + * @param {any} voiceUrl + * @param {string} saynameTranslations {\"en\": \"Bob\", \"fa\": \"بابک\"} + * @param {string} bioTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {string} bioSummaryTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {string} phoneNumber + * @param {number} country + * @param {number} city + * @param {boolean} gender + * @param {number} [ngoId] + * @param {number} [swId] + * @param {string} [firstNameTranslations] + * @param {string} [lastNameTranslations] + * @param {number} [nationality] + * @param {string} [birthPlace] + * @param {string} [birthDate] + * @param {string} [address] + * @param {number} [housingStatus] + * @param {number} [familyCount] + * @param {number} [education] + * @param {number} [status] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChildAPIApi + */ + public apiV2ChildAddPost( + authorization: string, + awakeAvatarUrl: any, + sleptAvatarUrl: any, + voiceUrl: any, + saynameTranslations: any, + bioTranslations: any, + bioSummaryTranslations: any, + phoneNumber: string, + country: number, + city: number, + gender: boolean, + ngoId?: number, + swId?: number, + firstNameTranslations?: any, + lastNameTranslations?: any, + nationality?: number, + birthPlace?: string, + birthDate?: string, + address?: string, + housingStatus?: number, + familyCount?: number, + education?: number, + status?: number, + options?: any, + ) { + return ChildAPIApiFp(this.configuration).apiV2ChildAddPost( + authorization, + awakeAvatarUrl, + sleptAvatarUrl, + voiceUrl, + saynameTranslations, + bioTranslations, + bioSummaryTranslations, + phoneNumber, + country, + city, + gender, + ngoId, + swId, + firstNameTranslations, + lastNameTranslations, + nationality, + birthPlace, + birthDate, + address, + housingStatus, + familyCount, + education, + status, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns information of all children as a json object.
Json key is child id and json value is children data.
Calling this API affects on child, need, child_need, need_family and user tables.
It contains children info, their needs and participants of those needs. Confirm tag determines the type of output:
[0]for not confirmed children only, [1]for confirmed children only, [2]for both confirmed and not confirmed children
+ * @summary get all children + * @param {string} authorization Access Token + * @param {number} confirm + * @param {any} [ngoId] + * @param {any} [swId] + * @param {any} [take] + * @param {any} [skip] + * @param {any} [existenceStatus] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChildAPIApi + */ + public apiV2ChildAllConfirmconfirmGet( + authorization: string, + confirm: number, + ngoId?: any, + swId?: any, + take?: any, + skip?: any, + existenceStatus?: any, + options?: any, + ) { + return ChildAPIApiFp(this.configuration).apiV2ChildAllConfirmconfirmGet( + authorization, + confirm, + ngoId, + swId, + take, + skip, + existenceStatus, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary get child needs summary + * @param {string} authorization Access Token + * @param {number} childId + * @param {boolean} [isDone] + * @param {number} [status] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChildAPIApi + */ + public apiV2ChildChildIdNeedsSummaryGet( + authorization: string, + childId: number, + isDone?: boolean, + status?: number, + options?: any, + ) { + return ChildAPIApiFp(this.configuration).apiV2ChildChildIdNeedsSummaryGet( + authorization, + childId, + isDone, + status, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary get child needs + * @param {string} authorization Access Token + * @param {number} childId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChildAPIApi + */ + public apiV2ChildChildIdchildIdNeedsGet( + authorization: string, + childId: number, + options?: any, + ) { + return ChildAPIApiFp(this.configuration).apiV2ChildChildIdchildIdNeedsGet( + authorization, + childId, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns information of a child with given id as a json object.
Calling this API affects on child, need, child_need and need_family and user tables.
It contains child info, its needs and participants of those needs.
Confirm parameter determines how do you want the result:
[0]not confirmed, [1] confirmed, [2]both
+ * @summary get child by id + * @param {string} authorization Access Token + * @param {number} childId + * @param {number} confirm + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChildAPIApi + */ + public apiV2ChildChildIdchildIdconfirmconfirmGet( + authorization: string, + childId: number, + confirm: number, + options?: any, + ) { + return ChildAPIApiFp( + this.configuration, + ).apiV2ChildChildIdchildIdconfirmconfirmGet( + authorization, + childId, + confirm, + options, + )(this.fetch, this.basePath); + } + + /** + * Confirms a child, so you cannot delete it anymore but you can add needs to it.
Calling this API affect child, ngo, social_worker, child_need and family tables.
+ * @summary confirm a child + * @param {string} authorization Access Token + * @param {number} childId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChildAPIApi + */ + public apiV2ChildConfirmChildIdchildIdPatch( + authorization: string, + childId: number, + options?: any, + ) { + return ChildAPIApiFp( + this.configuration, + ).apiV2ChildConfirmChildIdchildIdPatch( + authorization, + childId, + options, + )(this.fetch, this.basePath); + } + + /** + * This API deletes a specific child. Only not confirmed children can be deleted.
Calling this API affects family table by updating a row and set isDeleted tag true, social_worker and ngo table by decreasing their currentChildrenCount field by 1 and child by setting isDeleted tag true for some rows.
We do not fully delete any rows.
+ * @summary delete a child + * @param {string} authorization Access Token + * @param {number} childId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChildAPIApi + */ + public apiV2ChildDeleteChildIdchildIdPatch( + authorization: string, + childId: number, + options?: any, + ) { + return ChildAPIApiFp( + this.configuration, + ).apiV2ChildDeleteChildIdchildIdPatch( + authorization, + childId, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary get child by invitation token + * @param {string} token + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChildAPIApi + */ + public apiV2ChildInvitationsTokenGet( + token: string, + authorization?: string, + options?: any, + ) { + return ChildAPIApiFp(this.configuration).apiV2ChildInvitationsTokenGet( + token, + authorization, + options, + )(this.fetch, this.basePath); + } + + /** + * This API migrates a child.
It means that from the moment after migration, another social worker will cover the child's need.
The records of child will migrate too, so nothing is going to be missed or deleted.
Calling this API affects on child, social_worker, ngo, child_need, need and family tables.
It inserts a new record int child table for the migrated child and deactives the previous child's record.
+ * @summary migrate a child + * @param {string} authorization Access Token + * @param {number} childId + * @param {number} newSwId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChildAPIApi + */ + public apiV2ChildMigrateChildIdchildIdPatch( + authorization: string, + childId: number, + newSwId: number, + options?: any, + ) { + return ChildAPIApiFp( + this.configuration, + ).apiV2ChildMigrateChildIdchildIdPatch( + authorization, + childId, + newSwId, + options, + )(this.fetch, this.basePath); + } + + /** + * All the fields are optional. You can fill every field you want to change, and it will update the desired child.
Calling this API only affects child table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
The same rule applied for nationality and birthPlace.
For voiceUrl and awakeAvatarUrl you have to upload a file; for avatar in png, jpg or jpeg and for voice in wav, m4a, wma, mp3, aac or ogg format.
Social workers can change their NGO by editing ngoId field.
+ * @summary update a child + * @param {string} authorization Access Token + * @param {number} childId + * @param {any} [awakeAvatarUrl] + * @param {any} [sleptAvatarUrl] + * @param {any} [voiceUrl] + * @param {string} [firstNameTranslations] + * @param {string} [saynameTranslations] {\"en\": \"Bob\", \"fa\": \"بابک\"} + * @param {string} [bioTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {string} [bioSummaryTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {string} [lastNameTranslations] + * @param {string} [sayName] + * @param {string} [phoneNumber] + * @param {number} [nationality] + * @param {number} [country] + * @param {number} [city] + * @param {boolean} [gender] + * @param {string} [birthPlace] + * @param {string} [birthDate] + * @param {string} [address] + * @param {number} [housingStatus] + * @param {number} [familyCount] + * @param {number} [education] + * @param {number} [status] + * @param {number} [existenceStatus] 0 dead :( | 1 alive and present | 2 alive but gone | 3 Temporarry gone + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChildAPIApi + */ + public apiV2ChildUpdateChildIdchildIdPatch( + authorization: string, + childId: number, + awakeAvatarUrl?: any, + sleptAvatarUrl?: any, + voiceUrl?: any, + firstNameTranslations?: string, + saynameTranslations?: string, + bioTranslations?: string, + bioSummaryTranslations?: string, + lastNameTranslations?: string, + sayName?: string, + phoneNumber?: string, + nationality?: number, + country?: number, + city?: number, + gender?: boolean, + birthPlace?: string, + birthDate?: string, + address?: string, + housingStatus?: number, + familyCount?: number, + education?: number, + status?: number, + existenceStatus?: number, + options?: any, + ) { + return ChildAPIApiFp( + this.configuration, + ).apiV2ChildUpdateChildIdchildIdPatch( + authorization, + childId, + awakeAvatarUrl, + sleptAvatarUrl, + voiceUrl, + firstNameTranslations, + saynameTranslations, + bioTranslations, + bioSummaryTranslations, + lastNameTranslations, + sayName, + phoneNumber, + nationality, + country, + city, + gender, + birthPlace, + birthDate, + address, + housingStatus, + familyCount, + education, + status, + existenceStatus, + options, + )(this.fetch, this.basePath); + } } /** * DashboardAPIApi - fetch parameter creator * @export */ -export const DashboardAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * Returns required information for dashboard as a json object.
It contains user data and user urgent needs.
Calling this API affects need, child, child_need, need_family and user tables.
- * @summary get dashboard data feed by id - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2DashboardGet(authorization: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2DashboardGet.'); - } - const localVarPath = `/api/v2/dashboard`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } +export const DashboardAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + * Returns required information for dashboard as a json object.
It contains user data and user urgent needs.
Calling this API affects need, child, child_need, need_family and user tables.
+ * @summary get dashboard data feed by id + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2DashboardGet(authorization: string, options: any = {}): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2DashboardGet.', + ); + } + const localVarPath = `/api/v2/dashboard`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; }; /** @@ -5299,46 +7834,64 @@ export const DashboardAPIApiFetchParamCreator = function (configuration?: Config * @export */ export const DashboardAPIApiFp = function (configuration?: Configuration) { - return { - /** - * Returns required information for dashboard as a json object.
It contains user data and user urgent needs.
Calling this API affects need, child, child_need, need_family and user tables.
- * @summary get dashboard data feed by id - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2DashboardGet(authorization: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = DashboardAPIApiFetchParamCreator(configuration).apiV2DashboardGet(authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - } + return { + /** + * Returns required information for dashboard as a json object.
It contains user data and user urgent needs.
Calling this API affects need, child, child_need, need_family and user tables.
+ * @summary get dashboard data feed by id + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2DashboardGet( + authorization: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = DashboardAPIApiFetchParamCreator( + configuration, + ).apiV2DashboardGet(authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + }; }; /** * DashboardAPIApi - factory interface * @export */ -export const DashboardAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * Returns required information for dashboard as a json object.
It contains user data and user urgent needs.
Calling this API affects need, child, child_need, need_family and user tables.
- * @summary get dashboard data feed by id - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2DashboardGet(authorization: string, options?: any) { - return DashboardAPIApiFp(configuration).apiV2DashboardGet(authorization, options)(fetch, basePath); - }, - }; +export const DashboardAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { + /** + * Returns required information for dashboard as a json object.
It contains user data and user urgent needs.
Calling this API affects need, child, child_need, need_family and user tables.
+ * @summary get dashboard data feed by id + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2DashboardGet(authorization: string, options?: any) { + return DashboardAPIApiFp(configuration).apiV2DashboardGet( + authorization, + options, + )(fetch, basePath); + }, + }; }; /** @@ -5348,231 +7901,338 @@ export const DashboardAPIApiFactory = function (configuration?: Configuration, f * @extends {BaseAPI} */ export class DashboardAPIApi extends BaseAPI { - /** - * Returns required information for dashboard as a json object.
It contains user data and user urgent needs.
Calling this API affects need, child, child_need, need_family and user tables.
- * @summary get dashboard data feed by id - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof DashboardAPIApi - */ - public apiV2DashboardGet(authorization: string, options?: any) { - return DashboardAPIApiFp(this.configuration).apiV2DashboardGet(authorization, options)(this.fetch, this.basePath); - } - + /** + * Returns required information for dashboard as a json object.
It contains user data and user urgent needs.
Calling this API affects need, child, child_need, need_family and user tables.
+ * @summary get dashboard data feed by id + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DashboardAPIApi + */ + public apiV2DashboardGet(authorization: string, options?: any) { + return DashboardAPIApiFp(this.configuration).apiV2DashboardGet( + authorization, + options, + )(this.fetch, this.basePath); + } } /** * FamilyAPIApi - fetch parameter creator * @export */ -export const FamilyAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * Adds a user to the family.
Calling this API affects family and user_family tables.
Each user has a role in family.
- * @summary add user to family - * @param {string} authorization Access Token - * @param {string} invitationToken Related to inviation model and contains family_id and role - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2FamilyAddPost(authorization: string, invitationToken: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2FamilyAddPost.'); - } - // verify required parameter 'invitationToken' is not null or undefined - if (invitationToken === null || invitationToken === undefined) { - throw new RequiredError('invitationToken', 'Required parameter invitationToken was null or undefined when calling apiV2FamilyAddPost.'); - } - const localVarPath = `/api/v2/family/add`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (invitationToken !== undefined) { - localVarFormParams.set('invitationToken', invitationToken as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns all families as a json object.
Calling this API affects family and user_family tables.
- * @summary get all families - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2FamilyAllGet(authorization: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2FamilyAllGet.'); - } - const localVarPath = `/api/v2/family/all`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * This API deletes a specific user from child family.
Calling this API affects user_family table by updating a row and set isDeleted tag true, child table by decreasing its sayFamilyCount field by 1 and need_family by setting isDeleted tag true for some rows.
We do not fully delete any rows.
- * @summary Leave from a family - * @param {string} authorization Access Token - * @param {number} familyId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2FamilyFamilyIdLeavePatch(authorization: string, familyId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2FamilyFamilyIdLeavePatch.'); - } - // verify required parameter 'familyId' is not null or undefined - if (familyId === null || familyId === undefined) { - throw new RequiredError('familyId', 'Required parameter familyId was null or undefined when calling apiV2FamilyFamilyIdLeavePatch.'); - } - const localVarPath = `/api/v2/family/{family_id}/leave` - .replace(`{${"family_id"}}`, encodeURIComponent(String(familyId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns the family with given id as a json object.
Calling this API affects family and user_family tables.
- * @summary get family by id - * @param {string} authorization Access Token - * @param {number} familyId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2FamilyFamilyIdfamilyIdGet(authorization: string, familyId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2FamilyFamilyIdfamilyIdGet.'); - } - // verify required parameter 'familyId' is not null or undefined - if (familyId === null || familyId === undefined) { - throw new RequiredError('familyId', 'Required parameter familyId was null or undefined when calling apiV2FamilyFamilyIdfamilyIdGet.'); - } - const localVarPath = `/api/v2/family/familyId={family_id}` - .replace(`{${"family_id"}}`, encodeURIComponent(String(familyId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
- * @summary Join to a family V3 - * @param {string} authorization - * @param {number} familyId - * @param {number} role - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV3FamiliesFamilyIdJoinPost(authorization: string, familyId: number, role: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV3FamiliesFamilyIdJoinPost.'); - } - // verify required parameter 'familyId' is not null or undefined - if (familyId === null || familyId === undefined) { - throw new RequiredError('familyId', 'Required parameter familyId was null or undefined when calling apiV3FamiliesFamilyIdJoinPost.'); - } - // verify required parameter 'role' is not null or undefined - if (role === null || role === undefined) { - throw new RequiredError('role', 'Required parameter role was null or undefined when calling apiV3FamiliesFamilyIdJoinPost.'); - } - const localVarPath = `/api/v3/families/{family_id}/join` - .replace(`{${"family_id"}}`, encodeURIComponent(String(familyId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (role !== undefined) { - localVarFormParams.set('role', role as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } +export const FamilyAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + * Adds a user to the family.
Calling this API affects family and user_family tables.
Each user has a role in family.
+ * @summary add user to family + * @param {string} authorization Access Token + * @param {string} invitationToken Related to inviation model and contains family_id and role + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2FamilyAddPost( + authorization: string, + invitationToken: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2FamilyAddPost.', + ); + } + // verify required parameter 'invitationToken' is not null or undefined + if (invitationToken === null || invitationToken === undefined) { + throw new RequiredError( + 'invitationToken', + 'Required parameter invitationToken was null or undefined when calling apiV2FamilyAddPost.', + ); + } + const localVarPath = `/api/v2/family/add`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (invitationToken !== undefined) { + localVarFormParams.set('invitationToken', invitationToken as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns all families as a json object.
Calling this API affects family and user_family tables.
+ * @summary get all families + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2FamilyAllGet(authorization: string, options: any = {}): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2FamilyAllGet.', + ); + } + const localVarPath = `/api/v2/family/all`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * This API deletes a specific user from child family.
Calling this API affects user_family table by updating a row and set isDeleted tag true, child table by decreasing its sayFamilyCount field by 1 and need_family by setting isDeleted tag true for some rows.
We do not fully delete any rows.
+ * @summary Leave from a family + * @param {string} authorization Access Token + * @param {number} familyId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2FamilyFamilyIdLeavePatch( + authorization: string, + familyId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2FamilyFamilyIdLeavePatch.', + ); + } + // verify required parameter 'familyId' is not null or undefined + if (familyId === null || familyId === undefined) { + throw new RequiredError( + 'familyId', + 'Required parameter familyId was null or undefined when calling apiV2FamilyFamilyIdLeavePatch.', + ); + } + const localVarPath = `/api/v2/family/{family_id}/leave`.replace( + `{${'family_id'}}`, + encodeURIComponent(String(familyId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns the family with given id as a json object.
Calling this API affects family and user_family tables.
+ * @summary get family by id + * @param {string} authorization Access Token + * @param {number} familyId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2FamilyFamilyIdfamilyIdGet( + authorization: string, + familyId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2FamilyFamilyIdfamilyIdGet.', + ); + } + // verify required parameter 'familyId' is not null or undefined + if (familyId === null || familyId === undefined) { + throw new RequiredError( + 'familyId', + 'Required parameter familyId was null or undefined when calling apiV2FamilyFamilyIdfamilyIdGet.', + ); + } + const localVarPath = `/api/v2/family/familyId={family_id}`.replace( + `{${'family_id'}}`, + encodeURIComponent(String(familyId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
+ * @summary Join to a family V3 + * @param {string} authorization + * @param {number} familyId + * @param {number} role + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV3FamiliesFamilyIdJoinPost( + authorization: string, + familyId: number, + role: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV3FamiliesFamilyIdJoinPost.', + ); + } + // verify required parameter 'familyId' is not null or undefined + if (familyId === null || familyId === undefined) { + throw new RequiredError( + 'familyId', + 'Required parameter familyId was null or undefined when calling apiV3FamiliesFamilyIdJoinPost.', + ); + } + // verify required parameter 'role' is not null or undefined + if (role === null || role === undefined) { + throw new RequiredError( + 'role', + 'Required parameter role was null or undefined when calling apiV3FamiliesFamilyIdJoinPost.', + ); + } + const localVarPath = `/api/v3/families/{family_id}/join`.replace( + `{${'family_id'}}`, + encodeURIComponent(String(familyId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (role !== undefined) { + localVarFormParams.set('role', role as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; }; /** @@ -5580,181 +8240,180 @@ export const FamilyAPIApiFetchParamCreator = function (configuration?: Configura * @export */ export const FamilyAPIApiFp = function (configuration?: Configuration) { - return { - /** - * Adds a user to the family.
Calling this API affects family and user_family tables.
Each user has a role in family.
- * @summary add user to family - * @param {string} authorization Access Token - * @param {string} invitationToken Related to inviation model and contains family_id and role - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2FamilyAddPost(authorization: string, invitationToken: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = FamilyAPIApiFetchParamCreator(configuration).apiV2FamilyAddPost(authorization, invitationToken, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * Returns all families as a json object.
Calling this API affects family and user_family tables.
- * @summary get all families - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2FamilyAllGet(authorization: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = FamilyAPIApiFetchParamCreator(configuration).apiV2FamilyAllGet(authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * This API deletes a specific user from child family.
Calling this API affects user_family table by updating a row and set isDeleted tag true, child table by decreasing its sayFamilyCount field by 1 and need_family by setting isDeleted tag true for some rows.
We do not fully delete any rows.
- * @summary Leave from a family - * @param {string} authorization Access Token - * @param {number} familyId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2FamilyFamilyIdLeavePatch(authorization: string, familyId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = FamilyAPIApiFetchParamCreator(configuration).apiV2FamilyFamilyIdLeavePatch(authorization, familyId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * Returns the family with given id as a json object.
Calling this API affects family and user_family tables.
- * @summary get family by id - * @param {string} authorization Access Token - * @param {number} familyId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2FamilyFamilyIdfamilyIdGet(authorization: string, familyId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = FamilyAPIApiFetchParamCreator(configuration).apiV2FamilyFamilyIdfamilyIdGet(authorization, familyId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
- * @summary Join to a family V3 - * @param {string} authorization - * @param {number} familyId - * @param {number} role - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV3FamiliesFamilyIdJoinPost(authorization: string, familyId: number, role: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = FamilyAPIApiFetchParamCreator(configuration).apiV3FamiliesFamilyIdJoinPost(authorization, familyId, role, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - } + return { + /** + * Adds a user to the family.
Calling this API affects family and user_family tables.
Each user has a role in family.
+ * @summary add user to family + * @param {string} authorization Access Token + * @param {string} invitationToken Related to inviation model and contains family_id and role + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2FamilyAddPost( + authorization: string, + invitationToken: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = FamilyAPIApiFetchParamCreator( + configuration, + ).apiV2FamilyAddPost(authorization, invitationToken, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * Returns all families as a json object.
Calling this API affects family and user_family tables.
+ * @summary get all families + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2FamilyAllGet( + authorization: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = FamilyAPIApiFetchParamCreator( + configuration, + ).apiV2FamilyAllGet(authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * This API deletes a specific user from child family.
Calling this API affects user_family table by updating a row and set isDeleted tag true, child table by decreasing its sayFamilyCount field by 1 and need_family by setting isDeleted tag true for some rows.
We do not fully delete any rows.
+ * @summary Leave from a family + * @param {string} authorization Access Token + * @param {number} familyId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2FamilyFamilyIdLeavePatch( + authorization: string, + familyId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = FamilyAPIApiFetchParamCreator( + configuration, + ).apiV2FamilyFamilyIdLeavePatch(authorization, familyId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * Returns the family with given id as a json object.
Calling this API affects family and user_family tables.
+ * @summary get family by id + * @param {string} authorization Access Token + * @param {number} familyId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2FamilyFamilyIdfamilyIdGet( + authorization: string, + familyId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = FamilyAPIApiFetchParamCreator( + configuration, + ).apiV2FamilyFamilyIdfamilyIdGet(authorization, familyId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
+ * @summary Join to a family V3 + * @param {string} authorization + * @param {number} familyId + * @param {number} role + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV3FamiliesFamilyIdJoinPost( + authorization: string, + familyId: number, + role: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = FamilyAPIApiFetchParamCreator( + configuration, + ).apiV3FamiliesFamilyIdJoinPost(authorization, familyId, role, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + }; }; /** * FamilyAPIApi - factory interface * @export */ -export const FamilyAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * Adds a user to the family.
Calling this API affects family and user_family tables.
Each user has a role in family.
- * @summary add user to family - * @param {string} authorization Access Token - * @param {string} invitationToken Related to inviation model and contains family_id and role - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2FamilyAddPost(authorization: string, invitationToken: string, options?: any) { - return FamilyAPIApiFp(configuration).apiV2FamilyAddPost(authorization, invitationToken, options)(fetch, basePath); - }, - /** - * Returns all families as a json object.
Calling this API affects family and user_family tables.
- * @summary get all families - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2FamilyAllGet(authorization: string, options?: any) { - return FamilyAPIApiFp(configuration).apiV2FamilyAllGet(authorization, options)(fetch, basePath); - }, - /** - * This API deletes a specific user from child family.
Calling this API affects user_family table by updating a row and set isDeleted tag true, child table by decreasing its sayFamilyCount field by 1 and need_family by setting isDeleted tag true for some rows.
We do not fully delete any rows.
- * @summary Leave from a family - * @param {string} authorization Access Token - * @param {number} familyId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2FamilyFamilyIdLeavePatch(authorization: string, familyId: number, options?: any) { - return FamilyAPIApiFp(configuration).apiV2FamilyFamilyIdLeavePatch(authorization, familyId, options)(fetch, basePath); - }, - /** - * Returns the family with given id as a json object.
Calling this API affects family and user_family tables.
- * @summary get family by id - * @param {string} authorization Access Token - * @param {number} familyId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2FamilyFamilyIdfamilyIdGet(authorization: string, familyId: number, options?: any) { - return FamilyAPIApiFp(configuration).apiV2FamilyFamilyIdfamilyIdGet(authorization, familyId, options)(fetch, basePath); - }, - /** - * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
- * @summary Join to a family V3 - * @param {string} authorization - * @param {number} familyId - * @param {number} role - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV3FamiliesFamilyIdJoinPost(authorization: string, familyId: number, role: number, options?: any) { - return FamilyAPIApiFp(configuration).apiV3FamiliesFamilyIdJoinPost(authorization, familyId, role, options)(fetch, basePath); - }, - }; -}; - -/** - * FamilyAPIApi - object-oriented interface - * @export - * @class FamilyAPIApi - * @extends {BaseAPI} - */ -export class FamilyAPIApi extends BaseAPI { +export const FamilyAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { /** * Adds a user to the family.
Calling this API affects family and user_family tables.
Each user has a role in family.
* @summary add user to family @@ -5762,24 +8421,31 @@ export class FamilyAPIApi extends BaseAPI { * @param {string} invitationToken Related to inviation model and contains family_id and role * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof FamilyAPIApi */ - public apiV2FamilyAddPost(authorization: string, invitationToken: string, options?: any) { - return FamilyAPIApiFp(this.configuration).apiV2FamilyAddPost(authorization, invitationToken, options)(this.fetch, this.basePath); - } - + apiV2FamilyAddPost( + authorization: string, + invitationToken: string, + options?: any, + ) { + return FamilyAPIApiFp(configuration).apiV2FamilyAddPost( + authorization, + invitationToken, + options, + )(fetch, basePath); + }, /** * Returns all families as a json object.
Calling this API affects family and user_family tables.
* @summary get all families * @param {string} authorization Access Token * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof FamilyAPIApi */ - public apiV2FamilyAllGet(authorization: string, options?: any) { - return FamilyAPIApiFp(this.configuration).apiV2FamilyAllGet(authorization, options)(this.fetch, this.basePath); - } - + apiV2FamilyAllGet(authorization: string, options?: any) { + return FamilyAPIApiFp(configuration).apiV2FamilyAllGet( + authorization, + options, + )(fetch, basePath); + }, /** * This API deletes a specific user from child family.
Calling this API affects user_family table by updating a row and set isDeleted tag true, child table by decreasing its sayFamilyCount field by 1 and need_family by setting isDeleted tag true for some rows.
We do not fully delete any rows.
* @summary Leave from a family @@ -5787,12 +8453,18 @@ export class FamilyAPIApi extends BaseAPI { * @param {number} familyId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof FamilyAPIApi */ - public apiV2FamilyFamilyIdLeavePatch(authorization: string, familyId: number, options?: any) { - return FamilyAPIApiFp(this.configuration).apiV2FamilyFamilyIdLeavePatch(authorization, familyId, options)(this.fetch, this.basePath); - } - + apiV2FamilyFamilyIdLeavePatch( + authorization: string, + familyId: number, + options?: any, + ) { + return FamilyAPIApiFp(configuration).apiV2FamilyFamilyIdLeavePatch( + authorization, + familyId, + options, + )(fetch, basePath); + }, /** * Returns the family with given id as a json object.
Calling this API affects family and user_family tables.
* @summary get family by id @@ -5800,12 +8472,18 @@ export class FamilyAPIApi extends BaseAPI { * @param {number} familyId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof FamilyAPIApi */ - public apiV2FamilyFamilyIdfamilyIdGet(authorization: string, familyId: number, options?: any) { - return FamilyAPIApiFp(this.configuration).apiV2FamilyFamilyIdfamilyIdGet(authorization, familyId, options)(this.fetch, this.basePath); - } - + apiV2FamilyFamilyIdfamilyIdGet( + authorization: string, + familyId: number, + options?: any, + ) { + return FamilyAPIApiFp(configuration).apiV2FamilyFamilyIdfamilyIdGet( + authorization, + familyId, + options, + )(fetch, basePath); + }, /** * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
* @summary Join to a family V3 @@ -5814,802 +8492,469 @@ export class FamilyAPIApi extends BaseAPI { * @param {number} role * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof FamilyAPIApi */ - public apiV3FamiliesFamilyIdJoinPost(authorization: string, familyId: number, role: number, options?: any) { - return FamilyAPIApiFp(this.configuration).apiV3FamiliesFamilyIdJoinPost(authorization, familyId, role, options)(this.fetch, this.basePath); - } - -} - -/** - * GeoAPIApi - fetch parameter creator - * @export - */ -export const GeoAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Get a City - * @param {number} id ID of city - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CitiesIdGet(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2CitiesIdGet.'); - } - const localVarPath = `/api/v2/cities/{id}` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary List countries - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CountriesGet(options: any = {}): FetchArgs { - const localVarPath = `/api/v2/countries`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get Country - * @param {number} id ID of Country - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CountriesIdGet(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2CountriesIdGet.'); - } - const localVarPath = `/api/v2/countries/{id}` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary List states of a country - * @param {number} id ID of Country - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CountriesIdStatesGet(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2CountriesIdStatesGet.'); - } - const localVarPath = `/api/v2/countries/{id}/states` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary List cities of a State - * @param {number} id ID of State - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2StatesIdCitiesGet(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2StatesIdCitiesGet.'); - } - const localVarPath = `/api/v2/states/{id}/cities` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get State by id - * @param {number} id ID of State - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2StatesIdGet(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2StatesIdGet.'); - } - const localVarPath = `/api/v2/states/{id}` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * GeoAPIApi - functional programming interface - * @export - */ -export const GeoAPIApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Get a City - * @param {number} id ID of city - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CitiesIdGet(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = GeoAPIApiFetchParamCreator(configuration).apiV2CitiesIdGet(id, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary List countries - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CountriesGet(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { - const localVarFetchArgs = GeoAPIApiFetchParamCreator(configuration).apiV2CountriesGet(options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Get Country - * @param {number} id ID of Country - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CountriesIdGet(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = GeoAPIApiFetchParamCreator(configuration).apiV2CountriesIdGet(id, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary List states of a country - * @param {number} id ID of Country - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CountriesIdStatesGet(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { - const localVarFetchArgs = GeoAPIApiFetchParamCreator(configuration).apiV2CountriesIdStatesGet(id, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary List cities of a State - * @param {number} id ID of State - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2StatesIdCitiesGet(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { - const localVarFetchArgs = GeoAPIApiFetchParamCreator(configuration).apiV2StatesIdCitiesGet(id, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Get State by id - * @param {number} id ID of State - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2StatesIdGet(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = GeoAPIApiFetchParamCreator(configuration).apiV2StatesIdGet(id, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - } + apiV3FamiliesFamilyIdJoinPost( + authorization: string, + familyId: number, + role: number, + options?: any, + ) { + return FamilyAPIApiFp(configuration).apiV3FamiliesFamilyIdJoinPost( + authorization, + familyId, + role, + options, + )(fetch, basePath); + }, + }; }; /** - * GeoAPIApi - factory interface + * FamilyAPIApi - object-oriented interface * @export + * @class FamilyAPIApi + * @extends {BaseAPI} */ -export const GeoAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * - * @summary Get a City - * @param {number} id ID of city - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CitiesIdGet(id: number, options?: any) { - return GeoAPIApiFp(configuration).apiV2CitiesIdGet(id, options)(fetch, basePath); - }, - /** - * - * @summary List countries - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CountriesGet(options?: any) { - return GeoAPIApiFp(configuration).apiV2CountriesGet(options)(fetch, basePath); - }, - /** - * - * @summary Get Country - * @param {number} id ID of Country - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CountriesIdGet(id: number, options?: any) { - return GeoAPIApiFp(configuration).apiV2CountriesIdGet(id, options)(fetch, basePath); - }, - /** - * - * @summary List states of a country - * @param {number} id ID of Country - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2CountriesIdStatesGet(id: number, options?: any) { - return GeoAPIApiFp(configuration).apiV2CountriesIdStatesGet(id, options)(fetch, basePath); - }, - /** - * - * @summary List cities of a State - * @param {number} id ID of State - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2StatesIdCitiesGet(id: number, options?: any) { - return GeoAPIApiFp(configuration).apiV2StatesIdCitiesGet(id, options)(fetch, basePath); - }, - /** - * - * @summary Get State by id - * @param {number} id ID of State - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2StatesIdGet(id: number, options?: any) { - return GeoAPIApiFp(configuration).apiV2StatesIdGet(id, options)(fetch, basePath); - }, - }; -}; +export class FamilyAPIApi extends BaseAPI { + /** + * Adds a user to the family.
Calling this API affects family and user_family tables.
Each user has a role in family.
+ * @summary add user to family + * @param {string} authorization Access Token + * @param {string} invitationToken Related to inviation model and contains family_id and role + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FamilyAPIApi + */ + public apiV2FamilyAddPost( + authorization: string, + invitationToken: string, + options?: any, + ) { + return FamilyAPIApiFp(this.configuration).apiV2FamilyAddPost( + authorization, + invitationToken, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns all families as a json object.
Calling this API affects family and user_family tables.
+ * @summary get all families + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FamilyAPIApi + */ + public apiV2FamilyAllGet(authorization: string, options?: any) { + return FamilyAPIApiFp(this.configuration).apiV2FamilyAllGet( + authorization, + options, + )(this.fetch, this.basePath); + } + + /** + * This API deletes a specific user from child family.
Calling this API affects user_family table by updating a row and set isDeleted tag true, child table by decreasing its sayFamilyCount field by 1 and need_family by setting isDeleted tag true for some rows.
We do not fully delete any rows.
+ * @summary Leave from a family + * @param {string} authorization Access Token + * @param {number} familyId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FamilyAPIApi + */ + public apiV2FamilyFamilyIdLeavePatch( + authorization: string, + familyId: number, + options?: any, + ) { + return FamilyAPIApiFp(this.configuration).apiV2FamilyFamilyIdLeavePatch( + authorization, + familyId, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns the family with given id as a json object.
Calling this API affects family and user_family tables.
+ * @summary get family by id + * @param {string} authorization Access Token + * @param {number} familyId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FamilyAPIApi + */ + public apiV2FamilyFamilyIdfamilyIdGet( + authorization: string, + familyId: number, + options?: any, + ) { + return FamilyAPIApiFp(this.configuration).apiV2FamilyFamilyIdfamilyIdGet( + authorization, + familyId, + options, + )(this.fetch, this.basePath); + } + + /** + * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
+ * @summary Join to a family V3 + * @param {string} authorization + * @param {number} familyId + * @param {number} role + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FamilyAPIApi + */ + public apiV3FamiliesFamilyIdJoinPost( + authorization: string, + familyId: number, + role: number, + options?: any, + ) { + return FamilyAPIApiFp(this.configuration).apiV3FamiliesFamilyIdJoinPost( + authorization, + familyId, + role, + options, + )(this.fetch, this.basePath); + } +} /** - * GeoAPIApi - object-oriented interface + * GeoAPIApi - fetch parameter creator * @export - * @class GeoAPIApi - * @extends {BaseAPI} */ -export class GeoAPIApi extends BaseAPI { +export const GeoAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { /** * - * @summary Get a City - * @param {number} id ID of city + * @summary List countries * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof GeoAPIApi */ - public apiV2CitiesIdGet(id: number, options?: any) { - return GeoAPIApiFp(this.configuration).apiV2CitiesIdGet(id, options)(this.fetch, this.basePath); - } - + apiV2CountriesGet(options: any = {}): FetchArgs { + const localVarPath = `/api/v2/countries`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @summary List countries + * @summary List states of a country + * @param {number} id ID of Country * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof GeoAPIApi */ - public apiV2CountriesGet(options?: any) { - return GeoAPIApiFp(this.configuration).apiV2CountriesGet(options)(this.fetch, this.basePath); - } - + apiV2CountriesIdStatesGet(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2CountriesIdStatesGet.', + ); + } + const localVarPath = `/api/v2/countries/{id}/states`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * - * @summary Get Country - * @param {number} id ID of Country + * @summary List cities of a State + * @param {number} id ID of State * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof GeoAPIApi */ - public apiV2CountriesIdGet(id: number, options?: any) { - return GeoAPIApiFp(this.configuration).apiV2CountriesIdGet(id, options)(this.fetch, this.basePath); - } + apiV2StatesIdCitiesGet(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2StatesIdCitiesGet.', + ); + } + const localVarPath = `/api/v2/states/{id}/cities`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; +/** + * GeoAPIApi - functional programming interface + * @export + */ +export const GeoAPIApiFp = function (configuration?: Configuration) { + return { /** * - * @summary List states of a country - * @param {number} id ID of Country + * @summary List countries * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof GeoAPIApi */ - public apiV2CountriesIdStatesGet(id: number, options?: any) { - return GeoAPIApiFp(this.configuration).apiV2CountriesIdStatesGet(id, options)(this.fetch, this.basePath); - } - + apiV2CountriesGet( + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise> { + const localVarFetchArgs = + GeoAPIApiFetchParamCreator(configuration).apiV2CountriesGet(options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * - * @summary List cities of a State - * @param {number} id ID of State + * @summary List states of a country + * @param {number} id ID of Country * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof GeoAPIApi */ - public apiV2StatesIdCitiesGet(id: number, options?: any) { - return GeoAPIApiFp(this.configuration).apiV2StatesIdCitiesGet(id, options)(this.fetch, this.basePath); - } - + apiV2CountriesIdStatesGet( + id: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise> { + const localVarFetchArgs = GeoAPIApiFetchParamCreator( + configuration, + ).apiV2CountriesIdStatesGet(id, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * - * @summary Get State by id + * @summary List cities of a State * @param {number} id ID of State * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof GeoAPIApi */ - public apiV2StatesIdGet(id: number, options?: any) { - return GeoAPIApiFp(this.configuration).apiV2StatesIdGet(id, options)(this.fetch, this.basePath); - } - -} - -/** - * InvitationAPIApi - fetch parameter creator - * @export - */ -export const InvitationAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
- * @summary Invite to join to a family - * @param {number} familyId - * @param {string} [authorization] - * @param {number} [role] - * @param {string} [text] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2InvitationsPost(familyId: number, authorization?: string, role?: number, text?: string, options: any = {}): FetchArgs { - // verify required parameter 'familyId' is not null or undefined - if (familyId === null || familyId === undefined) { - throw new RequiredError('familyId', 'Required parameter familyId was null or undefined when calling apiV2InvitationsPost.'); - } - const localVarPath = `/api/v2/invitations/`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (familyId !== undefined) { - localVarFormParams.set('family_id', familyId as any); - } - - if (role !== undefined) { - localVarFormParams.set('role', role as any); - } - - if (text !== undefined) { - localVarFormParams.set('text', text as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
- * @summary Invite to join to a family V3 - * @param {string} authorization - * @param {number} familyId - * @param {number} role - * @param {string} [text] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV3InvitationsPost(authorization: string, familyId: number, role: number, text?: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV3InvitationsPost.'); - } - // verify required parameter 'familyId' is not null or undefined - if (familyId === null || familyId === undefined) { - throw new RequiredError('familyId', 'Required parameter familyId was null or undefined when calling apiV3InvitationsPost.'); - } - // verify required parameter 'role' is not null or undefined - if (role === null || role === undefined) { - throw new RequiredError('role', 'Required parameter role was null or undefined when calling apiV3InvitationsPost.'); - } - const localVarPath = `/api/v3/invitations/`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (familyId !== undefined) { - localVarFormParams.set('family_id', familyId as any); - } - - if (role !== undefined) { - localVarFormParams.set('role', role as any); - } - - if (text !== undefined) { - localVarFormParams.set('text', text as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Accept an Invitation V3 - * @param {string} authorization Access Token - * @param {string} token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV3InvitationsTokenAcceptPost(authorization: string, token: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV3InvitationsTokenAcceptPost.'); - } - // verify required parameter 'token' is not null or undefined - if (token === null || token === undefined) { - throw new RequiredError('token', 'Required parameter token was null or undefined when calling apiV3InvitationsTokenAcceptPost.'); - } - const localVarPath = `/api/v3/invitations/{token}/accept` - .replace(`{${"token"}}`, encodeURIComponent(String(token))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get Invitation V3 - * @param {string} token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV3InvitationsTokenGet(token: string, options: any = {}): FetchArgs { - // verify required parameter 'token' is not null or undefined - if (token === null || token === undefined) { - throw new RequiredError('token', 'Required parameter token was null or undefined when calling apiV3InvitationsTokenGet.'); - } - const localVarPath = `/api/v3/invitations/{token}` - .replace(`{${"token"}}`, encodeURIComponent(String(token))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } + apiV2StatesIdCitiesGet( + id: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise> { + const localVarFetchArgs = GeoAPIApiFetchParamCreator( + configuration, + ).apiV2StatesIdCitiesGet(id, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + }; }; /** - * InvitationAPIApi - functional programming interface + * GeoAPIApi - factory interface * @export */ -export const InvitationAPIApiFp = function (configuration?: Configuration) { - return { - /** - * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
- * @summary Invite to join to a family - * @param {number} familyId - * @param {string} [authorization] - * @param {number} [role] - * @param {string} [text] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2InvitationsPost(familyId: number, authorization?: string, role?: number, text?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InvitationAPIApiFetchParamCreator(configuration).apiV2InvitationsPost(familyId, authorization, role, text, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
- * @summary Invite to join to a family V3 - * @param {string} authorization - * @param {number} familyId - * @param {number} role - * @param {string} [text] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV3InvitationsPost(authorization: string, familyId: number, role: number, text?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InvitationAPIApiFetchParamCreator(configuration).apiV3InvitationsPost(authorization, familyId, role, text, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Accept an Invitation V3 - * @param {string} authorization Access Token - * @param {string} token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV3InvitationsTokenAcceptPost(authorization: string, token: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InvitationAPIApiFetchParamCreator(configuration).apiV3InvitationsTokenAcceptPost(authorization, token, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Get Invitation V3 - * @param {string} token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV3InvitationsTokenGet(token: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InvitationAPIApiFetchParamCreator(configuration).apiV3InvitationsTokenGet(token, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - } +export const GeoAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { + /** + * + * @summary List countries + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2CountriesGet(options?: any) { + return GeoAPIApiFp(configuration).apiV2CountriesGet(options)( + fetch, + basePath, + ); + }, + /** + * + * @summary List states of a country + * @param {number} id ID of Country + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2CountriesIdStatesGet(id: number, options?: any) { + return GeoAPIApiFp(configuration).apiV2CountriesIdStatesGet(id, options)( + fetch, + basePath, + ); + }, + /** + * + * @summary List cities of a State + * @param {number} id ID of State + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2StatesIdCitiesGet(id: number, options?: any) { + return GeoAPIApiFp(configuration).apiV2StatesIdCitiesGet(id, options)( + fetch, + basePath, + ); + }, + }; }; /** - * InvitationAPIApi - factory interface + * GeoAPIApi - object-oriented interface * @export + * @class GeoAPIApi + * @extends {BaseAPI} */ -export const InvitationAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
- * @summary Invite to join to a family - * @param {number} familyId - * @param {string} [authorization] - * @param {number} [role] - * @param {string} [text] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2InvitationsPost(familyId: number, authorization?: string, role?: number, text?: string, options?: any) { - return InvitationAPIApiFp(configuration).apiV2InvitationsPost(familyId, authorization, role, text, options)(fetch, basePath); - }, - /** - * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
- * @summary Invite to join to a family V3 - * @param {string} authorization - * @param {number} familyId - * @param {number} role - * @param {string} [text] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV3InvitationsPost(authorization: string, familyId: number, role: number, text?: string, options?: any) { - return InvitationAPIApiFp(configuration).apiV3InvitationsPost(authorization, familyId, role, text, options)(fetch, basePath); - }, - /** - * - * @summary Accept an Invitation V3 - * @param {string} authorization Access Token - * @param {string} token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV3InvitationsTokenAcceptPost(authorization: string, token: string, options?: any) { - return InvitationAPIApiFp(configuration).apiV3InvitationsTokenAcceptPost(authorization, token, options)(fetch, basePath); - }, - /** - * - * @summary Get Invitation V3 - * @param {string} token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV3InvitationsTokenGet(token: string, options?: any) { - return InvitationAPIApiFp(configuration).apiV3InvitationsTokenGet(token, options)(fetch, basePath); - }, - }; -}; +export class GeoAPIApi extends BaseAPI { + /** + * + * @summary List countries + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof GeoAPIApi + */ + public apiV2CountriesGet(options?: any) { + return GeoAPIApiFp(this.configuration).apiV2CountriesGet(options)( + this.fetch, + this.basePath, + ); + } + + /** + * + * @summary List states of a country + * @param {number} id ID of Country + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof GeoAPIApi + */ + public apiV2CountriesIdStatesGet(id: number, options?: any) { + return GeoAPIApiFp(this.configuration).apiV2CountriesIdStatesGet( + id, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary List cities of a State + * @param {number} id ID of State + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof GeoAPIApi + */ + public apiV2StatesIdCitiesGet(id: number, options?: any) { + return GeoAPIApiFp(this.configuration).apiV2StatesIdCitiesGet(id, options)( + this.fetch, + this.basePath, + ); + } +} /** - * InvitationAPIApi - object-oriented interface + * InvitationAPIApi - fetch parameter creator * @export - * @class InvitationAPIApi - * @extends {BaseAPI} */ -export class InvitationAPIApi extends BaseAPI { +export const InvitationAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { /** * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
* @summary Invite to join to a family @@ -6619,12 +8964,67 @@ export class InvitationAPIApi extends BaseAPI { * @param {string} [text] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof InvitationAPIApi */ - public apiV2InvitationsPost(familyId: number, authorization?: string, role?: number, text?: string, options?: any) { - return InvitationAPIApiFp(this.configuration).apiV2InvitationsPost(familyId, authorization, role, text, options)(this.fetch, this.basePath); - } - + apiV2InvitationsPost( + familyId: number, + authorization?: string, + role?: number, + text?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'familyId' is not null or undefined + if (familyId === null || familyId === undefined) { + throw new RequiredError( + 'familyId', + 'Required parameter familyId was null or undefined when calling apiV2InvitationsPost.', + ); + } + const localVarPath = `/api/v2/invitations/`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (familyId !== undefined) { + localVarFormParams.set('family_id', familyId as any); + } + + if (role !== undefined) { + localVarFormParams.set('role', role as any); + } + + if (text !== undefined) { + localVarFormParams.set('text', text as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
* @summary Invite to join to a family V3 @@ -6634,12 +9034,81 @@ export class InvitationAPIApi extends BaseAPI { * @param {string} [text] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof InvitationAPIApi */ - public apiV3InvitationsPost(authorization: string, familyId: number, role: number, text?: string, options?: any) { - return InvitationAPIApiFp(this.configuration).apiV3InvitationsPost(authorization, familyId, role, text, options)(this.fetch, this.basePath); - } - + apiV3InvitationsPost( + authorization: string, + familyId: number, + role: number, + text?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV3InvitationsPost.', + ); + } + // verify required parameter 'familyId' is not null or undefined + if (familyId === null || familyId === undefined) { + throw new RequiredError( + 'familyId', + 'Required parameter familyId was null or undefined when calling apiV3InvitationsPost.', + ); + } + // verify required parameter 'role' is not null or undefined + if (role === null || role === undefined) { + throw new RequiredError( + 'role', + 'Required parameter role was null or undefined when calling apiV3InvitationsPost.', + ); + } + const localVarPath = `/api/v3/invitations/`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (familyId !== undefined) { + localVarFormParams.set('family_id', familyId as any); + } + + if (role !== undefined) { + localVarFormParams.set('role', role as any); + } + + if (text !== undefined) { + localVarFormParams.set('text', text as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @summary Accept an Invitation V3 @@ -6647,660 +9116,450 @@ export class InvitationAPIApi extends BaseAPI { * @param {string} token * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof InvitationAPIApi */ - public apiV3InvitationsTokenAcceptPost(authorization: string, token: string, options?: any) { - return InvitationAPIApiFp(this.configuration).apiV3InvitationsTokenAcceptPost(authorization, token, options)(this.fetch, this.basePath); - } - + apiV3InvitationsTokenAcceptPost( + authorization: string, + token: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV3InvitationsTokenAcceptPost.', + ); + } + // verify required parameter 'token' is not null or undefined + if (token === null || token === undefined) { + throw new RequiredError( + 'token', + 'Required parameter token was null or undefined when calling apiV3InvitationsTokenAcceptPost.', + ); + } + const localVarPath = `/api/v3/invitations/{token}/accept`.replace( + `{${'token'}}`, + encodeURIComponent(String(token)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @summary Get Invitation V3 * @param {string} token * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof InvitationAPIApi */ - public apiV3InvitationsTokenGet(token: string, options?: any) { - return InvitationAPIApiFp(this.configuration).apiV3InvitationsTokenGet(token, options)(this.fetch, this.basePath); - } - -} - -/** - * NGOAPIApi - fetch parameter creator - * @export - */ -export const NGOAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * Activates a deactive NGO.
Calling this API only affects ngo table by updating a row.
- * @summary activate ngo - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoActivateNgoIdngoIdPatch(authorization: string, ngoId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NgoActivateNgoIdngoIdPatch.'); - } - // verify required parameter 'ngoId' is not null or undefined - if (ngoId === null || ngoId === undefined) { - throw new RequiredError('ngoId', 'Required parameter ngoId was null or undefined when calling apiV2NgoActivateNgoIdngoIdPatch.'); - } - const localVarPath = `/api/v2/ngo/activate/ngoId={ngo_id}` - .replace(`{${"ngo_id"}}`, encodeURIComponent(String(ngoId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Adds an NGO.
This API creates a row in ngo table containing a new NGO information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding website is optional.
For logoUrl ypu have to upload a file.
Adding multiple phone numbers is allowed.
They must be comma separated and without any spaces like the example bellow:
[number],[number],...
- * @summary add ngo - * @param {string} authorization Access Token - * @param {number} cityId - * @param {string} name - * @param {string} postalAddress - * @param {string} emailAddress - * @param {string} phoneNumber - * @param {any} logoUrl - * @param {string} [website] - * @param {number} [balance] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoAddPost(authorization: string, cityId: number, name: string, postalAddress: string, emailAddress: string, phoneNumber: string, logoUrl: any, website?: string, balance?: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NgoAddPost.'); - } - // verify required parameter 'cityId' is not null or undefined - if (cityId === null || cityId === undefined) { - throw new RequiredError('cityId', 'Required parameter cityId was null or undefined when calling apiV2NgoAddPost.'); - } - // verify required parameter 'name' is not null or undefined - if (name === null || name === undefined) { - throw new RequiredError('name', 'Required parameter name was null or undefined when calling apiV2NgoAddPost.'); - } - // verify required parameter 'postalAddress' is not null or undefined - if (postalAddress === null || postalAddress === undefined) { - throw new RequiredError('postalAddress', 'Required parameter postalAddress was null or undefined when calling apiV2NgoAddPost.'); - } - // verify required parameter 'emailAddress' is not null or undefined - if (emailAddress === null || emailAddress === undefined) { - throw new RequiredError('emailAddress', 'Required parameter emailAddress was null or undefined when calling apiV2NgoAddPost.'); - } - // verify required parameter 'phoneNumber' is not null or undefined - if (phoneNumber === null || phoneNumber === undefined) { - throw new RequiredError('phoneNumber', 'Required parameter phoneNumber was null or undefined when calling apiV2NgoAddPost.'); - } - // verify required parameter 'logoUrl' is not null or undefined - if (logoUrl === null || logoUrl === undefined) { - throw new RequiredError('logoUrl', 'Required parameter logoUrl was null or undefined when calling apiV2NgoAddPost.'); - } - const localVarPath = `/api/v2/ngo/add`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (cityId !== undefined) { - localVarFormParams.set('cityId', cityId as any); - } - - if (name !== undefined) { - localVarFormParams.set('name', name as any); - } - - if (website !== undefined) { - localVarFormParams.set('website', website as any); - } - - if (postalAddress !== undefined) { - localVarFormParams.set('postalAddress', postalAddress as any); - } - - if (emailAddress !== undefined) { - localVarFormParams.set('emailAddress', emailAddress as any); - } - - if (phoneNumber !== undefined) { - localVarFormParams.set('phoneNumber', phoneNumber as any); - } - - if (logoUrl !== undefined) { - localVarFormParams.set('logoUrl', logoUrl as any); - } - - if (balance !== undefined) { - localVarFormParams.set('balance', balance as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns information of all NGOs in a json.
Json key is NGO id and json value is NGO object.
Calling this API only affects ngo table by selecting rows from it.
- * @summary get all ngos - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoAllGet(authorization: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NgoAllGet.'); - } - const localVarPath = `/api/v2/ngo/all`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Deactivates an active NGO.
Calling this API only affects ngo table by updating a row.
- * @summary deactivate ngo - * @param {number} ngoId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoDeactivateNgoIdngoIdPatch(ngoId: number, options: any = {}): FetchArgs { - // verify required parameter 'ngoId' is not null or undefined - if (ngoId === null || ngoId === undefined) { - throw new RequiredError('ngoId', 'Required parameter ngoId was null or undefined when calling apiV2NgoDeactivateNgoIdngoIdPatch.'); - } - const localVarPath = `/api/v2/ngo/deactivate/ngoId={ngo_id}` - .replace(`{${"ngo_id"}}`, encodeURIComponent(String(ngoId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Deletes a specific NGO.
Calling this API only affects ngo table by updating a row and set isDeleted tag true.
We do not fully delete any rows.
- * @summary delete ngo - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoDeleteNgoIdngoIdPatch(authorization: string, ngoId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NgoDeleteNgoIdngoIdPatch.'); - } - // verify required parameter 'ngoId' is not null or undefined - if (ngoId === null || ngoId === undefined) { - throw new RequiredError('ngoId', 'Required parameter ngoId was null or undefined when calling apiV2NgoDeleteNgoIdngoIdPatch.'); - } - const localVarPath = `/api/v2/ngo/delete/ngoId={ngo_id}` - .replace(`{${"ngo_id"}}`, encodeURIComponent(String(ngoId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns information of an NGO with given id as a json object.
Calling this API only affects ngo table by selecting a single row from it.
- * @summary get ngo by id - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoNgoIdngoIdGet(authorization: string, ngoId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NgoNgoIdngoIdGet.'); - } - // verify required parameter 'ngoId' is not null or undefined - if (ngoId === null || ngoId === undefined) { - throw new RequiredError('ngoId', 'Required parameter ngoId was null or undefined when calling apiV2NgoNgoIdngoIdGet.'); - } - const localVarPath = `/api/v2/ngo/ngoId={ngo_id}` - .replace(`{${"ngo_id"}}`, encodeURIComponent(String(ngoId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * All the fields are optional.
You can fill every field you want to change, and it will update the desired NGO.
Calling this API only affects ngo table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
For logoUrl you have to upload a file.
- * @summary update ngo - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {number} [cityId] - * @param {string} [name] - * @param {string} [website] - * @param {string} [postalAddress] - * @param {string} [emailAddress] - * @param {string} [phoneNumber] - * @param {any} [logoUrl] - * @param {number} [balance] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoUpdateNgoIdngoIdPatch(authorization: string, ngoId: number, cityId?: number, name?: string, website?: string, postalAddress?: string, emailAddress?: string, phoneNumber?: string, logoUrl?: any, balance?: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NgoUpdateNgoIdngoIdPatch.'); - } - // verify required parameter 'ngoId' is not null or undefined - if (ngoId === null || ngoId === undefined) { - throw new RequiredError('ngoId', 'Required parameter ngoId was null or undefined when calling apiV2NgoUpdateNgoIdngoIdPatch.'); - } - const localVarPath = `/api/v2/ngo/update/ngoId={ngo_id}` - .replace(`{${"ngo_id"}}`, encodeURIComponent(String(ngoId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (cityId !== undefined) { - localVarFormParams.set('cityId', cityId as any); - } - - if (name !== undefined) { - localVarFormParams.set('name', name as any); - } - - if (website !== undefined) { - localVarFormParams.set('website', website as any); - } - - if (postalAddress !== undefined) { - localVarFormParams.set('postalAddress', postalAddress as any); - } - - if (emailAddress !== undefined) { - localVarFormParams.set('emailAddress', emailAddress as any); - } - - if (phoneNumber !== undefined) { - localVarFormParams.set('phoneNumber', phoneNumber as any); - } - - if (logoUrl !== undefined) { - localVarFormParams.set('logoUrl', logoUrl as any); - } - - if (balance !== undefined) { - localVarFormParams.set('balance', balance as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * NGOAPIApi - functional programming interface - * @export - */ -export const NGOAPIApiFp = function (configuration?: Configuration) { - return { - /** - * Activates a deactive NGO.
Calling this API only affects ngo table by updating a row.
- * @summary activate ngo - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoActivateNgoIdngoIdPatch(authorization: string, ngoId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NGOAPIApiFetchParamCreator(configuration).apiV2NgoActivateNgoIdngoIdPatch(authorization, ngoId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * Adds an NGO.
This API creates a row in ngo table containing a new NGO information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding website is optional.
For logoUrl ypu have to upload a file.
Adding multiple phone numbers is allowed.
They must be comma separated and without any spaces like the example bellow:
[number],[number],...
- * @summary add ngo - * @param {string} authorization Access Token - * @param {number} cityId - * @param {string} name - * @param {string} postalAddress - * @param {string} emailAddress - * @param {string} phoneNumber - * @param {any} logoUrl - * @param {string} [website] - * @param {number} [balance] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoAddPost(authorization: string, cityId: number, name: string, postalAddress: string, emailAddress: string, phoneNumber: string, logoUrl: any, website?: string, balance?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NGOAPIApiFetchParamCreator(configuration).apiV2NgoAddPost(authorization, cityId, name, postalAddress, emailAddress, phoneNumber, logoUrl, website, balance, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * Returns information of all NGOs in a json.
Json key is NGO id and json value is NGO object.
Calling this API only affects ngo table by selecting rows from it.
- * @summary get all ngos - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoAllGet(authorization: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NGOAPIApiFetchParamCreator(configuration).apiV2NgoAllGet(authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Deactivates an active NGO.
Calling this API only affects ngo table by updating a row.
- * @summary deactivate ngo - * @param {number} ngoId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoDeactivateNgoIdngoIdPatch(ngoId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NGOAPIApiFetchParamCreator(configuration).apiV2NgoDeactivateNgoIdngoIdPatch(ngoId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * Deletes a specific NGO.
Calling this API only affects ngo table by updating a row and set isDeleted tag true.
We do not fully delete any rows.
- * @summary delete ngo - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoDeleteNgoIdngoIdPatch(authorization: string, ngoId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NGOAPIApiFetchParamCreator(configuration).apiV2NgoDeleteNgoIdngoIdPatch(authorization, ngoId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * Returns information of an NGO with given id as a json object.
Calling this API only affects ngo table by selecting a single row from it.
- * @summary get ngo by id - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoNgoIdngoIdGet(authorization: string, ngoId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NGOAPIApiFetchParamCreator(configuration).apiV2NgoNgoIdngoIdGet(authorization, ngoId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * All the fields are optional.
You can fill every field you want to change, and it will update the desired NGO.
Calling this API only affects ngo table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
For logoUrl you have to upload a file.
- * @summary update ngo - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {number} [cityId] - * @param {string} [name] - * @param {string} [website] - * @param {string} [postalAddress] - * @param {string} [emailAddress] - * @param {string} [phoneNumber] - * @param {any} [logoUrl] - * @param {number} [balance] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoUpdateNgoIdngoIdPatch(authorization: string, ngoId: number, cityId?: number, name?: string, website?: string, postalAddress?: string, emailAddress?: string, phoneNumber?: string, logoUrl?: any, balance?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NGOAPIApiFetchParamCreator(configuration).apiV2NgoUpdateNgoIdngoIdPatch(authorization, ngoId, cityId, name, website, postalAddress, emailAddress, phoneNumber, logoUrl, balance, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - } + apiV3InvitationsTokenGet(token: string, options: any = {}): FetchArgs { + // verify required parameter 'token' is not null or undefined + if (token === null || token === undefined) { + throw new RequiredError( + 'token', + 'Required parameter token was null or undefined when calling apiV3InvitationsTokenGet.', + ); + } + const localVarPath = `/api/v3/invitations/{token}`.replace( + `{${'token'}}`, + encodeURIComponent(String(token)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; }; /** - * NGOAPIApi - factory interface + * InvitationAPIApi - functional programming interface * @export */ -export const NGOAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * Activates a deactive NGO.
Calling this API only affects ngo table by updating a row.
- * @summary activate ngo - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoActivateNgoIdngoIdPatch(authorization: string, ngoId: number, options?: any) { - return NGOAPIApiFp(configuration).apiV2NgoActivateNgoIdngoIdPatch(authorization, ngoId, options)(fetch, basePath); - }, - /** - * Adds an NGO.
This API creates a row in ngo table containing a new NGO information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding website is optional.
For logoUrl ypu have to upload a file.
Adding multiple phone numbers is allowed.
They must be comma separated and without any spaces like the example bellow:
[number],[number],...
- * @summary add ngo - * @param {string} authorization Access Token - * @param {number} cityId - * @param {string} name - * @param {string} postalAddress - * @param {string} emailAddress - * @param {string} phoneNumber - * @param {any} logoUrl - * @param {string} [website] - * @param {number} [balance] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoAddPost(authorization: string, cityId: number, name: string, postalAddress: string, emailAddress: string, phoneNumber: string, logoUrl: any, website?: string, balance?: number, options?: any) { - return NGOAPIApiFp(configuration).apiV2NgoAddPost(authorization, cityId, name, postalAddress, emailAddress, phoneNumber, logoUrl, website, balance, options)(fetch, basePath); - }, - /** - * Returns information of all NGOs in a json.
Json key is NGO id and json value is NGO object.
Calling this API only affects ngo table by selecting rows from it.
- * @summary get all ngos - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoAllGet(authorization: string, options?: any) { - return NGOAPIApiFp(configuration).apiV2NgoAllGet(authorization, options)(fetch, basePath); - }, - /** - * Deactivates an active NGO.
Calling this API only affects ngo table by updating a row.
- * @summary deactivate ngo - * @param {number} ngoId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoDeactivateNgoIdngoIdPatch(ngoId: number, options?: any) { - return NGOAPIApiFp(configuration).apiV2NgoDeactivateNgoIdngoIdPatch(ngoId, options)(fetch, basePath); - }, - /** - * Deletes a specific NGO.
Calling this API only affects ngo table by updating a row and set isDeleted tag true.
We do not fully delete any rows.
- * @summary delete ngo - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoDeleteNgoIdngoIdPatch(authorization: string, ngoId: number, options?: any) { - return NGOAPIApiFp(configuration).apiV2NgoDeleteNgoIdngoIdPatch(authorization, ngoId, options)(fetch, basePath); - }, - /** - * Returns information of an NGO with given id as a json object.
Calling this API only affects ngo table by selecting a single row from it.
- * @summary get ngo by id - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoNgoIdngoIdGet(authorization: string, ngoId: number, options?: any) { - return NGOAPIApiFp(configuration).apiV2NgoNgoIdngoIdGet(authorization, ngoId, options)(fetch, basePath); - }, - /** - * All the fields are optional.
You can fill every field you want to change, and it will update the desired NGO.
Calling this API only affects ngo table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
For logoUrl you have to upload a file.
- * @summary update ngo - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {number} [cityId] - * @param {string} [name] - * @param {string} [website] - * @param {string} [postalAddress] - * @param {string} [emailAddress] - * @param {string} [phoneNumber] - * @param {any} [logoUrl] - * @param {number} [balance] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NgoUpdateNgoIdngoIdPatch(authorization: string, ngoId: number, cityId?: number, name?: string, website?: string, postalAddress?: string, emailAddress?: string, phoneNumber?: string, logoUrl?: any, balance?: number, options?: any) { - return NGOAPIApiFp(configuration).apiV2NgoUpdateNgoIdngoIdPatch(authorization, ngoId, cityId, name, website, postalAddress, emailAddress, phoneNumber, logoUrl, balance, options)(fetch, basePath); - }, - }; -}; - -/** - * NGOAPIApi - object-oriented interface - * @export - * @class NGOAPIApi +export const InvitationAPIApiFp = function (configuration?: Configuration) { + return { + /** + * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
+ * @summary Invite to join to a family + * @param {number} familyId + * @param {string} [authorization] + * @param {number} [role] + * @param {string} [text] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2InvitationsPost( + familyId: number, + authorization?: string, + role?: number, + text?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InvitationAPIApiFetchParamCreator( + configuration, + ).apiV2InvitationsPost(familyId, authorization, role, text, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
+ * @summary Invite to join to a family V3 + * @param {string} authorization + * @param {number} familyId + * @param {number} role + * @param {string} [text] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV3InvitationsPost( + authorization: string, + familyId: number, + role: number, + text?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InvitationAPIApiFetchParamCreator( + configuration, + ).apiV3InvitationsPost(authorization, familyId, role, text, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Accept an Invitation V3 + * @param {string} authorization Access Token + * @param {string} token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV3InvitationsTokenAcceptPost( + authorization: string, + token: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InvitationAPIApiFetchParamCreator( + configuration, + ).apiV3InvitationsTokenAcceptPost(authorization, token, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get Invitation V3 + * @param {string} token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV3InvitationsTokenGet( + token: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InvitationAPIApiFetchParamCreator( + configuration, + ).apiV3InvitationsTokenGet(token, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + }; +}; + +/** + * InvitationAPIApi - factory interface + * @export + */ +export const InvitationAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { + /** + * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
+ * @summary Invite to join to a family + * @param {number} familyId + * @param {string} [authorization] + * @param {number} [role] + * @param {string} [text] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2InvitationsPost( + familyId: number, + authorization?: string, + role?: number, + text?: string, + options?: any, + ) { + return InvitationAPIApiFp(configuration).apiV2InvitationsPost( + familyId, + authorization, + role, + text, + options, + )(fetch, basePath); + }, + /** + * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
+ * @summary Invite to join to a family V3 + * @param {string} authorization + * @param {number} familyId + * @param {number} role + * @param {string} [text] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV3InvitationsPost( + authorization: string, + familyId: number, + role: number, + text?: string, + options?: any, + ) { + return InvitationAPIApiFp(configuration).apiV3InvitationsPost( + authorization, + familyId, + role, + text, + options, + )(fetch, basePath); + }, + /** + * + * @summary Accept an Invitation V3 + * @param {string} authorization Access Token + * @param {string} token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV3InvitationsTokenAcceptPost( + authorization: string, + token: string, + options?: any, + ) { + return InvitationAPIApiFp(configuration).apiV3InvitationsTokenAcceptPost( + authorization, + token, + options, + )(fetch, basePath); + }, + /** + * + * @summary Get Invitation V3 + * @param {string} token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV3InvitationsTokenGet(token: string, options?: any) { + return InvitationAPIApiFp(configuration).apiV3InvitationsTokenGet( + token, + options, + )(fetch, basePath); + }, + }; +}; + +/** + * InvitationAPIApi - object-oriented interface + * @export + * @class InvitationAPIApi * @extends {BaseAPI} */ -export class NGOAPIApi extends BaseAPI { +export class InvitationAPIApi extends BaseAPI { + /** + * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
+ * @summary Invite to join to a family + * @param {number} familyId + * @param {string} [authorization] + * @param {number} [role] + * @param {string} [text] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof InvitationAPIApi + */ + public apiV2InvitationsPost( + familyId: number, + authorization?: string, + role?: number, + text?: string, + options?: any, + ) { + return InvitationAPIApiFp(this.configuration).apiV2InvitationsPost( + familyId, + authorization, + role, + text, + options, + )(this.fetch, this.basePath); + } + + /** + * The roles are listed below:
[0]father, [1]mother, [2] uncle, [3]aunt [4]daii [5]amme
+ * @summary Invite to join to a family V3 + * @param {string} authorization + * @param {number} familyId + * @param {number} role + * @param {string} [text] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof InvitationAPIApi + */ + public apiV3InvitationsPost( + authorization: string, + familyId: number, + role: number, + text?: string, + options?: any, + ) { + return InvitationAPIApiFp(this.configuration).apiV3InvitationsPost( + authorization, + familyId, + role, + text, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Accept an Invitation V3 + * @param {string} authorization Access Token + * @param {string} token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof InvitationAPIApi + */ + public apiV3InvitationsTokenAcceptPost( + authorization: string, + token: string, + options?: any, + ) { + return InvitationAPIApiFp( + this.configuration, + ).apiV3InvitationsTokenAcceptPost( + authorization, + token, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Get Invitation V3 + * @param {string} token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof InvitationAPIApi + */ + public apiV3InvitationsTokenGet(token: string, options?: any) { + return InvitationAPIApiFp(this.configuration).apiV3InvitationsTokenGet( + token, + options, + )(this.fetch, this.basePath); + } +} + +/** + * NGOAPIApi - fetch parameter creator + * @export + */ +export const NGOAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { /** * Activates a deactive NGO.
Calling this API only affects ngo table by updating a row.
* @summary activate ngo @@ -7308,12 +9567,61 @@ export class NGOAPIApi extends BaseAPI { * @param {number} ngoId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NGOAPIApi */ - public apiV2NgoActivateNgoIdngoIdPatch(authorization: string, ngoId: number, options?: any) { - return NGOAPIApiFp(this.configuration).apiV2NgoActivateNgoIdngoIdPatch(authorization, ngoId, options)(this.fetch, this.basePath); - } - + apiV2NgoActivateNgoIdngoIdPatch( + authorization: string, + ngoId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NgoActivateNgoIdngoIdPatch.', + ); + } + // verify required parameter 'ngoId' is not null or undefined + if (ngoId === null || ngoId === undefined) { + throw new RequiredError( + 'ngoId', + 'Required parameter ngoId was null or undefined when calling apiV2NgoActivateNgoIdngoIdPatch.', + ); + } + const localVarPath = `/api/v2/ngo/activate/ngoId={ngo_id}`.replace( + `{${'ngo_id'}}`, + encodeURIComponent(String(ngoId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * Adds an NGO.
This API creates a row in ngo table containing a new NGO information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding website is optional.
For logoUrl ypu have to upload a file.
Adding multiple phone numbers is allowed.
They must be comma separated and without any spaces like the example bellow:
[number],[number],...
* @summary add ngo @@ -7328,36 +9636,227 @@ export class NGOAPIApi extends BaseAPI { * @param {number} [balance] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NGOAPIApi */ - public apiV2NgoAddPost(authorization: string, cityId: number, name: string, postalAddress: string, emailAddress: string, phoneNumber: string, logoUrl: any, website?: string, balance?: number, options?: any) { - return NGOAPIApiFp(this.configuration).apiV2NgoAddPost(authorization, cityId, name, postalAddress, emailAddress, phoneNumber, logoUrl, website, balance, options)(this.fetch, this.basePath); - } - + apiV2NgoAddPost( + authorization: string, + cityId: number, + name: string, + postalAddress: string, + emailAddress: string, + phoneNumber: string, + logoUrl: any, + website?: string, + balance?: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NgoAddPost.', + ); + } + // verify required parameter 'cityId' is not null or undefined + if (cityId === null || cityId === undefined) { + throw new RequiredError( + 'cityId', + 'Required parameter cityId was null or undefined when calling apiV2NgoAddPost.', + ); + } + // verify required parameter 'name' is not null or undefined + if (name === null || name === undefined) { + throw new RequiredError( + 'name', + 'Required parameter name was null or undefined when calling apiV2NgoAddPost.', + ); + } + // verify required parameter 'postalAddress' is not null or undefined + if (postalAddress === null || postalAddress === undefined) { + throw new RequiredError( + 'postalAddress', + 'Required parameter postalAddress was null or undefined when calling apiV2NgoAddPost.', + ); + } + // verify required parameter 'emailAddress' is not null or undefined + if (emailAddress === null || emailAddress === undefined) { + throw new RequiredError( + 'emailAddress', + 'Required parameter emailAddress was null or undefined when calling apiV2NgoAddPost.', + ); + } + // verify required parameter 'phoneNumber' is not null or undefined + if (phoneNumber === null || phoneNumber === undefined) { + throw new RequiredError( + 'phoneNumber', + 'Required parameter phoneNumber was null or undefined when calling apiV2NgoAddPost.', + ); + } + // verify required parameter 'logoUrl' is not null or undefined + if (logoUrl === null || logoUrl === undefined) { + throw new RequiredError( + 'logoUrl', + 'Required parameter logoUrl was null or undefined when calling apiV2NgoAddPost.', + ); + } + const localVarPath = `/api/v2/ngo/add`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (cityId !== undefined) { + localVarFormParams.set('cityId', cityId as any); + } + + if (name !== undefined) { + localVarFormParams.set('name', name as any); + } + + if (website !== undefined) { + localVarFormParams.set('website', website as any); + } + + if (postalAddress !== undefined) { + localVarFormParams.set('postalAddress', postalAddress as any); + } + + if (emailAddress !== undefined) { + localVarFormParams.set('emailAddress', emailAddress as any); + } + + if (phoneNumber !== undefined) { + localVarFormParams.set('phoneNumber', phoneNumber as any); + } + + if (logoUrl !== undefined) { + localVarFormParams.set('logoUrl', logoUrl as any); + } + + if (balance !== undefined) { + localVarFormParams.set('balance', balance as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * Returns information of all NGOs in a json.
Json key is NGO id and json value is NGO object.
Calling this API only affects ngo table by selecting rows from it.
* @summary get all ngos * @param {string} authorization Access Token * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NGOAPIApi */ - public apiV2NgoAllGet(authorization: string, options?: any) { - return NGOAPIApiFp(this.configuration).apiV2NgoAllGet(authorization, options)(this.fetch, this.basePath); - } - + apiV2NgoAllGet(authorization: string, options: any = {}): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NgoAllGet.', + ); + } + const localVarPath = `/api/v2/ngo/all`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * Deactivates an active NGO.
Calling this API only affects ngo table by updating a row.
* @summary deactivate ngo * @param {number} ngoId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NGOAPIApi */ - public apiV2NgoDeactivateNgoIdngoIdPatch(ngoId: number, options?: any) { - return NGOAPIApiFp(this.configuration).apiV2NgoDeactivateNgoIdngoIdPatch(ngoId, options)(this.fetch, this.basePath); - } - + apiV2NgoDeactivateNgoIdngoIdPatch( + ngoId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'ngoId' is not null or undefined + if (ngoId === null || ngoId === undefined) { + throw new RequiredError( + 'ngoId', + 'Required parameter ngoId was null or undefined when calling apiV2NgoDeactivateNgoIdngoIdPatch.', + ); + } + const localVarPath = `/api/v2/ngo/deactivate/ngoId={ngo_id}`.replace( + `{${'ngo_id'}}`, + encodeURIComponent(String(ngoId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * Deletes a specific NGO.
Calling this API only affects ngo table by updating a row and set isDeleted tag true.
We do not fully delete any rows.
* @summary delete ngo @@ -7365,12 +9864,61 @@ export class NGOAPIApi extends BaseAPI { * @param {number} ngoId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NGOAPIApi */ - public apiV2NgoDeleteNgoIdngoIdPatch(authorization: string, ngoId: number, options?: any) { - return NGOAPIApiFp(this.configuration).apiV2NgoDeleteNgoIdngoIdPatch(authorization, ngoId, options)(this.fetch, this.basePath); - } - + apiV2NgoDeleteNgoIdngoIdPatch( + authorization: string, + ngoId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NgoDeleteNgoIdngoIdPatch.', + ); + } + // verify required parameter 'ngoId' is not null or undefined + if (ngoId === null || ngoId === undefined) { + throw new RequiredError( + 'ngoId', + 'Required parameter ngoId was null or undefined when calling apiV2NgoDeleteNgoIdngoIdPatch.', + ); + } + const localVarPath = `/api/v2/ngo/delete/ngoId={ngo_id}`.replace( + `{${'ngo_id'}}`, + encodeURIComponent(String(ngoId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * Returns information of an NGO with given id as a json object.
Calling this API only affects ngo table by selecting a single row from it.
* @summary get ngo by id @@ -7378,12 +9926,58 @@ export class NGOAPIApi extends BaseAPI { * @param {number} ngoId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NGOAPIApi */ - public apiV2NgoNgoIdngoIdGet(authorization: string, ngoId: number, options?: any) { - return NGOAPIApiFp(this.configuration).apiV2NgoNgoIdngoIdGet(authorization, ngoId, options)(this.fetch, this.basePath); - } - + apiV2NgoNgoIdngoIdGet( + authorization: string, + ngoId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NgoNgoIdngoIdGet.', + ); + } + // verify required parameter 'ngoId' is not null or undefined + if (ngoId === null || ngoId === undefined) { + throw new RequiredError( + 'ngoId', + 'Required parameter ngoId was null or undefined when calling apiV2NgoNgoIdngoIdGet.', + ); + } + const localVarPath = `/api/v2/ngo/ngoId={ngo_id}`.replace( + `{${'ngo_id'}}`, + encodeURIComponent(String(ngoId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * All the fields are optional.
You can fill every field you want to change, and it will update the desired NGO.
Calling this API only affects ngo table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
For logoUrl you have to upload a file.
* @summary update ngo @@ -7399,5889 +9993,10282 @@ export class NGOAPIApi extends BaseAPI { * @param {number} [balance] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NGOAPIApi */ - public apiV2NgoUpdateNgoIdngoIdPatch(authorization: string, ngoId: number, cityId?: number, name?: string, website?: string, postalAddress?: string, emailAddress?: string, phoneNumber?: string, logoUrl?: any, balance?: number, options?: any) { - return NGOAPIApiFp(this.configuration).apiV2NgoUpdateNgoIdngoIdPatch(authorization, ngoId, cityId, name, website, postalAddress, emailAddress, phoneNumber, logoUrl, balance, options)(this.fetch, this.basePath); - } - -} - -/** - * NakamaAPIApi - fetch parameter creator - * @export - */ -export const NakamaAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - *
- * @summary Submit eth transaction for a need (Nakama) - * @param {string} txHash - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NakamaTxHashPost(txHash: string, options: any = {}): FetchArgs { - // verify required parameter 'txHash' is not null or undefined - if (txHash === null || txHash === undefined) { - throw new RequiredError('txHash', 'Required parameter txHash was null or undefined when calling apiV2NakamaTxHashPost.'); - } - const localVarPath = `/api/v2/nakama/{tx_hash}` - .replace(`{${"tx_hash"}}`, encodeURIComponent(String(txHash))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * NakamaAPIApi - functional programming interface - * @export - */ -export const NakamaAPIApiFp = function (configuration?: Configuration) { - return { - /** - *
- * @summary Submit eth transaction for a need (Nakama) - * @param {string} txHash - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NakamaTxHashPost(txHash: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NakamaAPIApiFetchParamCreator(configuration).apiV2NakamaTxHashPost(txHash, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - } -}; - -/** - * NakamaAPIApi - factory interface - * @export - */ -export const NakamaAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - *
- * @summary Submit eth transaction for a need (Nakama) - * @param {string} txHash - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NakamaTxHashPost(txHash: string, options?: any) { - return NakamaAPIApiFp(configuration).apiV2NakamaTxHashPost(txHash, options)(fetch, basePath); - }, - }; + apiV2NgoUpdateNgoIdngoIdPatch( + authorization: string, + ngoId: number, + cityId?: number, + name?: string, + website?: string, + postalAddress?: string, + emailAddress?: string, + phoneNumber?: string, + logoUrl?: any, + balance?: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NgoUpdateNgoIdngoIdPatch.', + ); + } + // verify required parameter 'ngoId' is not null or undefined + if (ngoId === null || ngoId === undefined) { + throw new RequiredError( + 'ngoId', + 'Required parameter ngoId was null or undefined when calling apiV2NgoUpdateNgoIdngoIdPatch.', + ); + } + const localVarPath = `/api/v2/ngo/update/ngoId={ngo_id}`.replace( + `{${'ngo_id'}}`, + encodeURIComponent(String(ngoId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (cityId !== undefined) { + localVarFormParams.set('cityId', cityId as any); + } + + if (name !== undefined) { + localVarFormParams.set('name', name as any); + } + + if (website !== undefined) { + localVarFormParams.set('website', website as any); + } + + if (postalAddress !== undefined) { + localVarFormParams.set('postalAddress', postalAddress as any); + } + + if (emailAddress !== undefined) { + localVarFormParams.set('emailAddress', emailAddress as any); + } + + if (phoneNumber !== undefined) { + localVarFormParams.set('phoneNumber', phoneNumber as any); + } + + if (logoUrl !== undefined) { + localVarFormParams.set('logoUrl', logoUrl as any); + } + + if (balance !== undefined) { + localVarFormParams.set('balance', balance as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; }; /** - * NakamaAPIApi - object-oriented interface + * NGOAPIApi - functional programming interface * @export - * @class NakamaAPIApi - * @extends {BaseAPI} */ -export class NakamaAPIApi extends BaseAPI { +export const NGOAPIApiFp = function (configuration?: Configuration) { + return { /** - *
- * @summary Submit eth transaction for a need (Nakama) - * @param {string} txHash + * Activates a deactive NGO.
Calling this API only affects ngo table by updating a row.
+ * @summary activate ngo + * @param {string} authorization Access Token + * @param {number} ngoId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NakamaAPIApi */ - public apiV2NakamaTxHashPost(txHash: string, options?: any) { - return NakamaAPIApiFp(this.configuration).apiV2NakamaTxHashPost(txHash, options)(this.fetch, this.basePath); - } - -} - -/** - * NeedAPIApi - fetch parameter creator - * @export - */ -export const NeedAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * Confirms a need, so you can add a payment for it and add it to a confirmed child but you cannot update its price (cost) anymore.
Calling this API affects need, child and social_worker tables.
- * @summary confirm a need - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedConfirmNeedIdneedIdPatch(authorization: string, needId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NeedConfirmNeedIdneedIdPatch.'); - } - // verify required parameter 'needId' is not null or undefined - if (needId === null || needId === undefined) { - throw new RequiredError('needId', 'Required parameter needId was null or undefined when calling apiV2NeedConfirmNeedIdneedIdPatch.'); - } - const localVarPath = `/api/v2/need/confirm/needId={need_id}` - .replace(`{${"need_id"}}`, encodeURIComponent(String(needId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Deletes a need by setting its isDeleted tag true.
It also delete all impacts and occurrences of this need in whole database.
It is only possible to delete the needs without any payments.
Deleting is managed by isDeleted tag everywhere, so we do not fully delete anything.
Calling this API affects need, need_family and child_need tables.
- * @summary delete a need - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedDeleteNeedIdneedIdPatch(authorization: string, needId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NeedDeleteNeedIdneedIdPatch.'); - } - // verify required parameter 'needId' is not null or undefined - if (needId === null || needId === undefined) { - throw new RequiredError('needId', 'Required parameter needId was null or undefined when calling apiV2NeedDeleteNeedIdneedIdPatch.'); - } - const localVarPath = `/api/v2/need/delete/needId={need_id}` - .replace(`{${"need_id"}}`, encodeURIComponent(String(needId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns information of a need with given id as a json object.
Calling this API affects need, child_need and need_family and user tables.
Confirm parameter determines how do you want the result:
[0]not onfirmed, [1]confirmed, [2]both
- * @summary get need by id - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedNeedIdneedIdGet(authorization: string, needId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NeedNeedIdneedIdGet.'); - } - // verify required parameter 'needId' is not null or undefined - if (needId === null || needId === undefined) { - throw new RequiredError('needId', 'Required parameter needId was null or undefined when calling apiV2NeedNeedIdneedIdGet.'); - } - const localVarPath = `/api/v2/need/needId={need_id}` - .replace(`{${"need_id"}}`, encodeURIComponent(String(needId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Adds a need.
It is possible to have multiple receipts, but each time you can upload one receipt, but their addresses will be saved as a comma separated string in db.
You have to upload a file for receipts and imageUrl.
Calling this API affects need table only.
Adding affiliateLinkUrl and receipts are optional.
type codes: [0]donate, [1]affiliate
- * @summary add need - * @param {string} authorization Access Token - * @param {number} childId - * @param {string} nameTranslations {\"en\": \"Bob\", \"fa\": \"بابک\"} - * @param {string} descriptionTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {number} category - * @param {boolean} isUrgent - * @param {number} cost - * @param {number} type - * @param {number} [swId] - * @param {any} [imageUrl] - * @param {string} [link] - * @param {string} [affiliateLinkUrl] - * @param {any} [receipts] - * @param {number} [doingDuration] - * @param {string} [details] - * @param {string} [informations] - * @param {string} [deliveryDate] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedPost(authorization: string, childId: number, nameTranslations: string, descriptionTranslations: string, category: number, isUrgent: boolean, cost: number, type: number, swId?: number, imageUrl?: any, link?: string, affiliateLinkUrl?: string, receipts?: any, doingDuration?: number, details?: string, informations?: string, deliveryDate?: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NeedPost.'); - } - // verify required parameter 'childId' is not null or undefined - if (childId === null || childId === undefined) { - throw new RequiredError('childId', 'Required parameter childId was null or undefined when calling apiV2NeedPost.'); - } - // verify required parameter 'nameTranslations' is not null or undefined - if (nameTranslations === null || nameTranslations === undefined) { - throw new RequiredError('nameTranslations', 'Required parameter nameTranslations was null or undefined when calling apiV2NeedPost.'); - } - // verify required parameter 'descriptionTranslations' is not null or undefined - if (descriptionTranslations === null || descriptionTranslations === undefined) { - throw new RequiredError('descriptionTranslations', 'Required parameter descriptionTranslations was null or undefined when calling apiV2NeedPost.'); - } - // verify required parameter 'category' is not null or undefined - if (category === null || category === undefined) { - throw new RequiredError('category', 'Required parameter category was null or undefined when calling apiV2NeedPost.'); - } - // verify required parameter 'isUrgent' is not null or undefined - if (isUrgent === null || isUrgent === undefined) { - throw new RequiredError('isUrgent', 'Required parameter isUrgent was null or undefined when calling apiV2NeedPost.'); - } - // verify required parameter 'cost' is not null or undefined - if (cost === null || cost === undefined) { - throw new RequiredError('cost', 'Required parameter cost was null or undefined when calling apiV2NeedPost.'); - } - // verify required parameter 'type' is not null or undefined - if (type === null || type === undefined) { - throw new RequiredError('type', 'Required parameter type was null or undefined when calling apiV2NeedPost.'); - } - const localVarPath = `/api/v2/need/`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (childId !== undefined) { - localVarFormParams.set('child_id', childId as any); - } - - if (swId !== undefined) { - localVarFormParams.set('sw_id', swId as any); - } - - if (imageUrl !== undefined) { - localVarFormParams.set('imageUrl', imageUrl as any); - } - - if (nameTranslations !== undefined) { - localVarFormParams.set('name_translations', nameTranslations as any); - } - - if (descriptionTranslations !== undefined) { - localVarFormParams.set('description_translations', descriptionTranslations as any); - } - - if (category !== undefined) { - localVarFormParams.set('category', category as any); - } - - if (isUrgent !== undefined) { - localVarFormParams.set('isUrgent', isUrgent as any); - } - - if (cost !== undefined) { - localVarFormParams.set('cost', cost as any); - } - - if (type !== undefined) { - localVarFormParams.set('type', type as any); - } - - if (link !== undefined) { - localVarFormParams.set('link', link as any); - } - - if (affiliateLinkUrl !== undefined) { - localVarFormParams.set('affiliateLinkUrl', affiliateLinkUrl as any); - } - - if (receipts !== undefined) { - localVarFormParams.set('receipts', receipts as any); - } - - if (doingDuration !== undefined) { - localVarFormParams.set('doing_duration', doingDuration as any); - } - - if (details !== undefined) { - localVarFormParams.set('details', details as any); - } - - if (informations !== undefined) { - localVarFormParams.set('informations', informations as any); - } - - if (deliveryDate !== undefined) { - localVarFormParams.set('delivery_date', deliveryDate as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * All fields are optional.
You cannot change cost for confirmed needs but it is ok with not confirmed needs.
It is possible to have multiple receipts, but each time you can upload one receipt, but their addresses will be saved as a comma separated string in db.
You have to upload a file for receipts and imageUrl.
Calling this API affects need table only.
- * @summary update need - * @param {string} authorization Access Token - * @param {number} needId - * @param {any} [imageUrl] - * @param {string} [nameTranslations] {\"en\": \"Bob\", \"fa\": \"بابک\"} - * @param {string} [descriptionTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {number} [category] - * @param {boolean} [isUrgent] - * @param {number} [cost] - * @param {number} [purchaseCost] Can be set only in p3 (product status 3) - * @param {number} [type] - * @param {string} [link] - * @param {string} [affiliateLinkUrl] - * @param {any} [receipts] - * @param {number} [status] - * @param {number} [doingDuration] - * @param {string} [details] - * @param {string} [expectedDeliveryDate] - * @param {string} [ngoDeliveryDate] - * @param {string} [dkc] Digikala purchase code (only in s3) - * @param {string} [informations] - * @param {string} [bankTrackId] Only for services, S2 -> S3 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedUpdateNeedIdneedIdPatch(authorization: string, needId: number, imageUrl?: any, nameTranslations?: string, descriptionTranslations?: string, category?: number, isUrgent?: boolean, cost?: number, purchaseCost?: number, type?: number, link?: string, affiliateLinkUrl?: string, receipts?: any, status?: number, doingDuration?: number, details?: string, expectedDeliveryDate?: string, ngoDeliveryDate?: string, dkc?: string, informations?: string, bankTrackId?: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NeedUpdateNeedIdneedIdPatch.'); - } - // verify required parameter 'needId' is not null or undefined - if (needId === null || needId === undefined) { - throw new RequiredError('needId', 'Required parameter needId was null or undefined when calling apiV2NeedUpdateNeedIdneedIdPatch.'); - } - const localVarPath = `/api/v2/need/update/needId={need_id}` - .replace(`{${"need_id"}}`, encodeURIComponent(String(needId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (imageUrl !== undefined) { - localVarFormParams.set('imageUrl', imageUrl as any); - } - - if (nameTranslations !== undefined) { - localVarFormParams.set('name_translations', nameTranslations as any); - } - - if (descriptionTranslations !== undefined) { - localVarFormParams.set('description_translations', descriptionTranslations as any); - } - - if (category !== undefined) { - localVarFormParams.set('category', category as any); - } - - if (isUrgent !== undefined) { - localVarFormParams.set('isUrgent', isUrgent as any); - } - - if (cost !== undefined) { - localVarFormParams.set('cost', cost as any); - } - - if (purchaseCost !== undefined) { - localVarFormParams.set('purchase_cost', purchaseCost as any); - } - - if (type !== undefined) { - localVarFormParams.set('type', type as any); - } - - if (link !== undefined) { - localVarFormParams.set('link', link as any); - } - - if (affiliateLinkUrl !== undefined) { - localVarFormParams.set('affiliateLinkUrl', affiliateLinkUrl as any); - } - - if (receipts !== undefined) { - localVarFormParams.set('receipts', receipts as any); - } - - if (status !== undefined) { - localVarFormParams.set('status', status as any); - } - - if (doingDuration !== undefined) { - localVarFormParams.set('doing_duration', doingDuration as any); - } - - if (details !== undefined) { - localVarFormParams.set('details', details as any); - } - - if (expectedDeliveryDate !== undefined) { - localVarFormParams.set('expected_delivery_date', expectedDeliveryDate as any); - } - - if (ngoDeliveryDate !== undefined) { - localVarFormParams.set('ngo_delivery_date', ngoDeliveryDate as any); - } - - if (dkc !== undefined) { - localVarFormParams.set('dkc', dkc as any); - } - - if (informations !== undefined) { - localVarFormParams.set('informations', informations as any); - } - - if (bankTrackId !== undefined) { - localVarFormParams.set('bank_track_id', bankTrackId as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns information of all needs as a json object.
Calling this API affects need, child_need and need_family and user tables.
[0]not onfirmed, [1]confirmed, [2]both

Done parameter determines how do you want the result:
[0]not done, [1]done, [2]all
- * @summary get all needs - * @param {string} authorization Access Token - * @param {number} [X_SKIP] - * @param {number} [X_TAKE] Max 500 - * @param {boolean} [isConfirmed] - * @param {boolean} [isDone] - * @param {boolean} [isReported] - * @param {string} [status] - * @param {number} [type] - * @param {number} [ngoId] - * @param {boolean} [isChildConfirmed] - * @param {boolean} [unpayable] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedsGet(authorization: string, X_SKIP?: number, X_TAKE?: number, isConfirmed?: boolean, isDone?: boolean, isReported?: boolean, status?: string, type?: number, ngoId?: number, isChildConfirmed?: boolean, unpayable?: boolean, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NeedsGet.'); - } - const localVarPath = `/api/v2/needs`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (isConfirmed !== undefined) { - localVarQueryParameter['isConfirmed'] = isConfirmed; - } - - if (isDone !== undefined) { - localVarQueryParameter['isDone'] = isDone; - } - - if (isReported !== undefined) { - localVarQueryParameter['isReported'] = isReported; - } - - if (status !== undefined) { - localVarQueryParameter['status'] = status; - } - - if (type !== undefined) { - localVarQueryParameter['type'] = type; - } - - if (ngoId !== undefined) { - localVarQueryParameter['ngoId'] = ngoId; - } - - if (isChildConfirmed !== undefined) { - localVarQueryParameter['isChildConfirmed'] = isChildConfirmed; - } - - if (unpayable !== undefined) { - localVarQueryParameter['unpayable'] = unpayable; - } - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (X_SKIP !== undefined && X_SKIP !== null) { - localVarHeaderParameter['X_SKIP'] = String(X_SKIP); - } - - if (X_TAKE !== undefined && X_TAKE !== null) { - localVarHeaderParameter['X_TAKE'] = String(X_TAKE); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - *
- * @summary List receipts for a need - * @param {any} id - * @param {string} [authorization] Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedsIdReceiptsGet(id: any, authorization?: string, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2NeedsIdReceiptsGet.'); - } - const localVarPath = `/api/v2/needs/{id}/receipts` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Create a new receipt for a need - * @param {string} authorization Access Token - * @param {any} id - * @param {any} attachment - * @param {string} title max 128 char - * @param {string} [code] unique, max 128 char - * @param {string} [description] max 1024 char - * @param {boolean} [isPublic] default=false, only SUPER_ADMIN, SAY_SUPERVISOR, ADMIN can set to true - * @param {number} [needStatus] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedsIdReceiptsPost(authorization: string, id: any, attachment: any, title: string, code?: string, description?: string, isPublic?: boolean, needStatus?: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NeedsIdReceiptsPost.'); - } - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2NeedsIdReceiptsPost.'); - } - // verify required parameter 'attachment' is not null or undefined - if (attachment === null || attachment === undefined) { - throw new RequiredError('attachment', 'Required parameter attachment was null or undefined when calling apiV2NeedsIdReceiptsPost.'); - } - // verify required parameter 'title' is not null or undefined - if (title === null || title === undefined) { - throw new RequiredError('title', 'Required parameter title was null or undefined when calling apiV2NeedsIdReceiptsPost.'); - } - const localVarPath = `/api/v2/needs/{id}/receipts` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (code !== undefined) { - localVarFormParams.set('code', code as any); - } - - if (attachment !== undefined) { - localVarFormParams.set('attachment', attachment as any); - } - - if (description !== undefined) { - localVarFormParams.set('description', description as any); - } - - if (title !== undefined) { - localVarFormParams.set('title', title as any); - } - - if (isPublic !== undefined) { - localVarFormParams.set('isPublic', isPublic as any); - } - - if (needStatus !== undefined) { - localVarFormParams.set('needStatus', needStatus as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - *
- * @summary Delete a receipt from a need, not the receipt itself! - * @param {string} authorization Access Token - * @param {any} id - * @param {any} receiptId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedsIdReceiptsReceiptIdDelete(authorization: string, id: any, receiptId: any, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NeedsIdReceiptsReceiptIdDelete.'); - } - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2NeedsIdReceiptsReceiptIdDelete.'); - } - // verify required parameter 'receiptId' is not null or undefined - if (receiptId === null || receiptId === undefined) { - throw new RequiredError('receiptId', 'Required parameter receiptId was null or undefined when calling apiV2NeedsIdReceiptsReceiptIdDelete.'); - } - const localVarPath = `/api/v2/needs/{id}/receipts/{receiptId}` - .replace(`{${"id"}}`, encodeURIComponent(String(id))) - .replace(`{${"receiptId"}}`, encodeURIComponent(String(receiptId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'DELETE' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * NeedAPIApi - functional programming interface - * @export - */ -export const NeedAPIApiFp = function (configuration?: Configuration) { - return { - /** - * Confirms a need, so you can add a payment for it and add it to a confirmed child but you cannot update its price (cost) anymore.
Calling this API affects need, child and social_worker tables.
- * @summary confirm a need - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedConfirmNeedIdneedIdPatch(authorization: string, needId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NeedAPIApiFetchParamCreator(configuration).apiV2NeedConfirmNeedIdneedIdPatch(authorization, needId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Deletes a need by setting its isDeleted tag true.
It also delete all impacts and occurrences of this need in whole database.
It is only possible to delete the needs without any payments.
Deleting is managed by isDeleted tag everywhere, so we do not fully delete anything.
Calling this API affects need, need_family and child_need tables.
- * @summary delete a need - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedDeleteNeedIdneedIdPatch(authorization: string, needId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NeedAPIApiFetchParamCreator(configuration).apiV2NeedDeleteNeedIdneedIdPatch(authorization, needId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * Returns information of a need with given id as a json object.
Calling this API affects need, child_need and need_family and user tables.
Confirm parameter determines how do you want the result:
[0]not onfirmed, [1]confirmed, [2]both
- * @summary get need by id - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedNeedIdneedIdGet(authorization: string, needId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NeedAPIApiFetchParamCreator(configuration).apiV2NeedNeedIdneedIdGet(authorization, needId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Adds a need.
It is possible to have multiple receipts, but each time you can upload one receipt, but their addresses will be saved as a comma separated string in db.
You have to upload a file for receipts and imageUrl.
Calling this API affects need table only.
Adding affiliateLinkUrl and receipts are optional.
type codes: [0]donate, [1]affiliate
- * @summary add need - * @param {string} authorization Access Token - * @param {number} childId - * @param {string} nameTranslations {\"en\": \"Bob\", \"fa\": \"بابک\"} - * @param {string} descriptionTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {number} category - * @param {boolean} isUrgent - * @param {number} cost - * @param {number} type - * @param {number} [swId] - * @param {any} [imageUrl] - * @param {string} [link] - * @param {string} [affiliateLinkUrl] - * @param {any} [receipts] - * @param {number} [doingDuration] - * @param {string} [details] - * @param {string} [informations] - * @param {string} [deliveryDate] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedPost(authorization: string, childId: number, nameTranslations: string, descriptionTranslations: string, category: number, isUrgent: boolean, cost: number, type: number, swId?: number, imageUrl?: any, link?: string, affiliateLinkUrl?: string, receipts?: any, doingDuration?: number, details?: string, informations?: string, deliveryDate?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NeedAPIApiFetchParamCreator(configuration).apiV2NeedPost(authorization, childId, nameTranslations, descriptionTranslations, category, isUrgent, cost, type, swId, imageUrl, link, affiliateLinkUrl, receipts, doingDuration, details, informations, deliveryDate, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * All fields are optional.
You cannot change cost for confirmed needs but it is ok with not confirmed needs.
It is possible to have multiple receipts, but each time you can upload one receipt, but their addresses will be saved as a comma separated string in db.
You have to upload a file for receipts and imageUrl.
Calling this API affects need table only.
- * @summary update need - * @param {string} authorization Access Token - * @param {number} needId - * @param {any} [imageUrl] - * @param {string} [nameTranslations] {\"en\": \"Bob\", \"fa\": \"بابک\"} - * @param {string} [descriptionTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {number} [category] - * @param {boolean} [isUrgent] - * @param {number} [cost] - * @param {number} [purchaseCost] Can be set only in p3 (product status 3) - * @param {number} [type] - * @param {string} [link] - * @param {string} [affiliateLinkUrl] - * @param {any} [receipts] - * @param {number} [status] - * @param {number} [doingDuration] - * @param {string} [details] - * @param {string} [expectedDeliveryDate] - * @param {string} [ngoDeliveryDate] - * @param {string} [dkc] Digikala purchase code (only in s3) - * @param {string} [informations] - * @param {string} [bankTrackId] Only for services, S2 -> S3 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedUpdateNeedIdneedIdPatch(authorization: string, needId: number, imageUrl?: any, nameTranslations?: string, descriptionTranslations?: string, category?: number, isUrgent?: boolean, cost?: number, purchaseCost?: number, type?: number, link?: string, affiliateLinkUrl?: string, receipts?: any, status?: number, doingDuration?: number, details?: string, expectedDeliveryDate?: string, ngoDeliveryDate?: string, dkc?: string, informations?: string, bankTrackId?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NeedAPIApiFetchParamCreator(configuration).apiV2NeedUpdateNeedIdneedIdPatch(authorization, needId, imageUrl, nameTranslations, descriptionTranslations, category, isUrgent, cost, purchaseCost, type, link, affiliateLinkUrl, receipts, status, doingDuration, details, expectedDeliveryDate, ngoDeliveryDate, dkc, informations, bankTrackId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * Returns information of all needs as a json object.
Calling this API affects need, child_need and need_family and user tables.
[0]not onfirmed, [1]confirmed, [2]both

Done parameter determines how do you want the result:
[0]not done, [1]done, [2]all
- * @summary get all needs - * @param {string} authorization Access Token - * @param {number} [X_SKIP] - * @param {number} [X_TAKE] Max 500 - * @param {boolean} [isConfirmed] - * @param {boolean} [isDone] - * @param {boolean} [isReported] - * @param {string} [status] - * @param {number} [type] - * @param {number} [ngoId] - * @param {boolean} [isChildConfirmed] - * @param {boolean} [unpayable] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedsGet(authorization: string, X_SKIP?: number, X_TAKE?: number, isConfirmed?: boolean, isDone?: boolean, isReported?: boolean, status?: string, type?: number, ngoId?: number, isChildConfirmed?: boolean, unpayable?: boolean, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NeedAPIApiFetchParamCreator(configuration).apiV2NeedsGet(authorization, X_SKIP, X_TAKE, isConfirmed, isDone, isReported, status, type, ngoId, isChildConfirmed, unpayable, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - *
- * @summary List receipts for a need - * @param {any} id - * @param {string} [authorization] Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedsIdReceiptsGet(id: any, authorization?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NeedAPIApiFetchParamCreator(configuration).apiV2NeedsIdReceiptsGet(id, authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Create a new receipt for a need - * @param {string} authorization Access Token - * @param {any} id - * @param {any} attachment - * @param {string} title max 128 char - * @param {string} [code] unique, max 128 char - * @param {string} [description] max 1024 char - * @param {boolean} [isPublic] default=false, only SUPER_ADMIN, SAY_SUPERVISOR, ADMIN can set to true - * @param {number} [needStatus] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedsIdReceiptsPost(authorization: string, id: any, attachment: any, title: string, code?: string, description?: string, isPublic?: boolean, needStatus?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NeedAPIApiFetchParamCreator(configuration).apiV2NeedsIdReceiptsPost(authorization, id, attachment, title, code, description, isPublic, needStatus, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - *
- * @summary Delete a receipt from a need, not the receipt itself! - * @param {string} authorization Access Token - * @param {any} id - * @param {any} receiptId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedsIdReceiptsReceiptIdDelete(authorization: string, id: any, receiptId: any, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NeedAPIApiFetchParamCreator(configuration).apiV2NeedsIdReceiptsReceiptIdDelete(authorization, id, receiptId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - } -}; - -/** - * NeedAPIApi - factory interface - * @export - */ -export const NeedAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * Confirms a need, so you can add a payment for it and add it to a confirmed child but you cannot update its price (cost) anymore.
Calling this API affects need, child and social_worker tables.
- * @summary confirm a need - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedConfirmNeedIdneedIdPatch(authorization: string, needId: number, options?: any) { - return NeedAPIApiFp(configuration).apiV2NeedConfirmNeedIdneedIdPatch(authorization, needId, options)(fetch, basePath); - }, - /** - * Deletes a need by setting its isDeleted tag true.
It also delete all impacts and occurrences of this need in whole database.
It is only possible to delete the needs without any payments.
Deleting is managed by isDeleted tag everywhere, so we do not fully delete anything.
Calling this API affects need, need_family and child_need tables.
- * @summary delete a need - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedDeleteNeedIdneedIdPatch(authorization: string, needId: number, options?: any) { - return NeedAPIApiFp(configuration).apiV2NeedDeleteNeedIdneedIdPatch(authorization, needId, options)(fetch, basePath); - }, - /** - * Returns information of a need with given id as a json object.
Calling this API affects need, child_need and need_family and user tables.
Confirm parameter determines how do you want the result:
[0]not onfirmed, [1]confirmed, [2]both
- * @summary get need by id - * @param {string} authorization Access Token - * @param {number} needId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedNeedIdneedIdGet(authorization: string, needId: number, options?: any) { - return NeedAPIApiFp(configuration).apiV2NeedNeedIdneedIdGet(authorization, needId, options)(fetch, basePath); - }, - /** - * Adds a need.
It is possible to have multiple receipts, but each time you can upload one receipt, but their addresses will be saved as a comma separated string in db.
You have to upload a file for receipts and imageUrl.
Calling this API affects need table only.
Adding affiliateLinkUrl and receipts are optional.
type codes: [0]donate, [1]affiliate
- * @summary add need - * @param {string} authorization Access Token - * @param {number} childId - * @param {string} nameTranslations {\"en\": \"Bob\", \"fa\": \"بابک\"} - * @param {string} descriptionTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {number} category - * @param {boolean} isUrgent - * @param {number} cost - * @param {number} type - * @param {number} [swId] - * @param {any} [imageUrl] - * @param {string} [link] - * @param {string} [affiliateLinkUrl] - * @param {any} [receipts] - * @param {number} [doingDuration] - * @param {string} [details] - * @param {string} [informations] - * @param {string} [deliveryDate] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedPost(authorization: string, childId: number, nameTranslations: string, descriptionTranslations: string, category: number, isUrgent: boolean, cost: number, type: number, swId?: number, imageUrl?: any, link?: string, affiliateLinkUrl?: string, receipts?: any, doingDuration?: number, details?: string, informations?: string, deliveryDate?: string, options?: any) { - return NeedAPIApiFp(configuration).apiV2NeedPost(authorization, childId, nameTranslations, descriptionTranslations, category, isUrgent, cost, type, swId, imageUrl, link, affiliateLinkUrl, receipts, doingDuration, details, informations, deliveryDate, options)(fetch, basePath); - }, - /** - * All fields are optional.
You cannot change cost for confirmed needs but it is ok with not confirmed needs.
It is possible to have multiple receipts, but each time you can upload one receipt, but their addresses will be saved as a comma separated string in db.
You have to upload a file for receipts and imageUrl.
Calling this API affects need table only.
- * @summary update need - * @param {string} authorization Access Token - * @param {number} needId - * @param {any} [imageUrl] - * @param {string} [nameTranslations] {\"en\": \"Bob\", \"fa\": \"بابک\"} - * @param {string} [descriptionTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {number} [category] - * @param {boolean} [isUrgent] - * @param {number} [cost] - * @param {number} [purchaseCost] Can be set only in p3 (product status 3) - * @param {number} [type] - * @param {string} [link] - * @param {string} [affiliateLinkUrl] - * @param {any} [receipts] - * @param {number} [status] - * @param {number} [doingDuration] - * @param {string} [details] - * @param {string} [expectedDeliveryDate] - * @param {string} [ngoDeliveryDate] - * @param {string} [dkc] Digikala purchase code (only in s3) - * @param {string} [informations] - * @param {string} [bankTrackId] Only for services, S2 -> S3 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedUpdateNeedIdneedIdPatch(authorization: string, needId: number, imageUrl?: any, nameTranslations?: string, descriptionTranslations?: string, category?: number, isUrgent?: boolean, cost?: number, purchaseCost?: number, type?: number, link?: string, affiliateLinkUrl?: string, receipts?: any, status?: number, doingDuration?: number, details?: string, expectedDeliveryDate?: string, ngoDeliveryDate?: string, dkc?: string, informations?: string, bankTrackId?: string, options?: any) { - return NeedAPIApiFp(configuration).apiV2NeedUpdateNeedIdneedIdPatch(authorization, needId, imageUrl, nameTranslations, descriptionTranslations, category, isUrgent, cost, purchaseCost, type, link, affiliateLinkUrl, receipts, status, doingDuration, details, expectedDeliveryDate, ngoDeliveryDate, dkc, informations, bankTrackId, options)(fetch, basePath); - }, - /** - * Returns information of all needs as a json object.
Calling this API affects need, child_need and need_family and user tables.
[0]not onfirmed, [1]confirmed, [2]both

Done parameter determines how do you want the result:
[0]not done, [1]done, [2]all
- * @summary get all needs - * @param {string} authorization Access Token - * @param {number} [X_SKIP] - * @param {number} [X_TAKE] Max 500 - * @param {boolean} [isConfirmed] - * @param {boolean} [isDone] - * @param {boolean} [isReported] - * @param {string} [status] - * @param {number} [type] - * @param {number} [ngoId] - * @param {boolean} [isChildConfirmed] - * @param {boolean} [unpayable] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedsGet(authorization: string, X_SKIP?: number, X_TAKE?: number, isConfirmed?: boolean, isDone?: boolean, isReported?: boolean, status?: string, type?: number, ngoId?: number, isChildConfirmed?: boolean, unpayable?: boolean, options?: any) { - return NeedAPIApiFp(configuration).apiV2NeedsGet(authorization, X_SKIP, X_TAKE, isConfirmed, isDone, isReported, status, type, ngoId, isChildConfirmed, unpayable, options)(fetch, basePath); - }, - /** - *
- * @summary List receipts for a need - * @param {any} id - * @param {string} [authorization] Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedsIdReceiptsGet(id: any, authorization?: string, options?: any) { - return NeedAPIApiFp(configuration).apiV2NeedsIdReceiptsGet(id, authorization, options)(fetch, basePath); - }, - /** - * - * @summary Create a new receipt for a need - * @param {string} authorization Access Token - * @param {any} id - * @param {any} attachment - * @param {string} title max 128 char - * @param {string} [code] unique, max 128 char - * @param {string} [description] max 1024 char - * @param {boolean} [isPublic] default=false, only SUPER_ADMIN, SAY_SUPERVISOR, ADMIN can set to true - * @param {number} [needStatus] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedsIdReceiptsPost(authorization: string, id: any, attachment: any, title: string, code?: string, description?: string, isPublic?: boolean, needStatus?: number, options?: any) { - return NeedAPIApiFp(configuration).apiV2NeedsIdReceiptsPost(authorization, id, attachment, title, code, description, isPublic, needStatus, options)(fetch, basePath); - }, - /** - *
- * @summary Delete a receipt from a need, not the receipt itself! - * @param {string} authorization Access Token - * @param {any} id - * @param {any} receiptId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedsIdReceiptsReceiptIdDelete(authorization: string, id: any, receiptId: any, options?: any) { - return NeedAPIApiFp(configuration).apiV2NeedsIdReceiptsReceiptIdDelete(authorization, id, receiptId, options)(fetch, basePath); - }, - }; -}; - -/** - * NeedAPIApi - object-oriented interface - * @export - * @class NeedAPIApi - * @extends {BaseAPI} - */ -export class NeedAPIApi extends BaseAPI { + apiV2NgoActivateNgoIdngoIdPatch( + authorization: string, + ngoId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NGOAPIApiFetchParamCreator( + configuration, + ).apiV2NgoActivateNgoIdngoIdPatch(authorization, ngoId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, /** - * Confirms a need, so you can add a payment for it and add it to a confirmed child but you cannot update its price (cost) anymore.
Calling this API affects need, child and social_worker tables.
- * @summary confirm a need + * Adds an NGO.
This API creates a row in ngo table containing a new NGO information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding website is optional.
For logoUrl ypu have to upload a file.
Adding multiple phone numbers is allowed.
They must be comma separated and without any spaces like the example bellow:
[number],[number],...
+ * @summary add ngo * @param {string} authorization Access Token - * @param {number} needId + * @param {number} cityId + * @param {string} name + * @param {string} postalAddress + * @param {string} emailAddress + * @param {string} phoneNumber + * @param {any} logoUrl + * @param {string} [website] + * @param {number} [balance] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NeedAPIApi */ - public apiV2NeedConfirmNeedIdneedIdPatch(authorization: string, needId: number, options?: any) { - return NeedAPIApiFp(this.configuration).apiV2NeedConfirmNeedIdneedIdPatch(authorization, needId, options)(this.fetch, this.basePath); - } - + apiV2NgoAddPost( + authorization: string, + cityId: number, + name: string, + postalAddress: string, + emailAddress: string, + phoneNumber: string, + logoUrl: any, + website?: string, + balance?: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NGOAPIApiFetchParamCreator( + configuration, + ).apiV2NgoAddPost( + authorization, + cityId, + name, + postalAddress, + emailAddress, + phoneNumber, + logoUrl, + website, + balance, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, /** - * Deletes a need by setting its isDeleted tag true.
It also delete all impacts and occurrences of this need in whole database.
It is only possible to delete the needs without any payments.
Deleting is managed by isDeleted tag everywhere, so we do not fully delete anything.
Calling this API affects need, need_family and child_need tables.
- * @summary delete a need + * Returns information of all NGOs in a json.
Json key is NGO id and json value is NGO object.
Calling this API only affects ngo table by selecting rows from it.
+ * @summary get all ngos * @param {string} authorization Access Token - * @param {number} needId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NeedAPIApi */ - public apiV2NeedDeleteNeedIdneedIdPatch(authorization: string, needId: number, options?: any) { - return NeedAPIApiFp(this.configuration).apiV2NeedDeleteNeedIdneedIdPatch(authorization, needId, options)(this.fetch, this.basePath); - } - + apiV2NgoAllGet( + authorization: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NGOAPIApiFetchParamCreator( + configuration, + ).apiV2NgoAllGet(authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** - * Returns information of a need with given id as a json object.
Calling this API affects need, child_need and need_family and user tables.
Confirm parameter determines how do you want the result:
[0]not onfirmed, [1]confirmed, [2]both
- * @summary get need by id - * @param {string} authorization Access Token - * @param {number} needId + * Deactivates an active NGO.
Calling this API only affects ngo table by updating a row.
+ * @summary deactivate ngo + * @param {number} ngoId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NeedAPIApi */ - public apiV2NeedNeedIdneedIdGet(authorization: string, needId: number, options?: any) { - return NeedAPIApiFp(this.configuration).apiV2NeedNeedIdneedIdGet(authorization, needId, options)(this.fetch, this.basePath); - } - + apiV2NgoDeactivateNgoIdngoIdPatch( + ngoId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NGOAPIApiFetchParamCreator( + configuration, + ).apiV2NgoDeactivateNgoIdngoIdPatch(ngoId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, /** - * Adds a need.
It is possible to have multiple receipts, but each time you can upload one receipt, but their addresses will be saved as a comma separated string in db.
You have to upload a file for receipts and imageUrl.
Calling this API affects need table only.
Adding affiliateLinkUrl and receipts are optional.
type codes: [0]donate, [1]affiliate
- * @summary add need + * Deletes a specific NGO.
Calling this API only affects ngo table by updating a row and set isDeleted tag true.
We do not fully delete any rows.
+ * @summary delete ngo * @param {string} authorization Access Token - * @param {number} childId - * @param {string} nameTranslations {\"en\": \"Bob\", \"fa\": \"بابک\"} - * @param {string} descriptionTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {number} category - * @param {boolean} isUrgent - * @param {number} cost - * @param {number} type - * @param {number} [swId] - * @param {any} [imageUrl] - * @param {string} [link] - * @param {string} [affiliateLinkUrl] - * @param {any} [receipts] - * @param {number} [doingDuration] - * @param {string} [details] - * @param {string} [informations] - * @param {string} [deliveryDate] + * @param {number} ngoId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NeedAPIApi */ - public apiV2NeedPost(authorization: string, childId: number, nameTranslations: string, descriptionTranslations: string, category: number, isUrgent: boolean, cost: number, type: number, swId?: number, imageUrl?: any, link?: string, affiliateLinkUrl?: string, receipts?: any, doingDuration?: number, details?: string, informations?: string, deliveryDate?: string, options?: any) { - return NeedAPIApiFp(this.configuration).apiV2NeedPost(authorization, childId, nameTranslations, descriptionTranslations, category, isUrgent, cost, type, swId, imageUrl, link, affiliateLinkUrl, receipts, doingDuration, details, informations, deliveryDate, options)(this.fetch, this.basePath); - } - + apiV2NgoDeleteNgoIdngoIdPatch( + authorization: string, + ngoId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NGOAPIApiFetchParamCreator( + configuration, + ).apiV2NgoDeleteNgoIdngoIdPatch(authorization, ngoId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, /** - * All fields are optional.
You cannot change cost for confirmed needs but it is ok with not confirmed needs.
It is possible to have multiple receipts, but each time you can upload one receipt, but their addresses will be saved as a comma separated string in db.
You have to upload a file for receipts and imageUrl.
Calling this API affects need table only.
- * @summary update need + * Returns information of an NGO with given id as a json object.
Calling this API only affects ngo table by selecting a single row from it.
+ * @summary get ngo by id * @param {string} authorization Access Token - * @param {number} needId - * @param {any} [imageUrl] - * @param {string} [nameTranslations] {\"en\": \"Bob\", \"fa\": \"بابک\"} - * @param {string} [descriptionTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} - * @param {number} [category] - * @param {boolean} [isUrgent] - * @param {number} [cost] - * @param {number} [purchaseCost] Can be set only in p3 (product status 3) - * @param {number} [type] - * @param {string} [link] - * @param {string} [affiliateLinkUrl] - * @param {any} [receipts] - * @param {number} [status] - * @param {number} [doingDuration] - * @param {string} [details] - * @param {string} [expectedDeliveryDate] - * @param {string} [ngoDeliveryDate] - * @param {string} [dkc] Digikala purchase code (only in s3) - * @param {string} [informations] - * @param {string} [bankTrackId] Only for services, S2 -> S3 + * @param {number} ngoId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NeedAPIApi */ - public apiV2NeedUpdateNeedIdneedIdPatch(authorization: string, needId: number, imageUrl?: any, nameTranslations?: string, descriptionTranslations?: string, category?: number, isUrgent?: boolean, cost?: number, purchaseCost?: number, type?: number, link?: string, affiliateLinkUrl?: string, receipts?: any, status?: number, doingDuration?: number, details?: string, expectedDeliveryDate?: string, ngoDeliveryDate?: string, dkc?: string, informations?: string, bankTrackId?: string, options?: any) { - return NeedAPIApiFp(this.configuration).apiV2NeedUpdateNeedIdneedIdPatch(authorization, needId, imageUrl, nameTranslations, descriptionTranslations, category, isUrgent, cost, purchaseCost, type, link, affiliateLinkUrl, receipts, status, doingDuration, details, expectedDeliveryDate, ngoDeliveryDate, dkc, informations, bankTrackId, options)(this.fetch, this.basePath); - } - + apiV2NgoNgoIdngoIdGet( + authorization: string, + ngoId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NGOAPIApiFetchParamCreator( + configuration, + ).apiV2NgoNgoIdngoIdGet(authorization, ngoId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** - * Returns information of all needs as a json object.
Calling this API affects need, child_need and need_family and user tables.
[0]not onfirmed, [1]confirmed, [2]both

Done parameter determines how do you want the result:
[0]not done, [1]done, [2]all
- * @summary get all needs - * @param {string} authorization Access Token - * @param {number} [X_SKIP] - * @param {number} [X_TAKE] Max 500 - * @param {boolean} [isConfirmed] - * @param {boolean} [isDone] - * @param {boolean} [isReported] - * @param {string} [status] - * @param {number} [type] - * @param {number} [ngoId] - * @param {boolean} [isChildConfirmed] - * @param {boolean} [unpayable] + * All the fields are optional.
You can fill every field you want to change, and it will update the desired NGO.
Calling this API only affects ngo table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
For logoUrl you have to upload a file.
+ * @summary update ngo + * @param {string} authorization Access Token + * @param {number} ngoId + * @param {number} [cityId] + * @param {string} [name] + * @param {string} [website] + * @param {string} [postalAddress] + * @param {string} [emailAddress] + * @param {string} [phoneNumber] + * @param {any} [logoUrl] + * @param {number} [balance] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NeedAPIApi */ - public apiV2NeedsGet(authorization: string, X_SKIP?: number, X_TAKE?: number, isConfirmed?: boolean, isDone?: boolean, isReported?: boolean, status?: string, type?: number, ngoId?: number, isChildConfirmed?: boolean, unpayable?: boolean, options?: any) { - return NeedAPIApiFp(this.configuration).apiV2NeedsGet(authorization, X_SKIP, X_TAKE, isConfirmed, isDone, isReported, status, type, ngoId, isChildConfirmed, unpayable, options)(this.fetch, this.basePath); - } + apiV2NgoUpdateNgoIdngoIdPatch( + authorization: string, + ngoId: number, + cityId?: number, + name?: string, + website?: string, + postalAddress?: string, + emailAddress?: string, + phoneNumber?: string, + logoUrl?: any, + balance?: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NGOAPIApiFetchParamCreator( + configuration, + ).apiV2NgoUpdateNgoIdngoIdPatch( + authorization, + ngoId, + cityId, + name, + website, + postalAddress, + emailAddress, + phoneNumber, + logoUrl, + balance, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + }; +}; +/** + * NGOAPIApi - factory interface + * @export + */ +export const NGOAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { /** - *
- * @summary List receipts for a need - * @param {any} id - * @param {string} [authorization] Access Token + * Activates a deactive NGO.
Calling this API only affects ngo table by updating a row.
+ * @summary activate ngo + * @param {string} authorization Access Token + * @param {number} ngoId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NeedAPIApi */ - public apiV2NeedsIdReceiptsGet(id: any, authorization?: string, options?: any) { - return NeedAPIApiFp(this.configuration).apiV2NeedsIdReceiptsGet(id, authorization, options)(this.fetch, this.basePath); - } - + apiV2NgoActivateNgoIdngoIdPatch( + authorization: string, + ngoId: number, + options?: any, + ) { + return NGOAPIApiFp(configuration).apiV2NgoActivateNgoIdngoIdPatch( + authorization, + ngoId, + options, + )(fetch, basePath); + }, /** - * - * @summary Create a new receipt for a need + * Adds an NGO.
This API creates a row in ngo table containing a new NGO information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding website is optional.
For logoUrl ypu have to upload a file.
Adding multiple phone numbers is allowed.
They must be comma separated and without any spaces like the example bellow:
[number],[number],...
+ * @summary add ngo * @param {string} authorization Access Token - * @param {any} id - * @param {any} attachment - * @param {string} title max 128 char - * @param {string} [code] unique, max 128 char - * @param {string} [description] max 1024 char - * @param {boolean} [isPublic] default=false, only SUPER_ADMIN, SAY_SUPERVISOR, ADMIN can set to true - * @param {number} [needStatus] + * @param {number} cityId + * @param {string} name + * @param {string} postalAddress + * @param {string} emailAddress + * @param {string} phoneNumber + * @param {any} logoUrl + * @param {string} [website] + * @param {number} [balance] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NeedAPIApi */ - public apiV2NeedsIdReceiptsPost(authorization: string, id: any, attachment: any, title: string, code?: string, description?: string, isPublic?: boolean, needStatus?: number, options?: any) { - return NeedAPIApiFp(this.configuration).apiV2NeedsIdReceiptsPost(authorization, id, attachment, title, code, description, isPublic, needStatus, options)(this.fetch, this.basePath); - } - + apiV2NgoAddPost( + authorization: string, + cityId: number, + name: string, + postalAddress: string, + emailAddress: string, + phoneNumber: string, + logoUrl: any, + website?: string, + balance?: number, + options?: any, + ) { + return NGOAPIApiFp(configuration).apiV2NgoAddPost( + authorization, + cityId, + name, + postalAddress, + emailAddress, + phoneNumber, + logoUrl, + website, + balance, + options, + )(fetch, basePath); + }, /** - *
- * @summary Delete a receipt from a need, not the receipt itself! + * Returns information of all NGOs in a json.
Json key is NGO id and json value is NGO object.
Calling this API only affects ngo table by selecting rows from it.
+ * @summary get all ngos * @param {string} authorization Access Token - * @param {any} id - * @param {any} receiptId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NeedAPIApi */ - public apiV2NeedsIdReceiptsReceiptIdDelete(authorization: string, id: any, receiptId: any, options?: any) { - return NeedAPIApiFp(this.configuration).apiV2NeedsIdReceiptsReceiptIdDelete(authorization, id, receiptId, options)(this.fetch, this.basePath); - } - -} - -/** - * NeedStatusUpdatesAPIApi - fetch parameter creator - * @export - */ -export const NeedStatusUpdatesAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * Orderin, Filtering, Pagination
- * @summary List all Need Status Updates - * @param {string} authorization Access Token, Only Super Admin and SAY Supervisior - * @param {number} [xTake] Number of results in one page - * @param {number} [xSkip] Skip n result - * @param {string} [orderBy] OrderBy column/columns, use - to revrse the order, like this -created,needId - * @param {number} [needId] Filter by needId - * @param {number} [swId] Filter by swId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedStatusUpdatesGet(authorization: string, xTake?: number, xSkip?: number, orderBy?: string, needId?: number, swId?: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2NeedStatusUpdatesGet.'); - } - const localVarPath = `/api/v2/need-status-updates`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (needId !== undefined) { - localVarQueryParameter['needId'] = needId; - } - - if (swId !== undefined) { - localVarQueryParameter['swId'] = swId; - } - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (xTake !== undefined && xTake !== null) { - localVarHeaderParameter['X_TAKE'] = String(xTake); - } - - if (xSkip !== undefined && xSkip !== null) { - localVarHeaderParameter['X_SKIP'] = String(xSkip); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * NeedStatusUpdatesAPIApi - functional programming interface - * @export - */ -export const NeedStatusUpdatesAPIApiFp = function (configuration?: Configuration) { - return { - /** - * Orderin, Filtering, Pagination
- * @summary List all Need Status Updates - * @param {string} authorization Access Token, Only Super Admin and SAY Supervisior - * @param {number} [xTake] Number of results in one page - * @param {number} [xSkip] Skip n result - * @param {string} [orderBy] OrderBy column/columns, use - to revrse the order, like this -created,needId - * @param {number} [needId] Filter by needId - * @param {number} [swId] Filter by swId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedStatusUpdatesGet(authorization: string, xTake?: number, xSkip?: number, orderBy?: string, needId?: number, swId?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { - const localVarFetchArgs = NeedStatusUpdatesAPIApiFetchParamCreator(configuration).apiV2NeedStatusUpdatesGet(authorization, xTake, xSkip, orderBy, needId, swId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - } -}; - -/** - * NeedStatusUpdatesAPIApi - factory interface - * @export - */ -export const NeedStatusUpdatesAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * Orderin, Filtering, Pagination
- * @summary List all Need Status Updates - * @param {string} authorization Access Token, Only Super Admin and SAY Supervisior - * @param {number} [xTake] Number of results in one page - * @param {number} [xSkip] Skip n result - * @param {string} [orderBy] OrderBy column/columns, use - to revrse the order, like this -created,needId - * @param {number} [needId] Filter by needId - * @param {number} [swId] Filter by swId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2NeedStatusUpdatesGet(authorization: string, xTake?: number, xSkip?: number, orderBy?: string, needId?: number, swId?: number, options?: any) { - return NeedStatusUpdatesAPIApiFp(configuration).apiV2NeedStatusUpdatesGet(authorization, xTake, xSkip, orderBy, needId, swId, options)(fetch, basePath); - }, - }; -}; - -/** - * NeedStatusUpdatesAPIApi - object-oriented interface - * @export - * @class NeedStatusUpdatesAPIApi - * @extends {BaseAPI} - */ -export class NeedStatusUpdatesAPIApi extends BaseAPI { + apiV2NgoAllGet(authorization: string, options?: any) { + return NGOAPIApiFp(configuration).apiV2NgoAllGet(authorization, options)( + fetch, + basePath, + ); + }, /** - * Orderin, Filtering, Pagination
- * @summary List all Need Status Updates - * @param {string} authorization Access Token, Only Super Admin and SAY Supervisior - * @param {number} [xTake] Number of results in one page - * @param {number} [xSkip] Skip n result - * @param {string} [orderBy] OrderBy column/columns, use - to revrse the order, like this -created,needId - * @param {number} [needId] Filter by needId - * @param {number} [swId] Filter by swId + * Deactivates an active NGO.
Calling this API only affects ngo table by updating a row.
+ * @summary deactivate ngo + * @param {number} ngoId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof NeedStatusUpdatesAPIApi */ - public apiV2NeedStatusUpdatesGet(authorization: string, xTake?: number, xSkip?: number, orderBy?: string, needId?: number, swId?: number, options?: any) { - return NeedStatusUpdatesAPIApiFp(this.configuration).apiV2NeedStatusUpdatesGet(authorization, xTake, xSkip, orderBy, needId, swId, options)(this.fetch, this.basePath); - } - -} - -/** - * PanelAuthAPIApi - fetch parameter creator - * @export - */ -export const PanelAuthAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Panel Login API - * @param {any} username - * @param {any} password - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PanelAuthLoginPost(username: any, password: any, options: any = {}): FetchArgs { - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username', 'Required parameter username was null or undefined when calling apiV2PanelAuthLoginPost.'); - } - // verify required parameter 'password' is not null or undefined - if (password === null || password === undefined) { - throw new RequiredError('password', 'Required parameter password was null or undefined when calling apiV2PanelAuthLoginPost.'); - } - const localVarPath = `/api/v2/panel/auth/login`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (username !== undefined) { - localVarFormParams.set('username', username as any); - } - - if (password !== undefined) { - localVarFormParams.set('password', password as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Panel Logout (Access Token) API - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PanelAuthLogoutTokenPost(authorization: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2PanelAuthLogoutTokenPost.'); - } - const localVarPath = `/api/v2/panel/auth/logout/token`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * PanelAuthAPIApi - functional programming interface - * @export - */ -export const PanelAuthAPIApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Panel Login API - * @param {any} username - * @param {any} password - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PanelAuthLoginPost(username: any, password: any, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = PanelAuthAPIApiFetchParamCreator(configuration).apiV2PanelAuthLoginPost(username, password, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(async (response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Panel Logout (Access Token) API - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PanelAuthLogoutTokenPost(authorization: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = PanelAuthAPIApiFetchParamCreator(configuration).apiV2PanelAuthLogoutTokenPost(authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - } + apiV2NgoDeactivateNgoIdngoIdPatch(ngoId: number, options?: any) { + return NGOAPIApiFp(configuration).apiV2NgoDeactivateNgoIdngoIdPatch( + ngoId, + options, + )(fetch, basePath); + }, + /** + * Deletes a specific NGO.
Calling this API only affects ngo table by updating a row and set isDeleted tag true.
We do not fully delete any rows.
+ * @summary delete ngo + * @param {string} authorization Access Token + * @param {number} ngoId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NgoDeleteNgoIdngoIdPatch( + authorization: string, + ngoId: number, + options?: any, + ) { + return NGOAPIApiFp(configuration).apiV2NgoDeleteNgoIdngoIdPatch( + authorization, + ngoId, + options, + )(fetch, basePath); + }, + /** + * Returns information of an NGO with given id as a json object.
Calling this API only affects ngo table by selecting a single row from it.
+ * @summary get ngo by id + * @param {string} authorization Access Token + * @param {number} ngoId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NgoNgoIdngoIdGet(authorization: string, ngoId: number, options?: any) { + return NGOAPIApiFp(configuration).apiV2NgoNgoIdngoIdGet( + authorization, + ngoId, + options, + )(fetch, basePath); + }, + /** + * All the fields are optional.
You can fill every field you want to change, and it will update the desired NGO.
Calling this API only affects ngo table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
For logoUrl you have to upload a file.
+ * @summary update ngo + * @param {string} authorization Access Token + * @param {number} ngoId + * @param {number} [cityId] + * @param {string} [name] + * @param {string} [website] + * @param {string} [postalAddress] + * @param {string} [emailAddress] + * @param {string} [phoneNumber] + * @param {any} [logoUrl] + * @param {number} [balance] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NgoUpdateNgoIdngoIdPatch( + authorization: string, + ngoId: number, + cityId?: number, + name?: string, + website?: string, + postalAddress?: string, + emailAddress?: string, + phoneNumber?: string, + logoUrl?: any, + balance?: number, + options?: any, + ) { + return NGOAPIApiFp(configuration).apiV2NgoUpdateNgoIdngoIdPatch( + authorization, + ngoId, + cityId, + name, + website, + postalAddress, + emailAddress, + phoneNumber, + logoUrl, + balance, + options, + )(fetch, basePath); + }, + }; }; /** - * PanelAuthAPIApi - factory interface + * NGOAPIApi - object-oriented interface * @export + * @class NGOAPIApi + * @extends {BaseAPI} */ -export const PanelAuthAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * - * @summary Panel Login API - * @param {any} username - * @param {any} password - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PanelAuthLoginPost(username: any, password: any, options?: any) { - return PanelAuthAPIApiFp(configuration).apiV2PanelAuthLoginPost(username, password, options)(fetch, basePath); - }, - /** - * - * @summary Panel Logout (Access Token) API - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PanelAuthLogoutTokenPost(authorization: string, options?: any) { - return PanelAuthAPIApiFp(configuration).apiV2PanelAuthLogoutTokenPost(authorization, options)(fetch, basePath); - }, - }; -}; +export class NGOAPIApi extends BaseAPI { + /** + * Activates a deactive NGO.
Calling this API only affects ngo table by updating a row.
+ * @summary activate ngo + * @param {string} authorization Access Token + * @param {number} ngoId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NGOAPIApi + */ + public apiV2NgoActivateNgoIdngoIdPatch( + authorization: string, + ngoId: number, + options?: any, + ) { + return NGOAPIApiFp(this.configuration).apiV2NgoActivateNgoIdngoIdPatch( + authorization, + ngoId, + options, + )(this.fetch, this.basePath); + } + + /** + * Adds an NGO.
This API creates a row in ngo table containing a new NGO information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding website is optional.
For logoUrl ypu have to upload a file.
Adding multiple phone numbers is allowed.
They must be comma separated and without any spaces like the example bellow:
[number],[number],...
+ * @summary add ngo + * @param {string} authorization Access Token + * @param {number} cityId + * @param {string} name + * @param {string} postalAddress + * @param {string} emailAddress + * @param {string} phoneNumber + * @param {any} logoUrl + * @param {string} [website] + * @param {number} [balance] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NGOAPIApi + */ + public apiV2NgoAddPost( + authorization: string, + cityId: number, + name: string, + postalAddress: string, + emailAddress: string, + phoneNumber: string, + logoUrl: any, + website?: string, + balance?: number, + options?: any, + ) { + return NGOAPIApiFp(this.configuration).apiV2NgoAddPost( + authorization, + cityId, + name, + postalAddress, + emailAddress, + phoneNumber, + logoUrl, + website, + balance, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns information of all NGOs in a json.
Json key is NGO id and json value is NGO object.
Calling this API only affects ngo table by selecting rows from it.
+ * @summary get all ngos + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NGOAPIApi + */ + public apiV2NgoAllGet(authorization: string, options?: any) { + return NGOAPIApiFp(this.configuration).apiV2NgoAllGet( + authorization, + options, + )(this.fetch, this.basePath); + } + + /** + * Deactivates an active NGO.
Calling this API only affects ngo table by updating a row.
+ * @summary deactivate ngo + * @param {number} ngoId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NGOAPIApi + */ + public apiV2NgoDeactivateNgoIdngoIdPatch(ngoId: number, options?: any) { + return NGOAPIApiFp(this.configuration).apiV2NgoDeactivateNgoIdngoIdPatch( + ngoId, + options, + )(this.fetch, this.basePath); + } + + /** + * Deletes a specific NGO.
Calling this API only affects ngo table by updating a row and set isDeleted tag true.
We do not fully delete any rows.
+ * @summary delete ngo + * @param {string} authorization Access Token + * @param {number} ngoId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NGOAPIApi + */ + public apiV2NgoDeleteNgoIdngoIdPatch( + authorization: string, + ngoId: number, + options?: any, + ) { + return NGOAPIApiFp(this.configuration).apiV2NgoDeleteNgoIdngoIdPatch( + authorization, + ngoId, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns information of an NGO with given id as a json object.
Calling this API only affects ngo table by selecting a single row from it.
+ * @summary get ngo by id + * @param {string} authorization Access Token + * @param {number} ngoId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NGOAPIApi + */ + public apiV2NgoNgoIdngoIdGet( + authorization: string, + ngoId: number, + options?: any, + ) { + return NGOAPIApiFp(this.configuration).apiV2NgoNgoIdngoIdGet( + authorization, + ngoId, + options, + )(this.fetch, this.basePath); + } + + /** + * All the fields are optional.
You can fill every field you want to change, and it will update the desired NGO.
Calling this API only affects ngo table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
For logoUrl you have to upload a file.
+ * @summary update ngo + * @param {string} authorization Access Token + * @param {number} ngoId + * @param {number} [cityId] + * @param {string} [name] + * @param {string} [website] + * @param {string} [postalAddress] + * @param {string} [emailAddress] + * @param {string} [phoneNumber] + * @param {any} [logoUrl] + * @param {number} [balance] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NGOAPIApi + */ + public apiV2NgoUpdateNgoIdngoIdPatch( + authorization: string, + ngoId: number, + cityId?: number, + name?: string, + website?: string, + postalAddress?: string, + emailAddress?: string, + phoneNumber?: string, + logoUrl?: any, + balance?: number, + options?: any, + ) { + return NGOAPIApiFp(this.configuration).apiV2NgoUpdateNgoIdngoIdPatch( + authorization, + ngoId, + cityId, + name, + website, + postalAddress, + emailAddress, + phoneNumber, + logoUrl, + balance, + options, + )(this.fetch, this.basePath); + } +} /** - * PanelAuthAPIApi - object-oriented interface + * NakamaAPIApi - fetch parameter creator * @export - * @class PanelAuthAPIApi - * @extends {BaseAPI} */ -export class PanelAuthAPIApi extends BaseAPI { +export const NakamaAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { /** - * - * @summary Panel Login API - * @param {any} username - * @param {any} password + *
+ * @summary Submit eth transaction for a need (Nakama) + * @param {string} txHash * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof PanelAuthAPIApi */ - public apiV2PanelAuthLoginPost(username: any, password: any, options?: any) { - return PanelAuthAPIApiFp(this.configuration).apiV2PanelAuthLoginPost(username, password, options)(this.fetch, this.basePath); - } + apiV2NakamaTxHashPost(txHash: string, options: any = {}): FetchArgs { + // verify required parameter 'txHash' is not null or undefined + if (txHash === null || txHash === undefined) { + throw new RequiredError( + 'txHash', + 'Required parameter txHash was null or undefined when calling apiV2NakamaTxHashPost.', + ); + } + const localVarPath = `/api/v2/nakama/{tx_hash}`.replace( + `{${'tx_hash'}}`, + encodeURIComponent(String(txHash)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; +/** + * NakamaAPIApi - functional programming interface + * @export + */ +export const NakamaAPIApiFp = function (configuration?: Configuration) { + return { /** - * - * @summary Panel Logout (Access Token) API - * @param {string} authorization Access Token + *
+ * @summary Submit eth transaction for a need (Nakama) + * @param {string} txHash * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof PanelAuthAPIApi */ - public apiV2PanelAuthLogoutTokenPost(authorization: string, options?: any) { - return PanelAuthAPIApiFp(this.configuration).apiV2PanelAuthLogoutTokenPost(authorization, options)(this.fetch, this.basePath); - } - -} - -/** - * PaymentAPIApi - fetch parameter creator - * @export - */ -export const PaymentAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - *
- * @summary get all payments - * @param {string} authorization Access Token - * @param {any} [needId] - * @param {any} [take] - * @param {any} [skip] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PaymentAllGet(authorization: string, needId?: any, take?: any, skip?: any, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2PaymentAllGet.'); - } - const localVarPath = `/api/v2/payment/all`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (needId !== undefined) { - localVarQueryParameter['need_id'] = needId; - } - - if (take !== undefined) { - localVarQueryParameter['take'] = take; - } - - if (skip !== undefined) { - localVarQueryParameter['skip'] = skip; - } - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary get a payment - * @param {string} authorization Access Token - * @param {number} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PaymentIdGet(authorization: string, id: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2PaymentIdGet.'); - } - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2PaymentIdGet.'); - } - const localVarPath = `/api/v2/payment/{id}` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Create a paymnet for a need - * @param {string} authorization Access Token - * @param {Register} register - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PaymentPost(authorization: string, register: Register, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2PaymentPost.'); - } - // verify required parameter 'register' is not null or undefined - if (register === null || register === undefined) { - throw new RequiredError('register', 'Required parameter register was null or undefined when calling apiV2PaymentPost.'); - } - const localVarPath = `/api/v2/payment`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - const needsSerialization = ("Register" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(register || {}) : (register || ""); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } + apiV2NakamaTxHashPost( + txHash: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NakamaAPIApiFetchParamCreator( + configuration, + ).apiV2NakamaTxHashPost(txHash, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + }; }; /** - * PaymentAPIApi - functional programming interface + * NakamaAPIApi - factory interface * @export */ -export const PaymentAPIApiFp = function (configuration?: Configuration) { - return { - /** - *
- * @summary get all payments - * @param {string} authorization Access Token - * @param {any} [needId] - * @param {any} [take] - * @param {any} [skip] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PaymentAllGet(authorization: string, needId?: any, take?: any, skip?: any, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = PaymentAPIApiFetchParamCreator(configuration).apiV2PaymentAllGet(authorization, needId, take, skip, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary get a payment - * @param {string} authorization Access Token - * @param {number} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PaymentIdGet(authorization: string, id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = PaymentAPIApiFetchParamCreator(configuration).apiV2PaymentIdGet(authorization, id, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Create a paymnet for a need - * @param {string} authorization Access Token - * @param {Register} register - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PaymentPost(authorization: string, register: Register, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = PaymentAPIApiFetchParamCreator(configuration).apiV2PaymentPost(authorization, register, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - } +export const NakamaAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { + /** + *
+ * @summary Submit eth transaction for a need (Nakama) + * @param {string} txHash + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NakamaTxHashPost(txHash: string, options?: any) { + return NakamaAPIApiFp(configuration).apiV2NakamaTxHashPost( + txHash, + options, + )(fetch, basePath); + }, + }; }; /** - * PaymentAPIApi - factory interface + * NakamaAPIApi - object-oriented interface * @export + * @class NakamaAPIApi + * @extends {BaseAPI} */ -export const PaymentAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - *
- * @summary get all payments - * @param {string} authorization Access Token - * @param {any} [needId] - * @param {any} [take] - * @param {any} [skip] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PaymentAllGet(authorization: string, needId?: any, take?: any, skip?: any, options?: any) { - return PaymentAPIApiFp(configuration).apiV2PaymentAllGet(authorization, needId, take, skip, options)(fetch, basePath); - }, - /** - * - * @summary get a payment - * @param {string} authorization Access Token - * @param {number} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PaymentIdGet(authorization: string, id: number, options?: any) { - return PaymentAPIApiFp(configuration).apiV2PaymentIdGet(authorization, id, options)(fetch, basePath); - }, - /** - * - * @summary Create a paymnet for a need - * @param {string} authorization Access Token - * @param {Register} register - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PaymentPost(authorization: string, register: Register, options?: any) { - return PaymentAPIApiFp(configuration).apiV2PaymentPost(authorization, register, options)(fetch, basePath); - }, - }; -}; +export class NakamaAPIApi extends BaseAPI { + /** + *
+ * @summary Submit eth transaction for a need (Nakama) + * @param {string} txHash + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NakamaAPIApi + */ + public apiV2NakamaTxHashPost(txHash: string, options?: any) { + return NakamaAPIApiFp(this.configuration).apiV2NakamaTxHashPost( + txHash, + options, + )(this.fetch, this.basePath); + } +} /** - * PaymentAPIApi - object-oriented interface + * NeedAPIApi - fetch parameter creator * @export - * @class PaymentAPIApi - * @extends {BaseAPI} */ -export class PaymentAPIApi extends BaseAPI { +export const NeedAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { /** - *
- * @summary get all payments + * Confirms a need, so you can add a payment for it and add it to a confirmed child but you cannot update its price (cost) anymore.
Calling this API affects need, child and social_worker tables.
+ * @summary confirm a need * @param {string} authorization Access Token - * @param {any} [needId] - * @param {any} [take] - * @param {any} [skip] + * @param {number} needId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof PaymentAPIApi */ - public apiV2PaymentAllGet(authorization: string, needId?: any, take?: any, skip?: any, options?: any) { - return PaymentAPIApiFp(this.configuration).apiV2PaymentAllGet(authorization, needId, take, skip, options)(this.fetch, this.basePath); - } - + apiV2NeedConfirmNeedIdneedIdPatch( + authorization: string, + needId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NeedConfirmNeedIdneedIdPatch.', + ); + } + // verify required parameter 'needId' is not null or undefined + if (needId === null || needId === undefined) { + throw new RequiredError( + 'needId', + 'Required parameter needId was null or undefined when calling apiV2NeedConfirmNeedIdneedIdPatch.', + ); + } + const localVarPath = `/api/v2/need/confirm/needId={need_id}`.replace( + `{${'need_id'}}`, + encodeURIComponent(String(needId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** - * - * @summary get a payment + * Deletes a need by setting its isDeleted tag true.
It also delete all impacts and occurrences of this need in whole database.
It is only possible to delete the needs without any payments.
Deleting is managed by isDeleted tag everywhere, so we do not fully delete anything.
Calling this API affects need, need_family and child_need tables.
+ * @summary delete a need * @param {string} authorization Access Token - * @param {number} id + * @param {number} needId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof PaymentAPIApi */ - public apiV2PaymentIdGet(authorization: string, id: number, options?: any) { - return PaymentAPIApiFp(this.configuration).apiV2PaymentIdGet(authorization, id, options)(this.fetch, this.basePath); - } - + apiV2NeedDeleteNeedIdneedIdPatch( + authorization: string, + needId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NeedDeleteNeedIdneedIdPatch.', + ); + } + // verify required parameter 'needId' is not null or undefined + if (needId === null || needId === undefined) { + throw new RequiredError( + 'needId', + 'Required parameter needId was null or undefined when calling apiV2NeedDeleteNeedIdneedIdPatch.', + ); + } + const localVarPath = `/api/v2/need/delete/needId={need_id}`.replace( + `{${'need_id'}}`, + encodeURIComponent(String(needId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** - * - * @summary Create a paymnet for a need + * Returns information of a need with given id as a json object.
Calling this API affects need, child_need and need_family and user tables.
Confirm parameter determines how do you want the result:
[0]not onfirmed, [1]confirmed, [2]both
+ * @summary get need by id * @param {string} authorization Access Token - * @param {Register} register + * @param {number} needId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof PaymentAPIApi */ - public apiV2PaymentPost(authorization: string, register: Register, options?: any) { - return PaymentAPIApiFp(this.configuration).apiV2PaymentPost(authorization, register, options)(this.fetch, this.basePath); - } - -} - -/** - * PreneedAPIApi - fetch parameter creator - * @export - */ -export const PreneedAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary List of Preneeds - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PreneedsGet(authorization: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2PreneedsGet.'); - } - const localVarPath = `/api/v2/preneeds/`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** + apiV2NeedNeedIdneedIdGet( + authorization: string, + needId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NeedNeedIdneedIdGet.', + ); + } + // verify required parameter 'needId' is not null or undefined + if (needId === null || needId === undefined) { + throw new RequiredError( + 'needId', + 'Required parameter needId was null or undefined when calling apiV2NeedNeedIdneedIdGet.', + ); + } + const localVarPath = `/api/v2/need/needId={need_id}`.replace( + `{${'need_id'}}`, + encodeURIComponent(String(needId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Adds a need.
It is possible to have multiple receipts, but each time you can upload one receipt, but their addresses will be saved as a comma separated string in db.
You have to upload a file for receipts and imageUrl.
Calling this API affects need table only.
Adding affiliateLinkUrl and receipts are optional.
type codes: [0]donate, [1]affiliate
+ * @summary add need + * @param {string} authorization Access Token + * @param {number} childId + * @param {string} nameTranslations {\"en\": \"Bob\", \"fa\": \"بابک\"} + * @param {string} descriptionTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {number} category + * @param {boolean} isUrgent + * @param {number} cost + * @param {number} type + * @param {number} [swId] + * @param {any} [imageUrl] + * @param {string} [link] + * @param {string} [affiliateLinkUrl] + * @param {any} [receipts] + * @param {number} [doingDuration] + * @param {string} [details] + * @param {string} [informations] + * @param {string} [deliveryDate] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedPost( + authorization: string, + childId: number, + nameTranslations: string, + descriptionTranslations: string, + category: number, + isUrgent: boolean, + cost: number, + type: number, + swId?: number, + imageUrl?: any, + link?: string, + affiliateLinkUrl?: string, + receipts?: any, + doingDuration?: number, + details?: string, + informations?: string, + deliveryDate?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NeedPost.', + ); + } + // verify required parameter 'childId' is not null or undefined + if (childId === null || childId === undefined) { + throw new RequiredError( + 'childId', + 'Required parameter childId was null or undefined when calling apiV2NeedPost.', + ); + } + // verify required parameter 'nameTranslations' is not null or undefined + if (nameTranslations === null || nameTranslations === undefined) { + throw new RequiredError( + 'nameTranslations', + 'Required parameter nameTranslations was null or undefined when calling apiV2NeedPost.', + ); + } + // verify required parameter 'descriptionTranslations' is not null or undefined + if ( + descriptionTranslations === null || + descriptionTranslations === undefined + ) { + throw new RequiredError( + 'descriptionTranslations', + 'Required parameter descriptionTranslations was null or undefined when calling apiV2NeedPost.', + ); + } + // verify required parameter 'category' is not null or undefined + if (category === null || category === undefined) { + throw new RequiredError( + 'category', + 'Required parameter category was null or undefined when calling apiV2NeedPost.', + ); + } + // verify required parameter 'isUrgent' is not null or undefined + if (isUrgent === null || isUrgent === undefined) { + throw new RequiredError( + 'isUrgent', + 'Required parameter isUrgent was null or undefined when calling apiV2NeedPost.', + ); + } + // verify required parameter 'cost' is not null or undefined + if (cost === null || cost === undefined) { + throw new RequiredError( + 'cost', + 'Required parameter cost was null or undefined when calling apiV2NeedPost.', + ); + } + // verify required parameter 'type' is not null or undefined + if (type === null || type === undefined) { + throw new RequiredError( + 'type', + 'Required parameter type was null or undefined when calling apiV2NeedPost.', + ); + } + const localVarPath = `/api/v2/need/`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (childId !== undefined) { + localVarFormParams.set('child_id', childId as any); + } + + if (swId !== undefined) { + localVarFormParams.set('sw_id', swId as any); + } + + if (imageUrl !== undefined) { + localVarFormParams.set('imageUrl', imageUrl as any); + } + + if (nameTranslations !== undefined) { + localVarFormParams.set('name_translations', nameTranslations as any); + } + + if (descriptionTranslations !== undefined) { + localVarFormParams.set( + 'description_translations', + descriptionTranslations as any, + ); + } + + if (category !== undefined) { + localVarFormParams.set('category', category as any); + } + + if (isUrgent !== undefined) { + localVarFormParams.set('isUrgent', isUrgent as any); + } + + if (cost !== undefined) { + localVarFormParams.set('cost', cost as any); + } + + if (type !== undefined) { + localVarFormParams.set('type', type as any); + } + + if (link !== undefined) { + localVarFormParams.set('link', link as any); + } + + if (affiliateLinkUrl !== undefined) { + localVarFormParams.set('affiliateLinkUrl', affiliateLinkUrl as any); + } + + if (receipts !== undefined) { + localVarFormParams.set('receipts', receipts as any); + } + + if (doingDuration !== undefined) { + localVarFormParams.set('doing_duration', doingDuration as any); + } + + if (details !== undefined) { + localVarFormParams.set('details', details as any); + } + + if (informations !== undefined) { + localVarFormParams.set('informations', informations as any); + } + + if (deliveryDate !== undefined) { + localVarFormParams.set('delivery_date', deliveryDate as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * All fields are optional.
You cannot change cost for confirmed needs but it is ok with not confirmed needs.
It is possible to have multiple receipts, but each time you can upload one receipt, but their addresses will be saved as a comma separated string in db.
You have to upload a file for receipts and imageUrl.
Calling this API affects need table only.
+ * @summary update need + * @param {string} authorization Access Token + * @param {number} needId + * @param {any} [imageUrl] + * @param {string} [nameTranslations] {\"en\": \"Bob\", \"fa\": \"بابک\"} + * @param {string} [descriptionTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {number} [category] + * @param {boolean} [isUrgent] + * @param {number} [cost] + * @param {number} [purchaseCost] Can be set only in p3 (product status 3) + * @param {number} [type] + * @param {string} [link] + * @param {string} [affiliateLinkUrl] + * @param {any} [receipts] + * @param {number} [status] + * @param {number} [doingDuration] + * @param {string} [details] + * @param {string} [expectedDeliveryDate] + * @param {string} [ngoDeliveryDate] + * @param {string} [dkc] Digikala purchase code (only in s3) + * @param {string} [informations] + * @param {string} [bankTrackId] Only for services, S2 -> S3 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedUpdateNeedIdneedIdPatch( + authorization: string, + needId: number, + imageUrl?: any, + nameTranslations?: string, + descriptionTranslations?: string, + category?: number, + isUrgent?: boolean, + cost?: number, + purchaseCost?: number, + type?: number, + link?: string, + affiliateLinkUrl?: string, + receipts?: any, + status?: number, + doingDuration?: number, + details?: string, + expectedDeliveryDate?: string, + ngoDeliveryDate?: string, + dkc?: string, + informations?: string, + bankTrackId?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NeedUpdateNeedIdneedIdPatch.', + ); + } + // verify required parameter 'needId' is not null or undefined + if (needId === null || needId === undefined) { + throw new RequiredError( + 'needId', + 'Required parameter needId was null or undefined when calling apiV2NeedUpdateNeedIdneedIdPatch.', + ); + } + const localVarPath = `/api/v2/need/update/needId={need_id}`.replace( + `{${'need_id'}}`, + encodeURIComponent(String(needId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (imageUrl !== undefined) { + localVarFormParams.set('imageUrl', imageUrl as any); + } + + if (nameTranslations !== undefined) { + localVarFormParams.set('name_translations', nameTranslations as any); + } + + if (descriptionTranslations !== undefined) { + localVarFormParams.set( + 'description_translations', + descriptionTranslations as any, + ); + } + + if (category !== undefined) { + localVarFormParams.set('category', category as any); + } + + if (isUrgent !== undefined) { + localVarFormParams.set('isUrgent', isUrgent as any); + } + + if (cost !== undefined) { + localVarFormParams.set('cost', cost as any); + } + + if (purchaseCost !== undefined) { + localVarFormParams.set('purchase_cost', purchaseCost as any); + } + + if (type !== undefined) { + localVarFormParams.set('type', type as any); + } + + if (link !== undefined) { + localVarFormParams.set('link', link as any); + } + + if (affiliateLinkUrl !== undefined) { + localVarFormParams.set('affiliateLinkUrl', affiliateLinkUrl as any); + } + + if (receipts !== undefined) { + localVarFormParams.set('receipts', receipts as any); + } + + if (status !== undefined) { + localVarFormParams.set('status', status as any); + } + + if (doingDuration !== undefined) { + localVarFormParams.set('doing_duration', doingDuration as any); + } + + if (details !== undefined) { + localVarFormParams.set('details', details as any); + } + + if (expectedDeliveryDate !== undefined) { + localVarFormParams.set( + 'expected_delivery_date', + expectedDeliveryDate as any, + ); + } + + if (ngoDeliveryDate !== undefined) { + localVarFormParams.set('ngo_delivery_date', ngoDeliveryDate as any); + } + + if (dkc !== undefined) { + localVarFormParams.set('dkc', dkc as any); + } + + if (informations !== undefined) { + localVarFormParams.set('informations', informations as any); + } + + if (bankTrackId !== undefined) { + localVarFormParams.set('bank_track_id', bankTrackId as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns information of all needs as a json object.
Calling this API affects need, child_need and need_family and user tables.
[0]not onfirmed, [1]confirmed, [2]both

Done parameter determines how do you want the result:
[0]not done, [1]done, [2]all
+ * @summary get all needs + * @param {string} authorization Access Token + * @param {number} [X_SKIP] + * @param {number} [X_TAKE] Max 500 + * @param {boolean} [isConfirmed] + * @param {boolean} [isDone] + * @param {boolean} [isReported] + * @param {string} [status] + * @param {number} [type] + * @param {number} [ngoId] + * @param {boolean} [isChildConfirmed] + * @param {boolean} [unpayable] + * @param {number} [createdBy] + * @param {number} [confirmedBy] + * @param {number} [purchasedBy] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedsGet( + authorization: string, + X_SKIP?: number, + X_TAKE?: number, + isConfirmed?: boolean, + isDone?: boolean, + isReported?: boolean, + status?: string, + type?: number, + ngoId?: number, + isChildConfirmed?: boolean, + unpayable?: boolean, + createdBy?: number, + confirmedBy?: number, + purchasedBy?: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NeedsGet.', + ); + } + const localVarPath = `/api/v2/needs`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (isConfirmed !== undefined) { + localVarQueryParameter['isConfirmed'] = isConfirmed; + } + + if (isDone !== undefined) { + localVarQueryParameter['isDone'] = isDone; + } + + if (isReported !== undefined) { + localVarQueryParameter['isReported'] = isReported; + } + + if (status !== undefined) { + localVarQueryParameter['status'] = status; + } + + if (type !== undefined) { + localVarQueryParameter['type'] = type; + } + + if (ngoId !== undefined) { + localVarQueryParameter['ngoId'] = ngoId; + } + + if (isChildConfirmed !== undefined) { + localVarQueryParameter['isChildConfirmed'] = isChildConfirmed; + } + + if (unpayable !== undefined) { + localVarQueryParameter['unpayable'] = unpayable; + } + + if (createdBy !== undefined) { + localVarQueryParameter['createdBy'] = createdBy; + } + + if (confirmedBy !== undefined) { + localVarQueryParameter['confirmedBy'] = confirmedBy; + } + + if (purchasedBy !== undefined) { + localVarQueryParameter['purchasedBy'] = purchasedBy; + } + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (X_SKIP !== undefined && X_SKIP !== null) { + localVarHeaderParameter['X-SKIP'] = String(X_SKIP); + } + + if (X_TAKE !== undefined && X_TAKE !== null) { + localVarHeaderParameter['X-TAKE'] = String(X_TAKE); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + *
+ * @summary List receipts for a need + * @param {any} id + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedsIdReceiptsGet( + id: any, + authorization?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2NeedsIdReceiptsGet.', + ); + } + const localVarPath = `/api/v2/needs/{id}/receipts`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Create a new receipt for a need + * @param {string} authorization Access Token + * @param {any} id + * @param {any} attachment + * @param {string} title max 128 char + * @param {string} [code] unique, max 128 char + * @param {string} [description] max 1024 char + * @param {boolean} [isPublic] default=false, only SUPER_ADMIN, SAY_SUPERVISOR, ADMIN can set to true + * @param {number} [needStatus] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedsIdReceiptsPost( + authorization: string, + id: any, + attachment: any, + title: string, + code?: string, + description?: string, + isPublic?: boolean, + needStatus?: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NeedsIdReceiptsPost.', + ); + } + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2NeedsIdReceiptsPost.', + ); + } + // verify required parameter 'attachment' is not null or undefined + if (attachment === null || attachment === undefined) { + throw new RequiredError( + 'attachment', + 'Required parameter attachment was null or undefined when calling apiV2NeedsIdReceiptsPost.', + ); + } + // verify required parameter 'title' is not null or undefined + if (title === null || title === undefined) { + throw new RequiredError( + 'title', + 'Required parameter title was null or undefined when calling apiV2NeedsIdReceiptsPost.', + ); + } + const localVarPath = `/api/v2/needs/{id}/receipts`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (code !== undefined) { + localVarFormParams.set('code', code as any); + } + + if (attachment !== undefined) { + localVarFormParams.set('attachment', attachment as any); + } + + if (description !== undefined) { + localVarFormParams.set('description', description as any); + } + + if (title !== undefined) { + localVarFormParams.set('title', title as any); + } + + if (isPublic !== undefined) { + localVarFormParams.set('isPublic', isPublic as any); + } + + if (needStatus !== undefined) { + localVarFormParams.set('needStatus', needStatus as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + *
+ * @summary Delete a receipt from a need, not the receipt itself! + * @param {string} authorization Access Token + * @param {any} id + * @param {any} receiptId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedsIdReceiptsReceiptIdDelete( + authorization: string, + id: any, + receiptId: any, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NeedsIdReceiptsReceiptIdDelete.', + ); + } + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2NeedsIdReceiptsReceiptIdDelete.', + ); + } + // verify required parameter 'receiptId' is not null or undefined + if (receiptId === null || receiptId === undefined) { + throw new RequiredError( + 'receiptId', + 'Required parameter receiptId was null or undefined when calling apiV2NeedsIdReceiptsReceiptIdDelete.', + ); + } + const localVarPath = `/api/v2/needs/{id}/receipts/{receiptId}` + .replace(`{${'id'}}`, encodeURIComponent(String(id))) + .replace(`{${'receiptId'}}`, encodeURIComponent(String(receiptId))); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'DELETE' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; + +/** + * NeedAPIApi - functional programming interface + * @export + */ +export const NeedAPIApiFp = function (configuration?: Configuration) { + return { + /** + * Confirms a need, so you can add a payment for it and add it to a confirmed child but you cannot update its price (cost) anymore.
Calling this API affects need, child and social_worker tables.
+ * @summary confirm a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedConfirmNeedIdneedIdPatch( + authorization: string, + needId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NeedAPIApiFetchParamCreator( + configuration, + ).apiV2NeedConfirmNeedIdneedIdPatch(authorization, needId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * Deletes a need by setting its isDeleted tag true.
It also delete all impacts and occurrences of this need in whole database.
It is only possible to delete the needs without any payments.
Deleting is managed by isDeleted tag everywhere, so we do not fully delete anything.
Calling this API affects need, need_family and child_need tables.
+ * @summary delete a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedDeleteNeedIdneedIdPatch( + authorization: string, + needId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NeedAPIApiFetchParamCreator( + configuration, + ).apiV2NeedDeleteNeedIdneedIdPatch(authorization, needId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * Returns information of a need with given id as a json object.
Calling this API affects need, child_need and need_family and user tables.
Confirm parameter determines how do you want the result:
[0]not onfirmed, [1]confirmed, [2]both
+ * @summary get need by id + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedNeedIdneedIdGet( + authorization: string, + needId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NeedAPIApiFetchParamCreator( + configuration, + ).apiV2NeedNeedIdneedIdGet(authorization, needId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * Adds a need.
It is possible to have multiple receipts, but each time you can upload one receipt, but their addresses will be saved as a comma separated string in db.
You have to upload a file for receipts and imageUrl.
Calling this API affects need table only.
Adding affiliateLinkUrl and receipts are optional.
type codes: [0]donate, [1]affiliate
+ * @summary add need + * @param {string} authorization Access Token + * @param {number} childId + * @param {string} nameTranslations {\"en\": \"Bob\", \"fa\": \"بابک\"} + * @param {string} descriptionTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {number} category + * @param {boolean} isUrgent + * @param {number} cost + * @param {number} type + * @param {number} [swId] + * @param {any} [imageUrl] + * @param {string} [link] + * @param {string} [affiliateLinkUrl] + * @param {any} [receipts] + * @param {number} [doingDuration] + * @param {string} [details] + * @param {string} [informations] + * @param {string} [deliveryDate] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedPost( + authorization: string, + childId: number, + nameTranslations: string, + descriptionTranslations: string, + category: number, + isUrgent: boolean, + cost: number, + type: number, + swId?: number, + imageUrl?: any, + link?: string, + affiliateLinkUrl?: string, + receipts?: any, + doingDuration?: number, + details?: string, + informations?: string, + deliveryDate?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NeedAPIApiFetchParamCreator( + configuration, + ).apiV2NeedPost( + authorization, + childId, + nameTranslations, + descriptionTranslations, + category, + isUrgent, + cost, + type, + swId, + imageUrl, + link, + affiliateLinkUrl, + receipts, + doingDuration, + details, + informations, + deliveryDate, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * All fields are optional.
You cannot change cost for confirmed needs but it is ok with not confirmed needs.
It is possible to have multiple receipts, but each time you can upload one receipt, but their addresses will be saved as a comma separated string in db.
You have to upload a file for receipts and imageUrl.
Calling this API affects need table only.
+ * @summary update need + * @param {string} authorization Access Token + * @param {number} needId + * @param {any} [imageUrl] + * @param {string} [nameTranslations] {\"en\": \"Bob\", \"fa\": \"بابک\"} + * @param {string} [descriptionTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {number} [category] + * @param {boolean} [isUrgent] + * @param {number} [cost] + * @param {number} [purchaseCost] Can be set only in p3 (product status 3) + * @param {number} [type] + * @param {string} [link] + * @param {string} [affiliateLinkUrl] + * @param {any} [receipts] + * @param {number} [status] + * @param {number} [doingDuration] + * @param {string} [details] + * @param {string} [expectedDeliveryDate] + * @param {string} [ngoDeliveryDate] + * @param {string} [dkc] Digikala purchase code (only in s3) + * @param {string} [informations] + * @param {string} [bankTrackId] Only for services, S2 -> S3 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedUpdateNeedIdneedIdPatch( + authorization: string, + needId: number, + imageUrl?: any, + nameTranslations?: string, + descriptionTranslations?: string, + category?: number, + isUrgent?: boolean, + cost?: number, + purchaseCost?: number, + type?: number, + link?: string, + affiliateLinkUrl?: string, + receipts?: any, + status?: number, + doingDuration?: number, + details?: string, + expectedDeliveryDate?: string, + ngoDeliveryDate?: string, + dkc?: string, + informations?: string, + bankTrackId?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NeedAPIApiFetchParamCreator( + configuration, + ).apiV2NeedUpdateNeedIdneedIdPatch( + authorization, + needId, + imageUrl, + nameTranslations, + descriptionTranslations, + category, + isUrgent, + cost, + purchaseCost, + type, + link, + affiliateLinkUrl, + receipts, + status, + doingDuration, + details, + expectedDeliveryDate, + ngoDeliveryDate, + dkc, + informations, + bankTrackId, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * Returns information of all needs as a json object.
Calling this API affects need, child_need and need_family and user tables.
[0]not onfirmed, [1]confirmed, [2]both

Done parameter determines how do you want the result:
[0]not done, [1]done, [2]all
+ * @summary get all needs + * @param {string} authorization Access Token + * @param {number} [X_SKIP] + * @param {number} [X_TAKE] Max 500 + * @param {boolean} [isConfirmed] + * @param {boolean} [isDone] + * @param {boolean} [isReported] + * @param {string} [status] + * @param {number} [type] + * @param {number} [ngoId] + * @param {boolean} [isChildConfirmed] + * @param {boolean} [unpayable] + * @param {number} [createdBy] + * @param {number} [confirmedBy] + * @param {number} [purchasedBy] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedsGet( + authorization: string, + X_SKIP?: number, + X_TAKE?: number, + isConfirmed?: boolean, + isDone?: boolean, + isReported?: boolean, + status?: string, + type?: number, + ngoId?: number, + isChildConfirmed?: boolean, + unpayable?: boolean, + createdBy?: number, + confirmedBy?: number, + purchasedBy?: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NeedAPIApiFetchParamCreator( + configuration, + ).apiV2NeedsGet( + authorization, + X_SKIP, + X_TAKE, + isConfirmed, + isDone, + isReported, + status, + type, + ngoId, + isChildConfirmed, + unpayable, + createdBy, + confirmedBy, + purchasedBy, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + *
+ * @summary List receipts for a need + * @param {any} id + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedsIdReceiptsGet( + id: any, + authorization?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise> { + const localVarFetchArgs = NeedAPIApiFetchParamCreator( + configuration, + ).apiV2NeedsIdReceiptsGet(id, authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Create a new receipt for a need + * @param {string} authorization Access Token + * @param {any} id + * @param {any} attachment + * @param {string} title max 128 char + * @param {string} [code] unique, max 128 char + * @param {string} [description] max 1024 char + * @param {boolean} [isPublic] default=false, only SUPER_ADMIN, SAY_SUPERVISOR, ADMIN can set to true + * @param {number} [needStatus] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedsIdReceiptsPost( + authorization: string, + id: any, + attachment: any, + title: string, + code?: string, + description?: string, + isPublic?: boolean, + needStatus?: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NeedAPIApiFetchParamCreator( + configuration, + ).apiV2NeedsIdReceiptsPost( + authorization, + id, + attachment, + title, + code, + description, + isPublic, + needStatus, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + *
+ * @summary Delete a receipt from a need, not the receipt itself! + * @param {string} authorization Access Token + * @param {any} id + * @param {any} receiptId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedsIdReceiptsReceiptIdDelete( + authorization: string, + id: any, + receiptId: any, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NeedAPIApiFetchParamCreator( + configuration, + ).apiV2NeedsIdReceiptsReceiptIdDelete( + authorization, + id, + receiptId, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + }; +}; + +/** + * NeedAPIApi - factory interface + * @export + */ +export const NeedAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { + /** + * Confirms a need, so you can add a payment for it and add it to a confirmed child but you cannot update its price (cost) anymore.
Calling this API affects need, child and social_worker tables.
+ * @summary confirm a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedConfirmNeedIdneedIdPatch( + authorization: string, + needId: number, + options?: any, + ) { + return NeedAPIApiFp(configuration).apiV2NeedConfirmNeedIdneedIdPatch( + authorization, + needId, + options, + )(fetch, basePath); + }, + /** + * Deletes a need by setting its isDeleted tag true.
It also delete all impacts and occurrences of this need in whole database.
It is only possible to delete the needs without any payments.
Deleting is managed by isDeleted tag everywhere, so we do not fully delete anything.
Calling this API affects need, need_family and child_need tables.
+ * @summary delete a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedDeleteNeedIdneedIdPatch( + authorization: string, + needId: number, + options?: any, + ) { + return NeedAPIApiFp(configuration).apiV2NeedDeleteNeedIdneedIdPatch( + authorization, + needId, + options, + )(fetch, basePath); + }, + /** + * Returns information of a need with given id as a json object.
Calling this API affects need, child_need and need_family and user tables.
Confirm parameter determines how do you want the result:
[0]not onfirmed, [1]confirmed, [2]both
+ * @summary get need by id + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedNeedIdneedIdGet( + authorization: string, + needId: number, + options?: any, + ) { + return NeedAPIApiFp(configuration).apiV2NeedNeedIdneedIdGet( + authorization, + needId, + options, + )(fetch, basePath); + }, + /** + * Adds a need.
It is possible to have multiple receipts, but each time you can upload one receipt, but their addresses will be saved as a comma separated string in db.
You have to upload a file for receipts and imageUrl.
Calling this API affects need table only.
Adding affiliateLinkUrl and receipts are optional.
type codes: [0]donate, [1]affiliate
+ * @summary add need + * @param {string} authorization Access Token + * @param {number} childId + * @param {string} nameTranslations {\"en\": \"Bob\", \"fa\": \"بابک\"} + * @param {string} descriptionTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {number} category + * @param {boolean} isUrgent + * @param {number} cost + * @param {number} type + * @param {number} [swId] + * @param {any} [imageUrl] + * @param {string} [link] + * @param {string} [affiliateLinkUrl] + * @param {any} [receipts] + * @param {number} [doingDuration] + * @param {string} [details] + * @param {string} [informations] + * @param {string} [deliveryDate] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedPost( + authorization: string, + childId: number, + nameTranslations: string, + descriptionTranslations: string, + category: number, + isUrgent: boolean, + cost: number, + type: number, + swId?: number, + imageUrl?: any, + link?: string, + affiliateLinkUrl?: string, + receipts?: any, + doingDuration?: number, + details?: string, + informations?: string, + deliveryDate?: string, + options?: any, + ) { + return NeedAPIApiFp(configuration).apiV2NeedPost( + authorization, + childId, + nameTranslations, + descriptionTranslations, + category, + isUrgent, + cost, + type, + swId, + imageUrl, + link, + affiliateLinkUrl, + receipts, + doingDuration, + details, + informations, + deliveryDate, + options, + )(fetch, basePath); + }, + /** + * All fields are optional.
You cannot change cost for confirmed needs but it is ok with not confirmed needs.
It is possible to have multiple receipts, but each time you can upload one receipt, but their addresses will be saved as a comma separated string in db.
You have to upload a file for receipts and imageUrl.
Calling this API affects need table only.
+ * @summary update need + * @param {string} authorization Access Token + * @param {number} needId + * @param {any} [imageUrl] + * @param {string} [nameTranslations] {\"en\": \"Bob\", \"fa\": \"بابک\"} + * @param {string} [descriptionTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {number} [category] + * @param {boolean} [isUrgent] + * @param {number} [cost] + * @param {number} [purchaseCost] Can be set only in p3 (product status 3) + * @param {number} [type] + * @param {string} [link] + * @param {string} [affiliateLinkUrl] + * @param {any} [receipts] + * @param {number} [status] + * @param {number} [doingDuration] + * @param {string} [details] + * @param {string} [expectedDeliveryDate] + * @param {string} [ngoDeliveryDate] + * @param {string} [dkc] Digikala purchase code (only in s3) + * @param {string} [informations] + * @param {string} [bankTrackId] Only for services, S2 -> S3 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedUpdateNeedIdneedIdPatch( + authorization: string, + needId: number, + imageUrl?: any, + nameTranslations?: string, + descriptionTranslations?: string, + category?: number, + isUrgent?: boolean, + cost?: number, + purchaseCost?: number, + type?: number, + link?: string, + affiliateLinkUrl?: string, + receipts?: any, + status?: number, + doingDuration?: number, + details?: string, + expectedDeliveryDate?: string, + ngoDeliveryDate?: string, + dkc?: string, + informations?: string, + bankTrackId?: string, + options?: any, + ) { + return NeedAPIApiFp(configuration).apiV2NeedUpdateNeedIdneedIdPatch( + authorization, + needId, + imageUrl, + nameTranslations, + descriptionTranslations, + category, + isUrgent, + cost, + purchaseCost, + type, + link, + affiliateLinkUrl, + receipts, + status, + doingDuration, + details, + expectedDeliveryDate, + ngoDeliveryDate, + dkc, + informations, + bankTrackId, + options, + )(fetch, basePath); + }, + /** + * Returns information of all needs as a json object.
Calling this API affects need, child_need and need_family and user tables.
[0]not onfirmed, [1]confirmed, [2]both

Done parameter determines how do you want the result:
[0]not done, [1]done, [2]all
+ * @summary get all needs + * @param {string} authorization Access Token + * @param {number} [X_SKIP] + * @param {number} [X_TAKE] Max 500 + * @param {boolean} [isConfirmed] + * @param {boolean} [isDone] + * @param {boolean} [isReported] + * @param {string} [status] + * @param {number} [type] + * @param {number} [ngoId] + * @param {boolean} [isChildConfirmed] + * @param {boolean} [unpayable] + * @param {number} [createdBy] + * @param {number} [confirmedBy] + * @param {number} [purchasedBy] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedsGet( + authorization: string, + X_SKIP?: number, + X_TAKE?: number, + isConfirmed?: boolean, + isDone?: boolean, + isReported?: boolean, + status?: string, + type?: number, + ngoId?: number, + isChildConfirmed?: boolean, + unpayable?: boolean, + createdBy?: number, + confirmedBy?: number, + purchasedBy?: number, + options?: any, + ) { + return NeedAPIApiFp(configuration).apiV2NeedsGet( + authorization, + X_SKIP, + X_TAKE, + isConfirmed, + isDone, + isReported, + status, + type, + ngoId, + isChildConfirmed, + unpayable, + createdBy, + confirmedBy, + purchasedBy, + options, + )(fetch, basePath); + }, + /** + *
+ * @summary List receipts for a need + * @param {any} id + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedsIdReceiptsGet(id: any, authorization?: string, options?: any) { + return NeedAPIApiFp(configuration).apiV2NeedsIdReceiptsGet( + id, + authorization, + options, + )(fetch, basePath); + }, + /** + * + * @summary Create a new receipt for a need + * @param {string} authorization Access Token + * @param {any} id + * @param {any} attachment + * @param {string} title max 128 char + * @param {string} [code] unique, max 128 char + * @param {string} [description] max 1024 char + * @param {boolean} [isPublic] default=false, only SUPER_ADMIN, SAY_SUPERVISOR, ADMIN can set to true + * @param {number} [needStatus] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedsIdReceiptsPost( + authorization: string, + id: any, + attachment: any, + title: string, + code?: string, + description?: string, + isPublic?: boolean, + needStatus?: number, + options?: any, + ) { + return NeedAPIApiFp(configuration).apiV2NeedsIdReceiptsPost( + authorization, + id, + attachment, + title, + code, + description, + isPublic, + needStatus, + options, + )(fetch, basePath); + }, + /** + *
+ * @summary Delete a receipt from a need, not the receipt itself! + * @param {string} authorization Access Token + * @param {any} id + * @param {any} receiptId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedsIdReceiptsReceiptIdDelete( + authorization: string, + id: any, + receiptId: any, + options?: any, + ) { + return NeedAPIApiFp(configuration).apiV2NeedsIdReceiptsReceiptIdDelete( + authorization, + id, + receiptId, + options, + )(fetch, basePath); + }, + }; +}; + +/** + * NeedAPIApi - object-oriented interface + * @export + * @class NeedAPIApi + * @extends {BaseAPI} + */ +export class NeedAPIApi extends BaseAPI { + /** + * Confirms a need, so you can add a payment for it and add it to a confirmed child but you cannot update its price (cost) anymore.
Calling this API affects need, child and social_worker tables.
+ * @summary confirm a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NeedAPIApi + */ + public apiV2NeedConfirmNeedIdneedIdPatch( + authorization: string, + needId: number, + options?: any, + ) { + return NeedAPIApiFp(this.configuration).apiV2NeedConfirmNeedIdneedIdPatch( + authorization, + needId, + options, + )(this.fetch, this.basePath); + } + + /** + * Deletes a need by setting its isDeleted tag true.
It also delete all impacts and occurrences of this need in whole database.
It is only possible to delete the needs without any payments.
Deleting is managed by isDeleted tag everywhere, so we do not fully delete anything.
Calling this API affects need, need_family and child_need tables.
+ * @summary delete a need + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NeedAPIApi + */ + public apiV2NeedDeleteNeedIdneedIdPatch( + authorization: string, + needId: number, + options?: any, + ) { + return NeedAPIApiFp(this.configuration).apiV2NeedDeleteNeedIdneedIdPatch( + authorization, + needId, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns information of a need with given id as a json object.
Calling this API affects need, child_need and need_family and user tables.
Confirm parameter determines how do you want the result:
[0]not onfirmed, [1]confirmed, [2]both
+ * @summary get need by id + * @param {string} authorization Access Token + * @param {number} needId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NeedAPIApi + */ + public apiV2NeedNeedIdneedIdGet( + authorization: string, + needId: number, + options?: any, + ) { + return NeedAPIApiFp(this.configuration).apiV2NeedNeedIdneedIdGet( + authorization, + needId, + options, + )(this.fetch, this.basePath); + } + + /** + * Adds a need.
It is possible to have multiple receipts, but each time you can upload one receipt, but their addresses will be saved as a comma separated string in db.
You have to upload a file for receipts and imageUrl.
Calling this API affects need table only.
Adding affiliateLinkUrl and receipts are optional.
type codes: [0]donate, [1]affiliate
+ * @summary add need + * @param {string} authorization Access Token + * @param {number} childId + * @param {string} nameTranslations {\"en\": \"Bob\", \"fa\": \"بابک\"} + * @param {string} descriptionTranslations {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {number} category + * @param {boolean} isUrgent + * @param {number} cost + * @param {number} type + * @param {number} [swId] + * @param {any} [imageUrl] + * @param {string} [link] + * @param {string} [affiliateLinkUrl] + * @param {any} [receipts] + * @param {number} [doingDuration] + * @param {string} [details] + * @param {string} [informations] + * @param {string} [deliveryDate] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NeedAPIApi + */ + public apiV2NeedPost( + authorization: string, + childId: number, + nameTranslations: string, + descriptionTranslations: string, + category: number, + isUrgent: boolean, + cost: number, + type: number, + swId?: number, + imageUrl?: any, + link?: string, + affiliateLinkUrl?: string, + receipts?: any, + doingDuration?: number, + details?: string, + informations?: string, + deliveryDate?: string, + options?: any, + ) { + return NeedAPIApiFp(this.configuration).apiV2NeedPost( + authorization, + childId, + nameTranslations, + descriptionTranslations, + category, + isUrgent, + cost, + type, + swId, + imageUrl, + link, + affiliateLinkUrl, + receipts, + doingDuration, + details, + informations, + deliveryDate, + options, + )(this.fetch, this.basePath); + } + + /** + * All fields are optional.
You cannot change cost for confirmed needs but it is ok with not confirmed needs.
It is possible to have multiple receipts, but each time you can upload one receipt, but their addresses will be saved as a comma separated string in db.
You have to upload a file for receipts and imageUrl.
Calling this API affects need table only.
+ * @summary update need + * @param {string} authorization Access Token + * @param {number} needId + * @param {any} [imageUrl] + * @param {string} [nameTranslations] {\"en\": \"Bob\", \"fa\": \"بابک\"} + * @param {string} [descriptionTranslations] {\"en\": \"Lorem ipsome\", \"fa\": \"لورم ایپسون\"} + * @param {number} [category] + * @param {boolean} [isUrgent] + * @param {number} [cost] + * @param {number} [purchaseCost] Can be set only in p3 (product status 3) + * @param {number} [type] + * @param {string} [link] + * @param {string} [affiliateLinkUrl] + * @param {any} [receipts] + * @param {number} [status] + * @param {number} [doingDuration] + * @param {string} [details] + * @param {string} [expectedDeliveryDate] + * @param {string} [ngoDeliveryDate] + * @param {string} [dkc] Digikala purchase code (only in s3) + * @param {string} [informations] + * @param {string} [bankTrackId] Only for services, S2 -> S3 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NeedAPIApi + */ + public apiV2NeedUpdateNeedIdneedIdPatch( + authorization: string, + needId: number, + imageUrl?: any, + nameTranslations?: string, + descriptionTranslations?: string, + category?: number, + isUrgent?: boolean, + cost?: number, + purchaseCost?: number, + type?: number, + link?: string, + affiliateLinkUrl?: string, + receipts?: any, + status?: number, + doingDuration?: number, + details?: string, + expectedDeliveryDate?: string, + ngoDeliveryDate?: string, + dkc?: string, + informations?: string, + bankTrackId?: string, + options?: any, + ) { + return NeedAPIApiFp(this.configuration).apiV2NeedUpdateNeedIdneedIdPatch( + authorization, + needId, + imageUrl, + nameTranslations, + descriptionTranslations, + category, + isUrgent, + cost, + purchaseCost, + type, + link, + affiliateLinkUrl, + receipts, + status, + doingDuration, + details, + expectedDeliveryDate, + ngoDeliveryDate, + dkc, + informations, + bankTrackId, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns information of all needs as a json object.
Calling this API affects need, child_need and need_family and user tables.
[0]not onfirmed, [1]confirmed, [2]both

Done parameter determines how do you want the result:
[0]not done, [1]done, [2]all
+ * @summary get all needs + * @param {string} authorization Access Token + * @param {number} [X_SKIP] + * @param {number} [X_TAKE] Max 500 + * @param {boolean} [isConfirmed] + * @param {boolean} [isDone] + * @param {boolean} [isReported] + * @param {string} [status] + * @param {number} [type] + * @param {number} [ngoId] + * @param {boolean} [isChildConfirmed] + * @param {boolean} [unpayable] + * @param {number} [createdBy] + * @param {number} [confirmedBy] + * @param {number} [purchasedBy] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NeedAPIApi + */ + public apiV2NeedsGet( + authorization: string, + X_SKIP?: number, + X_TAKE?: number, + isConfirmed?: boolean, + isDone?: boolean, + isReported?: boolean, + status?: string, + type?: number, + ngoId?: number, + isChildConfirmed?: boolean, + unpayable?: boolean, + createdBy?: number, + confirmedBy?: number, + purchasedBy?: number, + options?: any, + ) { + return NeedAPIApiFp(this.configuration).apiV2NeedsGet( + authorization, + X_SKIP, + X_TAKE, + isConfirmed, + isDone, + isReported, + status, + type, + ngoId, + isChildConfirmed, + unpayable, + createdBy, + confirmedBy, + purchasedBy, + options, + )(this.fetch, this.basePath); + } + + /** + *
+ * @summary List receipts for a need + * @param {any} id + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NeedAPIApi + */ + public apiV2NeedsIdReceiptsGet( + id: any, + authorization?: string, + options?: any, + ) { + return NeedAPIApiFp(this.configuration).apiV2NeedsIdReceiptsGet( + id, + authorization, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Create a new receipt for a need + * @param {string} authorization Access Token + * @param {any} id + * @param {any} attachment + * @param {string} title max 128 char + * @param {string} [code] unique, max 128 char + * @param {string} [description] max 1024 char + * @param {boolean} [isPublic] default=false, only SUPER_ADMIN, SAY_SUPERVISOR, ADMIN can set to true + * @param {number} [needStatus] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NeedAPIApi + */ + public apiV2NeedsIdReceiptsPost( + authorization: string, + id: any, + attachment: any, + title: string, + code?: string, + description?: string, + isPublic?: boolean, + needStatus?: number, + options?: any, + ) { + return NeedAPIApiFp(this.configuration).apiV2NeedsIdReceiptsPost( + authorization, + id, + attachment, + title, + code, + description, + isPublic, + needStatus, + options, + )(this.fetch, this.basePath); + } + + /** + *
+ * @summary Delete a receipt from a need, not the receipt itself! + * @param {string} authorization Access Token + * @param {any} id + * @param {any} receiptId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NeedAPIApi + */ + public apiV2NeedsIdReceiptsReceiptIdDelete( + authorization: string, + id: any, + receiptId: any, + options?: any, + ) { + return NeedAPIApiFp(this.configuration).apiV2NeedsIdReceiptsReceiptIdDelete( + authorization, + id, + receiptId, + options, + )(this.fetch, this.basePath); + } +} + +/** + * NeedStatusUpdatesAPIApi - fetch parameter creator + * @export + */ +export const NeedStatusUpdatesAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + * Orderin, Filtering, Pagination
+ * @summary List all Need Status Updates + * @param {string} authorization Access Token, Only Super Admin and SAY Supervisior + * @param {number} [xTake] Number of results in one page + * @param {number} [xSkip] Skip n result + * @param {string} [orderBy] OrderBy column/columns, use - to revrse the order, like this -created,needId + * @param {number} [needId] Filter by needId + * @param {number} [swId] Filter by swId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedStatusUpdatesGet( + authorization: string, + xTake?: number, + xSkip?: number, + orderBy?: string, + needId?: number, + swId?: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2NeedStatusUpdatesGet.', + ); + } + const localVarPath = `/api/v2/need-status-updates`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy; + } + + if (needId !== undefined) { + localVarQueryParameter['needId'] = needId; + } + + if (swId !== undefined) { + localVarQueryParameter['swId'] = swId; + } + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (xTake !== undefined && xTake !== null) { + localVarHeaderParameter['X-Take'] = String(xTake); + } + + if (xSkip !== undefined && xSkip !== null) { + localVarHeaderParameter['X-Skip'] = String(xSkip); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; + +/** + * NeedStatusUpdatesAPIApi - functional programming interface + * @export + */ +export const NeedStatusUpdatesAPIApiFp = function ( + configuration?: Configuration, +) { + return { + /** + * Orderin, Filtering, Pagination
+ * @summary List all Need Status Updates + * @param {string} authorization Access Token, Only Super Admin and SAY Supervisior + * @param {number} [xTake] Number of results in one page + * @param {number} [xSkip] Skip n result + * @param {string} [orderBy] OrderBy column/columns, use - to revrse the order, like this -created,needId + * @param {number} [needId] Filter by needId + * @param {number} [swId] Filter by swId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedStatusUpdatesGet( + authorization: string, + xTake?: number, + xSkip?: number, + orderBy?: string, + needId?: number, + swId?: number, + options?: any, + ): ( + fetch?: FetchAPI, + basePath?: string, + ) => Promise> { + const localVarFetchArgs = NeedStatusUpdatesAPIApiFetchParamCreator( + configuration, + ).apiV2NeedStatusUpdatesGet( + authorization, + xTake, + xSkip, + orderBy, + needId, + swId, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + }; +}; + +/** + * NeedStatusUpdatesAPIApi - factory interface + * @export + */ +export const NeedStatusUpdatesAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { + /** + * Orderin, Filtering, Pagination
+ * @summary List all Need Status Updates + * @param {string} authorization Access Token, Only Super Admin and SAY Supervisior + * @param {number} [xTake] Number of results in one page + * @param {number} [xSkip] Skip n result + * @param {string} [orderBy] OrderBy column/columns, use - to revrse the order, like this -created,needId + * @param {number} [needId] Filter by needId + * @param {number} [swId] Filter by swId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2NeedStatusUpdatesGet( + authorization: string, + xTake?: number, + xSkip?: number, + orderBy?: string, + needId?: number, + swId?: number, + options?: any, + ) { + return NeedStatusUpdatesAPIApiFp(configuration).apiV2NeedStatusUpdatesGet( + authorization, + xTake, + xSkip, + orderBy, + needId, + swId, + options, + )(fetch, basePath); + }, + }; +}; + +/** + * NeedStatusUpdatesAPIApi - object-oriented interface + * @export + * @class NeedStatusUpdatesAPIApi + * @extends {BaseAPI} + */ +export class NeedStatusUpdatesAPIApi extends BaseAPI { + /** + * Orderin, Filtering, Pagination
+ * @summary List all Need Status Updates + * @param {string} authorization Access Token, Only Super Admin and SAY Supervisior + * @param {number} [xTake] Number of results in one page + * @param {number} [xSkip] Skip n result + * @param {string} [orderBy] OrderBy column/columns, use - to revrse the order, like this -created,needId + * @param {number} [needId] Filter by needId + * @param {number} [swId] Filter by swId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NeedStatusUpdatesAPIApi + */ + public apiV2NeedStatusUpdatesGet( + authorization: string, + xTake?: number, + xSkip?: number, + orderBy?: string, + needId?: number, + swId?: number, + options?: any, + ) { + return NeedStatusUpdatesAPIApiFp( + this.configuration, + ).apiV2NeedStatusUpdatesGet( + authorization, + xTake, + xSkip, + orderBy, + needId, + swId, + options, + )(this.fetch, this.basePath); + } +} + +/** + * PanelAuthAPIApi - fetch parameter creator + * @export + */ +export const PanelAuthAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + * + * @summary Panel Login API + * @param {any} username + * @param {any} password + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PanelAuthLoginPost( + username: any, + password: any, + options: any = {}, + ): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError( + 'username', + 'Required parameter username was null or undefined when calling apiV2PanelAuthLoginPost.', + ); + } + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new RequiredError( + 'password', + 'Required parameter password was null or undefined when calling apiV2PanelAuthLoginPost.', + ); + } + const localVarPath = `/api/v2/panel/auth/login`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (username !== undefined) { + localVarFormParams.set('username', username as any); + } + + if (password !== undefined) { + localVarFormParams.set('password', password as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Panel Logout (Access Token) API + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PanelAuthLogoutTokenPost( + authorization: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2PanelAuthLogoutTokenPost.', + ); + } + const localVarPath = `/api/v2/panel/auth/logout/token`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; + +/** + * PanelAuthAPIApi - functional programming interface + * @export + */ +export const PanelAuthAPIApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Panel Login API + * @param {any} username + * @param {any} password + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PanelAuthLoginPost( + username: any, + password: any, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PanelAuthAPIApiFetchParamCreator( + configuration, + ).apiV2PanelAuthLoginPost(username, password, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Panel Logout (Access Token) API + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PanelAuthLogoutTokenPost( + authorization: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PanelAuthAPIApiFetchParamCreator( + configuration, + ).apiV2PanelAuthLogoutTokenPost(authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + }; +}; + +/** + * PanelAuthAPIApi - factory interface + * @export + */ +export const PanelAuthAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { + /** + * + * @summary Panel Login API + * @param {any} username + * @param {any} password + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PanelAuthLoginPost(username: any, password: any, options?: any) { + return PanelAuthAPIApiFp(configuration).apiV2PanelAuthLoginPost( + username, + password, + options, + )(fetch, basePath); + }, + /** + * + * @summary Panel Logout (Access Token) API + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PanelAuthLogoutTokenPost(authorization: string, options?: any) { + return PanelAuthAPIApiFp(configuration).apiV2PanelAuthLogoutTokenPost( + authorization, + options, + )(fetch, basePath); + }, + }; +}; + +/** + * PanelAuthAPIApi - object-oriented interface + * @export + * @class PanelAuthAPIApi + * @extends {BaseAPI} + */ +export class PanelAuthAPIApi extends BaseAPI { + /** + * + * @summary Panel Login API + * @param {any} username + * @param {any} password + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PanelAuthAPIApi + */ + public apiV2PanelAuthLoginPost(username: any, password: any, options?: any) { + return PanelAuthAPIApiFp(this.configuration).apiV2PanelAuthLoginPost( + username, + password, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Panel Logout (Access Token) API + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PanelAuthAPIApi + */ + public apiV2PanelAuthLogoutTokenPost(authorization: string, options?: any) { + return PanelAuthAPIApiFp(this.configuration).apiV2PanelAuthLogoutTokenPost( + authorization, + options, + )(this.fetch, this.basePath); + } +} + +/** + * PaymentAPIApi - fetch parameter creator + * @export + */ +export const PaymentAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + *
+ * @summary get all payments + * @param {string} authorization Access Token + * @param {any} [needId] + * @param {any} [take] + * @param {any} [skip] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PaymentAllGet( + authorization: string, + needId?: any, + take?: any, + skip?: any, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2PaymentAllGet.', + ); + } + const localVarPath = `/api/v2/payment/all`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (needId !== undefined) { + localVarQueryParameter['need_id'] = needId; + } + + if (take !== undefined) { + localVarQueryParameter['take'] = take; + } + + if (skip !== undefined) { + localVarQueryParameter['skip'] = skip; + } + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary get a payment + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PaymentIdGet( + authorization: string, + id: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2PaymentIdGet.', + ); + } + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2PaymentIdGet.', + ); + } + const localVarPath = `/api/v2/payment/{id}`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Create a paymnet for a need + * @param {string} authorization Access Token + * @param {Register} register + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PaymentPost( + authorization: string, + register: Register, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2PaymentPost.', + ); + } + // verify required parameter 'register' is not null or undefined + if (register === null || register === undefined) { + throw new RequiredError( + 'register', + 'Required parameter register was null or undefined when calling apiV2PaymentPost.', + ); + } + const localVarPath = `/api/v2/payment`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + const needsSerialization = + 'Register' !== 'string' || + localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = needsSerialization + ? JSON.stringify(register || {}) + : register || ''; + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; + +/** + * PaymentAPIApi - functional programming interface + * @export + */ +export const PaymentAPIApiFp = function (configuration?: Configuration) { + return { + /** + *
+ * @summary get all payments + * @param {string} authorization Access Token + * @param {any} [needId] + * @param {any} [take] + * @param {any} [skip] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PaymentAllGet( + authorization: string, + needId?: any, + take?: any, + skip?: any, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PaymentAPIApiFetchParamCreator( + configuration, + ).apiV2PaymentAllGet(authorization, needId, take, skip, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary get a payment + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PaymentIdGet( + authorization: string, + id: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PaymentAPIApiFetchParamCreator( + configuration, + ).apiV2PaymentIdGet(authorization, id, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Create a paymnet for a need + * @param {string} authorization Access Token + * @param {Register} register + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PaymentPost( + authorization: string, + register: Register, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PaymentAPIApiFetchParamCreator( + configuration, + ).apiV2PaymentPost(authorization, register, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + }; +}; + +/** + * PaymentAPIApi - factory interface + * @export + */ +export const PaymentAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { + /** + *
+ * @summary get all payments + * @param {string} authorization Access Token + * @param {any} [needId] + * @param {any} [take] + * @param {any} [skip] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PaymentAllGet( + authorization: string, + needId?: any, + take?: any, + skip?: any, + options?: any, + ) { + return PaymentAPIApiFp(configuration).apiV2PaymentAllGet( + authorization, + needId, + take, + skip, + options, + )(fetch, basePath); + }, + /** + * + * @summary get a payment + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PaymentIdGet(authorization: string, id: number, options?: any) { + return PaymentAPIApiFp(configuration).apiV2PaymentIdGet( + authorization, + id, + options, + )(fetch, basePath); + }, + /** + * + * @summary Create a paymnet for a need + * @param {string} authorization Access Token + * @param {Register} register + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PaymentPost(authorization: string, register: Register, options?: any) { + return PaymentAPIApiFp(configuration).apiV2PaymentPost( + authorization, + register, + options, + )(fetch, basePath); + }, + }; +}; + +/** + * PaymentAPIApi - object-oriented interface + * @export + * @class PaymentAPIApi + * @extends {BaseAPI} + */ +export class PaymentAPIApi extends BaseAPI { + /** + *
+ * @summary get all payments + * @param {string} authorization Access Token + * @param {any} [needId] + * @param {any} [take] + * @param {any} [skip] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PaymentAPIApi + */ + public apiV2PaymentAllGet( + authorization: string, + needId?: any, + take?: any, + skip?: any, + options?: any, + ) { + return PaymentAPIApiFp(this.configuration).apiV2PaymentAllGet( + authorization, + needId, + take, + skip, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary get a payment + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PaymentAPIApi + */ + public apiV2PaymentIdGet(authorization: string, id: number, options?: any) { + return PaymentAPIApiFp(this.configuration).apiV2PaymentIdGet( + authorization, + id, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Create a paymnet for a need + * @param {string} authorization Access Token + * @param {Register} register + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PaymentAPIApi + */ + public apiV2PaymentPost( + authorization: string, + register: Register, + options?: any, + ) { + return PaymentAPIApiFp(this.configuration).apiV2PaymentPost( + authorization, + register, + options, + )(this.fetch, this.basePath); + } +} + +/** + * PreneedAPIApi - fetch parameter creator + * @export + */ +export const PreneedAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + * + * @summary List of Preneeds + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PreneedsGet(authorization: string, options: any = {}): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2PreneedsGet.', + ); + } + const localVarPath = `/api/v2/preneeds/`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; + +/** * PreneedAPIApi - functional programming interface * @export */ -export const PreneedAPIApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary List of Preneeds - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PreneedsGet(authorization: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = PreneedAPIApiFetchParamCreator(configuration).apiV2PreneedsGet(authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - } -}; +export const PreneedAPIApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary List of Preneeds + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PreneedsGet( + authorization: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PreneedAPIApiFetchParamCreator( + configuration, + ).apiV2PreneedsGet(authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + }; +}; + +/** + * PreneedAPIApi - factory interface + * @export + */ +export const PreneedAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { + /** + * + * @summary List of Preneeds + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PreneedsGet(authorization: string, options?: any) { + return PreneedAPIApiFp(configuration).apiV2PreneedsGet( + authorization, + options, + )(fetch, basePath); + }, + }; +}; + +/** + * PreneedAPIApi - object-oriented interface + * @export + * @class PreneedAPIApi + * @extends {BaseAPI} + */ +export class PreneedAPIApi extends BaseAPI { + /** + * + * @summary List of Preneeds + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PreneedAPIApi + */ + public apiV2PreneedsGet(authorization: string, options?: any) { + return PreneedAPIApiFp(this.configuration).apiV2PreneedsGet( + authorization, + options, + )(this.fetch, this.basePath); + } +} + +/** + * PrivilegeAPIApi - fetch parameter creator + * @export + */ +export const PrivilegeAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + * Adds a privilege.
This API creates a row in social_worker_type table containing a new privilege information.
privilege must be among these numbers:
[0]super admin, [1]social worker, [2]coordinator, [3]NGO supervisor, [4]SAY supervisor, [5]admin
+ * @summary add privilege + * @param {string} authorization Access Token + * @param {number} privilege + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegeAddPost( + authorization: string, + privilege: number, + name: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2PrivilegeAddPost.', + ); + } + // verify required parameter 'privilege' is not null or undefined + if (privilege === null || privilege === undefined) { + throw new RequiredError( + 'privilege', + 'Required parameter privilege was null or undefined when calling apiV2PrivilegeAddPost.', + ); + } + // verify required parameter 'name' is not null or undefined + if (name === null || name === undefined) { + throw new RequiredError( + 'name', + 'Required parameter name was null or undefined when calling apiV2PrivilegeAddPost.', + ); + } + const localVarPath = `/api/v2/privilege/add`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (privilege !== undefined) { + localVarFormParams.set('privilege', privilege as any); + } + + if (name !== undefined) { + localVarFormParams.set('name', name as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns information of all privileges in a json.
Json key is privilege id and json value is privilege object.
Calling this API only affects social_worker_type table by selecting rows from it.
+ * @summary get all privileges + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegeAllGet(authorization: string, options: any = {}): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2PrivilegeAllGet.', + ); + } + const localVarPath = `/api/v2/privilege/all`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns information of all privileges with given id as a json object.
Calling this API only affects social_worker_type table by selecting rows from it.
+ * @summary get privilege by name + * @param {string} authorization Access Token + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegeNamenameGet( + authorization: string, + name: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2PrivilegeNamenameGet.', + ); + } + // verify required parameter 'name' is not null or undefined + if (name === null || name === undefined) { + throw new RequiredError( + 'name', + 'Required parameter name was null or undefined when calling apiV2PrivilegeNamenameGet.', + ); + } + const localVarPath = `/api/v2/privilege/name={name}`.replace( + `{${'name'}}`, + encodeURIComponent(String(name)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns information of a privilege with given id as a json object.
Calling this API only affects social_worker_type table by selecting a single row from it.
+ * @summary get privilege by id + * @param {string} authorization Access Token + * @param {number} privilegeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegePrivilegeIdprivilegeIdGet( + authorization: string, + privilegeId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2PrivilegePrivilegeIdprivilegeIdGet.', + ); + } + // verify required parameter 'privilegeId' is not null or undefined + if (privilegeId === null || privilegeId === undefined) { + throw new RequiredError( + 'privilegeId', + 'Required parameter privilegeId was null or undefined when calling apiV2PrivilegePrivilegeIdprivilegeIdGet.', + ); + } + const localVarPath = + `/api/v2/privilege/privilegeId={privilege_id}`.replace( + `{${'privilege_id'}}`, + encodeURIComponent(String(privilegeId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns information of all privileges with given privilege as a json object.
Calling this API only affects social_worker_type table by selecting rows from it.
+ * @summary get privilege by privilege + * @param {string} authorization Access Token + * @param {number} privilegeType + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegePrivilegeprivilegeTypeGet( + authorization: string, + privilegeType: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2PrivilegePrivilegeprivilegeTypeGet.', + ); + } + // verify required parameter 'privilegeType' is not null or undefined + if (privilegeType === null || privilegeType === undefined) { + throw new RequiredError( + 'privilegeType', + 'Required parameter privilegeType was null or undefined when calling apiV2PrivilegePrivilegeprivilegeTypeGet.', + ); + } + const localVarPath = + `/api/v2/privilege/privilege={privilege_type}`.replace( + `{${'privilege_type'}}`, + encodeURIComponent(String(privilegeType)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * All the fields are optional.
You can fill every field you want to change, and it will update the desired privilege.
Calling this API only affects social_worker_type table by updating a row.
Be aware that privilege code must be among the list in second row of this table.
+ * @summary update privilege + * @param {string} authorization Access Token + * @param {number} privilegeId + * @param {number} privilege + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch( + authorization: string, + privilegeId: number, + privilege: number, + name: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch.', + ); + } + // verify required parameter 'privilegeId' is not null or undefined + if (privilegeId === null || privilegeId === undefined) { + throw new RequiredError( + 'privilegeId', + 'Required parameter privilegeId was null or undefined when calling apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch.', + ); + } + // verify required parameter 'privilege' is not null or undefined + if (privilege === null || privilege === undefined) { + throw new RequiredError( + 'privilege', + 'Required parameter privilege was null or undefined when calling apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch.', + ); + } + // verify required parameter 'name' is not null or undefined + if (name === null || name === undefined) { + throw new RequiredError( + 'name', + 'Required parameter name was null or undefined when calling apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch.', + ); + } + const localVarPath = + `/api/v2/privilege/update/privilegeId={privilege_id}`.replace( + `{${'privilege_id'}}`, + encodeURIComponent(String(privilegeId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (privilege !== undefined) { + localVarFormParams.set('privilege', privilege as any); + } + + if (name !== undefined) { + localVarFormParams.set('name', name as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; + +/** + * PrivilegeAPIApi - functional programming interface + * @export + */ +export const PrivilegeAPIApiFp = function (configuration?: Configuration) { + return { + /** + * Adds a privilege.
This API creates a row in social_worker_type table containing a new privilege information.
privilege must be among these numbers:
[0]super admin, [1]social worker, [2]coordinator, [3]NGO supervisor, [4]SAY supervisor, [5]admin
+ * @summary add privilege + * @param {string} authorization Access Token + * @param {number} privilege + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegeAddPost( + authorization: string, + privilege: number, + name: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PrivilegeAPIApiFetchParamCreator( + configuration, + ).apiV2PrivilegeAddPost(authorization, privilege, name, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * Returns information of all privileges in a json.
Json key is privilege id and json value is privilege object.
Calling this API only affects social_worker_type table by selecting rows from it.
+ * @summary get all privileges + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegeAllGet( + authorization: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PrivilegeAPIApiFetchParamCreator( + configuration, + ).apiV2PrivilegeAllGet(authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * Returns information of all privileges with given id as a json object.
Calling this API only affects social_worker_type table by selecting rows from it.
+ * @summary get privilege by name + * @param {string} authorization Access Token + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegeNamenameGet( + authorization: string, + name: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PrivilegeAPIApiFetchParamCreator( + configuration, + ).apiV2PrivilegeNamenameGet(authorization, name, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * Returns information of a privilege with given id as a json object.
Calling this API only affects social_worker_type table by selecting a single row from it.
+ * @summary get privilege by id + * @param {string} authorization Access Token + * @param {number} privilegeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegePrivilegeIdprivilegeIdGet( + authorization: string, + privilegeId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PrivilegeAPIApiFetchParamCreator( + configuration, + ).apiV2PrivilegePrivilegeIdprivilegeIdGet( + authorization, + privilegeId, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * Returns information of all privileges with given privilege as a json object.
Calling this API only affects social_worker_type table by selecting rows from it.
+ * @summary get privilege by privilege + * @param {string} authorization Access Token + * @param {number} privilegeType + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegePrivilegeprivilegeTypeGet( + authorization: string, + privilegeType: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PrivilegeAPIApiFetchParamCreator( + configuration, + ).apiV2PrivilegePrivilegeprivilegeTypeGet( + authorization, + privilegeType, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * All the fields are optional.
You can fill every field you want to change, and it will update the desired privilege.
Calling this API only affects social_worker_type table by updating a row.
Be aware that privilege code must be among the list in second row of this table.
+ * @summary update privilege + * @param {string} authorization Access Token + * @param {number} privilegeId + * @param {number} privilege + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch( + authorization: string, + privilegeId: number, + privilege: number, + name: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PrivilegeAPIApiFetchParamCreator( + configuration, + ).apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch( + authorization, + privilegeId, + privilege, + name, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + }; +}; + +/** + * PrivilegeAPIApi - factory interface + * @export + */ +export const PrivilegeAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { + /** + * Adds a privilege.
This API creates a row in social_worker_type table containing a new privilege information.
privilege must be among these numbers:
[0]super admin, [1]social worker, [2]coordinator, [3]NGO supervisor, [4]SAY supervisor, [5]admin
+ * @summary add privilege + * @param {string} authorization Access Token + * @param {number} privilege + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegeAddPost( + authorization: string, + privilege: number, + name: string, + options?: any, + ) { + return PrivilegeAPIApiFp(configuration).apiV2PrivilegeAddPost( + authorization, + privilege, + name, + options, + )(fetch, basePath); + }, + /** + * Returns information of all privileges in a json.
Json key is privilege id and json value is privilege object.
Calling this API only affects social_worker_type table by selecting rows from it.
+ * @summary get all privileges + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegeAllGet(authorization: string, options?: any) { + return PrivilegeAPIApiFp(configuration).apiV2PrivilegeAllGet( + authorization, + options, + )(fetch, basePath); + }, + /** + * Returns information of all privileges with given id as a json object.
Calling this API only affects social_worker_type table by selecting rows from it.
+ * @summary get privilege by name + * @param {string} authorization Access Token + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegeNamenameGet( + authorization: string, + name: string, + options?: any, + ) { + return PrivilegeAPIApiFp(configuration).apiV2PrivilegeNamenameGet( + authorization, + name, + options, + )(fetch, basePath); + }, + /** + * Returns information of a privilege with given id as a json object.
Calling this API only affects social_worker_type table by selecting a single row from it.
+ * @summary get privilege by id + * @param {string} authorization Access Token + * @param {number} privilegeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegePrivilegeIdprivilegeIdGet( + authorization: string, + privilegeId: number, + options?: any, + ) { + return PrivilegeAPIApiFp( + configuration, + ).apiV2PrivilegePrivilegeIdprivilegeIdGet( + authorization, + privilegeId, + options, + )(fetch, basePath); + }, + /** + * Returns information of all privileges with given privilege as a json object.
Calling this API only affects social_worker_type table by selecting rows from it.
+ * @summary get privilege by privilege + * @param {string} authorization Access Token + * @param {number} privilegeType + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegePrivilegeprivilegeTypeGet( + authorization: string, + privilegeType: number, + options?: any, + ) { + return PrivilegeAPIApiFp( + configuration, + ).apiV2PrivilegePrivilegeprivilegeTypeGet( + authorization, + privilegeType, + options, + )(fetch, basePath); + }, + /** + * All the fields are optional.
You can fill every field you want to change, and it will update the desired privilege.
Calling this API only affects social_worker_type table by updating a row.
Be aware that privilege code must be among the list in second row of this table.
+ * @summary update privilege + * @param {string} authorization Access Token + * @param {number} privilegeId + * @param {number} privilege + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch( + authorization: string, + privilegeId: number, + privilege: number, + name: string, + options?: any, + ) { + return PrivilegeAPIApiFp( + configuration, + ).apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch( + authorization, + privilegeId, + privilege, + name, + options, + )(fetch, basePath); + }, + }; +}; + +/** + * PrivilegeAPIApi - object-oriented interface + * @export + * @class PrivilegeAPIApi + * @extends {BaseAPI} + */ +export class PrivilegeAPIApi extends BaseAPI { + /** + * Adds a privilege.
This API creates a row in social_worker_type table containing a new privilege information.
privilege must be among these numbers:
[0]super admin, [1]social worker, [2]coordinator, [3]NGO supervisor, [4]SAY supervisor, [5]admin
+ * @summary add privilege + * @param {string} authorization Access Token + * @param {number} privilege + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PrivilegeAPIApi + */ + public apiV2PrivilegeAddPost( + authorization: string, + privilege: number, + name: string, + options?: any, + ) { + return PrivilegeAPIApiFp(this.configuration).apiV2PrivilegeAddPost( + authorization, + privilege, + name, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns information of all privileges in a json.
Json key is privilege id and json value is privilege object.
Calling this API only affects social_worker_type table by selecting rows from it.
+ * @summary get all privileges + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PrivilegeAPIApi + */ + public apiV2PrivilegeAllGet(authorization: string, options?: any) { + return PrivilegeAPIApiFp(this.configuration).apiV2PrivilegeAllGet( + authorization, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns information of all privileges with given id as a json object.
Calling this API only affects social_worker_type table by selecting rows from it.
+ * @summary get privilege by name + * @param {string} authorization Access Token + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PrivilegeAPIApi + */ + public apiV2PrivilegeNamenameGet( + authorization: string, + name: string, + options?: any, + ) { + return PrivilegeAPIApiFp(this.configuration).apiV2PrivilegeNamenameGet( + authorization, + name, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns information of a privilege with given id as a json object.
Calling this API only affects social_worker_type table by selecting a single row from it.
+ * @summary get privilege by id + * @param {string} authorization Access Token + * @param {number} privilegeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PrivilegeAPIApi + */ + public apiV2PrivilegePrivilegeIdprivilegeIdGet( + authorization: string, + privilegeId: number, + options?: any, + ) { + return PrivilegeAPIApiFp( + this.configuration, + ).apiV2PrivilegePrivilegeIdprivilegeIdGet( + authorization, + privilegeId, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns information of all privileges with given privilege as a json object.
Calling this API only affects social_worker_type table by selecting rows from it.
+ * @summary get privilege by privilege + * @param {string} authorization Access Token + * @param {number} privilegeType + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PrivilegeAPIApi + */ + public apiV2PrivilegePrivilegeprivilegeTypeGet( + authorization: string, + privilegeType: number, + options?: any, + ) { + return PrivilegeAPIApiFp( + this.configuration, + ).apiV2PrivilegePrivilegeprivilegeTypeGet( + authorization, + privilegeType, + options, + )(this.fetch, this.basePath); + } + + /** + * All the fields are optional.
You can fill every field you want to change, and it will update the desired privilege.
Calling this API only affects social_worker_type table by updating a row.
Be aware that privilege code must be among the list in second row of this table.
+ * @summary update privilege + * @param {string} authorization Access Token + * @param {number} privilegeId + * @param {number} privilege + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PrivilegeAPIApi + */ + public apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch( + authorization: string, + privilegeId: number, + privilege: number, + name: string, + options?: any, + ) { + return PrivilegeAPIApiFp( + this.configuration, + ).apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch( + authorization, + privilegeId, + privilege, + name, + options, + )(this.fetch, this.basePath); + } +} + +/** + * PublicAPIApi - fetch parameter creator + * @export + */ +export const PublicAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + * + * @summary Children with family members + * @param {string} [lang] fa,en + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PublicChildrenGet(lang?: string, options: any = {}): FetchArgs { + const localVarPath = `/api/v2/public/children`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (lang !== undefined) { + localVarQueryParameter['_lang'] = lang; + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get Public Need + * @param {string} id + * @param {string} [lang] fa,en + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PublicNeedsIdGet( + id: string, + lang?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2PublicNeedsIdGet.', + ); + } + const localVarPath = `/api/v2/public/needs/{id}`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (lang !== undefined) { + localVarQueryParameter['_lang'] = lang; + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Random Need + * @param {string} [lang] fa,en + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PublicRandomNeedGet(lang?: string, options: any = {}): FetchArgs { + const localVarPath = `/api/v2/public/random/need`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (lang !== undefined) { + localVarQueryParameter['_lang'] = lang; + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; + +/** + * PublicAPIApi - functional programming interface + * @export + */ +export const PublicAPIApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Children with family members + * @param {string} [lang] fa,en + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PublicChildrenGet( + lang?: string, + options?: any, + ): ( + fetch?: FetchAPI, + basePath?: string, + ) => Promise { + const localVarFetchArgs = PublicAPIApiFetchParamCreator( + configuration, + ).apiV2PublicChildrenGet(lang, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get Public Need + * @param {string} id + * @param {string} [lang] fa,en + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PublicNeedsIdGet( + id: string, + lang?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PublicAPIApiFetchParamCreator( + configuration, + ).apiV2PublicNeedsIdGet(id, lang, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Random Need + * @param {string} [lang] fa,en + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PublicRandomNeedGet( + lang?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PublicAPIApiFetchParamCreator( + configuration, + ).apiV2PublicRandomNeedGet(lang, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + }; +}; + +/** + * PublicAPIApi - factory interface + * @export + */ +export const PublicAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { + /** + * + * @summary Children with family members + * @param {string} [lang] fa,en + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PublicChildrenGet(lang?: string, options?: any) { + return PublicAPIApiFp(configuration).apiV2PublicChildrenGet( + lang, + options, + )(fetch, basePath); + }, + /** + * + * @summary Get Public Need + * @param {string} id + * @param {string} [lang] fa,en + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PublicNeedsIdGet(id: string, lang?: string, options?: any) { + return PublicAPIApiFp(configuration).apiV2PublicNeedsIdGet( + id, + lang, + options, + )(fetch, basePath); + }, + /** + * + * @summary Random Need + * @param {string} [lang] fa,en + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2PublicRandomNeedGet(lang?: string, options?: any) { + return PublicAPIApiFp(configuration).apiV2PublicRandomNeedGet( + lang, + options, + )(fetch, basePath); + }, + }; +}; + +/** + * PublicAPIApi - object-oriented interface + * @export + * @class PublicAPIApi + * @extends {BaseAPI} + */ +export class PublicAPIApi extends BaseAPI { + /** + * + * @summary Children with family members + * @param {string} [lang] fa,en + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PublicAPIApi + */ + public apiV2PublicChildrenGet(lang?: string, options?: any) { + return PublicAPIApiFp(this.configuration).apiV2PublicChildrenGet( + lang, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Get Public Need + * @param {string} id + * @param {string} [lang] fa,en + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PublicAPIApi + */ + public apiV2PublicNeedsIdGet(id: string, lang?: string, options?: any) { + return PublicAPIApiFp(this.configuration).apiV2PublicNeedsIdGet( + id, + lang, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Random Need + * @param {string} [lang] fa,en + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PublicAPIApi + */ + public apiV2PublicRandomNeedGet(lang?: string, options?: any) { + return PublicAPIApiFp(this.configuration).apiV2PublicRandomNeedGet( + lang, + options, + )(this.fetch, this.basePath); + } +} + +/** + * ReceiptAPIApi - fetch parameter creator + * @export + */ +export const ReceiptAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + *
+ * @summary List receipts, sorted by updated, created + * @param {string} [authorization] Access Token + * @param {any} [search] search query + * @param {any} [take] max 100, default = 10 + * @param {any} [skip] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ReceiptsGet( + authorization?: string, + search?: any, + take?: any, + skip?: any, + options: any = {}, + ): FetchArgs { + const localVarPath = `/api/v2/receipts`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (search !== undefined) { + localVarQueryParameter['search'] = search; + } + + if (take !== undefined) { + localVarQueryParameter['take'] = take; + } + + if (skip !== undefined) { + localVarQueryParameter['skip'] = skip; + } + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + *
+ * @summary Delete a receipt, from all needs that it is attached + * @param {string} authorization Access Token + * @param {any} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ReceiptsIdDelete( + authorization: string, + id: any, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2ReceiptsIdDelete.', + ); + } + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2ReceiptsIdDelete.', + ); + } + const localVarPath = `/api/v2/receipts/{id}`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'DELETE' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a receipt + * @param {any} id + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ReceiptsIdGet( + id: any, + authorization?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2ReceiptsIdGet.', + ); + } + const localVarPath = `/api/v2/receipts/{id}`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Update a receipt + * @param {string} authorization Access Token + * @param {any} id + * @param {any} [attachment] + * @param {string} [description] max 1024 char + * @param {string} [title] max 128 char + * @param {number} [needStatus] + * @param {boolean} [isPublic] default=false, only SUPER_ADMIN, SAY_SUPERVISOR, ADMIN can set to true + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ReceiptsIdPatch( + authorization: string, + id: any, + attachment?: any, + description?: string, + title?: string, + needStatus?: number, + isPublic?: boolean, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2ReceiptsIdPatch.', + ); + } + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2ReceiptsIdPatch.', + ); + } + const localVarPath = `/api/v2/receipts/{id}`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (attachment !== undefined) { + localVarFormParams.set('attachment', attachment as any); + } + + if (description !== undefined) { + localVarFormParams.set('description', description as any); + } + + if (title !== undefined) { + localVarFormParams.set('title', title as any); + } + + if (needStatus !== undefined) { + localVarFormParams.set('needStatus', needStatus as any); + } + + if (isPublic !== undefined) { + localVarFormParams.set('isPublic', isPublic as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; + +/** + * ReceiptAPIApi - functional programming interface + * @export + */ +export const ReceiptAPIApiFp = function (configuration?: Configuration) { + return { + /** + *
+ * @summary List receipts, sorted by updated, created + * @param {string} [authorization] Access Token + * @param {any} [search] search query + * @param {any} [take] max 100, default = 10 + * @param {any} [skip] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ReceiptsGet( + authorization?: string, + search?: any, + take?: any, + skip?: any, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise> { + const localVarFetchArgs = ReceiptAPIApiFetchParamCreator( + configuration, + ).apiV2ReceiptsGet(authorization, search, take, skip, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + *
+ * @summary Delete a receipt, from all needs that it is attached + * @param {string} authorization Access Token + * @param {any} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ReceiptsIdDelete( + authorization: string, + id: any, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ReceiptAPIApiFetchParamCreator( + configuration, + ).apiV2ReceiptsIdDelete(authorization, id, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a receipt + * @param {any} id + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ReceiptsIdGet( + id: any, + authorization?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ReceiptAPIApiFetchParamCreator( + configuration, + ).apiV2ReceiptsIdGet(id, authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Update a receipt + * @param {string} authorization Access Token + * @param {any} id + * @param {any} [attachment] + * @param {string} [description] max 1024 char + * @param {string} [title] max 128 char + * @param {number} [needStatus] + * @param {boolean} [isPublic] default=false, only SUPER_ADMIN, SAY_SUPERVISOR, ADMIN can set to true + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ReceiptsIdPatch( + authorization: string, + id: any, + attachment?: any, + description?: string, + title?: string, + needStatus?: number, + isPublic?: boolean, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise> { + const localVarFetchArgs = ReceiptAPIApiFetchParamCreator( + configuration, + ).apiV2ReceiptsIdPatch( + authorization, + id, + attachment, + description, + title, + needStatus, + isPublic, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + }; +}; + +/** + * ReceiptAPIApi - factory interface + * @export + */ +export const ReceiptAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { + /** + *
+ * @summary List receipts, sorted by updated, created + * @param {string} [authorization] Access Token + * @param {any} [search] search query + * @param {any} [take] max 100, default = 10 + * @param {any} [skip] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ReceiptsGet( + authorization?: string, + search?: any, + take?: any, + skip?: any, + options?: any, + ) { + return ReceiptAPIApiFp(configuration).apiV2ReceiptsGet( + authorization, + search, + take, + skip, + options, + )(fetch, basePath); + }, + /** + *
+ * @summary Delete a receipt, from all needs that it is attached + * @param {string} authorization Access Token + * @param {any} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ReceiptsIdDelete(authorization: string, id: any, options?: any) { + return ReceiptAPIApiFp(configuration).apiV2ReceiptsIdDelete( + authorization, + id, + options, + )(fetch, basePath); + }, + /** + * + * @summary Get a receipt + * @param {any} id + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ReceiptsIdGet(id: any, authorization?: string, options?: any) { + return ReceiptAPIApiFp(configuration).apiV2ReceiptsIdGet( + id, + authorization, + options, + )(fetch, basePath); + }, + /** + * + * @summary Update a receipt + * @param {string} authorization Access Token + * @param {any} id + * @param {any} [attachment] + * @param {string} [description] max 1024 char + * @param {string} [title] max 128 char + * @param {number} [needStatus] + * @param {boolean} [isPublic] default=false, only SUPER_ADMIN, SAY_SUPERVISOR, ADMIN can set to true + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ReceiptsIdPatch( + authorization: string, + id: any, + attachment?: any, + description?: string, + title?: string, + needStatus?: number, + isPublic?: boolean, + options?: any, + ) { + return ReceiptAPIApiFp(configuration).apiV2ReceiptsIdPatch( + authorization, + id, + attachment, + description, + title, + needStatus, + isPublic, + options, + )(fetch, basePath); + }, + }; +}; + +/** + * ReceiptAPIApi - object-oriented interface + * @export + * @class ReceiptAPIApi + * @extends {BaseAPI} + */ +export class ReceiptAPIApi extends BaseAPI { + /** + *
+ * @summary List receipts, sorted by updated, created + * @param {string} [authorization] Access Token + * @param {any} [search] search query + * @param {any} [take] max 100, default = 10 + * @param {any} [skip] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ReceiptAPIApi + */ + public apiV2ReceiptsGet( + authorization?: string, + search?: any, + take?: any, + skip?: any, + options?: any, + ) { + return ReceiptAPIApiFp(this.configuration).apiV2ReceiptsGet( + authorization, + search, + take, + skip, + options, + )(this.fetch, this.basePath); + } + + /** + *
+ * @summary Delete a receipt, from all needs that it is attached + * @param {string} authorization Access Token + * @param {any} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ReceiptAPIApi + */ + public apiV2ReceiptsIdDelete(authorization: string, id: any, options?: any) { + return ReceiptAPIApiFp(this.configuration).apiV2ReceiptsIdDelete( + authorization, + id, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Get a receipt + * @param {any} id + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ReceiptAPIApi + */ + public apiV2ReceiptsIdGet(id: any, authorization?: string, options?: any) { + return ReceiptAPIApiFp(this.configuration).apiV2ReceiptsIdGet( + id, + authorization, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Update a receipt + * @param {string} authorization Access Token + * @param {any} id + * @param {any} [attachment] + * @param {string} [description] max 1024 char + * @param {string} [title] max 128 char + * @param {number} [needStatus] + * @param {boolean} [isPublic] default=false, only SUPER_ADMIN, SAY_SUPERVISOR, ADMIN can set to true + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ReceiptAPIApi + */ + public apiV2ReceiptsIdPatch( + authorization: string, + id: any, + attachment?: any, + description?: string, + title?: string, + needStatus?: number, + isPublic?: boolean, + options?: any, + ) { + return ReceiptAPIApiFp(this.configuration).apiV2ReceiptsIdPatch( + authorization, + id, + attachment, + description, + title, + needStatus, + isPublic, + options, + )(this.fetch, this.basePath); + } +} + +/** + * SearchAPIApi - fetch parameter creator + * @export + */ +export const SearchAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + * + * @summary Random Search V2 + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SearchRandomPost( + authorization?: string, + options: any = {}, + ): FetchArgs { + const localVarPath = `/api/v2/search/random`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary say brain search + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SearchSaybrainGet( + authorization: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2SearchSaybrainGet.', + ); + } + const localVarPath = `/api/v2/search/saybrain`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Random Search V3 + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV3SearchRandomPost( + authorization?: string, + options: any = {}, + ): FetchArgs { + const localVarPath = `/api/v3/search/random`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; + +/** + * SearchAPIApi - functional programming interface + * @export + */ +export const SearchAPIApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Random Search V2 + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SearchRandomPost( + authorization?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = SearchAPIApiFetchParamCreator( + configuration, + ).apiV2SearchRandomPost(authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary say brain search + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SearchSaybrainGet( + authorization: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = SearchAPIApiFetchParamCreator( + configuration, + ).apiV2SearchSaybrainGet(authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Random Search V3 + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV3SearchRandomPost( + authorization?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = SearchAPIApiFetchParamCreator( + configuration, + ).apiV3SearchRandomPost(authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + }; +}; + +/** + * SearchAPIApi - factory interface + * @export + */ +export const SearchAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { + /** + * + * @summary Random Search V2 + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SearchRandomPost(authorization?: string, options?: any) { + return SearchAPIApiFp(configuration).apiV2SearchRandomPost( + authorization, + options, + )(fetch, basePath); + }, + /** + * + * @summary say brain search + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SearchSaybrainGet(authorization: string, options?: any) { + return SearchAPIApiFp(configuration).apiV2SearchSaybrainGet( + authorization, + options, + )(fetch, basePath); + }, + /** + * + * @summary Random Search V3 + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV3SearchRandomPost(authorization?: string, options?: any) { + return SearchAPIApiFp(configuration).apiV3SearchRandomPost( + authorization, + options, + )(fetch, basePath); + }, + }; +}; + +/** + * SearchAPIApi - object-oriented interface + * @export + * @class SearchAPIApi + * @extends {BaseAPI} + */ +export class SearchAPIApi extends BaseAPI { + /** + * + * @summary Random Search V2 + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SearchAPIApi + */ + public apiV2SearchRandomPost(authorization?: string, options?: any) { + return SearchAPIApiFp(this.configuration).apiV2SearchRandomPost( + authorization, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary say brain search + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SearchAPIApi + */ + public apiV2SearchSaybrainGet(authorization: string, options?: any) { + return SearchAPIApiFp(this.configuration).apiV2SearchSaybrainGet( + authorization, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Random Search V3 + * @param {string} [authorization] Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SearchAPIApi + */ + public apiV3SearchRandomPost(authorization?: string, options?: any) { + return SearchAPIApiFp(this.configuration).apiV3SearchRandomPost( + authorization, + options, + )(this.fetch, this.basePath); + } +} /** - * PreneedAPIApi - factory interface + * SocialWorkerAPIApi - fetch parameter creator * @export */ -export const PreneedAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * - * @summary List of Preneeds - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PreneedsGet(authorization: string, options?: any) { - return PreneedAPIApiFp(configuration).apiV2PreneedsGet(authorization, options)(fetch, basePath); - }, - }; +export const SocialWorkerAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + * Returns information of all social workers in a json.
Json key is social worker id and json value is social worker object.
Calling this API only affects social_worker table by selecting rows from it.
+ * @summary get all social workers + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersGet(authorization: string, options: any = {}): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2SocialworkersGet.', + ); + } + const localVarPath = `/api/v2/socialworkers/`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns information of all social workers in a json.
Json key is social worker id and json value is social worker object.
Calling this API only affects social_worker table by selecting rows from it.
+ * @summary get all social workers + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersGet_1( + authorization: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2SocialworkersGet_1.', + ); + } + const localVarPath = `/api/v2/socialworkers`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Activates a deactive social worker.
Calling this API only affects social_worker table by updating a row.
+ * @summary activate social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersIdActivatePost( + authorization: string, + id: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2SocialworkersIdActivatePost.', + ); + } + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2SocialworkersIdActivatePost.', + ); + } + const localVarPath = `/api/v2/socialworkers/{id}/activate`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + *
+ * @summary Migrate all children of sw to another + * @param {string} authorization Access Token + * @param {number} id + * @param {number} destinationSocialWorkerId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersIdChildrenMigratePost( + authorization: string, + id: number, + destinationSocialWorkerId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2SocialworkersIdChildrenMigratePost.', + ); + } + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2SocialworkersIdChildrenMigratePost.', + ); + } + // verify required parameter 'destinationSocialWorkerId' is not null or undefined + if ( + destinationSocialWorkerId === null || + destinationSocialWorkerId === undefined + ) { + throw new RequiredError( + 'destinationSocialWorkerId', + 'Required parameter destinationSocialWorkerId was null or undefined when calling apiV2SocialworkersIdChildrenMigratePost.', + ); + } + const localVarPath = + `/api/v2/socialworkers/{id}/children/migrate`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (destinationSocialWorkerId !== undefined) { + localVarFormParams.set( + 'destinationSocialWorkerId', + destinationSocialWorkerId as any, + ); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary List created needs of a social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {number} [X_SKIP] + * @param {number} [X_TAKE] Max 500 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersIdCreatedNeedsGet( + authorization: string, + id: number, + X_SKIP?: number, + X_TAKE?: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2SocialworkersIdCreatedNeedsGet.', + ); + } + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2SocialworkersIdCreatedNeedsGet.', + ); + } + const localVarPath = `/api/v2/socialworkers/{id}/createdNeeds`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (X_SKIP !== undefined && X_SKIP !== null) { + localVarHeaderParameter['X-SKIP'] = String(X_SKIP); + } + + if (X_TAKE !== undefined && X_TAKE !== null) { + localVarHeaderParameter['X-TAKE'] = String(X_TAKE); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Deactivates an active social worker.
Calling this API only affects social_worker table by updating a row.
+ * @summary deactivate social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersIdDeactivatePost( + authorization: string, + id: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2SocialworkersIdDeactivatePost.', + ); + } + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2SocialworkersIdDeactivatePost.', + ); + } + const localVarPath = `/api/v2/socialworkers/{id}/deactivate`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Deletes a specific social worker.
Calling this API only affects social_worker table by updating a row and set isDeleted tag true.
We do not fully delete any rows.
+ * @summary delete social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersIdDelete( + authorization: string, + id: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2SocialworkersIdDelete.', + ); + } + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2SocialworkersIdDelete.', + ); + } + const localVarPath = `/api/v2/socialworkers/{id}`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'DELETE' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns information of an social worker with given id as a json object.
Calling this API only affects social_worker table by selecting a single row from it.
+ * @summary get social worker by id + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersIdGet( + authorization: string, + id: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2SocialworkersIdGet.', + ); + } + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2SocialworkersIdGet.', + ); + } + const localVarPath = `/api/v2/socialworkers/{id}`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * All the fields are optional.
You can fill every field you want to change, and it will update the desired social worker.
Calling this API only affects social_worker table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
Social workers can change their NGO by editing ngo_id field.
+ * @summary update social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {boolean} isCoordinator + * @param {number} [ngoId] + * @param {number} [cityId] + * @param {number} [typeId] + * @param {string} [username] + * @param {string} [password] + * @param {string} [firstName] + * @param {string} [lastName] + * @param {string} [birthCertificateNumber] + * @param {string} [idNumber] + * @param {any} [idCardUrl] + * @param {string} [passportNumber] + * @param {any} [passportUrl] + * @param {boolean} [gender] + * @param {string} [birthDate] + * @param {string} [phoneNumber] + * @param {string} [emergencyPhoneNumber] + * @param {string} [email] + * @param {string} [telegramId] + * @param {string} [postalAddress] + * @param {any} [avatarUrl] + * @param {string} [bankAccountNumber] + * @param {string} [bankAccountShebaNumber] + * @param {string} [bankAccountCardNumber] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersIdPatch( + authorization: string, + id: number, + isCoordinator: boolean, + ngoId?: number, + cityId?: number, + typeId?: number, + username?: string, + password?: string, + firstName?: string, + lastName?: string, + birthCertificateNumber?: string, + idNumber?: string, + idCardUrl?: any, + passportNumber?: string, + passportUrl?: any, + gender?: boolean, + birthDate?: string, + phoneNumber?: string, + emergencyPhoneNumber?: string, + email?: string, + telegramId?: string, + postalAddress?: string, + avatarUrl?: any, + bankAccountNumber?: string, + bankAccountShebaNumber?: string, + bankAccountCardNumber?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2SocialworkersIdPatch.', + ); + } + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2SocialworkersIdPatch.', + ); + } + // verify required parameter 'isCoordinator' is not null or undefined + if (isCoordinator === null || isCoordinator === undefined) { + throw new RequiredError( + 'isCoordinator', + 'Required parameter isCoordinator was null or undefined when calling apiV2SocialworkersIdPatch.', + ); + } + const localVarPath = `/api/v2/socialworkers/{id}`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (ngoId !== undefined) { + localVarFormParams.set('ngoId', ngoId as any); + } + + if (cityId !== undefined) { + localVarFormParams.set('cityId', cityId as any); + } + + if (typeId !== undefined) { + localVarFormParams.set('typeId', typeId as any); + } + + if (isCoordinator !== undefined) { + localVarFormParams.set('isCoordinator', isCoordinator as any); + } + + if (username !== undefined) { + localVarFormParams.set('username', username as any); + } + + if (password !== undefined) { + localVarFormParams.set('password', password as any); + } + + if (firstName !== undefined) { + localVarFormParams.set('firstName', firstName as any); + } + + if (lastName !== undefined) { + localVarFormParams.set('lastName', lastName as any); + } + + if (birthCertificateNumber !== undefined) { + localVarFormParams.set( + 'birthCertificateNumber', + birthCertificateNumber as any, + ); + } + + if (idNumber !== undefined) { + localVarFormParams.set('idNumber', idNumber as any); + } + + if (idCardUrl !== undefined) { + localVarFormParams.set('idCardUrl', idCardUrl as any); + } + + if (passportNumber !== undefined) { + localVarFormParams.set('passportNumber', passportNumber as any); + } + + if (passportUrl !== undefined) { + localVarFormParams.set('passportUrl', passportUrl as any); + } + + if (gender !== undefined) { + localVarFormParams.set('gender', gender as any); + } + + if (birthDate !== undefined) { + localVarFormParams.set('birthDate', birthDate as any); + } + + if (phoneNumber !== undefined) { + localVarFormParams.set('phoneNumber', phoneNumber as any); + } + + if (emergencyPhoneNumber !== undefined) { + localVarFormParams.set( + 'emergencyPhoneNumber', + emergencyPhoneNumber as any, + ); + } + + if (email !== undefined) { + localVarFormParams.set('email', email as any); + } + + if (telegramId !== undefined) { + localVarFormParams.set('telegramId', telegramId as any); + } + + if (postalAddress !== undefined) { + localVarFormParams.set('postalAddress', postalAddress as any); + } + + if (avatarUrl !== undefined) { + localVarFormParams.set('avatarUrl', avatarUrl as any); + } + + if (bankAccountNumber !== undefined) { + localVarFormParams.set('bankAccountNumber', bankAccountNumber as any); + } + + if (bankAccountShebaNumber !== undefined) { + localVarFormParams.set( + 'bankAccountShebaNumber', + bankAccountShebaNumber as any, + ); + } + + if (bankAccountCardNumber !== undefined) { + localVarFormParams.set( + 'bankAccountCardNumber', + bankAccountCardNumber as any, + ); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Social Worker Page + * @param {string} authorization Access Token + * @param {number} [X_SKIP] + * @param {number} [X_TAKE] Max 50 + * @param {number} [swId] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersMyPageGet( + authorization: string, + X_SKIP?: number, + X_TAKE?: number, + swId?: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2SocialworkersMyPageGet.', + ); + } + const localVarPath = `/api/v2/socialworkers/my-page`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (swId !== undefined) { + localVarQueryParameter['swId'] = swId; + } + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (X_SKIP !== undefined && X_SKIP !== null) { + localVarHeaderParameter['X-SKIP'] = String(X_SKIP); + } + + if (X_TAKE !== undefined && X_TAKE !== null) { + localVarHeaderParameter['X-TAKE'] = String(X_TAKE); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Adds a social worker.
This API creates a row in social_worker table containing a new social worker information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber and bankAccountCardNumber is optional.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
+ * @summary add social worker + * @param {string} authorization Access Token + * @param {number} ngoId + * @param {number} typeId + * @param {boolean} isCoordinator + * @param {string} lastName + * @param {string} idNumber + * @param {boolean} gender + * @param {string} phoneNumber + * @param {string} emergencyPhoneNumber + * @param {string} email + * @param {string} telegramId + * @param {any} avatarUrl + * @param {number} [cityId] + * @param {string} [firstName] + * @param {string} [birthCertificateNumber] + * @param {any} [idCardUrl] + * @param {string} [passportNumber] + * @param {any} [passportUrl] + * @param {string} [birthDate] + * @param {string} [postalAddress] + * @param {string} [bankAccountNumber] + * @param {string} [bankAccountShebaNumber] + * @param {string} [bankAccountCardNumber] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersPost( + authorization: string, + ngoId: number, + typeId: number, + isCoordinator: boolean, + lastName: string, + idNumber: string, + gender: boolean, + phoneNumber: string, + emergencyPhoneNumber: string, + email: string, + telegramId: string, + avatarUrl: any, + cityId?: number, + firstName?: string, + birthCertificateNumber?: string, + idCardUrl?: any, + passportNumber?: string, + passportUrl?: any, + birthDate?: string, + postalAddress?: string, + bankAccountNumber?: string, + bankAccountShebaNumber?: string, + bankAccountCardNumber?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2SocialworkersPost.', + ); + } + // verify required parameter 'ngoId' is not null or undefined + if (ngoId === null || ngoId === undefined) { + throw new RequiredError( + 'ngoId', + 'Required parameter ngoId was null or undefined when calling apiV2SocialworkersPost.', + ); + } + // verify required parameter 'typeId' is not null or undefined + if (typeId === null || typeId === undefined) { + throw new RequiredError( + 'typeId', + 'Required parameter typeId was null or undefined when calling apiV2SocialworkersPost.', + ); + } + // verify required parameter 'isCoordinator' is not null or undefined + if (isCoordinator === null || isCoordinator === undefined) { + throw new RequiredError( + 'isCoordinator', + 'Required parameter isCoordinator was null or undefined when calling apiV2SocialworkersPost.', + ); + } + // verify required parameter 'lastName' is not null or undefined + if (lastName === null || lastName === undefined) { + throw new RequiredError( + 'lastName', + 'Required parameter lastName was null or undefined when calling apiV2SocialworkersPost.', + ); + } + // verify required parameter 'idNumber' is not null or undefined + if (idNumber === null || idNumber === undefined) { + throw new RequiredError( + 'idNumber', + 'Required parameter idNumber was null or undefined when calling apiV2SocialworkersPost.', + ); + } + // verify required parameter 'gender' is not null or undefined + if (gender === null || gender === undefined) { + throw new RequiredError( + 'gender', + 'Required parameter gender was null or undefined when calling apiV2SocialworkersPost.', + ); + } + // verify required parameter 'phoneNumber' is not null or undefined + if (phoneNumber === null || phoneNumber === undefined) { + throw new RequiredError( + 'phoneNumber', + 'Required parameter phoneNumber was null or undefined when calling apiV2SocialworkersPost.', + ); + } + // verify required parameter 'emergencyPhoneNumber' is not null or undefined + if (emergencyPhoneNumber === null || emergencyPhoneNumber === undefined) { + throw new RequiredError( + 'emergencyPhoneNumber', + 'Required parameter emergencyPhoneNumber was null or undefined when calling apiV2SocialworkersPost.', + ); + } + // verify required parameter 'email' is not null or undefined + if (email === null || email === undefined) { + throw new RequiredError( + 'email', + 'Required parameter email was null or undefined when calling apiV2SocialworkersPost.', + ); + } + // verify required parameter 'telegramId' is not null or undefined + if (telegramId === null || telegramId === undefined) { + throw new RequiredError( + 'telegramId', + 'Required parameter telegramId was null or undefined when calling apiV2SocialworkersPost.', + ); + } + // verify required parameter 'avatarUrl' is not null or undefined + if (avatarUrl === null || avatarUrl === undefined) { + throw new RequiredError( + 'avatarUrl', + 'Required parameter avatarUrl was null or undefined when calling apiV2SocialworkersPost.', + ); + } + const localVarPath = `/api/v2/socialworkers/`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (ngoId !== undefined) { + localVarFormParams.set('ngoId', ngoId as any); + } + + if (cityId !== undefined) { + localVarFormParams.set('cityId', cityId as any); + } + + if (typeId !== undefined) { + localVarFormParams.set('typeId', typeId as any); + } + + if (isCoordinator !== undefined) { + localVarFormParams.set('isCoordinator', isCoordinator as any); + } + + if (firstName !== undefined) { + localVarFormParams.set('firstName', firstName as any); + } + + if (lastName !== undefined) { + localVarFormParams.set('lastName', lastName as any); + } + + if (birthCertificateNumber !== undefined) { + localVarFormParams.set( + 'birthCertificateNumber', + birthCertificateNumber as any, + ); + } + + if (idNumber !== undefined) { + localVarFormParams.set('idNumber', idNumber as any); + } + + if (idCardUrl !== undefined) { + localVarFormParams.set('idCardUrl', idCardUrl as any); + } + + if (passportNumber !== undefined) { + localVarFormParams.set('passportNumber', passportNumber as any); + } + + if (passportUrl !== undefined) { + localVarFormParams.set('passportUrl', passportUrl as any); + } + + if (gender !== undefined) { + localVarFormParams.set('gender', gender as any); + } + + if (birthDate !== undefined) { + localVarFormParams.set('birthDate', birthDate as any); + } + + if (phoneNumber !== undefined) { + localVarFormParams.set('phoneNumber', phoneNumber as any); + } + + if (emergencyPhoneNumber !== undefined) { + localVarFormParams.set( + 'emergencyPhoneNumber', + emergencyPhoneNumber as any, + ); + } + + if (email !== undefined) { + localVarFormParams.set('email', email as any); + } + + if (telegramId !== undefined) { + localVarFormParams.set('telegramId', telegramId as any); + } + + if (postalAddress !== undefined) { + localVarFormParams.set('postalAddress', postalAddress as any); + } + + if (avatarUrl !== undefined) { + localVarFormParams.set('avatarUrl', avatarUrl as any); + } + + if (bankAccountNumber !== undefined) { + localVarFormParams.set('bankAccountNumber', bankAccountNumber as any); + } + + if (bankAccountShebaNumber !== undefined) { + localVarFormParams.set( + 'bankAccountShebaNumber', + bankAccountShebaNumber as any, + ); + } + + if (bankAccountCardNumber !== undefined) { + localVarFormParams.set( + 'bankAccountCardNumber', + bankAccountCardNumber as any, + ); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Adds a social worker.
This API creates a row in social_worker table containing a new social worker information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber and bankAccountCardNumber is optional.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
+ * @summary add social worker + * @param {string} authorization Access Token + * @param {number} ngoId + * @param {number} typeId + * @param {boolean} isCoordinator + * @param {string} lastName + * @param {string} idNumber + * @param {boolean} gender + * @param {string} phoneNumber + * @param {string} emergencyPhoneNumber + * @param {string} email + * @param {string} telegramId + * @param {any} avatarUrl + * @param {number} [cityId] + * @param {string} [firstName] + * @param {string} [birthCertificateNumber] + * @param {any} [idCardUrl] + * @param {string} [passportNumber] + * @param {any} [passportUrl] + * @param {string} [birthDate] + * @param {string} [postalAddress] + * @param {string} [bankAccountNumber] + * @param {string} [bankAccountShebaNumber] + * @param {string} [bankAccountCardNumber] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersPost_2( + authorization: string, + ngoId: number, + typeId: number, + isCoordinator: boolean, + lastName: string, + idNumber: string, + gender: boolean, + phoneNumber: string, + emergencyPhoneNumber: string, + email: string, + telegramId: string, + avatarUrl: any, + cityId?: number, + firstName?: string, + birthCertificateNumber?: string, + idCardUrl?: any, + passportNumber?: string, + passportUrl?: any, + birthDate?: string, + postalAddress?: string, + bankAccountNumber?: string, + bankAccountShebaNumber?: string, + bankAccountCardNumber?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2SocialworkersPost_2.', + ); + } + // verify required parameter 'ngoId' is not null or undefined + if (ngoId === null || ngoId === undefined) { + throw new RequiredError( + 'ngoId', + 'Required parameter ngoId was null or undefined when calling apiV2SocialworkersPost_2.', + ); + } + // verify required parameter 'typeId' is not null or undefined + if (typeId === null || typeId === undefined) { + throw new RequiredError( + 'typeId', + 'Required parameter typeId was null or undefined when calling apiV2SocialworkersPost_2.', + ); + } + // verify required parameter 'isCoordinator' is not null or undefined + if (isCoordinator === null || isCoordinator === undefined) { + throw new RequiredError( + 'isCoordinator', + 'Required parameter isCoordinator was null or undefined when calling apiV2SocialworkersPost_2.', + ); + } + // verify required parameter 'lastName' is not null or undefined + if (lastName === null || lastName === undefined) { + throw new RequiredError( + 'lastName', + 'Required parameter lastName was null or undefined when calling apiV2SocialworkersPost_2.', + ); + } + // verify required parameter 'idNumber' is not null or undefined + if (idNumber === null || idNumber === undefined) { + throw new RequiredError( + 'idNumber', + 'Required parameter idNumber was null or undefined when calling apiV2SocialworkersPost_2.', + ); + } + // verify required parameter 'gender' is not null or undefined + if (gender === null || gender === undefined) { + throw new RequiredError( + 'gender', + 'Required parameter gender was null or undefined when calling apiV2SocialworkersPost_2.', + ); + } + // verify required parameter 'phoneNumber' is not null or undefined + if (phoneNumber === null || phoneNumber === undefined) { + throw new RequiredError( + 'phoneNumber', + 'Required parameter phoneNumber was null or undefined when calling apiV2SocialworkersPost_2.', + ); + } + // verify required parameter 'emergencyPhoneNumber' is not null or undefined + if (emergencyPhoneNumber === null || emergencyPhoneNumber === undefined) { + throw new RequiredError( + 'emergencyPhoneNumber', + 'Required parameter emergencyPhoneNumber was null or undefined when calling apiV2SocialworkersPost_2.', + ); + } + // verify required parameter 'email' is not null or undefined + if (email === null || email === undefined) { + throw new RequiredError( + 'email', + 'Required parameter email was null or undefined when calling apiV2SocialworkersPost_2.', + ); + } + // verify required parameter 'telegramId' is not null or undefined + if (telegramId === null || telegramId === undefined) { + throw new RequiredError( + 'telegramId', + 'Required parameter telegramId was null or undefined when calling apiV2SocialworkersPost_2.', + ); + } + // verify required parameter 'avatarUrl' is not null or undefined + if (avatarUrl === null || avatarUrl === undefined) { + throw new RequiredError( + 'avatarUrl', + 'Required parameter avatarUrl was null or undefined when calling apiV2SocialworkersPost_2.', + ); + } + const localVarPath = `/api/v2/socialworkers`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (ngoId !== undefined) { + localVarFormParams.set('ngoId', ngoId as any); + } + + if (cityId !== undefined) { + localVarFormParams.set('cityId', cityId as any); + } + + if (typeId !== undefined) { + localVarFormParams.set('typeId', typeId as any); + } + + if (isCoordinator !== undefined) { + localVarFormParams.set('isCoordinator', isCoordinator as any); + } + + if (firstName !== undefined) { + localVarFormParams.set('firstName', firstName as any); + } + + if (lastName !== undefined) { + localVarFormParams.set('lastName', lastName as any); + } + + if (birthCertificateNumber !== undefined) { + localVarFormParams.set( + 'birthCertificateNumber', + birthCertificateNumber as any, + ); + } + + if (idNumber !== undefined) { + localVarFormParams.set('idNumber', idNumber as any); + } + + if (idCardUrl !== undefined) { + localVarFormParams.set('idCardUrl', idCardUrl as any); + } + + if (passportNumber !== undefined) { + localVarFormParams.set('passportNumber', passportNumber as any); + } + + if (passportUrl !== undefined) { + localVarFormParams.set('passportUrl', passportUrl as any); + } + + if (gender !== undefined) { + localVarFormParams.set('gender', gender as any); + } + + if (birthDate !== undefined) { + localVarFormParams.set('birthDate', birthDate as any); + } + + if (phoneNumber !== undefined) { + localVarFormParams.set('phoneNumber', phoneNumber as any); + } + + if (emergencyPhoneNumber !== undefined) { + localVarFormParams.set( + 'emergencyPhoneNumber', + emergencyPhoneNumber as any, + ); + } + + if (email !== undefined) { + localVarFormParams.set('email', email as any); + } + + if (telegramId !== undefined) { + localVarFormParams.set('telegramId', telegramId as any); + } + + if (postalAddress !== undefined) { + localVarFormParams.set('postalAddress', postalAddress as any); + } + + if (avatarUrl !== undefined) { + localVarFormParams.set('avatarUrl', avatarUrl as any); + } + + if (bankAccountNumber !== undefined) { + localVarFormParams.set('bankAccountNumber', bankAccountNumber as any); + } + + if (bankAccountShebaNumber !== undefined) { + localVarFormParams.set( + 'bankAccountShebaNumber', + bankAccountShebaNumber as any, + ); + } + + if (bankAccountCardNumber !== undefined) { + localVarFormParams.set( + 'bankAccountCardNumber', + bankAccountCardNumber as any, + ); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; }; /** - * PreneedAPIApi - object-oriented interface + * SocialWorkerAPIApi - functional programming interface * @export - * @class PreneedAPIApi - * @extends {BaseAPI} */ -export class PreneedAPIApi extends BaseAPI { +export const SocialWorkerAPIApiFp = function (configuration?: Configuration) { + return { + /** + * Returns information of all social workers in a json.
Json key is social worker id and json value is social worker object.
Calling this API only affects social_worker table by selecting rows from it.
+ * @summary get all social workers + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersGet( + authorization: string, + options?: any, + ): ( + fetch?: FetchAPI, + basePath?: string, + ) => Promise> { + const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator( + configuration, + ).apiV2SocialworkersGet(authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * Returns information of all social workers in a json.
Json key is social worker id and json value is social worker object.
Calling this API only affects social_worker table by selecting rows from it.
+ * @summary get all social workers + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersGet_1( + authorization: string, + options?: any, + ): ( + fetch?: FetchAPI, + basePath?: string, + ) => Promise> { + const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator( + configuration, + ).apiV2SocialworkersGet_1(authorization, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * Activates a deactive social worker.
Calling this API only affects social_worker table by updating a row.
+ * @summary activate social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersIdActivatePost( + authorization: string, + id: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator( + configuration, + ).apiV2SocialworkersIdActivatePost(authorization, id, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + *
+ * @summary Migrate all children of sw to another + * @param {string} authorization Access Token + * @param {number} id + * @param {number} destinationSocialWorkerId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersIdChildrenMigratePost( + authorization: string, + id: number, + destinationSocialWorkerId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator( + configuration, + ).apiV2SocialworkersIdChildrenMigratePost( + authorization, + id, + destinationSocialWorkerId, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary List created needs of a social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {number} [X_SKIP] + * @param {number} [X_TAKE] Max 500 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersIdCreatedNeedsGet( + authorization: string, + id: number, + X_SKIP?: number, + X_TAKE?: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise> { + const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator( + configuration, + ).apiV2SocialworkersIdCreatedNeedsGet( + authorization, + id, + X_SKIP, + X_TAKE, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * Deactivates an active social worker.
Calling this API only affects social_worker table by updating a row.
+ * @summary deactivate social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersIdDeactivatePost( + authorization: string, + id: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator( + configuration, + ).apiV2SocialworkersIdDeactivatePost(authorization, id, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * Deletes a specific social worker.
Calling this API only affects social_worker table by updating a row and set isDeleted tag true.
We do not fully delete any rows.
+ * @summary delete social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersIdDelete( + authorization: string, + id: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator( + configuration, + ).apiV2SocialworkersIdDelete(authorization, id, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * Returns information of an social worker with given id as a json object.
Calling this API only affects social_worker table by selecting a single row from it.
+ * @summary get social worker by id + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersIdGet( + authorization: string, + id: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator( + configuration, + ).apiV2SocialworkersIdGet(authorization, id, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * All the fields are optional.
You can fill every field you want to change, and it will update the desired social worker.
Calling this API only affects social_worker table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
Social workers can change their NGO by editing ngo_id field.
+ * @summary update social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {boolean} isCoordinator + * @param {number} [ngoId] + * @param {number} [cityId] + * @param {number} [typeId] + * @param {string} [username] + * @param {string} [password] + * @param {string} [firstName] + * @param {string} [lastName] + * @param {string} [birthCertificateNumber] + * @param {string} [idNumber] + * @param {any} [idCardUrl] + * @param {string} [passportNumber] + * @param {any} [passportUrl] + * @param {boolean} [gender] + * @param {string} [birthDate] + * @param {string} [phoneNumber] + * @param {string} [emergencyPhoneNumber] + * @param {string} [email] + * @param {string} [telegramId] + * @param {string} [postalAddress] + * @param {any} [avatarUrl] + * @param {string} [bankAccountNumber] + * @param {string} [bankAccountShebaNumber] + * @param {string} [bankAccountCardNumber] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersIdPatch( + authorization: string, + id: number, + isCoordinator: boolean, + ngoId?: number, + cityId?: number, + typeId?: number, + username?: string, + password?: string, + firstName?: string, + lastName?: string, + birthCertificateNumber?: string, + idNumber?: string, + idCardUrl?: any, + passportNumber?: string, + passportUrl?: any, + gender?: boolean, + birthDate?: string, + phoneNumber?: string, + emergencyPhoneNumber?: string, + email?: string, + telegramId?: string, + postalAddress?: string, + avatarUrl?: any, + bankAccountNumber?: string, + bankAccountShebaNumber?: string, + bankAccountCardNumber?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator( + configuration, + ).apiV2SocialworkersIdPatch( + authorization, + id, + isCoordinator, + ngoId, + cityId, + typeId, + username, + password, + firstName, + lastName, + birthCertificateNumber, + idNumber, + idCardUrl, + passportNumber, + passportUrl, + gender, + birthDate, + phoneNumber, + emergencyPhoneNumber, + email, + telegramId, + postalAddress, + avatarUrl, + bankAccountNumber, + bankAccountShebaNumber, + bankAccountCardNumber, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * - * @summary List of Preneeds + * @summary Social Worker Page * @param {string} authorization Access Token + * @param {number} [X_SKIP] + * @param {number} [X_TAKE] Max 50 + * @param {number} [swId] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof PreneedAPIApi */ - public apiV2PreneedsGet(authorization: string, options?: any) { - return PreneedAPIApiFp(this.configuration).apiV2PreneedsGet(authorization, options)(this.fetch, this.basePath); - } - -} - -/** - * PrivilegeAPIApi - fetch parameter creator - * @export - */ -export const PrivilegeAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * Adds a privilege.
This API creates a row in social_worker_type table containing a new privilege information.
privilege must be among these numbers:
[0]super admin, [1]social worker, [2]coordinator, [3]NGO supervisor, [4]SAY supervisor, [5]admin
- * @summary add privilege - * @param {string} authorization Access Token - * @param {number} privilege - * @param {string} name - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegeAddPost(authorization: string, privilege: number, name: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2PrivilegeAddPost.'); - } - // verify required parameter 'privilege' is not null or undefined - if (privilege === null || privilege === undefined) { - throw new RequiredError('privilege', 'Required parameter privilege was null or undefined when calling apiV2PrivilegeAddPost.'); - } - // verify required parameter 'name' is not null or undefined - if (name === null || name === undefined) { - throw new RequiredError('name', 'Required parameter name was null or undefined when calling apiV2PrivilegeAddPost.'); - } - const localVarPath = `/api/v2/privilege/add`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (privilege !== undefined) { - localVarFormParams.set('privilege', privilege as any); - } - - if (name !== undefined) { - localVarFormParams.set('name', name as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns information of all privileges in a json.
Json key is privilege id and json value is privilege object.
Calling this API only affects social_worker_type table by selecting rows from it.
- * @summary get all privileges - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegeAllGet(authorization: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2PrivilegeAllGet.'); - } - const localVarPath = `/api/v2/privilege/all`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns information of all privileges with given id as a json object.
Calling this API only affects social_worker_type table by selecting rows from it.
- * @summary get privilege by name - * @param {string} authorization Access Token - * @param {string} name - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegeNamenameGet(authorization: string, name: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2PrivilegeNamenameGet.'); - } - // verify required parameter 'name' is not null or undefined - if (name === null || name === undefined) { - throw new RequiredError('name', 'Required parameter name was null or undefined when calling apiV2PrivilegeNamenameGet.'); - } - const localVarPath = `/api/v2/privilege/name={name}` - .replace(`{${"name"}}`, encodeURIComponent(String(name))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns information of a privilege with given id as a json object.
Calling this API only affects social_worker_type table by selecting a single row from it.
- * @summary get privilege by id - * @param {string} authorization Access Token - * @param {number} privilegeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegePrivilegeIdprivilegeIdGet(authorization: string, privilegeId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2PrivilegePrivilegeIdprivilegeIdGet.'); - } - // verify required parameter 'privilegeId' is not null or undefined - if (privilegeId === null || privilegeId === undefined) { - throw new RequiredError('privilegeId', 'Required parameter privilegeId was null or undefined when calling apiV2PrivilegePrivilegeIdprivilegeIdGet.'); - } - const localVarPath = `/api/v2/privilege/privilegeId={privilege_id}` - .replace(`{${"privilege_id"}}`, encodeURIComponent(String(privilegeId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns information of all privileges with given privilege as a json object.
Calling this API only affects social_worker_type table by selecting rows from it.
- * @summary get privilege by privilege - * @param {string} authorization Access Token - * @param {number} privilegeType - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegePrivilegeprivilegeTypeGet(authorization: string, privilegeType: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2PrivilegePrivilegeprivilegeTypeGet.'); - } - // verify required parameter 'privilegeType' is not null or undefined - if (privilegeType === null || privilegeType === undefined) { - throw new RequiredError('privilegeType', 'Required parameter privilegeType was null or undefined when calling apiV2PrivilegePrivilegeprivilegeTypeGet.'); - } - const localVarPath = `/api/v2/privilege/privilege={privilege_type}` - .replace(`{${"privilege_type"}}`, encodeURIComponent(String(privilegeType))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * All the fields are optional.
You can fill every field you want to change, and it will update the desired privilege.
Calling this API only affects social_worker_type table by updating a row.
Be aware that privilege code must be among the list in second row of this table.
- * @summary update privilege - * @param {string} authorization Access Token - * @param {number} privilegeId - * @param {number} privilege - * @param {string} name - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch(authorization: string, privilegeId: number, privilege: number, name: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch.'); - } - // verify required parameter 'privilegeId' is not null or undefined - if (privilegeId === null || privilegeId === undefined) { - throw new RequiredError('privilegeId', 'Required parameter privilegeId was null or undefined when calling apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch.'); - } - // verify required parameter 'privilege' is not null or undefined - if (privilege === null || privilege === undefined) { - throw new RequiredError('privilege', 'Required parameter privilege was null or undefined when calling apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch.'); - } - // verify required parameter 'name' is not null or undefined - if (name === null || name === undefined) { - throw new RequiredError('name', 'Required parameter name was null or undefined when calling apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch.'); - } - const localVarPath = `/api/v2/privilege/update/privilegeId={privilege_id}` - .replace(`{${"privilege_id"}}`, encodeURIComponent(String(privilegeId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (privilege !== undefined) { - localVarFormParams.set('privilege', privilege as any); - } - - if (name !== undefined) { - localVarFormParams.set('name', name as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * PrivilegeAPIApi - functional programming interface - * @export - */ -export const PrivilegeAPIApiFp = function (configuration?: Configuration) { - return { - /** - * Adds a privilege.
This API creates a row in social_worker_type table containing a new privilege information.
privilege must be among these numbers:
[0]super admin, [1]social worker, [2]coordinator, [3]NGO supervisor, [4]SAY supervisor, [5]admin
- * @summary add privilege - * @param {string} authorization Access Token - * @param {number} privilege - * @param {string} name - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegeAddPost(authorization: string, privilege: number, name: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = PrivilegeAPIApiFetchParamCreator(configuration).apiV2PrivilegeAddPost(authorization, privilege, name, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * Returns information of all privileges in a json.
Json key is privilege id and json value is privilege object.
Calling this API only affects social_worker_type table by selecting rows from it.
- * @summary get all privileges - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegeAllGet(authorization: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = PrivilegeAPIApiFetchParamCreator(configuration).apiV2PrivilegeAllGet(authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Returns information of all privileges with given id as a json object.
Calling this API only affects social_worker_type table by selecting rows from it.
- * @summary get privilege by name - * @param {string} authorization Access Token - * @param {string} name - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegeNamenameGet(authorization: string, name: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = PrivilegeAPIApiFetchParamCreator(configuration).apiV2PrivilegeNamenameGet(authorization, name, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Returns information of a privilege with given id as a json object.
Calling this API only affects social_worker_type table by selecting a single row from it.
- * @summary get privilege by id - * @param {string} authorization Access Token - * @param {number} privilegeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegePrivilegeIdprivilegeIdGet(authorization: string, privilegeId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = PrivilegeAPIApiFetchParamCreator(configuration).apiV2PrivilegePrivilegeIdprivilegeIdGet(authorization, privilegeId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Returns information of all privileges with given privilege as a json object.
Calling this API only affects social_worker_type table by selecting rows from it.
- * @summary get privilege by privilege - * @param {string} authorization Access Token - * @param {number} privilegeType - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegePrivilegeprivilegeTypeGet(authorization: string, privilegeType: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = PrivilegeAPIApiFetchParamCreator(configuration).apiV2PrivilegePrivilegeprivilegeTypeGet(authorization, privilegeType, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * All the fields are optional.
You can fill every field you want to change, and it will update the desired privilege.
Calling this API only affects social_worker_type table by updating a row.
Be aware that privilege code must be among the list in second row of this table.
- * @summary update privilege - * @param {string} authorization Access Token - * @param {number} privilegeId - * @param {number} privilege - * @param {string} name - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch(authorization: string, privilegeId: number, privilege: number, name: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = PrivilegeAPIApiFetchParamCreator(configuration).apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch(authorization, privilegeId, privilege, name, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - } -}; - -/** - * PrivilegeAPIApi - factory interface - * @export - */ -export const PrivilegeAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * Adds a privilege.
This API creates a row in social_worker_type table containing a new privilege information.
privilege must be among these numbers:
[0]super admin, [1]social worker, [2]coordinator, [3]NGO supervisor, [4]SAY supervisor, [5]admin
- * @summary add privilege - * @param {string} authorization Access Token - * @param {number} privilege - * @param {string} name - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegeAddPost(authorization: string, privilege: number, name: string, options?: any) { - return PrivilegeAPIApiFp(configuration).apiV2PrivilegeAddPost(authorization, privilege, name, options)(fetch, basePath); - }, - /** - * Returns information of all privileges in a json.
Json key is privilege id and json value is privilege object.
Calling this API only affects social_worker_type table by selecting rows from it.
- * @summary get all privileges - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegeAllGet(authorization: string, options?: any) { - return PrivilegeAPIApiFp(configuration).apiV2PrivilegeAllGet(authorization, options)(fetch, basePath); - }, - /** - * Returns information of all privileges with given id as a json object.
Calling this API only affects social_worker_type table by selecting rows from it.
- * @summary get privilege by name - * @param {string} authorization Access Token - * @param {string} name - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegeNamenameGet(authorization: string, name: string, options?: any) { - return PrivilegeAPIApiFp(configuration).apiV2PrivilegeNamenameGet(authorization, name, options)(fetch, basePath); - }, - /** - * Returns information of a privilege with given id as a json object.
Calling this API only affects social_worker_type table by selecting a single row from it.
- * @summary get privilege by id - * @param {string} authorization Access Token - * @param {number} privilegeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegePrivilegeIdprivilegeIdGet(authorization: string, privilegeId: number, options?: any) { - return PrivilegeAPIApiFp(configuration).apiV2PrivilegePrivilegeIdprivilegeIdGet(authorization, privilegeId, options)(fetch, basePath); - }, - /** - * Returns information of all privileges with given privilege as a json object.
Calling this API only affects social_worker_type table by selecting rows from it.
- * @summary get privilege by privilege - * @param {string} authorization Access Token - * @param {number} privilegeType - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegePrivilegeprivilegeTypeGet(authorization: string, privilegeType: number, options?: any) { - return PrivilegeAPIApiFp(configuration).apiV2PrivilegePrivilegeprivilegeTypeGet(authorization, privilegeType, options)(fetch, basePath); - }, - /** - * All the fields are optional.
You can fill every field you want to change, and it will update the desired privilege.
Calling this API only affects social_worker_type table by updating a row.
Be aware that privilege code must be among the list in second row of this table.
- * @summary update privilege - * @param {string} authorization Access Token - * @param {number} privilegeId - * @param {number} privilege - * @param {string} name - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch(authorization: string, privilegeId: number, privilege: number, name: string, options?: any) { - return PrivilegeAPIApiFp(configuration).apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch(authorization, privilegeId, privilege, name, options)(fetch, basePath); - }, - }; -}; - -/** - * PrivilegeAPIApi - object-oriented interface - * @export - * @class PrivilegeAPIApi - * @extends {BaseAPI} - */ -export class PrivilegeAPIApi extends BaseAPI { + apiV2SocialworkersMyPageGet( + authorization: string, + X_SKIP?: number, + X_TAKE?: number, + swId?: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator( + configuration, + ).apiV2SocialworkersMyPageGet( + authorization, + X_SKIP, + X_TAKE, + swId, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** - * Adds a privilege.
This API creates a row in social_worker_type table containing a new privilege information.
privilege must be among these numbers:
[0]super admin, [1]social worker, [2]coordinator, [3]NGO supervisor, [4]SAY supervisor, [5]admin
- * @summary add privilege + * Adds a social worker.
This API creates a row in social_worker table containing a new social worker information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber and bankAccountCardNumber is optional.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
+ * @summary add social worker * @param {string} authorization Access Token - * @param {number} privilege - * @param {string} name + * @param {number} ngoId + * @param {number} typeId + * @param {boolean} isCoordinator + * @param {string} lastName + * @param {string} idNumber + * @param {boolean} gender + * @param {string} phoneNumber + * @param {string} emergencyPhoneNumber + * @param {string} email + * @param {string} telegramId + * @param {any} avatarUrl + * @param {number} [cityId] + * @param {string} [firstName] + * @param {string} [birthCertificateNumber] + * @param {any} [idCardUrl] + * @param {string} [passportNumber] + * @param {any} [passportUrl] + * @param {string} [birthDate] + * @param {string} [postalAddress] + * @param {string} [bankAccountNumber] + * @param {string} [bankAccountShebaNumber] + * @param {string} [bankAccountCardNumber] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof PrivilegeAPIApi */ - public apiV2PrivilegeAddPost(authorization: string, privilege: number, name: string, options?: any) { - return PrivilegeAPIApiFp(this.configuration).apiV2PrivilegeAddPost(authorization, privilege, name, options)(this.fetch, this.basePath); - } - + apiV2SocialworkersPost( + authorization: string, + ngoId: number, + typeId: number, + isCoordinator: boolean, + lastName: string, + idNumber: string, + gender: boolean, + phoneNumber: string, + emergencyPhoneNumber: string, + email: string, + telegramId: string, + avatarUrl: any, + cityId?: number, + firstName?: string, + birthCertificateNumber?: string, + idCardUrl?: any, + passportNumber?: string, + passportUrl?: any, + birthDate?: string, + postalAddress?: string, + bankAccountNumber?: string, + bankAccountShebaNumber?: string, + bankAccountCardNumber?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator( + configuration, + ).apiV2SocialworkersPost( + authorization, + ngoId, + typeId, + isCoordinator, + lastName, + idNumber, + gender, + phoneNumber, + emergencyPhoneNumber, + email, + telegramId, + avatarUrl, + cityId, + firstName, + birthCertificateNumber, + idCardUrl, + passportNumber, + passportUrl, + birthDate, + postalAddress, + bankAccountNumber, + bankAccountShebaNumber, + bankAccountCardNumber, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** - * Returns information of all privileges in a json.
Json key is privilege id and json value is privilege object.
Calling this API only affects social_worker_type table by selecting rows from it.
- * @summary get all privileges + * Adds a social worker.
This API creates a row in social_worker table containing a new social worker information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber and bankAccountCardNumber is optional.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
+ * @summary add social worker * @param {string} authorization Access Token + * @param {number} ngoId + * @param {number} typeId + * @param {boolean} isCoordinator + * @param {string} lastName + * @param {string} idNumber + * @param {boolean} gender + * @param {string} phoneNumber + * @param {string} emergencyPhoneNumber + * @param {string} email + * @param {string} telegramId + * @param {any} avatarUrl + * @param {number} [cityId] + * @param {string} [firstName] + * @param {string} [birthCertificateNumber] + * @param {any} [idCardUrl] + * @param {string} [passportNumber] + * @param {any} [passportUrl] + * @param {string} [birthDate] + * @param {string} [postalAddress] + * @param {string} [bankAccountNumber] + * @param {string} [bankAccountShebaNumber] + * @param {string} [bankAccountCardNumber] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof PrivilegeAPIApi */ - public apiV2PrivilegeAllGet(authorization: string, options?: any) { - return PrivilegeAPIApiFp(this.configuration).apiV2PrivilegeAllGet(authorization, options)(this.fetch, this.basePath); - } + apiV2SocialworkersPost_2( + authorization: string, + ngoId: number, + typeId: number, + isCoordinator: boolean, + lastName: string, + idNumber: string, + gender: boolean, + phoneNumber: string, + emergencyPhoneNumber: string, + email: string, + telegramId: string, + avatarUrl: any, + cityId?: number, + firstName?: string, + birthCertificateNumber?: string, + idCardUrl?: any, + passportNumber?: string, + passportUrl?: any, + birthDate?: string, + postalAddress?: string, + bankAccountNumber?: string, + bankAccountShebaNumber?: string, + bankAccountCardNumber?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator( + configuration, + ).apiV2SocialworkersPost_2( + authorization, + ngoId, + typeId, + isCoordinator, + lastName, + idNumber, + gender, + phoneNumber, + emergencyPhoneNumber, + email, + telegramId, + avatarUrl, + cityId, + firstName, + birthCertificateNumber, + idCardUrl, + passportNumber, + passportUrl, + birthDate, + postalAddress, + bankAccountNumber, + bankAccountShebaNumber, + bankAccountCardNumber, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + }; +}; +/** + * SocialWorkerAPIApi - factory interface + * @export + */ +export const SocialWorkerAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { /** - * Returns information of all privileges with given id as a json object.
Calling this API only affects social_worker_type table by selecting rows from it.
- * @summary get privilege by name + * Returns information of all social workers in a json.
Json key is social worker id and json value is social worker object.
Calling this API only affects social_worker table by selecting rows from it.
+ * @summary get all social workers * @param {string} authorization Access Token - * @param {string} name * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof PrivilegeAPIApi */ - public apiV2PrivilegeNamenameGet(authorization: string, name: string, options?: any) { - return PrivilegeAPIApiFp(this.configuration).apiV2PrivilegeNamenameGet(authorization, name, options)(this.fetch, this.basePath); - } - + apiV2SocialworkersGet(authorization: string, options?: any) { + return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersGet( + authorization, + options, + )(fetch, basePath); + }, /** - * Returns information of a privilege with given id as a json object.
Calling this API only affects social_worker_type table by selecting a single row from it.
- * @summary get privilege by id + * Returns information of all social workers in a json.
Json key is social worker id and json value is social worker object.
Calling this API only affects social_worker table by selecting rows from it.
+ * @summary get all social workers * @param {string} authorization Access Token - * @param {number} privilegeId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof PrivilegeAPIApi */ - public apiV2PrivilegePrivilegeIdprivilegeIdGet(authorization: string, privilegeId: number, options?: any) { - return PrivilegeAPIApiFp(this.configuration).apiV2PrivilegePrivilegeIdprivilegeIdGet(authorization, privilegeId, options)(this.fetch, this.basePath); - } - + apiV2SocialworkersGet_1(authorization: string, options?: any) { + return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersGet_1( + authorization, + options, + )(fetch, basePath); + }, /** - * Returns information of all privileges with given privilege as a json object.
Calling this API only affects social_worker_type table by selecting rows from it.
- * @summary get privilege by privilege + * Activates a deactive social worker.
Calling this API only affects social_worker table by updating a row.
+ * @summary activate social worker * @param {string} authorization Access Token - * @param {number} privilegeType + * @param {number} id * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof PrivilegeAPIApi */ - public apiV2PrivilegePrivilegeprivilegeTypeGet(authorization: string, privilegeType: number, options?: any) { - return PrivilegeAPIApiFp(this.configuration).apiV2PrivilegePrivilegeprivilegeTypeGet(authorization, privilegeType, options)(this.fetch, this.basePath); - } - + apiV2SocialworkersIdActivatePost( + authorization: string, + id: number, + options?: any, + ) { + return SocialWorkerAPIApiFp( + configuration, + ).apiV2SocialworkersIdActivatePost( + authorization, + id, + options, + )(fetch, basePath); + }, /** - * All the fields are optional.
You can fill every field you want to change, and it will update the desired privilege.
Calling this API only affects social_worker_type table by updating a row.
Be aware that privilege code must be among the list in second row of this table.
- * @summary update privilege + *
+ * @summary Migrate all children of sw to another * @param {string} authorization Access Token - * @param {number} privilegeId - * @param {number} privilege - * @param {string} name + * @param {number} id + * @param {number} destinationSocialWorkerId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof PrivilegeAPIApi */ - public apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch(authorization: string, privilegeId: number, privilege: number, name: string, options?: any) { - return PrivilegeAPIApiFp(this.configuration).apiV2PrivilegeUpdatePrivilegeIdprivilegeIdPatch(authorization, privilegeId, privilege, name, options)(this.fetch, this.basePath); - } - -} - -/** - * PublicAPIApi - fetch parameter creator - * @export - */ -export const PublicAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Children with family members - * @param {string} [lang] fa,en - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PublicChildrenGet(lang?: string, options: any = {}): FetchArgs { - const localVarPath = `/api/v2/public/children`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (lang !== undefined) { - localVarQueryParameter['_lang'] = lang; - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get Public Need - * @param {string} id - * @param {string} [lang] fa,en - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PublicNeedsIdGet(id: string, lang?: string, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2PublicNeedsIdGet.'); - } - const localVarPath = `/api/v2/public/needs/{id}` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (lang !== undefined) { - localVarQueryParameter['_lang'] = lang; - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Random Need - * @param {string} [lang] fa,en - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PublicRandomNeedGet(lang?: string, options: any = {}): FetchArgs { - const localVarPath = `/api/v2/public/random/need`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (lang !== undefined) { - localVarQueryParameter['_lang'] = lang; - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * PublicAPIApi - functional programming interface - * @export - */ -export const PublicAPIApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Children with family members - * @param {string} [lang] fa,en - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PublicChildrenGet(lang?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = PublicAPIApiFetchParamCreator(configuration).apiV2PublicChildrenGet(lang, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Get Public Need - * @param {string} id - * @param {string} [lang] fa,en - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PublicNeedsIdGet(id: string, lang?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = PublicAPIApiFetchParamCreator(configuration).apiV2PublicNeedsIdGet(id, lang, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Random Need - * @param {string} [lang] fa,en - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PublicRandomNeedGet(lang?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = PublicAPIApiFetchParamCreator(configuration).apiV2PublicRandomNeedGet(lang, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - } -}; - -/** - * PublicAPIApi - factory interface - * @export - */ -export const PublicAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * - * @summary Children with family members - * @param {string} [lang] fa,en - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PublicChildrenGet(lang?: string, options?: any) { - return PublicAPIApiFp(configuration).apiV2PublicChildrenGet(lang, options)(fetch, basePath); - }, - /** - * - * @summary Get Public Need - * @param {string} id - * @param {string} [lang] fa,en - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PublicNeedsIdGet(id: string, lang?: string, options?: any) { - return PublicAPIApiFp(configuration).apiV2PublicNeedsIdGet(id, lang, options)(fetch, basePath); - }, - /** - * - * @summary Random Need - * @param {string} [lang] fa,en - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2PublicRandomNeedGet(lang?: string, options?: any) { - return PublicAPIApiFp(configuration).apiV2PublicRandomNeedGet(lang, options)(fetch, basePath); - }, - }; -}; - -/** - * PublicAPIApi - object-oriented interface - * @export - * @class PublicAPIApi - * @extends {BaseAPI} - */ -export class PublicAPIApi extends BaseAPI { + apiV2SocialworkersIdChildrenMigratePost( + authorization: string, + id: number, + destinationSocialWorkerId: number, + options?: any, + ) { + return SocialWorkerAPIApiFp( + configuration, + ).apiV2SocialworkersIdChildrenMigratePost( + authorization, + id, + destinationSocialWorkerId, + options, + )(fetch, basePath); + }, /** * - * @summary Children with family members - * @param {string} [lang] fa,en + * @summary List created needs of a social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {number} [X_SKIP] + * @param {number} [X_TAKE] Max 500 * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof PublicAPIApi */ - public apiV2PublicChildrenGet(lang?: string, options?: any) { - return PublicAPIApiFp(this.configuration).apiV2PublicChildrenGet(lang, options)(this.fetch, this.basePath); - } - + apiV2SocialworkersIdCreatedNeedsGet( + authorization: string, + id: number, + X_SKIP?: number, + X_TAKE?: number, + options?: any, + ) { + return SocialWorkerAPIApiFp( + configuration, + ).apiV2SocialworkersIdCreatedNeedsGet( + authorization, + id, + X_SKIP, + X_TAKE, + options, + )(fetch, basePath); + }, /** - * - * @summary Get Public Need - * @param {string} id - * @param {string} [lang] fa,en + * Deactivates an active social worker.
Calling this API only affects social_worker table by updating a row.
+ * @summary deactivate social worker + * @param {string} authorization Access Token + * @param {number} id * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof PublicAPIApi */ - public apiV2PublicNeedsIdGet(id: string, lang?: string, options?: any) { - return PublicAPIApiFp(this.configuration).apiV2PublicNeedsIdGet(id, lang, options)(this.fetch, this.basePath); - } - + apiV2SocialworkersIdDeactivatePost( + authorization: string, + id: number, + options?: any, + ) { + return SocialWorkerAPIApiFp( + configuration, + ).apiV2SocialworkersIdDeactivatePost( + authorization, + id, + options, + )(fetch, basePath); + }, /** - * - * @summary Random Need - * @param {string} [lang] fa,en + * Deletes a specific social worker.
Calling this API only affects social_worker table by updating a row and set isDeleted tag true.
We do not fully delete any rows.
+ * @summary delete social worker + * @param {string} authorization Access Token + * @param {number} id * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof PublicAPIApi */ - public apiV2PublicRandomNeedGet(lang?: string, options?: any) { - return PublicAPIApiFp(this.configuration).apiV2PublicRandomNeedGet(lang, options)(this.fetch, this.basePath); - } - -} - -/** - * ReceiptAPIApi - fetch parameter creator - * @export - */ -export const ReceiptAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - *
- * @summary List receipts, sorted by updated, created - * @param {string} [authorization] Access Token - * @param {any} [search] search query - * @param {any} [take] max 100, default = 10 - * @param {any} [skip] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ReceiptsGet(authorization?: string, search?: any, take?: any, skip?: any, options: any = {}): FetchArgs { - const localVarPath = `/api/v2/receipts`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (search !== undefined) { - localVarQueryParameter['search'] = search; - } - - if (take !== undefined) { - localVarQueryParameter['take'] = take; - } - - if (skip !== undefined) { - localVarQueryParameter['skip'] = skip; - } - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - *
- * @summary Delete a receipt, from all needs that it is attached - * @param {string} authorization Access Token - * @param {any} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ReceiptsIdDelete(authorization: string, id: any, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2ReceiptsIdDelete.'); - } - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2ReceiptsIdDelete.'); - } - const localVarPath = `/api/v2/receipts/{id}` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'DELETE' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - *
- * @summary Get a receipt - * @param {any} id - * @param {string} [authorization] Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ReceiptsIdGet(id: any, authorization?: string, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2ReceiptsIdGet.'); - } - const localVarPath = `/api/v2/receipts/{id}` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Update a receipt - * @param {string} authorization Access Token - * @param {any} id - * @param {any} [attachment] - * @param {string} [description] max 1024 char - * @param {string} [title] max 128 char - * @param {number} [needStatus] - * @param {boolean} [isPublic] default=false, only SUPER_ADMIN, SAY_SUPERVISOR, ADMIN can set to true - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ReceiptsIdPatch(authorization: string, id: any, attachment?: any, description?: string, title?: string, needStatus?: number, isPublic?: boolean, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2ReceiptsIdPatch.'); - } - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2ReceiptsIdPatch.'); - } - const localVarPath = `/api/v2/receipts/{id}` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (attachment !== undefined) { - localVarFormParams.set('attachment', attachment as any); - } - - if (description !== undefined) { - localVarFormParams.set('description', description as any); - } - - if (title !== undefined) { - localVarFormParams.set('title', title as any); - } - - if (needStatus !== undefined) { - localVarFormParams.set('needStatus', needStatus as any); - } - - if (isPublic !== undefined) { - localVarFormParams.set('isPublic', isPublic as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * ReceiptAPIApi - functional programming interface - * @export - */ -export const ReceiptAPIApiFp = function (configuration?: Configuration) { - return { - /** - *
- * @summary List receipts, sorted by updated, created - * @param {string} [authorization] Access Token - * @param {any} [search] search query - * @param {any} [take] max 100, default = 10 - * @param {any} [skip] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ReceiptsGet(authorization?: string, search?: any, take?: any, skip?: any, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ReceiptAPIApiFetchParamCreator(configuration).apiV2ReceiptsGet(authorization, search, take, skip, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - *
- * @summary Delete a receipt, from all needs that it is attached - * @param {string} authorization Access Token - * @param {any} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ReceiptsIdDelete(authorization: string, id: any, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ReceiptAPIApiFetchParamCreator(configuration).apiV2ReceiptsIdDelete(authorization, id, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - *
- * @summary Get a receipt - * @param {any} id - * @param {string} [authorization] Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ReceiptsIdGet(id: any, authorization?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ReceiptAPIApiFetchParamCreator(configuration).apiV2ReceiptsIdGet(id, authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Update a receipt - * @param {string} authorization Access Token - * @param {any} id - * @param {any} [attachment] - * @param {string} [description] max 1024 char - * @param {string} [title] max 128 char - * @param {number} [needStatus] - * @param {boolean} [isPublic] default=false, only SUPER_ADMIN, SAY_SUPERVISOR, ADMIN can set to true - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ReceiptsIdPatch(authorization: string, id: any, attachment?: any, description?: string, title?: string, needStatus?: number, isPublic?: boolean, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ReceiptAPIApiFetchParamCreator(configuration).apiV2ReceiptsIdPatch(authorization, id, attachment, description, title, needStatus, isPublic, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - } -}; - -/** - * ReceiptAPIApi - factory interface - * @export - */ -export const ReceiptAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - *
- * @summary List receipts, sorted by updated, created - * @param {string} [authorization] Access Token - * @param {any} [search] search query - * @param {any} [take] max 100, default = 10 - * @param {any} [skip] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ReceiptsGet(authorization?: string, search?: any, take?: any, skip?: any, options?: any) { - return ReceiptAPIApiFp(configuration).apiV2ReceiptsGet(authorization, search, take, skip, options)(fetch, basePath); - }, - /** - *
- * @summary Delete a receipt, from all needs that it is attached - * @param {string} authorization Access Token - * @param {any} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ReceiptsIdDelete(authorization: string, id: any, options?: any) { - return ReceiptAPIApiFp(configuration).apiV2ReceiptsIdDelete(authorization, id, options)(fetch, basePath); - }, - /** - *
- * @summary Get a receipt - * @param {any} id - * @param {string} [authorization] Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ReceiptsIdGet(id: any, authorization?: string, options?: any) { - return ReceiptAPIApiFp(configuration).apiV2ReceiptsIdGet(id, authorization, options)(fetch, basePath); - }, - /** - * - * @summary Update a receipt - * @param {string} authorization Access Token - * @param {any} id - * @param {any} [attachment] - * @param {string} [description] max 1024 char - * @param {string} [title] max 128 char - * @param {number} [needStatus] - * @param {boolean} [isPublic] default=false, only SUPER_ADMIN, SAY_SUPERVISOR, ADMIN can set to true - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2ReceiptsIdPatch(authorization: string, id: any, attachment?: any, description?: string, title?: string, needStatus?: number, isPublic?: boolean, options?: any) { - return ReceiptAPIApiFp(configuration).apiV2ReceiptsIdPatch(authorization, id, attachment, description, title, needStatus, isPublic, options)(fetch, basePath); - }, - }; -}; - -/** - * ReceiptAPIApi - object-oriented interface - * @export - * @class ReceiptAPIApi - * @extends {BaseAPI} - */ -export class ReceiptAPIApi extends BaseAPI { + apiV2SocialworkersIdDelete( + authorization: string, + id: number, + options?: any, + ) { + return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersIdDelete( + authorization, + id, + options, + )(fetch, basePath); + }, /** - *
- * @summary List receipts, sorted by updated, created - * @param {string} [authorization] Access Token - * @param {any} [search] search query - * @param {any} [take] max 100, default = 10 - * @param {any} [skip] + * Returns information of an social worker with given id as a json object.
Calling this API only affects social_worker table by selecting a single row from it.
+ * @summary get social worker by id + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2SocialworkersIdGet(authorization: string, id: number, options?: any) { + return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersIdGet( + authorization, + id, + options, + )(fetch, basePath); + }, + /** + * All the fields are optional.
You can fill every field you want to change, and it will update the desired social worker.
Calling this API only affects social_worker table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
Social workers can change their NGO by editing ngo_id field.
+ * @summary update social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {boolean} isCoordinator + * @param {number} [ngoId] + * @param {number} [cityId] + * @param {number} [typeId] + * @param {string} [username] + * @param {string} [password] + * @param {string} [firstName] + * @param {string} [lastName] + * @param {string} [birthCertificateNumber] + * @param {string} [idNumber] + * @param {any} [idCardUrl] + * @param {string} [passportNumber] + * @param {any} [passportUrl] + * @param {boolean} [gender] + * @param {string} [birthDate] + * @param {string} [phoneNumber] + * @param {string} [emergencyPhoneNumber] + * @param {string} [email] + * @param {string} [telegramId] + * @param {string} [postalAddress] + * @param {any} [avatarUrl] + * @param {string} [bankAccountNumber] + * @param {string} [bankAccountShebaNumber] + * @param {string} [bankAccountCardNumber] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ReceiptAPIApi */ - public apiV2ReceiptsGet(authorization?: string, search?: any, take?: any, skip?: any, options?: any) { - return ReceiptAPIApiFp(this.configuration).apiV2ReceiptsGet(authorization, search, take, skip, options)(this.fetch, this.basePath); - } - + apiV2SocialworkersIdPatch( + authorization: string, + id: number, + isCoordinator: boolean, + ngoId?: number, + cityId?: number, + typeId?: number, + username?: string, + password?: string, + firstName?: string, + lastName?: string, + birthCertificateNumber?: string, + idNumber?: string, + idCardUrl?: any, + passportNumber?: string, + passportUrl?: any, + gender?: boolean, + birthDate?: string, + phoneNumber?: string, + emergencyPhoneNumber?: string, + email?: string, + telegramId?: string, + postalAddress?: string, + avatarUrl?: any, + bankAccountNumber?: string, + bankAccountShebaNumber?: string, + bankAccountCardNumber?: string, + options?: any, + ) { + return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersIdPatch( + authorization, + id, + isCoordinator, + ngoId, + cityId, + typeId, + username, + password, + firstName, + lastName, + birthCertificateNumber, + idNumber, + idCardUrl, + passportNumber, + passportUrl, + gender, + birthDate, + phoneNumber, + emergencyPhoneNumber, + email, + telegramId, + postalAddress, + avatarUrl, + bankAccountNumber, + bankAccountShebaNumber, + bankAccountCardNumber, + options, + )(fetch, basePath); + }, /** - *
- * @summary Delete a receipt, from all needs that it is attached + * + * @summary Social Worker Page * @param {string} authorization Access Token - * @param {any} id + * @param {number} [X_SKIP] + * @param {number} [X_TAKE] Max 50 + * @param {number} [swId] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ReceiptAPIApi */ - public apiV2ReceiptsIdDelete(authorization: string, id: any, options?: any) { - return ReceiptAPIApiFp(this.configuration).apiV2ReceiptsIdDelete(authorization, id, options)(this.fetch, this.basePath); - } - + apiV2SocialworkersMyPageGet( + authorization: string, + X_SKIP?: number, + X_TAKE?: number, + swId?: number, + options?: any, + ) { + return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersMyPageGet( + authorization, + X_SKIP, + X_TAKE, + swId, + options, + )(fetch, basePath); + }, /** - *
- * @summary Get a receipt - * @param {any} id - * @param {string} [authorization] Access Token + * Adds a social worker.
This API creates a row in social_worker table containing a new social worker information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber and bankAccountCardNumber is optional.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
+ * @summary add social worker + * @param {string} authorization Access Token + * @param {number} ngoId + * @param {number} typeId + * @param {boolean} isCoordinator + * @param {string} lastName + * @param {string} idNumber + * @param {boolean} gender + * @param {string} phoneNumber + * @param {string} emergencyPhoneNumber + * @param {string} email + * @param {string} telegramId + * @param {any} avatarUrl + * @param {number} [cityId] + * @param {string} [firstName] + * @param {string} [birthCertificateNumber] + * @param {any} [idCardUrl] + * @param {string} [passportNumber] + * @param {any} [passportUrl] + * @param {string} [birthDate] + * @param {string} [postalAddress] + * @param {string} [bankAccountNumber] + * @param {string} [bankAccountShebaNumber] + * @param {string} [bankAccountCardNumber] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ReceiptAPIApi */ - public apiV2ReceiptsIdGet(id: any, authorization?: string, options?: any) { - return ReceiptAPIApiFp(this.configuration).apiV2ReceiptsIdGet(id, authorization, options)(this.fetch, this.basePath); - } - + apiV2SocialworkersPost( + authorization: string, + ngoId: number, + typeId: number, + isCoordinator: boolean, + lastName: string, + idNumber: string, + gender: boolean, + phoneNumber: string, + emergencyPhoneNumber: string, + email: string, + telegramId: string, + avatarUrl: any, + cityId?: number, + firstName?: string, + birthCertificateNumber?: string, + idCardUrl?: any, + passportNumber?: string, + passportUrl?: any, + birthDate?: string, + postalAddress?: string, + bankAccountNumber?: string, + bankAccountShebaNumber?: string, + bankAccountCardNumber?: string, + options?: any, + ) { + return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersPost( + authorization, + ngoId, + typeId, + isCoordinator, + lastName, + idNumber, + gender, + phoneNumber, + emergencyPhoneNumber, + email, + telegramId, + avatarUrl, + cityId, + firstName, + birthCertificateNumber, + idCardUrl, + passportNumber, + passportUrl, + birthDate, + postalAddress, + bankAccountNumber, + bankAccountShebaNumber, + bankAccountCardNumber, + options, + )(fetch, basePath); + }, /** - * - * @summary Update a receipt + * Adds a social worker.
This API creates a row in social_worker table containing a new social worker information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber and bankAccountCardNumber is optional.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
+ * @summary add social worker * @param {string} authorization Access Token - * @param {any} id - * @param {any} [attachment] - * @param {string} [description] max 1024 char - * @param {string} [title] max 128 char - * @param {number} [needStatus] - * @param {boolean} [isPublic] default=false, only SUPER_ADMIN, SAY_SUPERVISOR, ADMIN can set to true + * @param {number} ngoId + * @param {number} typeId + * @param {boolean} isCoordinator + * @param {string} lastName + * @param {string} idNumber + * @param {boolean} gender + * @param {string} phoneNumber + * @param {string} emergencyPhoneNumber + * @param {string} email + * @param {string} telegramId + * @param {any} avatarUrl + * @param {number} [cityId] + * @param {string} [firstName] + * @param {string} [birthCertificateNumber] + * @param {any} [idCardUrl] + * @param {string} [passportNumber] + * @param {any} [passportUrl] + * @param {string} [birthDate] + * @param {string} [postalAddress] + * @param {string} [bankAccountNumber] + * @param {string} [bankAccountShebaNumber] + * @param {string} [bankAccountCardNumber] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof ReceiptAPIApi */ - public apiV2ReceiptsIdPatch(authorization: string, id: any, attachment?: any, description?: string, title?: string, needStatus?: number, isPublic?: boolean, options?: any) { - return ReceiptAPIApiFp(this.configuration).apiV2ReceiptsIdPatch(authorization, id, attachment, description, title, needStatus, isPublic, options)(this.fetch, this.basePath); - } - -} - -/** - * SearchAPIApi - fetch parameter creator - * @export - */ -export const SearchAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Random Search V2 - * @param {string} [authorization] Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SearchRandomPost(authorization?: string, options: any = {}): FetchArgs { - const localVarPath = `/api/v2/search/random`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary say brain search - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SearchSaybrainGet(authorization: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2SearchSaybrainGet.'); - } - const localVarPath = `/api/v2/search/saybrain`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Random Search V3 - * @param {string} [authorization] Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV3SearchRandomPost(authorization?: string, options: any = {}): FetchArgs { - const localVarPath = `/api/v3/search/random`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * SearchAPIApi - functional programming interface - * @export - */ -export const SearchAPIApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Random Search V2 - * @param {string} [authorization] Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SearchRandomPost(authorization?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = SearchAPIApiFetchParamCreator(configuration).apiV2SearchRandomPost(authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary say brain search - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SearchSaybrainGet(authorization: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = SearchAPIApiFetchParamCreator(configuration).apiV2SearchSaybrainGet(authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Random Search V3 - * @param {string} [authorization] Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV3SearchRandomPost(authorization?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = SearchAPIApiFetchParamCreator(configuration).apiV3SearchRandomPost(authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - } + apiV2SocialworkersPost_2( + authorization: string, + ngoId: number, + typeId: number, + isCoordinator: boolean, + lastName: string, + idNumber: string, + gender: boolean, + phoneNumber: string, + emergencyPhoneNumber: string, + email: string, + telegramId: string, + avatarUrl: any, + cityId?: number, + firstName?: string, + birthCertificateNumber?: string, + idCardUrl?: any, + passportNumber?: string, + passportUrl?: any, + birthDate?: string, + postalAddress?: string, + bankAccountNumber?: string, + bankAccountShebaNumber?: string, + bankAccountCardNumber?: string, + options?: any, + ) { + return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersPost_2( + authorization, + ngoId, + typeId, + isCoordinator, + lastName, + idNumber, + gender, + phoneNumber, + emergencyPhoneNumber, + email, + telegramId, + avatarUrl, + cityId, + firstName, + birthCertificateNumber, + idCardUrl, + passportNumber, + passportUrl, + birthDate, + postalAddress, + bankAccountNumber, + bankAccountShebaNumber, + bankAccountCardNumber, + options, + )(fetch, basePath); + }, + }; }; /** - * SearchAPIApi - factory interface + * SocialWorkerAPIApi - object-oriented interface * @export + * @class SocialWorkerAPIApi + * @extends {BaseAPI} */ -export const SearchAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * - * @summary Random Search V2 - * @param {string} [authorization] Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SearchRandomPost(authorization?: string, options?: any) { - return SearchAPIApiFp(configuration).apiV2SearchRandomPost(authorization, options)(fetch, basePath); - }, - /** - * - * @summary say brain search - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SearchSaybrainGet(authorization: string, options?: any) { - return SearchAPIApiFp(configuration).apiV2SearchSaybrainGet(authorization, options)(fetch, basePath); - }, - /** - * - * @summary Random Search V3 - * @param {string} [authorization] Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV3SearchRandomPost(authorization?: string, options?: any) { - return SearchAPIApiFp(configuration).apiV3SearchRandomPost(authorization, options)(fetch, basePath); - }, - }; -}; +export class SocialWorkerAPIApi extends BaseAPI { + /** + * Returns information of all social workers in a json.
Json key is social worker id and json value is social worker object.
Calling this API only affects social_worker table by selecting rows from it.
+ * @summary get all social workers + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SocialWorkerAPIApi + */ + public apiV2SocialworkersGet(authorization: string, options?: any) { + return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersGet( + authorization, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns information of all social workers in a json.
Json key is social worker id and json value is social worker object.
Calling this API only affects social_worker table by selecting rows from it.
+ * @summary get all social workers + * @param {string} authorization Access Token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SocialWorkerAPIApi + */ + public apiV2SocialworkersGet_1(authorization: string, options?: any) { + return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersGet_1( + authorization, + options, + )(this.fetch, this.basePath); + } + + /** + * Activates a deactive social worker.
Calling this API only affects social_worker table by updating a row.
+ * @summary activate social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SocialWorkerAPIApi + */ + public apiV2SocialworkersIdActivatePost( + authorization: string, + id: number, + options?: any, + ) { + return SocialWorkerAPIApiFp( + this.configuration, + ).apiV2SocialworkersIdActivatePost( + authorization, + id, + options, + )(this.fetch, this.basePath); + } + + /** + *
+ * @summary Migrate all children of sw to another + * @param {string} authorization Access Token + * @param {number} id + * @param {number} destinationSocialWorkerId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SocialWorkerAPIApi + */ + public apiV2SocialworkersIdChildrenMigratePost( + authorization: string, + id: number, + destinationSocialWorkerId: number, + options?: any, + ) { + return SocialWorkerAPIApiFp( + this.configuration, + ).apiV2SocialworkersIdChildrenMigratePost( + authorization, + id, + destinationSocialWorkerId, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary List created needs of a social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {number} [X_SKIP] + * @param {number} [X_TAKE] Max 500 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SocialWorkerAPIApi + */ + public apiV2SocialworkersIdCreatedNeedsGet( + authorization: string, + id: number, + X_SKIP?: number, + X_TAKE?: number, + options?: any, + ) { + return SocialWorkerAPIApiFp( + this.configuration, + ).apiV2SocialworkersIdCreatedNeedsGet( + authorization, + id, + X_SKIP, + X_TAKE, + options, + )(this.fetch, this.basePath); + } + + /** + * Deactivates an active social worker.
Calling this API only affects social_worker table by updating a row.
+ * @summary deactivate social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SocialWorkerAPIApi + */ + public apiV2SocialworkersIdDeactivatePost( + authorization: string, + id: number, + options?: any, + ) { + return SocialWorkerAPIApiFp( + this.configuration, + ).apiV2SocialworkersIdDeactivatePost( + authorization, + id, + options, + )(this.fetch, this.basePath); + } + + /** + * Deletes a specific social worker.
Calling this API only affects social_worker table by updating a row and set isDeleted tag true.
We do not fully delete any rows.
+ * @summary delete social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SocialWorkerAPIApi + */ + public apiV2SocialworkersIdDelete( + authorization: string, + id: number, + options?: any, + ) { + return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersIdDelete( + authorization, + id, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns information of an social worker with given id as a json object.
Calling this API only affects social_worker table by selecting a single row from it.
+ * @summary get social worker by id + * @param {string} authorization Access Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SocialWorkerAPIApi + */ + public apiV2SocialworkersIdGet( + authorization: string, + id: number, + options?: any, + ) { + return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersIdGet( + authorization, + id, + options, + )(this.fetch, this.basePath); + } + + /** + * All the fields are optional.
You can fill every field you want to change, and it will update the desired social worker.
Calling this API only affects social_worker table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
Social workers can change their NGO by editing ngo_id field.
+ * @summary update social worker + * @param {string} authorization Access Token + * @param {number} id + * @param {boolean} isCoordinator + * @param {number} [ngoId] + * @param {number} [cityId] + * @param {number} [typeId] + * @param {string} [username] + * @param {string} [password] + * @param {string} [firstName] + * @param {string} [lastName] + * @param {string} [birthCertificateNumber] + * @param {string} [idNumber] + * @param {any} [idCardUrl] + * @param {string} [passportNumber] + * @param {any} [passportUrl] + * @param {boolean} [gender] + * @param {string} [birthDate] + * @param {string} [phoneNumber] + * @param {string} [emergencyPhoneNumber] + * @param {string} [email] + * @param {string} [telegramId] + * @param {string} [postalAddress] + * @param {any} [avatarUrl] + * @param {string} [bankAccountNumber] + * @param {string} [bankAccountShebaNumber] + * @param {string} [bankAccountCardNumber] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SocialWorkerAPIApi + */ + public apiV2SocialworkersIdPatch( + authorization: string, + id: number, + isCoordinator: boolean, + ngoId?: number, + cityId?: number, + typeId?: number, + username?: string, + password?: string, + firstName?: string, + lastName?: string, + birthCertificateNumber?: string, + idNumber?: string, + idCardUrl?: any, + passportNumber?: string, + passportUrl?: any, + gender?: boolean, + birthDate?: string, + phoneNumber?: string, + emergencyPhoneNumber?: string, + email?: string, + telegramId?: string, + postalAddress?: string, + avatarUrl?: any, + bankAccountNumber?: string, + bankAccountShebaNumber?: string, + bankAccountCardNumber?: string, + options?: any, + ) { + return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersIdPatch( + authorization, + id, + isCoordinator, + ngoId, + cityId, + typeId, + username, + password, + firstName, + lastName, + birthCertificateNumber, + idNumber, + idCardUrl, + passportNumber, + passportUrl, + gender, + birthDate, + phoneNumber, + emergencyPhoneNumber, + email, + telegramId, + postalAddress, + avatarUrl, + bankAccountNumber, + bankAccountShebaNumber, + bankAccountCardNumber, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Social Worker Page + * @param {string} authorization Access Token + * @param {number} [X_SKIP] + * @param {number} [X_TAKE] Max 50 + * @param {number} [swId] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SocialWorkerAPIApi + */ + public apiV2SocialworkersMyPageGet( + authorization: string, + X_SKIP?: number, + X_TAKE?: number, + swId?: number, + options?: any, + ) { + return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersMyPageGet( + authorization, + X_SKIP, + X_TAKE, + swId, + options, + )(this.fetch, this.basePath); + } + + /** + * Adds a social worker.
This API creates a row in social_worker table containing a new social worker information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber and bankAccountCardNumber is optional.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
+ * @summary add social worker + * @param {string} authorization Access Token + * @param {number} ngoId + * @param {number} typeId + * @param {boolean} isCoordinator + * @param {string} lastName + * @param {string} idNumber + * @param {boolean} gender + * @param {string} phoneNumber + * @param {string} emergencyPhoneNumber + * @param {string} email + * @param {string} telegramId + * @param {any} avatarUrl + * @param {number} [cityId] + * @param {string} [firstName] + * @param {string} [birthCertificateNumber] + * @param {any} [idCardUrl] + * @param {string} [passportNumber] + * @param {any} [passportUrl] + * @param {string} [birthDate] + * @param {string} [postalAddress] + * @param {string} [bankAccountNumber] + * @param {string} [bankAccountShebaNumber] + * @param {string} [bankAccountCardNumber] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SocialWorkerAPIApi + */ + public apiV2SocialworkersPost( + authorization: string, + ngoId: number, + typeId: number, + isCoordinator: boolean, + lastName: string, + idNumber: string, + gender: boolean, + phoneNumber: string, + emergencyPhoneNumber: string, + email: string, + telegramId: string, + avatarUrl: any, + cityId?: number, + firstName?: string, + birthCertificateNumber?: string, + idCardUrl?: any, + passportNumber?: string, + passportUrl?: any, + birthDate?: string, + postalAddress?: string, + bankAccountNumber?: string, + bankAccountShebaNumber?: string, + bankAccountCardNumber?: string, + options?: any, + ) { + return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersPost( + authorization, + ngoId, + typeId, + isCoordinator, + lastName, + idNumber, + gender, + phoneNumber, + emergencyPhoneNumber, + email, + telegramId, + avatarUrl, + cityId, + firstName, + birthCertificateNumber, + idCardUrl, + passportNumber, + passportUrl, + birthDate, + postalAddress, + bankAccountNumber, + bankAccountShebaNumber, + bankAccountCardNumber, + options, + )(this.fetch, this.basePath); + } + + /** + * Adds a social worker.
This API creates a row in social_worker table containing a new social worker information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber and bankAccountCardNumber is optional.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
+ * @summary add social worker + * @param {string} authorization Access Token + * @param {number} ngoId + * @param {number} typeId + * @param {boolean} isCoordinator + * @param {string} lastName + * @param {string} idNumber + * @param {boolean} gender + * @param {string} phoneNumber + * @param {string} emergencyPhoneNumber + * @param {string} email + * @param {string} telegramId + * @param {any} avatarUrl + * @param {number} [cityId] + * @param {string} [firstName] + * @param {string} [birthCertificateNumber] + * @param {any} [idCardUrl] + * @param {string} [passportNumber] + * @param {any} [passportUrl] + * @param {string} [birthDate] + * @param {string} [postalAddress] + * @param {string} [bankAccountNumber] + * @param {string} [bankAccountShebaNumber] + * @param {string} [bankAccountCardNumber] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SocialWorkerAPIApi + */ + public apiV2SocialworkersPost_2( + authorization: string, + ngoId: number, + typeId: number, + isCoordinator: boolean, + lastName: string, + idNumber: string, + gender: boolean, + phoneNumber: string, + emergencyPhoneNumber: string, + email: string, + telegramId: string, + avatarUrl: any, + cityId?: number, + firstName?: string, + birthCertificateNumber?: string, + idCardUrl?: any, + passportNumber?: string, + passportUrl?: any, + birthDate?: string, + postalAddress?: string, + bankAccountNumber?: string, + bankAccountShebaNumber?: string, + bankAccountCardNumber?: string, + options?: any, + ) { + return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersPost_2( + authorization, + ngoId, + typeId, + isCoordinator, + lastName, + idNumber, + gender, + phoneNumber, + emergencyPhoneNumber, + email, + telegramId, + avatarUrl, + cityId, + firstName, + birthCertificateNumber, + idCardUrl, + passportNumber, + passportUrl, + birthDate, + postalAddress, + bankAccountNumber, + bankAccountShebaNumber, + bankAccountCardNumber, + options, + )(this.fetch, this.basePath); + } +} /** - * SearchAPIApi - object-oriented interface + * UserAPIApi - fetch parameter creator * @export - * @class SearchAPIApi - * @extends {BaseAPI} */ -export class SearchAPIApi extends BaseAPI { +export const UserAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { /** - * - * @summary Random Search V2 - * @param {string} [authorization] Access Token + * Adds a user. Adding avatarUrl, emailAddress, gender, birthDate and birthPlace are optional.
For avatarUrl you have to upload a file in png, jpg or jpeg.
Be aware that city is integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities and the same rule is applied for birthPlace.
Calling this API only affects on user table.
For gender, [true] is male and [false] is female.
+ * @summary add a user + * @param {string} authorization Access Token + * @param {string} firstName + * @param {string} lastName + * @param {string} countryCode + * @param {number} city + * @param {string} userName + * @param {string} password + * @param {any} [avatarUrl] + * @param {string} [phoneNumber] + * @param {string} [emailAddress] + * @param {'female' | 'male' | 'other'} [gender] + * @param {number} [birthPlace] + * @param {string} [birthDate] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof SearchAPIApi */ - public apiV2SearchRandomPost(authorization?: string, options?: any) { - return SearchAPIApiFp(this.configuration).apiV2SearchRandomPost(authorization, options)(this.fetch, this.basePath); - } - + apiV2UserAddPost( + authorization: string, + firstName: string, + lastName: string, + countryCode: string, + city: number, + userName: string, + password: string, + avatarUrl?: any, + phoneNumber?: string, + emailAddress?: string, + gender?: 'female' | 'male' | 'other', + birthPlace?: number, + birthDate?: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2UserAddPost.', + ); + } + // verify required parameter 'firstName' is not null or undefined + if (firstName === null || firstName === undefined) { + throw new RequiredError( + 'firstName', + 'Required parameter firstName was null or undefined when calling apiV2UserAddPost.', + ); + } + // verify required parameter 'lastName' is not null or undefined + if (lastName === null || lastName === undefined) { + throw new RequiredError( + 'lastName', + 'Required parameter lastName was null or undefined when calling apiV2UserAddPost.', + ); + } + // verify required parameter 'countryCode' is not null or undefined + if (countryCode === null || countryCode === undefined) { + throw new RequiredError( + 'countryCode', + 'Required parameter countryCode was null or undefined when calling apiV2UserAddPost.', + ); + } + // verify required parameter 'city' is not null or undefined + if (city === null || city === undefined) { + throw new RequiredError( + 'city', + 'Required parameter city was null or undefined when calling apiV2UserAddPost.', + ); + } + // verify required parameter 'userName' is not null or undefined + if (userName === null || userName === undefined) { + throw new RequiredError( + 'userName', + 'Required parameter userName was null or undefined when calling apiV2UserAddPost.', + ); + } + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new RequiredError( + 'password', + 'Required parameter password was null or undefined when calling apiV2UserAddPost.', + ); + } + const localVarPath = `/api/v2/user/add`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (firstName !== undefined) { + localVarFormParams.set('firstName', firstName as any); + } + + if (lastName !== undefined) { + localVarFormParams.set('lastName', lastName as any); + } + + if (avatarUrl !== undefined) { + localVarFormParams.set('avatarUrl', avatarUrl as any); + } + + if (phoneNumber !== undefined) { + localVarFormParams.set('phoneNumber', phoneNumber as any); + } + + if (emailAddress !== undefined) { + localVarFormParams.set('emailAddress', emailAddress as any); + } + + if (gender !== undefined) { + localVarFormParams.set('gender', gender as any); + } + + if (countryCode !== undefined) { + localVarFormParams.set('countryCode', countryCode as any); + } + + if (city !== undefined) { + localVarFormParams.set('city', city as any); + } + + if (birthPlace !== undefined) { + localVarFormParams.set('birthPlace', birthPlace as any); + } + + if (birthDate !== undefined) { + localVarFormParams.set('birthDate', birthDate as any); + } + + if (userName !== undefined) { + localVarFormParams.set('userName', userName as any); + } + + if (password !== undefined) { + localVarFormParams.set('password', password as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** - * - * @summary say brain search + * Returns all children this user has.
Calling this API affects family, user_family, user, child_need, need and need_family tables.
+ * @summary get user children * @param {string} authorization Access Token + * @param {string} userId me or user_id * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof SearchAPIApi */ - public apiV2SearchSaybrainGet(authorization: string, options?: any) { - return SearchAPIApiFp(this.configuration).apiV2SearchSaybrainGet(authorization, options)(this.fetch, this.basePath); - } - + apiV2UserChildrenUserIduserIdGet( + authorization: string, + userId: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2UserChildrenUserIduserIdGet.', + ); + } + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError( + 'userId', + 'Required parameter userId was null or undefined when calling apiV2UserChildrenUserIduserIdGet.', + ); + } + const localVarPath = `/api/v2/user/children/userId={user_id}`.replace( + `{${'user_id'}}`, + encodeURIComponent(String(userId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** - * - * @summary Random Search V3 - * @param {string} [authorization] Access Token + * Deletes a user.
It also delete all impacts and occurrences of this user in whole database.
Deleting is managed by isDeleted tag everywhere, so we do not fully delete anything.
Calling this API affects user, need_family and user_family tables.
+ * @summary delete a user + * @param {string} authorization Access Token + * @param {string} userId me or user_id * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof SearchAPIApi */ - public apiV3SearchRandomPost(authorization?: string, options?: any) { - return SearchAPIApiFp(this.configuration).apiV3SearchRandomPost(authorization, options)(this.fetch, this.basePath); - } - -} - -/** - * SocialWorkerAPIApi - fetch parameter creator - * @export - */ -export const SocialWorkerAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * Returns information of all social workers in a json.
Json key is social worker id and json value is social worker object.
Calling this API only affects social_worker table by selecting rows from it.
- * @summary get all social workers - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersGet(authorization: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2SocialworkersGet.'); - } - const localVarPath = `/api/v2/socialworkers/`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns information of all social workers in a json.
Json key is social worker id and json value is social worker object.
Calling this API only affects social_worker table by selecting rows from it.
- * @summary get all social workers - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersGet_1(authorization: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2SocialworkersGet_1.'); - } - const localVarPath = `/api/v2/socialworkers`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Activates a deactive social worker.
Calling this API only affects social_worker table by updating a row.
- * @summary activate social worker - * @param {string} authorization Access Token - * @param {number} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdActivatePost(authorization: string, id: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2SocialworkersIdActivatePost.'); - } - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2SocialworkersIdActivatePost.'); - } - const localVarPath = `/api/v2/socialworkers/{id}/activate` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - *
- * @summary Migrate all children of sw to another - * @param {string} authorization Access Token - * @param {number} id - * @param {number} destinationSocialWorkerId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdChildrenMigratePost(authorization: string, id: number, destinationSocialWorkerId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2SocialworkersIdChildrenMigratePost.'); - } - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2SocialworkersIdChildrenMigratePost.'); - } - // verify required parameter 'destinationSocialWorkerId' is not null or undefined - if (destinationSocialWorkerId === null || destinationSocialWorkerId === undefined) { - throw new RequiredError('destinationSocialWorkerId', 'Required parameter destinationSocialWorkerId was null or undefined when calling apiV2SocialworkersIdChildrenMigratePost.'); - } - const localVarPath = `/api/v2/socialworkers/{id}/children/migrate` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (destinationSocialWorkerId !== undefined) { - localVarFormParams.set('destinationSocialWorkerId', destinationSocialWorkerId as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary List created needs of a social worker - * @param {string} authorization Access Token - * @param {number} id - * @param {number} [X_SKIP] - * @param {number} [X_TAKE] Max 500 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdCreatedNeedsGet(authorization: string, id: number, X_SKIP?: number, X_TAKE?: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2SocialworkersIdCreatedNeedsGet.'); - } - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2SocialworkersIdCreatedNeedsGet.'); - } - const localVarPath = `/api/v2/socialworkers/{id}/createdNeeds` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (X_SKIP !== undefined && X_SKIP !== null) { - localVarHeaderParameter['X_SKIP'] = String(X_SKIP); - } - - if (X_TAKE !== undefined && X_TAKE !== null) { - localVarHeaderParameter['X_TAKE'] = String(X_TAKE); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Deactivates an active social worker.
Calling this API only affects social_worker table by updating a row.
- * @summary deactivate social worker - * @param {string} authorization Access Token - * @param {number} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdDeactivatePost(authorization: string, id: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2SocialworkersIdDeactivatePost.'); - } - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2SocialworkersIdDeactivatePost.'); - } - const localVarPath = `/api/v2/socialworkers/{id}/deactivate` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Deletes a specific social worker.
Calling this API only affects social_worker table by updating a row and set isDeleted tag true.
We do not fully delete any rows.
- * @summary delete social worker - * @param {string} authorization Access Token - * @param {number} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdDelete(authorization: string, id: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2SocialworkersIdDelete.'); - } - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2SocialworkersIdDelete.'); - } - const localVarPath = `/api/v2/socialworkers/{id}` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'DELETE' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns information of an social worker with given id as a json object.
Calling this API only affects social_worker table by selecting a single row from it.
- * @summary get social worker by id - * @param {string} authorization Access Token - * @param {number} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdGet(authorization: string, id: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2SocialworkersIdGet.'); - } - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2SocialworkersIdGet.'); - } - const localVarPath = `/api/v2/socialworkers/{id}` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * All the fields are optional.
You can fill every field you want to change, and it will update the desired social worker.
Calling this API only affects social_worker table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
Social workers can change their NGO by editing ngo_id field.
- * @summary update social worker - * @param {string} authorization Access Token - * @param {number} id - * @param {boolean} isCoordinator - * @param {number} [ngoId] - * @param {number} [cityId] - * @param {number} [typeId] - * @param {string} [username] - * @param {string} [password] - * @param {string} [firstName] - * @param {string} [lastName] - * @param {string} [birthCertificateNumber] - * @param {string} [idNumber] - * @param {any} [idCardUrl] - * @param {string} [passportNumber] - * @param {any} [passportUrl] - * @param {boolean} [gender] - * @param {string} [birthDate] - * @param {string} [phoneNumber] - * @param {string} [emergencyPhoneNumber] - * @param {string} [email] - * @param {string} [telegramId] - * @param {string} [postalAddress] - * @param {any} [avatarUrl] - * @param {string} [bankAccountNumber] - * @param {string} [bankAccountShebaNumber] - * @param {string} [bankAccountCardNumber] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdPatch(authorization: string, id: number, isCoordinator: boolean, ngoId?: number, cityId?: number, typeId?: number, username?: string, password?: string, firstName?: string, lastName?: string, birthCertificateNumber?: string, idNumber?: string, idCardUrl?: any, passportNumber?: string, passportUrl?: any, gender?: boolean, birthDate?: string, phoneNumber?: string, emergencyPhoneNumber?: string, email?: string, telegramId?: string, postalAddress?: string, avatarUrl?: any, bankAccountNumber?: string, bankAccountShebaNumber?: string, bankAccountCardNumber?: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2SocialworkersIdPatch.'); - } - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2SocialworkersIdPatch.'); - } - // verify required parameter 'isCoordinator' is not null or undefined - if (isCoordinator === null || isCoordinator === undefined) { - throw new RequiredError('isCoordinator', 'Required parameter isCoordinator was null or undefined when calling apiV2SocialworkersIdPatch.'); - } - const localVarPath = `/api/v2/socialworkers/{id}` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (ngoId !== undefined) { - localVarFormParams.set('ngoId', ngoId as any); - } - - if (cityId !== undefined) { - localVarFormParams.set('cityId', cityId as any); - } - - if (typeId !== undefined) { - localVarFormParams.set('typeId', typeId as any); - } - - if (isCoordinator !== undefined) { - localVarFormParams.set('isCoordinator', isCoordinator as any); - } - - if (username !== undefined) { - localVarFormParams.set('username', username as any); - } - - if (password !== undefined) { - localVarFormParams.set('password', password as any); - } - - if (firstName !== undefined) { - localVarFormParams.set('firstName', firstName as any); - } - - if (lastName !== undefined) { - localVarFormParams.set('lastName', lastName as any); - } - - if (birthCertificateNumber !== undefined) { - localVarFormParams.set('birthCertificateNumber', birthCertificateNumber as any); - } - - if (idNumber !== undefined) { - localVarFormParams.set('idNumber', idNumber as any); - } - - if (idCardUrl !== undefined) { - localVarFormParams.set('idCardUrl', idCardUrl as any); - } - - if (passportNumber !== undefined) { - localVarFormParams.set('passportNumber', passportNumber as any); - } - - if (passportUrl !== undefined) { - localVarFormParams.set('passportUrl', passportUrl as any); - } - - if (gender !== undefined) { - localVarFormParams.set('gender', gender as any); - } - - if (birthDate !== undefined) { - localVarFormParams.set('birthDate', birthDate as any); - } - - if (phoneNumber !== undefined) { - localVarFormParams.set('phoneNumber', phoneNumber as any); - } - - if (emergencyPhoneNumber !== undefined) { - localVarFormParams.set('emergencyPhoneNumber', emergencyPhoneNumber as any); - } - - if (email !== undefined) { - localVarFormParams.set('email', email as any); - } - - if (telegramId !== undefined) { - localVarFormParams.set('telegramId', telegramId as any); - } - - if (postalAddress !== undefined) { - localVarFormParams.set('postalAddress', postalAddress as any); - } - - if (avatarUrl !== undefined) { - localVarFormParams.set('avatarUrl', avatarUrl as any); - } - - if (bankAccountNumber !== undefined) { - localVarFormParams.set('bankAccountNumber', bankAccountNumber as any); - } - - if (bankAccountShebaNumber !== undefined) { - localVarFormParams.set('bankAccountShebaNumber', bankAccountShebaNumber as any); - } - - if (bankAccountCardNumber !== undefined) { - localVarFormParams.set('bankAccountCardNumber', bankAccountCardNumber as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Adds a social worker.
This API creates a row in social_worker table containing a new social worker information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber and bankAccountCardNumber is optional.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
- * @summary add social worker - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {number} typeId - * @param {boolean} isCoordinator - * @param {string} lastName - * @param {string} idNumber - * @param {boolean} gender - * @param {string} phoneNumber - * @param {string} emergencyPhoneNumber - * @param {string} email - * @param {string} telegramId - * @param {any} avatarUrl - * @param {number} [cityId] - * @param {string} [firstName] - * @param {string} [birthCertificateNumber] - * @param {any} [idCardUrl] - * @param {string} [passportNumber] - * @param {any} [passportUrl] - * @param {string} [birthDate] - * @param {string} [postalAddress] - * @param {string} [bankAccountNumber] - * @param {string} [bankAccountShebaNumber] - * @param {string} [bankAccountCardNumber] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersPost(authorization: string, ngoId: number, typeId: number, isCoordinator: boolean, lastName: string, idNumber: string, gender: boolean, phoneNumber: string, emergencyPhoneNumber: string, email: string, telegramId: string, avatarUrl: any, cityId?: number, firstName?: string, birthCertificateNumber?: string, idCardUrl?: any, passportNumber?: string, passportUrl?: any, birthDate?: string, postalAddress?: string, bankAccountNumber?: string, bankAccountShebaNumber?: string, bankAccountCardNumber?: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2SocialworkersPost.'); - } - // verify required parameter 'ngoId' is not null or undefined - if (ngoId === null || ngoId === undefined) { - throw new RequiredError('ngoId', 'Required parameter ngoId was null or undefined when calling apiV2SocialworkersPost.'); - } - // verify required parameter 'typeId' is not null or undefined - if (typeId === null || typeId === undefined) { - throw new RequiredError('typeId', 'Required parameter typeId was null or undefined when calling apiV2SocialworkersPost.'); - } - // verify required parameter 'isCoordinator' is not null or undefined - if (isCoordinator === null || isCoordinator === undefined) { - throw new RequiredError('isCoordinator', 'Required parameter isCoordinator was null or undefined when calling apiV2SocialworkersPost.'); - } - // verify required parameter 'lastName' is not null or undefined - if (lastName === null || lastName === undefined) { - throw new RequiredError('lastName', 'Required parameter lastName was null or undefined when calling apiV2SocialworkersPost.'); - } - // verify required parameter 'idNumber' is not null or undefined - if (idNumber === null || idNumber === undefined) { - throw new RequiredError('idNumber', 'Required parameter idNumber was null or undefined when calling apiV2SocialworkersPost.'); - } - // verify required parameter 'gender' is not null or undefined - if (gender === null || gender === undefined) { - throw new RequiredError('gender', 'Required parameter gender was null or undefined when calling apiV2SocialworkersPost.'); - } - // verify required parameter 'phoneNumber' is not null or undefined - if (phoneNumber === null || phoneNumber === undefined) { - throw new RequiredError('phoneNumber', 'Required parameter phoneNumber was null or undefined when calling apiV2SocialworkersPost.'); - } - // verify required parameter 'emergencyPhoneNumber' is not null or undefined - if (emergencyPhoneNumber === null || emergencyPhoneNumber === undefined) { - throw new RequiredError('emergencyPhoneNumber', 'Required parameter emergencyPhoneNumber was null or undefined when calling apiV2SocialworkersPost.'); - } - // verify required parameter 'email' is not null or undefined - if (email === null || email === undefined) { - throw new RequiredError('email', 'Required parameter email was null or undefined when calling apiV2SocialworkersPost.'); - } - // verify required parameter 'telegramId' is not null or undefined - if (telegramId === null || telegramId === undefined) { - throw new RequiredError('telegramId', 'Required parameter telegramId was null or undefined when calling apiV2SocialworkersPost.'); - } - // verify required parameter 'avatarUrl' is not null or undefined - if (avatarUrl === null || avatarUrl === undefined) { - throw new RequiredError('avatarUrl', 'Required parameter avatarUrl was null or undefined when calling apiV2SocialworkersPost.'); - } - const localVarPath = `/api/v2/socialworkers/`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (ngoId !== undefined) { - localVarFormParams.set('ngoId', ngoId as any); - } - - if (cityId !== undefined) { - localVarFormParams.set('cityId', cityId as any); - } - - if (typeId !== undefined) { - localVarFormParams.set('typeId', typeId as any); - } - - if (isCoordinator !== undefined) { - localVarFormParams.set('isCoordinator', isCoordinator as any); - } - - if (firstName !== undefined) { - localVarFormParams.set('firstName', firstName as any); - } - - if (lastName !== undefined) { - localVarFormParams.set('lastName', lastName as any); - } - - if (birthCertificateNumber !== undefined) { - localVarFormParams.set('birthCertificateNumber', birthCertificateNumber as any); - } - - if (idNumber !== undefined) { - localVarFormParams.set('idNumber', idNumber as any); - } - - if (idCardUrl !== undefined) { - localVarFormParams.set('idCardUrl', idCardUrl as any); - } - - if (passportNumber !== undefined) { - localVarFormParams.set('passportNumber', passportNumber as any); - } - - if (passportUrl !== undefined) { - localVarFormParams.set('passportUrl', passportUrl as any); - } - - if (gender !== undefined) { - localVarFormParams.set('gender', gender as any); - } - - if (birthDate !== undefined) { - localVarFormParams.set('birthDate', birthDate as any); - } - - if (phoneNumber !== undefined) { - localVarFormParams.set('phoneNumber', phoneNumber as any); - } - - if (emergencyPhoneNumber !== undefined) { - localVarFormParams.set('emergencyPhoneNumber', emergencyPhoneNumber as any); - } - - if (email !== undefined) { - localVarFormParams.set('email', email as any); - } - - if (telegramId !== undefined) { - localVarFormParams.set('telegramId', telegramId as any); - } - - if (postalAddress !== undefined) { - localVarFormParams.set('postalAddress', postalAddress as any); - } - - if (avatarUrl !== undefined) { - localVarFormParams.set('avatarUrl', avatarUrl as any); - } - - if (bankAccountNumber !== undefined) { - localVarFormParams.set('bankAccountNumber', bankAccountNumber as any); - } - - if (bankAccountShebaNumber !== undefined) { - localVarFormParams.set('bankAccountShebaNumber', bankAccountShebaNumber as any); - } - - if (bankAccountCardNumber !== undefined) { - localVarFormParams.set('bankAccountCardNumber', bankAccountCardNumber as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Adds a social worker.
This API creates a row in social_worker table containing a new social worker information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber and bankAccountCardNumber is optional.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
- * @summary add social worker - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {number} typeId - * @param {boolean} isCoordinator - * @param {string} lastName - * @param {string} idNumber - * @param {boolean} gender - * @param {string} phoneNumber - * @param {string} emergencyPhoneNumber - * @param {string} email - * @param {string} telegramId - * @param {any} avatarUrl - * @param {number} [cityId] - * @param {string} [firstName] - * @param {string} [birthCertificateNumber] - * @param {any} [idCardUrl] - * @param {string} [passportNumber] - * @param {any} [passportUrl] - * @param {string} [birthDate] - * @param {string} [postalAddress] - * @param {string} [bankAccountNumber] - * @param {string} [bankAccountShebaNumber] - * @param {string} [bankAccountCardNumber] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersPost_2(authorization: string, ngoId: number, typeId: number, isCoordinator: boolean, lastName: string, idNumber: string, gender: boolean, phoneNumber: string, emergencyPhoneNumber: string, email: string, telegramId: string, avatarUrl: any, cityId?: number, firstName?: string, birthCertificateNumber?: string, idCardUrl?: any, passportNumber?: string, passportUrl?: any, birthDate?: string, postalAddress?: string, bankAccountNumber?: string, bankAccountShebaNumber?: string, bankAccountCardNumber?: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2SocialworkersPost_2.'); - } - // verify required parameter 'ngoId' is not null or undefined - if (ngoId === null || ngoId === undefined) { - throw new RequiredError('ngoId', 'Required parameter ngoId was null or undefined when calling apiV2SocialworkersPost_2.'); - } - // verify required parameter 'typeId' is not null or undefined - if (typeId === null || typeId === undefined) { - throw new RequiredError('typeId', 'Required parameter typeId was null or undefined when calling apiV2SocialworkersPost_2.'); - } - // verify required parameter 'isCoordinator' is not null or undefined - if (isCoordinator === null || isCoordinator === undefined) { - throw new RequiredError('isCoordinator', 'Required parameter isCoordinator was null or undefined when calling apiV2SocialworkersPost_2.'); - } - // verify required parameter 'lastName' is not null or undefined - if (lastName === null || lastName === undefined) { - throw new RequiredError('lastName', 'Required parameter lastName was null or undefined when calling apiV2SocialworkersPost_2.'); - } - // verify required parameter 'idNumber' is not null or undefined - if (idNumber === null || idNumber === undefined) { - throw new RequiredError('idNumber', 'Required parameter idNumber was null or undefined when calling apiV2SocialworkersPost_2.'); - } - // verify required parameter 'gender' is not null or undefined - if (gender === null || gender === undefined) { - throw new RequiredError('gender', 'Required parameter gender was null or undefined when calling apiV2SocialworkersPost_2.'); - } - // verify required parameter 'phoneNumber' is not null or undefined - if (phoneNumber === null || phoneNumber === undefined) { - throw new RequiredError('phoneNumber', 'Required parameter phoneNumber was null or undefined when calling apiV2SocialworkersPost_2.'); - } - // verify required parameter 'emergencyPhoneNumber' is not null or undefined - if (emergencyPhoneNumber === null || emergencyPhoneNumber === undefined) { - throw new RequiredError('emergencyPhoneNumber', 'Required parameter emergencyPhoneNumber was null or undefined when calling apiV2SocialworkersPost_2.'); - } - // verify required parameter 'email' is not null or undefined - if (email === null || email === undefined) { - throw new RequiredError('email', 'Required parameter email was null or undefined when calling apiV2SocialworkersPost_2.'); - } - // verify required parameter 'telegramId' is not null or undefined - if (telegramId === null || telegramId === undefined) { - throw new RequiredError('telegramId', 'Required parameter telegramId was null or undefined when calling apiV2SocialworkersPost_2.'); - } - // verify required parameter 'avatarUrl' is not null or undefined - if (avatarUrl === null || avatarUrl === undefined) { - throw new RequiredError('avatarUrl', 'Required parameter avatarUrl was null or undefined when calling apiV2SocialworkersPost_2.'); - } - const localVarPath = `/api/v2/socialworkers`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (ngoId !== undefined) { - localVarFormParams.set('ngoId', ngoId as any); - } - - if (cityId !== undefined) { - localVarFormParams.set('cityId', cityId as any); - } - - if (typeId !== undefined) { - localVarFormParams.set('typeId', typeId as any); - } - - if (isCoordinator !== undefined) { - localVarFormParams.set('isCoordinator', isCoordinator as any); - } - - if (firstName !== undefined) { - localVarFormParams.set('firstName', firstName as any); - } - - if (lastName !== undefined) { - localVarFormParams.set('lastName', lastName as any); - } - - if (birthCertificateNumber !== undefined) { - localVarFormParams.set('birthCertificateNumber', birthCertificateNumber as any); - } - - if (idNumber !== undefined) { - localVarFormParams.set('idNumber', idNumber as any); - } - - if (idCardUrl !== undefined) { - localVarFormParams.set('idCardUrl', idCardUrl as any); - } - - if (passportNumber !== undefined) { - localVarFormParams.set('passportNumber', passportNumber as any); - } - - if (passportUrl !== undefined) { - localVarFormParams.set('passportUrl', passportUrl as any); - } - - if (gender !== undefined) { - localVarFormParams.set('gender', gender as any); - } - - if (birthDate !== undefined) { - localVarFormParams.set('birthDate', birthDate as any); - } - - if (phoneNumber !== undefined) { - localVarFormParams.set('phoneNumber', phoneNumber as any); - } - - if (emergencyPhoneNumber !== undefined) { - localVarFormParams.set('emergencyPhoneNumber', emergencyPhoneNumber as any); - } - - if (email !== undefined) { - localVarFormParams.set('email', email as any); - } - - if (telegramId !== undefined) { - localVarFormParams.set('telegramId', telegramId as any); - } - - if (postalAddress !== undefined) { - localVarFormParams.set('postalAddress', postalAddress as any); - } - - if (avatarUrl !== undefined) { - localVarFormParams.set('avatarUrl', avatarUrl as any); - } - - if (bankAccountNumber !== undefined) { - localVarFormParams.set('bankAccountNumber', bankAccountNumber as any); - } - - if (bankAccountShebaNumber !== undefined) { - localVarFormParams.set('bankAccountShebaNumber', bankAccountShebaNumber as any); - } - - if (bankAccountCardNumber !== undefined) { - localVarFormParams.set('bankAccountCardNumber', bankAccountCardNumber as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * SocialWorkerAPIApi - functional programming interface - * @export - */ -export const SocialWorkerAPIApiFp = function (configuration?: Configuration) { - return { - /** - * Returns information of all social workers in a json.
Json key is social worker id and json value is social worker object.
Calling this API only affects social_worker table by selecting rows from it.
- * @summary get all social workers - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersGet(authorization: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { - const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator(configuration).apiV2SocialworkersGet(authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Returns information of all social workers in a json.
Json key is social worker id and json value is social worker object.
Calling this API only affects social_worker table by selecting rows from it.
- * @summary get all social workers - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersGet_1(authorization: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { - const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator(configuration).apiV2SocialworkersGet_1(authorization, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Activates a deactive social worker.
Calling this API only affects social_worker table by updating a row.
- * @summary activate social worker - * @param {string} authorization Access Token - * @param {number} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdActivatePost(authorization: string, id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator(configuration).apiV2SocialworkersIdActivatePost(authorization, id, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - *
- * @summary Migrate all children of sw to another - * @param {string} authorization Access Token - * @param {number} id - * @param {number} destinationSocialWorkerId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdChildrenMigratePost(authorization: string, id: number, destinationSocialWorkerId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator(configuration).apiV2SocialworkersIdChildrenMigratePost(authorization, id, destinationSocialWorkerId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary List created needs of a social worker - * @param {string} authorization Access Token - * @param {number} id - * @param {number} [X_SKIP] - * @param {number} [X_TAKE] Max 500 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdCreatedNeedsGet(authorization: string, id: number, X_SKIP?: number, X_TAKE?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { - const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator(configuration).apiV2SocialworkersIdCreatedNeedsGet(authorization, id, X_SKIP, X_TAKE, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Deactivates an active social worker.
Calling this API only affects social_worker table by updating a row.
- * @summary deactivate social worker - * @param {string} authorization Access Token - * @param {number} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdDeactivatePost(authorization: string, id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator(configuration).apiV2SocialworkersIdDeactivatePost(authorization, id, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * Deletes a specific social worker.
Calling this API only affects social_worker table by updating a row and set isDeleted tag true.
We do not fully delete any rows.
- * @summary delete social worker - * @param {string} authorization Access Token - * @param {number} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdDelete(authorization: string, id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator(configuration).apiV2SocialworkersIdDelete(authorization, id, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * Returns information of an social worker with given id as a json object.
Calling this API only affects social_worker table by selecting a single row from it.
- * @summary get social worker by id - * @param {string} authorization Access Token - * @param {number} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdGet(authorization: string, id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator(configuration).apiV2SocialworkersIdGet(authorization, id, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * All the fields are optional.
You can fill every field you want to change, and it will update the desired social worker.
Calling this API only affects social_worker table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
Social workers can change their NGO by editing ngo_id field.
- * @summary update social worker - * @param {string} authorization Access Token - * @param {number} id - * @param {boolean} isCoordinator - * @param {number} [ngoId] - * @param {number} [cityId] - * @param {number} [typeId] - * @param {string} [username] - * @param {string} [password] - * @param {string} [firstName] - * @param {string} [lastName] - * @param {string} [birthCertificateNumber] - * @param {string} [idNumber] - * @param {any} [idCardUrl] - * @param {string} [passportNumber] - * @param {any} [passportUrl] - * @param {boolean} [gender] - * @param {string} [birthDate] - * @param {string} [phoneNumber] - * @param {string} [emergencyPhoneNumber] - * @param {string} [email] - * @param {string} [telegramId] - * @param {string} [postalAddress] - * @param {any} [avatarUrl] - * @param {string} [bankAccountNumber] - * @param {string} [bankAccountShebaNumber] - * @param {string} [bankAccountCardNumber] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdPatch(authorization: string, id: number, isCoordinator: boolean, ngoId?: number, cityId?: number, typeId?: number, username?: string, password?: string, firstName?: string, lastName?: string, birthCertificateNumber?: string, idNumber?: string, idCardUrl?: any, passportNumber?: string, passportUrl?: any, gender?: boolean, birthDate?: string, phoneNumber?: string, emergencyPhoneNumber?: string, email?: string, telegramId?: string, postalAddress?: string, avatarUrl?: any, bankAccountNumber?: string, bankAccountShebaNumber?: string, bankAccountCardNumber?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator(configuration).apiV2SocialworkersIdPatch(authorization, id, isCoordinator, ngoId, cityId, typeId, username, password, firstName, lastName, birthCertificateNumber, idNumber, idCardUrl, passportNumber, passportUrl, gender, birthDate, phoneNumber, emergencyPhoneNumber, email, telegramId, postalAddress, avatarUrl, bankAccountNumber, bankAccountShebaNumber, bankAccountCardNumber, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Adds a social worker.
This API creates a row in social_worker table containing a new social worker information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber and bankAccountCardNumber is optional.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
- * @summary add social worker - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {number} typeId - * @param {boolean} isCoordinator - * @param {string} lastName - * @param {string} idNumber - * @param {boolean} gender - * @param {string} phoneNumber - * @param {string} emergencyPhoneNumber - * @param {string} email - * @param {string} telegramId - * @param {any} avatarUrl - * @param {number} [cityId] - * @param {string} [firstName] - * @param {string} [birthCertificateNumber] - * @param {any} [idCardUrl] - * @param {string} [passportNumber] - * @param {any} [passportUrl] - * @param {string} [birthDate] - * @param {string} [postalAddress] - * @param {string} [bankAccountNumber] - * @param {string} [bankAccountShebaNumber] - * @param {string} [bankAccountCardNumber] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersPost(authorization: string, ngoId: number, typeId: number, isCoordinator: boolean, lastName: string, idNumber: string, gender: boolean, phoneNumber: string, emergencyPhoneNumber: string, email: string, telegramId: string, avatarUrl: any, cityId?: number, firstName?: string, birthCertificateNumber?: string, idCardUrl?: any, passportNumber?: string, passportUrl?: any, birthDate?: string, postalAddress?: string, bankAccountNumber?: string, bankAccountShebaNumber?: string, bankAccountCardNumber?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator(configuration).apiV2SocialworkersPost(authorization, ngoId, typeId, isCoordinator, lastName, idNumber, gender, phoneNumber, emergencyPhoneNumber, email, telegramId, avatarUrl, cityId, firstName, birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber, bankAccountCardNumber, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Adds a social worker.
This API creates a row in social_worker table containing a new social worker information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber and bankAccountCardNumber is optional.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
- * @summary add social worker - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {number} typeId - * @param {boolean} isCoordinator - * @param {string} lastName - * @param {string} idNumber - * @param {boolean} gender - * @param {string} phoneNumber - * @param {string} emergencyPhoneNumber - * @param {string} email - * @param {string} telegramId - * @param {any} avatarUrl - * @param {number} [cityId] - * @param {string} [firstName] - * @param {string} [birthCertificateNumber] - * @param {any} [idCardUrl] - * @param {string} [passportNumber] - * @param {any} [passportUrl] - * @param {string} [birthDate] - * @param {string} [postalAddress] - * @param {string} [bankAccountNumber] - * @param {string} [bankAccountShebaNumber] - * @param {string} [bankAccountCardNumber] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersPost_2(authorization: string, ngoId: number, typeId: number, isCoordinator: boolean, lastName: string, idNumber: string, gender: boolean, phoneNumber: string, emergencyPhoneNumber: string, email: string, telegramId: string, avatarUrl: any, cityId?: number, firstName?: string, birthCertificateNumber?: string, idCardUrl?: any, passportNumber?: string, passportUrl?: any, birthDate?: string, postalAddress?: string, bankAccountNumber?: string, bankAccountShebaNumber?: string, bankAccountCardNumber?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = SocialWorkerAPIApiFetchParamCreator(configuration).apiV2SocialworkersPost_2(authorization, ngoId, typeId, isCoordinator, lastName, idNumber, gender, phoneNumber, emergencyPhoneNumber, email, telegramId, avatarUrl, cityId, firstName, birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber, bankAccountCardNumber, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - } -}; - -/** - * SocialWorkerAPIApi - factory interface - * @export - */ -export const SocialWorkerAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * Returns information of all social workers in a json.
Json key is social worker id and json value is social worker object.
Calling this API only affects social_worker table by selecting rows from it.
- * @summary get all social workers - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersGet(authorization: string, options?: any) { - return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersGet(authorization, options)(fetch, basePath); - }, - /** - * Returns information of all social workers in a json.
Json key is social worker id and json value is social worker object.
Calling this API only affects social_worker table by selecting rows from it.
- * @summary get all social workers - * @param {string} authorization Access Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersGet_1(authorization: string, options?: any) { - return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersGet_1(authorization, options)(fetch, basePath); - }, - /** - * Activates a deactive social worker.
Calling this API only affects social_worker table by updating a row.
- * @summary activate social worker - * @param {string} authorization Access Token - * @param {number} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdActivatePost(authorization: string, id: number, options?: any) { - return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersIdActivatePost(authorization, id, options)(fetch, basePath); - }, - /** - *
- * @summary Migrate all children of sw to another - * @param {string} authorization Access Token - * @param {number} id - * @param {number} destinationSocialWorkerId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdChildrenMigratePost(authorization: string, id: number, destinationSocialWorkerId: number, options?: any) { - return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersIdChildrenMigratePost(authorization, id, destinationSocialWorkerId, options)(fetch, basePath); - }, - /** - * - * @summary List created needs of a social worker - * @param {string} authorization Access Token - * @param {number} id - * @param {number} [X_SKIP] - * @param {number} [X_TAKE] Max 500 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdCreatedNeedsGet(authorization: string, id: number, X_SKIP?: number, X_TAKE?: number, options?: any) { - return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersIdCreatedNeedsGet(authorization, id, X_SKIP, X_TAKE, options)(fetch, basePath); - }, - /** - * Deactivates an active social worker.
Calling this API only affects social_worker table by updating a row.
- * @summary deactivate social worker - * @param {string} authorization Access Token - * @param {number} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdDeactivatePost(authorization: string, id: number, options?: any) { - return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersIdDeactivatePost(authorization, id, options)(fetch, basePath); - }, - /** - * Deletes a specific social worker.
Calling this API only affects social_worker table by updating a row and set isDeleted tag true.
We do not fully delete any rows.
- * @summary delete social worker - * @param {string} authorization Access Token - * @param {number} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdDelete(authorization: string, id: number, options?: any) { - return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersIdDelete(authorization, id, options)(fetch, basePath); - }, - /** - * Returns information of an social worker with given id as a json object.
Calling this API only affects social_worker table by selecting a single row from it.
- * @summary get social worker by id - * @param {string} authorization Access Token - * @param {number} id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdGet(authorization: string, id: number, options?: any) { - return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersIdGet(authorization, id, options)(fetch, basePath); - }, - /** - * All the fields are optional.
You can fill every field you want to change, and it will update the desired social worker.
Calling this API only affects social_worker table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
Social workers can change their NGO by editing ngo_id field.
- * @summary update social worker - * @param {string} authorization Access Token - * @param {number} id - * @param {boolean} isCoordinator - * @param {number} [ngoId] - * @param {number} [cityId] - * @param {number} [typeId] - * @param {string} [username] - * @param {string} [password] - * @param {string} [firstName] - * @param {string} [lastName] - * @param {string} [birthCertificateNumber] - * @param {string} [idNumber] - * @param {any} [idCardUrl] - * @param {string} [passportNumber] - * @param {any} [passportUrl] - * @param {boolean} [gender] - * @param {string} [birthDate] - * @param {string} [phoneNumber] - * @param {string} [emergencyPhoneNumber] - * @param {string} [email] - * @param {string} [telegramId] - * @param {string} [postalAddress] - * @param {any} [avatarUrl] - * @param {string} [bankAccountNumber] - * @param {string} [bankAccountShebaNumber] - * @param {string} [bankAccountCardNumber] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersIdPatch(authorization: string, id: number, isCoordinator: boolean, ngoId?: number, cityId?: number, typeId?: number, username?: string, password?: string, firstName?: string, lastName?: string, birthCertificateNumber?: string, idNumber?: string, idCardUrl?: any, passportNumber?: string, passportUrl?: any, gender?: boolean, birthDate?: string, phoneNumber?: string, emergencyPhoneNumber?: string, email?: string, telegramId?: string, postalAddress?: string, avatarUrl?: any, bankAccountNumber?: string, bankAccountShebaNumber?: string, bankAccountCardNumber?: string, options?: any) { - return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersIdPatch(authorization, id, isCoordinator, ngoId, cityId, typeId, username, password, firstName, lastName, birthCertificateNumber, idNumber, idCardUrl, passportNumber, passportUrl, gender, birthDate, phoneNumber, emergencyPhoneNumber, email, telegramId, postalAddress, avatarUrl, bankAccountNumber, bankAccountShebaNumber, bankAccountCardNumber, options)(fetch, basePath); - }, - /** - * Adds a social worker.
This API creates a row in social_worker table containing a new social worker information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber and bankAccountCardNumber is optional.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
- * @summary add social worker - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {number} typeId - * @param {boolean} isCoordinator - * @param {string} lastName - * @param {string} idNumber - * @param {boolean} gender - * @param {string} phoneNumber - * @param {string} emergencyPhoneNumber - * @param {string} email - * @param {string} telegramId - * @param {any} avatarUrl - * @param {number} [cityId] - * @param {string} [firstName] - * @param {string} [birthCertificateNumber] - * @param {any} [idCardUrl] - * @param {string} [passportNumber] - * @param {any} [passportUrl] - * @param {string} [birthDate] - * @param {string} [postalAddress] - * @param {string} [bankAccountNumber] - * @param {string} [bankAccountShebaNumber] - * @param {string} [bankAccountCardNumber] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersPost(authorization: string, ngoId: number, typeId: number, isCoordinator: boolean, lastName: string, idNumber: string, gender: boolean, phoneNumber: string, emergencyPhoneNumber: string, email: string, telegramId: string, avatarUrl: any, cityId?: number, firstName?: string, birthCertificateNumber?: string, idCardUrl?: any, passportNumber?: string, passportUrl?: any, birthDate?: string, postalAddress?: string, bankAccountNumber?: string, bankAccountShebaNumber?: string, bankAccountCardNumber?: string, options?: any) { - return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersPost(authorization, ngoId, typeId, isCoordinator, lastName, idNumber, gender, phoneNumber, emergencyPhoneNumber, email, telegramId, avatarUrl, cityId, firstName, birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber, bankAccountCardNumber, options)(fetch, basePath); - }, - /** - * Adds a social worker.
This API creates a row in social_worker table containing a new social worker information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber and bankAccountCardNumber is optional.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
- * @summary add social worker - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {number} typeId - * @param {boolean} isCoordinator - * @param {string} lastName - * @param {string} idNumber - * @param {boolean} gender - * @param {string} phoneNumber - * @param {string} emergencyPhoneNumber - * @param {string} email - * @param {string} telegramId - * @param {any} avatarUrl - * @param {number} [cityId] - * @param {string} [firstName] - * @param {string} [birthCertificateNumber] - * @param {any} [idCardUrl] - * @param {string} [passportNumber] - * @param {any} [passportUrl] - * @param {string} [birthDate] - * @param {string} [postalAddress] - * @param {string} [bankAccountNumber] - * @param {string} [bankAccountShebaNumber] - * @param {string} [bankAccountCardNumber] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2SocialworkersPost_2(authorization: string, ngoId: number, typeId: number, isCoordinator: boolean, lastName: string, idNumber: string, gender: boolean, phoneNumber: string, emergencyPhoneNumber: string, email: string, telegramId: string, avatarUrl: any, cityId?: number, firstName?: string, birthCertificateNumber?: string, idCardUrl?: any, passportNumber?: string, passportUrl?: any, birthDate?: string, postalAddress?: string, bankAccountNumber?: string, bankAccountShebaNumber?: string, bankAccountCardNumber?: string, options?: any) { - return SocialWorkerAPIApiFp(configuration).apiV2SocialworkersPost_2(authorization, ngoId, typeId, isCoordinator, lastName, idNumber, gender, phoneNumber, emergencyPhoneNumber, email, telegramId, avatarUrl, cityId, firstName, birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber, bankAccountCardNumber, options)(fetch, basePath); - }, - }; -}; - -/** - * SocialWorkerAPIApi - object-oriented interface - * @export - * @class SocialWorkerAPIApi - * @extends {BaseAPI} - */ -export class SocialWorkerAPIApi extends BaseAPI { + apiV2UserDeleteUserIduserIdPatch( + authorization: string, + userId: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2UserDeleteUserIduserIdPatch.', + ); + } + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError( + 'userId', + 'Required parameter userId was null or undefined when calling apiV2UserDeleteUserIduserIdPatch.', + ); + } + const localVarPath = `/api/v2/user/delete/userId={user_id}`.replace( + `{${'user_id'}}`, + encodeURIComponent(String(userId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** - * Returns information of all social workers in a json.
Json key is social worker id and json value is social worker object.
Calling this API only affects social_worker table by selecting rows from it.
- * @summary get all social workers + * Returns user's role in a specific family.
+ * @summary get user role * @param {string} authorization Access Token + * @param {string} userId me or user_id + * @param {number} childId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof SocialWorkerAPIApi */ - public apiV2SocialworkersGet(authorization: string, options?: any) { - return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersGet(authorization, options)(this.fetch, this.basePath); - } - + apiV2UserRoleUserIduserIdchildIdchildIdGet( + authorization: string, + userId: string, + childId: number, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2UserRoleUserIduserIdchildIdchildIdGet.', + ); + } + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError( + 'userId', + 'Required parameter userId was null or undefined when calling apiV2UserRoleUserIduserIdchildIdchildIdGet.', + ); + } + // verify required parameter 'childId' is not null or undefined + if (childId === null || childId === undefined) { + throw new RequiredError( + 'childId', + 'Required parameter childId was null or undefined when calling apiV2UserRoleUserIduserIdchildIdchildIdGet.', + ); + } + const localVarPath = + `/api/v2/user/role/userId={user_id}&childId={child_id}` + .replace(`{${'user_id'}}`, encodeURIComponent(String(userId))) + .replace(`{${'child_id'}}`, encodeURIComponent(String(childId))); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** - * Returns information of all social workers in a json.
Json key is social worker id and json value is social worker object.
Calling this API only affects social_worker table by selecting rows from it.
- * @summary get all social workers + * + * @summary Search in users * @param {string} authorization Access Token + * @param {string} q * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof SocialWorkerAPIApi */ - public apiV2SocialworkersGet_1(authorization: string, options?: any) { - return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersGet_1(authorization, options)(this.fetch, this.basePath); - } - + apiV2UserSearchGet( + authorization: string, + q: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2UserSearchGet.', + ); + } + // verify required parameter 'q' is not null or undefined + if (q === null || q === undefined) { + throw new RequiredError( + 'q', + 'Required parameter q was null or undefined when calling apiV2UserSearchGet.', + ); + } + const localVarPath = `/api/v2/user/search`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (q !== undefined) { + localVarQueryParameter['q'] = q; + } + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Updates a user information.
All the fields are optional.
For avatarUrl you have to upload a file in png, jpg or jpeg.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities and the same rule is applied for birthPlace.
Calling this API only affects on user table.
For gender, [true] is male and [false] is female.
+ * @summary update a user + * @param {string} authorization Access Token + * @param {string} userId me or user_id + * @param {string} [firstName] + * @param {string} [lastName] + * @param {any} [avatarUrl] + * @param {string} [phoneNumber] + * @param {string} [emailAddress] + * @param {string} [postalAddress] + * @param {string} [postalCode] + * @param {'female' | 'male' | 'other'} [gender] + * @param {string} [countryCode] + * @param {number} [city] + * @param {number} [birthPlace] + * @param {string} [birthDate] + * @param {string} [userName] + * @param {string} [password] + * @param {string} [locale] en or fa + * @param {boolean} [receiveEmail] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2UserUpdateUserIduserIdPatch( + authorization: string, + userId: string, + firstName?: string, + lastName?: string, + avatarUrl?: any, + phoneNumber?: string, + emailAddress?: string, + postalAddress?: string, + postalCode?: string, + gender?: 'female' | 'male' | 'other', + countryCode?: string, + city?: number, + birthPlace?: number, + birthDate?: string, + userName?: string, + password?: string, + locale?: string, + receiveEmail?: boolean, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2UserUpdateUserIduserIdPatch.', + ); + } + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError( + 'userId', + 'Required parameter userId was null or undefined when calling apiV2UserUpdateUserIduserIdPatch.', + ); + } + const localVarPath = `/api/v2/user/update/userId={user_id}`.replace( + `{${'user_id'}}`, + encodeURIComponent(String(userId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + if (firstName !== undefined) { + localVarFormParams.set('firstName', firstName as any); + } + + if (lastName !== undefined) { + localVarFormParams.set('lastName', lastName as any); + } + + if (avatarUrl !== undefined) { + localVarFormParams.set('avatarUrl', avatarUrl as any); + } + + if (phoneNumber !== undefined) { + localVarFormParams.set('phoneNumber', phoneNumber as any); + } + + if (emailAddress !== undefined) { + localVarFormParams.set('emailAddress', emailAddress as any); + } + + if (postalAddress !== undefined) { + localVarFormParams.set('postal_address', postalAddress as any); + } + + if (postalCode !== undefined) { + localVarFormParams.set('postal_code', postalCode as any); + } + + if (gender !== undefined) { + localVarFormParams.set('gender', gender as any); + } + + if (countryCode !== undefined) { + localVarFormParams.set('countryCode', countryCode as any); + } + + if (city !== undefined) { + localVarFormParams.set('city', city as any); + } + + if (birthPlace !== undefined) { + localVarFormParams.set('birthPlace', birthPlace as any); + } + + if (birthDate !== undefined) { + localVarFormParams.set('birthDate', birthDate as any); + } + + if (userName !== undefined) { + localVarFormParams.set('userName', userName as any); + } + + if (password !== undefined) { + localVarFormParams.set('password', password as any); + } + + if (locale !== undefined) { + localVarFormParams.set('locale', locale as any); + } + + if (receiveEmail !== undefined) { + localVarFormParams.set('receiveEmail', receiveEmail as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** - * Activates a deactive social worker.
Calling this API only affects social_worker table by updating a row.
- * @summary activate social worker + * Returns information of a user with given id as a json object.
Calling this API affects child, need, child_need and need_family and user tables.
It contains user info, its children and those children's needs.
+ * @summary get user by id * @param {string} authorization Access Token - * @param {number} id + * @param {string} userId me or user_id * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof SocialWorkerAPIApi */ - public apiV2SocialworkersIdActivatePost(authorization: string, id: number, options?: any) { - return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersIdActivatePost(authorization, id, options)(this.fetch, this.basePath); - } + apiV2UserUserIduserIdGet( + authorization: string, + userId: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'authorization' is not null or undefined + if (authorization === null || authorization === undefined) { + throw new RequiredError( + 'authorization', + 'Required parameter authorization was null or undefined when calling apiV2UserUserIduserIdGet.', + ); + } + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError( + 'userId', + 'Required parameter userId was null or undefined when calling apiV2UserUserIduserIdGet.', + ); + } + const localVarPath = `/api/v2/user/userId={user_id}`.replace( + `{${'user_id'}}`, + encodeURIComponent(String(userId)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization !== undefined && authorization !== null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; +/** + * UserAPIApi - functional programming interface + * @export + */ +export const UserAPIApiFp = function (configuration?: Configuration) { + return { /** - *
- * @summary Migrate all children of sw to another + * Adds a user. Adding avatarUrl, emailAddress, gender, birthDate and birthPlace are optional.
For avatarUrl you have to upload a file in png, jpg or jpeg.
Be aware that city is integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities and the same rule is applied for birthPlace.
Calling this API only affects on user table.
For gender, [true] is male and [false] is female.
+ * @summary add a user * @param {string} authorization Access Token - * @param {number} id - * @param {number} destinationSocialWorkerId + * @param {string} firstName + * @param {string} lastName + * @param {string} countryCode + * @param {number} city + * @param {string} userName + * @param {string} password + * @param {any} [avatarUrl] + * @param {string} [phoneNumber] + * @param {string} [emailAddress] + * @param {'female' | 'male' | 'other'} [gender] + * @param {number} [birthPlace] + * @param {string} [birthDate] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof SocialWorkerAPIApi */ - public apiV2SocialworkersIdChildrenMigratePost(authorization: string, id: number, destinationSocialWorkerId: number, options?: any) { - return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersIdChildrenMigratePost(authorization, id, destinationSocialWorkerId, options)(this.fetch, this.basePath); - } - + apiV2UserAddPost( + authorization: string, + firstName: string, + lastName: string, + countryCode: string, + city: number, + userName: string, + password: string, + avatarUrl?: any, + phoneNumber?: string, + emailAddress?: string, + gender?: 'female' | 'male' | 'other', + birthPlace?: number, + birthDate?: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UserAPIApiFetchParamCreator( + configuration, + ).apiV2UserAddPost( + authorization, + firstName, + lastName, + countryCode, + city, + userName, + password, + avatarUrl, + phoneNumber, + emailAddress, + gender, + birthPlace, + birthDate, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, /** - * - * @summary List created needs of a social worker + * Returns all children this user has.
Calling this API affects family, user_family, user, child_need, need and need_family tables.
+ * @summary get user children * @param {string} authorization Access Token - * @param {number} id - * @param {number} [X_SKIP] - * @param {number} [X_TAKE] Max 500 + * @param {string} userId me or user_id * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof SocialWorkerAPIApi */ - public apiV2SocialworkersIdCreatedNeedsGet(authorization: string, id: number, X_SKIP?: number, X_TAKE?: number, options?: any) { - return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersIdCreatedNeedsGet(authorization, id, X_SKIP, X_TAKE, options)(this.fetch, this.basePath); - } - + apiV2UserChildrenUserIduserIdGet( + authorization: string, + userId: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UserAPIApiFetchParamCreator( + configuration, + ).apiV2UserChildrenUserIduserIdGet(authorization, userId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** - * Deactivates an active social worker.
Calling this API only affects social_worker table by updating a row.
- * @summary deactivate social worker + * Deletes a user.
It also delete all impacts and occurrences of this user in whole database.
Deleting is managed by isDeleted tag everywhere, so we do not fully delete anything.
Calling this API affects user, need_family and user_family tables.
+ * @summary delete a user * @param {string} authorization Access Token - * @param {number} id + * @param {string} userId me or user_id * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof SocialWorkerAPIApi */ - public apiV2SocialworkersIdDeactivatePost(authorization: string, id: number, options?: any) { - return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersIdDeactivatePost(authorization, id, options)(this.fetch, this.basePath); - } - + apiV2UserDeleteUserIduserIdPatch( + authorization: string, + userId: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UserAPIApiFetchParamCreator( + configuration, + ).apiV2UserDeleteUserIduserIdPatch(authorization, userId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, /** - * Deletes a specific social worker.
Calling this API only affects social_worker table by updating a row and set isDeleted tag true.
We do not fully delete any rows.
- * @summary delete social worker + * Returns user's role in a specific family.
+ * @summary get user role * @param {string} authorization Access Token - * @param {number} id + * @param {string} userId me or user_id + * @param {number} childId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof SocialWorkerAPIApi */ - public apiV2SocialworkersIdDelete(authorization: string, id: number, options?: any) { - return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersIdDelete(authorization, id, options)(this.fetch, this.basePath); - } - + apiV2UserRoleUserIduserIdchildIdchildIdGet( + authorization: string, + userId: string, + childId: number, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UserAPIApiFetchParamCreator( + configuration, + ).apiV2UserRoleUserIduserIdchildIdchildIdGet( + authorization, + userId, + childId, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** - * Returns information of an social worker with given id as a json object.
Calling this API only affects social_worker table by selecting a single row from it.
- * @summary get social worker by id + * + * @summary Search in users * @param {string} authorization Access Token - * @param {number} id + * @param {string} q * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof SocialWorkerAPIApi */ - public apiV2SocialworkersIdGet(authorization: string, id: number, options?: any) { - return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersIdGet(authorization, id, options)(this.fetch, this.basePath); - } - - /** - * All the fields are optional.
You can fill every field you want to change, and it will update the desired social worker.
Calling this API only affects social_worker table by updating a row.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
Social workers can change their NGO by editing ngo_id field.
- * @summary update social worker + apiV2UserSearchGet( + authorization: string, + q: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UserAPIApiFetchParamCreator( + configuration, + ).apiV2UserSearchGet(authorization, q, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * Updates a user information.
All the fields are optional.
For avatarUrl you have to upload a file in png, jpg or jpeg.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities and the same rule is applied for birthPlace.
Calling this API only affects on user table.
For gender, [true] is male and [false] is female.
+ * @summary update a user * @param {string} authorization Access Token - * @param {number} id - * @param {boolean} isCoordinator - * @param {number} [ngoId] - * @param {number} [cityId] - * @param {number} [typeId] - * @param {string} [username] - * @param {string} [password] + * @param {string} userId me or user_id * @param {string} [firstName] * @param {string} [lastName] - * @param {string} [birthCertificateNumber] - * @param {string} [idNumber] - * @param {any} [idCardUrl] - * @param {string} [passportNumber] - * @param {any} [passportUrl] - * @param {boolean} [gender] - * @param {string} [birthDate] + * @param {any} [avatarUrl] * @param {string} [phoneNumber] - * @param {string} [emergencyPhoneNumber] - * @param {string} [email] - * @param {string} [telegramId] + * @param {string} [emailAddress] * @param {string} [postalAddress] - * @param {any} [avatarUrl] - * @param {string} [bankAccountNumber] - * @param {string} [bankAccountShebaNumber] - * @param {string} [bankAccountCardNumber] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof SocialWorkerAPIApi - */ - public apiV2SocialworkersIdPatch(authorization: string, id: number, isCoordinator: boolean, ngoId?: number, cityId?: number, typeId?: number, username?: string, password?: string, firstName?: string, lastName?: string, birthCertificateNumber?: string, idNumber?: string, idCardUrl?: any, passportNumber?: string, passportUrl?: any, gender?: boolean, birthDate?: string, phoneNumber?: string, emergencyPhoneNumber?: string, email?: string, telegramId?: string, postalAddress?: string, avatarUrl?: any, bankAccountNumber?: string, bankAccountShebaNumber?: string, bankAccountCardNumber?: string, options?: any) { - return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersIdPatch(authorization, id, isCoordinator, ngoId, cityId, typeId, username, password, firstName, lastName, birthCertificateNumber, idNumber, idCardUrl, passportNumber, passportUrl, gender, birthDate, phoneNumber, emergencyPhoneNumber, email, telegramId, postalAddress, avatarUrl, bankAccountNumber, bankAccountShebaNumber, bankAccountCardNumber, options)(this.fetch, this.basePath); - } - - /** - * Adds a social worker.
This API creates a row in social_worker table containing a new social worker information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber and bankAccountCardNumber is optional.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
- * @summary add social worker - * @param {string} authorization Access Token - * @param {number} ngoId - * @param {number} typeId - * @param {boolean} isCoordinator - * @param {string} lastName - * @param {string} idNumber - * @param {boolean} gender - * @param {string} phoneNumber - * @param {string} emergencyPhoneNumber - * @param {string} email - * @param {string} telegramId - * @param {any} avatarUrl - * @param {number} [cityId] - * @param {string} [firstName] - * @param {string} [birthCertificateNumber] - * @param {any} [idCardUrl] - * @param {string} [passportNumber] - * @param {any} [passportUrl] + * @param {string} [postalCode] + * @param {'female' | 'male' | 'other'} [gender] + * @param {string} [countryCode] + * @param {number} [city] + * @param {number} [birthPlace] * @param {string} [birthDate] - * @param {string} [postalAddress] - * @param {string} [bankAccountNumber] - * @param {string} [bankAccountShebaNumber] - * @param {string} [bankAccountCardNumber] + * @param {string} [userName] + * @param {string} [password] + * @param {string} [locale] en or fa + * @param {boolean} [receiveEmail] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof SocialWorkerAPIApi */ - public apiV2SocialworkersPost(authorization: string, ngoId: number, typeId: number, isCoordinator: boolean, lastName: string, idNumber: string, gender: boolean, phoneNumber: string, emergencyPhoneNumber: string, email: string, telegramId: string, avatarUrl: any, cityId?: number, firstName?: string, birthCertificateNumber?: string, idCardUrl?: any, passportNumber?: string, passportUrl?: any, birthDate?: string, postalAddress?: string, bankAccountNumber?: string, bankAccountShebaNumber?: string, bankAccountCardNumber?: string, options?: any) { - return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersPost(authorization, ngoId, typeId, isCoordinator, lastName, idNumber, gender, phoneNumber, emergencyPhoneNumber, email, telegramId, avatarUrl, cityId, firstName, birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber, bankAccountCardNumber, options)(this.fetch, this.basePath); - } - + apiV2UserUpdateUserIduserIdPatch( + authorization: string, + userId: string, + firstName?: string, + lastName?: string, + avatarUrl?: any, + phoneNumber?: string, + emailAddress?: string, + postalAddress?: string, + postalCode?: string, + gender?: 'female' | 'male' | 'other', + countryCode?: string, + city?: number, + birthPlace?: number, + birthDate?: string, + userName?: string, + password?: string, + locale?: string, + receiveEmail?: boolean, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UserAPIApiFetchParamCreator( + configuration, + ).apiV2UserUpdateUserIduserIdPatch( + authorization, + userId, + firstName, + lastName, + avatarUrl, + phoneNumber, + emailAddress, + postalAddress, + postalCode, + gender, + countryCode, + city, + birthPlace, + birthDate, + userName, + password, + locale, + receiveEmail, + options, + ); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** - * Adds a social worker.
This API creates a row in social_worker table containing a new social worker information.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Adding birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber and bankAccountCardNumber is optional.
For idCardUrl, passportUrl and avatarUrl you have to upload a file.
- * @summary add social worker + * Returns information of a user with given id as a json object.
Calling this API affects child, need, child_need and need_family and user tables.
It contains user info, its children and those children's needs.
+ * @summary get user by id * @param {string} authorization Access Token - * @param {number} ngoId - * @param {number} typeId - * @param {boolean} isCoordinator - * @param {string} lastName - * @param {string} idNumber - * @param {boolean} gender - * @param {string} phoneNumber - * @param {string} emergencyPhoneNumber - * @param {string} email - * @param {string} telegramId - * @param {any} avatarUrl - * @param {number} [cityId] - * @param {string} [firstName] - * @param {string} [birthCertificateNumber] - * @param {any} [idCardUrl] - * @param {string} [passportNumber] - * @param {any} [passportUrl] - * @param {string} [birthDate] - * @param {string} [postalAddress] - * @param {string} [bankAccountNumber] - * @param {string} [bankAccountShebaNumber] - * @param {string} [bankAccountCardNumber] + * @param {string} userId me or user_id * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof SocialWorkerAPIApi */ - public apiV2SocialworkersPost_2(authorization: string, ngoId: number, typeId: number, isCoordinator: boolean, lastName: string, idNumber: string, gender: boolean, phoneNumber: string, emergencyPhoneNumber: string, email: string, telegramId: string, avatarUrl: any, cityId?: number, firstName?: string, birthCertificateNumber?: string, idCardUrl?: any, passportNumber?: string, passportUrl?: any, birthDate?: string, postalAddress?: string, bankAccountNumber?: string, bankAccountShebaNumber?: string, bankAccountCardNumber?: string, options?: any) { - return SocialWorkerAPIApiFp(this.configuration).apiV2SocialworkersPost_2(authorization, ngoId, typeId, isCoordinator, lastName, idNumber, gender, phoneNumber, emergencyPhoneNumber, email, telegramId, avatarUrl, cityId, firstName, birthCertificateNumber, idCardUrl, passportNumber, passportUrl, birthDate, postalAddress, bankAccountNumber, bankAccountShebaNumber, bankAccountCardNumber, options)(this.fetch, this.basePath); - } - -} - -/** - * UserAPIApi - fetch parameter creator - * @export - */ -export const UserAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * Adds a user. Adding avatarUrl, emailAddress, gender, birthDate are optional.
For avatarUrl you have to upload a file in png, jpg or jpeg.
Be aware that city is integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Calling this API only affects on user table.
For gender, [true] is male and [false] is female.
- * @summary add a user - * @param {string} authorization Access Token - * @param {string} firstName - * @param {string} lastName - * @param {string} userName - * @param {string} password - * @param {any} [avatarUrl] - * @param {string} [phoneNumber] - * @param {string} [emailAddress] - * @param {'female' | 'male' | 'other'} [gender] - * @param {number} [cityId] - * @param {string} [birthDate] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserAddPost(authorization: string, firstName: string, lastName: string, userName: string, password: string, avatarUrl?: any, phoneNumber?: string, emailAddress?: string, gender?: 'female' | 'male' | 'other', cityId?: number, birthDate?: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2UserAddPost.'); - } - // verify required parameter 'firstName' is not null or undefined - if (firstName === null || firstName === undefined) { - throw new RequiredError('firstName', 'Required parameter firstName was null or undefined when calling apiV2UserAddPost.'); - } - // verify required parameter 'lastName' is not null or undefined - if (lastName === null || lastName === undefined) { - throw new RequiredError('lastName', 'Required parameter lastName was null or undefined when calling apiV2UserAddPost.'); - } - // verify required parameter 'userName' is not null or undefined - if (userName === null || userName === undefined) { - throw new RequiredError('userName', 'Required parameter userName was null or undefined when calling apiV2UserAddPost.'); - } - // verify required parameter 'password' is not null or undefined - if (password === null || password === undefined) { - throw new RequiredError('password', 'Required parameter password was null or undefined when calling apiV2UserAddPost.'); - } - const localVarPath = `/api/v2/user/add`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (firstName !== undefined) { - localVarFormParams.set('firstName', firstName as any); - } - - if (lastName !== undefined) { - localVarFormParams.set('lastName', lastName as any); - } - - if (avatarUrl !== undefined) { - localVarFormParams.set('avatarUrl', avatarUrl as any); - } - - if (phoneNumber !== undefined) { - localVarFormParams.set('phoneNumber', phoneNumber as any); - } - - if (emailAddress !== undefined) { - localVarFormParams.set('emailAddress', emailAddress as any); - } - - if (gender !== undefined) { - localVarFormParams.set('gender', gender as any); - } - - if (cityId !== undefined) { - localVarFormParams.set('cityId', cityId as any); - } - - if (birthDate !== undefined) { - localVarFormParams.set('birthDate', birthDate as any); - } - - if (userName !== undefined) { - localVarFormParams.set('userName', userName as any); - } - - if (password !== undefined) { - localVarFormParams.set('password', password as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns all children this user has.
Calling this API affects family, user_family, user, child_need, need and need_family tables.
- * @summary get user children - * @param {string} authorization Access Token - * @param {string} userId me or user_id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserChildrenUserIduserIdGet(authorization: string, userId: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2UserChildrenUserIduserIdGet.'); - } - // verify required parameter 'userId' is not null or undefined - if (userId === null || userId === undefined) { - throw new RequiredError('userId', 'Required parameter userId was null or undefined when calling apiV2UserChildrenUserIduserIdGet.'); - } - const localVarPath = `/api/v2/user/children/userId={user_id}` - .replace(`{${"user_id"}}`, encodeURIComponent(String(userId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Deletes a user.
It also delete all impacts and occurrences of this user in whole database.
Deleting is managed by isDeleted tag everywhere, so we do not fully delete anything.
Calling this API affects user, need_family and user_family tables.
- * @summary delete a user - * @param {string} authorization Access Token - * @param {string} userId me or user_id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserDeleteUserIduserIdPatch(authorization: string, userId: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2UserDeleteUserIduserIdPatch.'); - } - // verify required parameter 'userId' is not null or undefined - if (userId === null || userId === undefined) { - throw new RequiredError('userId', 'Required parameter userId was null or undefined when calling apiV2UserDeleteUserIduserIdPatch.'); - } - const localVarPath = `/api/v2/user/delete/userId={user_id}` - .replace(`{${"user_id"}}`, encodeURIComponent(String(userId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns user's role in a specific family.
- * @summary get user role - * @param {string} authorization Access Token - * @param {string} userId me or user_id - * @param {number} childId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserRoleUserIduserIdchildIdchildIdGet(authorization: string, userId: string, childId: number, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2UserRoleUserIduserIdchildIdchildIdGet.'); - } - // verify required parameter 'userId' is not null or undefined - if (userId === null || userId === undefined) { - throw new RequiredError('userId', 'Required parameter userId was null or undefined when calling apiV2UserRoleUserIduserIdchildIdchildIdGet.'); - } - // verify required parameter 'childId' is not null or undefined - if (childId === null || childId === undefined) { - throw new RequiredError('childId', 'Required parameter childId was null or undefined when calling apiV2UserRoleUserIduserIdchildIdchildIdGet.'); - } - const localVarPath = `/api/v2/user/role/userId={user_id}&childId={child_id}` - .replace(`{${"user_id"}}`, encodeURIComponent(String(userId))) - .replace(`{${"child_id"}}`, encodeURIComponent(String(childId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Search in users - * @param {string} authorization Access Token - * @param {string} q - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserSearchGet(authorization: string, q: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2UserSearchGet.'); - } - // verify required parameter 'q' is not null or undefined - if (q === null || q === undefined) { - throw new RequiredError('q', 'Required parameter q was null or undefined when calling apiV2UserSearchGet.'); - } - const localVarPath = `/api/v2/user/search`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (q !== undefined) { - localVarQueryParameter['q'] = q; - } - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Updates a user information.
All the fields are optional.
For avatarUrl you have to upload a file in png, jpg or jpeg.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Calling this API only affects on user table.
For gender, [true] is male and [false] is female.
- * @summary update a user - * @param {string} authorization Access Token - * @param {string} userId me or user_id - * @param {string} [firstName] - * @param {string} [lastName] - * @param {any} [avatarUrl] - * @param {string} [phoneNumber] - * @param {string} [emailAddress] - * @param {string} [postalAddress] - * @param {string} [postalCode] - * @param {'female' | 'male' | 'other'} [gender] - * @param {number} [cityId] - * @param {string} [birthDate] - * @param {string} [userName] - * @param {string} [password] - * @param {string} [locale] en or fa - * @param {boolean} [receiveEmail] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserUpdateUserIduserIdPatch(authorization: string, userId: string, firstName?: string, lastName?: string, avatarUrl?: any, phoneNumber?: string, emailAddress?: string, postalAddress?: string, postalCode?: string, gender?: 'female' | 'male' | 'other', cityId?: number, birthDate?: string, userName?: string, password?: string, locale?: string, receiveEmail?: boolean, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2UserUpdateUserIduserIdPatch.'); - } - // verify required parameter 'userId' is not null or undefined - if (userId === null || userId === undefined) { - throw new RequiredError('userId', 'Required parameter userId was null or undefined when calling apiV2UserUpdateUserIduserIdPatch.'); - } - const localVarPath = `/api/v2/user/update/userId={user_id}` - .replace(`{${"user_id"}}`, encodeURIComponent(String(userId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - if (firstName !== undefined) { - localVarFormParams.set('firstName', firstName as any); - } - - if (lastName !== undefined) { - localVarFormParams.set('lastName', lastName as any); - } - - if (avatarUrl !== undefined) { - localVarFormParams.set('avatarUrl', avatarUrl as any); - } - - if (phoneNumber !== undefined) { - localVarFormParams.set('phoneNumber', phoneNumber as any); - } - - if (emailAddress !== undefined) { - localVarFormParams.set('emailAddress', emailAddress as any); - } - - if (postalAddress !== undefined) { - localVarFormParams.set('postal_address', postalAddress as any); - } - - if (postalCode !== undefined) { - localVarFormParams.set('postal_code', postalCode as any); - } - - if (gender !== undefined) { - localVarFormParams.set('gender', gender as any); - } - - if (cityId !== undefined) { - localVarFormParams.set('cityId', cityId as any); - } - - if (birthDate !== undefined) { - localVarFormParams.set('birthDate', birthDate as any); - } - - if (userName !== undefined) { - localVarFormParams.set('userName', userName as any); - } - - if (password !== undefined) { - localVarFormParams.set('password', password as any); - } - - if (locale !== undefined) { - localVarFormParams.set('locale', locale as any); - } - - if (receiveEmail !== undefined) { - localVarFormParams.set('receiveEmail', receiveEmail as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns information of a user with given id as a json object.
Calling this API affects child, need, child_need and need_family and user tables.
It contains user info, its children and those children's needs.
- * @summary get user by id - * @param {string} authorization Access Token - * @param {string} userId me or user_id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserUserIduserIdGet(authorization: string, userId: string, options: any = {}): FetchArgs { - // verify required parameter 'authorization' is not null or undefined - if (authorization === null || authorization === undefined) { - throw new RequiredError('authorization', 'Required parameter authorization was null or undefined when calling apiV2UserUserIduserIdGet.'); - } - // verify required parameter 'userId' is not null or undefined - if (userId === null || userId === undefined) { - throw new RequiredError('userId', 'Required parameter userId was null or undefined when calling apiV2UserUserIduserIdGet.'); - } - const localVarPath = `/api/v2/user/userId={user_id}` - .replace(`{${"user_id"}}`, encodeURIComponent(String(userId))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'GET' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (authorization !== undefined && authorization !== null) { - localVarHeaderParameter['Authorization'] = String(authorization); - } - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * UserAPIApi - functional programming interface - * @export - */ -export const UserAPIApiFp = function (configuration?: Configuration) { - return { - /** - * Adds a user. Adding avatarUrl, emailAddress, gender, birthDate are optional.
For avatarUrl you have to upload a file in png, jpg or jpeg.
Be aware that city is integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Calling this API only affects on user table.
For gender, [true] is male and [false] is female.
- * @summary add a user - * @param {string} authorization Access Token - * @param {string} firstName - * @param {string} lastName - * @param {string} userName - * @param {string} password - * @param {any} [avatarUrl] - * @param {string} [phoneNumber] - * @param {string} [emailAddress] - * @param {'female' | 'male' | 'other'} [gender] - * @param {number} [cityId] - * @param {string} [birthDate] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserAddPost(authorization: string, firstName: string, lastName: string, userName: string, password: string, avatarUrl?: any, phoneNumber?: string, emailAddress?: string, gender?: 'female' | 'male' | 'other', cityId?: number, birthDate?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UserAPIApiFetchParamCreator(configuration).apiV2UserAddPost(authorization, firstName, lastName, userName, password, avatarUrl, phoneNumber, emailAddress, gender, cityId, birthDate, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * Returns all children this user has.
Calling this API affects family, user_family, user, child_need, need and need_family tables.
- * @summary get user children - * @param {string} authorization Access Token - * @param {string} userId me or user_id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserChildrenUserIduserIdGet(authorization: string, userId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UserAPIApiFetchParamCreator(configuration).apiV2UserChildrenUserIduserIdGet(authorization, userId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Deletes a user.
It also delete all impacts and occurrences of this user in whole database.
Deleting is managed by isDeleted tag everywhere, so we do not fully delete anything.
Calling this API affects user, need_family and user_family tables.
- * @summary delete a user - * @param {string} authorization Access Token - * @param {string} userId me or user_id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserDeleteUserIduserIdPatch(authorization: string, userId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UserAPIApiFetchParamCreator(configuration).apiV2UserDeleteUserIduserIdPatch(authorization, userId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * Returns user's role in a specific family.
- * @summary get user role - * @param {string} authorization Access Token - * @param {string} userId me or user_id - * @param {number} childId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserRoleUserIduserIdchildIdchildIdGet(authorization: string, userId: string, childId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UserAPIApiFetchParamCreator(configuration).apiV2UserRoleUserIduserIdchildIdchildIdGet(authorization, userId, childId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Search in users - * @param {string} authorization Access Token - * @param {string} q - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserSearchGet(authorization: string, q: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UserAPIApiFetchParamCreator(configuration).apiV2UserSearchGet(authorization, q, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Updates a user information.
All the fields are optional.
For avatarUrl you have to upload a file in png, jpg or jpeg.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Calling this API only affects on user table.
For gender, [true] is male and [false] is female.
- * @summary update a user - * @param {string} authorization Access Token - * @param {string} userId me or user_id - * @param {string} [firstName] - * @param {string} [lastName] - * @param {any} [avatarUrl] - * @param {string} [phoneNumber] - * @param {string} [emailAddress] - * @param {string} [postalAddress] - * @param {string} [postalCode] - * @param {'female' | 'male' | 'other'} [gender] - * @param {number} [cityId] - * @param {string} [birthDate] - * @param {string} [userName] - * @param {string} [password] - * @param {string} [locale] en or fa - * @param {boolean} [receiveEmail] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserUpdateUserIduserIdPatch(authorization: string, userId: string, firstName?: string, lastName?: string, avatarUrl?: any, phoneNumber?: string, emailAddress?: string, postalAddress?: string, postalCode?: string, gender?: 'female' | 'male' | 'other', cityId?: number, birthDate?: string, userName?: string, password?: string, locale?: string, receiveEmail?: boolean, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UserAPIApiFetchParamCreator(configuration).apiV2UserUpdateUserIduserIdPatch(authorization, userId, firstName, lastName, avatarUrl, phoneNumber, emailAddress, postalAddress, postalCode, gender, cityId, birthDate, userName, password, locale, receiveEmail, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - /** - * Returns information of a user with given id as a json object.
Calling this API affects child, need, child_need and need_family and user tables.
It contains user info, its children and those children's needs.
- * @summary get user by id - * @param {string} authorization Access Token - * @param {string} userId me or user_id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserUserIduserIdGet(authorization: string, userId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UserAPIApiFetchParamCreator(configuration).apiV2UserUserIduserIdGet(authorization, userId, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }; - }, - } + apiV2UserUserIduserIdGet( + authorization: string, + userId: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UserAPIApiFetchParamCreator( + configuration, + ).apiV2UserUserIduserIdGet(authorization, userId, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + }; }; /** * UserAPIApi - factory interface * @export */ -export const UserAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * Adds a user. Adding avatarUrl, emailAddress, gender, birthDate are optional.
For avatarUrl you have to upload a file in png, jpg or jpeg.
Be aware that city is integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Calling this API only affects on user table.
For gender, [true] is male and [false] is female.
- * @summary add a user - * @param {string} authorization Access Token - * @param {string} firstName - * @param {string} lastName - * @param {string} userName - * @param {string} password - * @param {any} [avatarUrl] - * @param {string} [phoneNumber] - * @param {string} [emailAddress] - * @param {'female' | 'male' | 'other'} [gender] - * @param {number} [cityId] - * @param {string} [birthDate] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserAddPost(authorization: string, firstName: string, lastName: string, userName: string, password: string, avatarUrl?: any, phoneNumber?: string, emailAddress?: string, gender?: 'female' | 'male' | 'other', cityId?: number, birthDate?: string, options?: any) { - return UserAPIApiFp(configuration).apiV2UserAddPost(authorization, firstName, lastName, userName, password, avatarUrl, phoneNumber, emailAddress, gender, cityId, birthDate, options)(fetch, basePath); - }, - /** - * Returns all children this user has.
Calling this API affects family, user_family, user, child_need, need and need_family tables.
- * @summary get user children - * @param {string} authorization Access Token - * @param {string} userId me or user_id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserChildrenUserIduserIdGet(authorization: string, userId: string, options?: any) { - return UserAPIApiFp(configuration).apiV2UserChildrenUserIduserIdGet(authorization, userId, options)(fetch, basePath); - }, - /** - * Deletes a user.
It also delete all impacts and occurrences of this user in whole database.
Deleting is managed by isDeleted tag everywhere, so we do not fully delete anything.
Calling this API affects user, need_family and user_family tables.
- * @summary delete a user - * @param {string} authorization Access Token - * @param {string} userId me or user_id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserDeleteUserIduserIdPatch(authorization: string, userId: string, options?: any) { - return UserAPIApiFp(configuration).apiV2UserDeleteUserIduserIdPatch(authorization, userId, options)(fetch, basePath); - }, - /** - * Returns user's role in a specific family.
- * @summary get user role - * @param {string} authorization Access Token - * @param {string} userId me or user_id - * @param {number} childId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserRoleUserIduserIdchildIdchildIdGet(authorization: string, userId: string, childId: number, options?: any) { - return UserAPIApiFp(configuration).apiV2UserRoleUserIduserIdchildIdchildIdGet(authorization, userId, childId, options)(fetch, basePath); - }, - /** - * - * @summary Search in users - * @param {string} authorization Access Token - * @param {string} q - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserSearchGet(authorization: string, q: string, options?: any) { - return UserAPIApiFp(configuration).apiV2UserSearchGet(authorization, q, options)(fetch, basePath); - }, - /** - * Updates a user information.
All the fields are optional.
For avatarUrl you have to upload a file in png, jpg or jpeg.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Calling this API only affects on user table.
For gender, [true] is male and [false] is female.
- * @summary update a user - * @param {string} authorization Access Token - * @param {string} userId me or user_id - * @param {string} [firstName] - * @param {string} [lastName] - * @param {any} [avatarUrl] - * @param {string} [phoneNumber] - * @param {string} [emailAddress] - * @param {string} [postalAddress] - * @param {string} [postalCode] - * @param {'female' | 'male' | 'other'} [gender] - * @param {number} [cityId] - * @param {string} [birthDate] - * @param {string} [userName] - * @param {string} [password] - * @param {string} [locale] en or fa - * @param {boolean} [receiveEmail] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserUpdateUserIduserIdPatch(authorization: string, userId: string, firstName?: string, lastName?: string, avatarUrl?: any, phoneNumber?: string, emailAddress?: string, postalAddress?: string, postalCode?: string, gender?: 'female' | 'male' | 'other', cityId?: number, birthDate?: string, userName?: string, password?: string, locale?: string, receiveEmail?: boolean, options?: any) { - return UserAPIApiFp(configuration).apiV2UserUpdateUserIduserIdPatch(authorization, userId, firstName, lastName, avatarUrl, phoneNumber, emailAddress, postalAddress, postalCode, gender, cityId, birthDate, userName, password, locale, receiveEmail, options)(fetch, basePath); - }, - /** - * Returns information of a user with given id as a json object.
Calling this API affects child, need, child_need and need_family and user tables.
It contains user info, its children and those children's needs.
- * @summary get user by id - * @param {string} authorization Access Token - * @param {string} userId me or user_id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2UserUserIduserIdGet(authorization: string, userId: string, options?: any) { - return UserAPIApiFp(configuration).apiV2UserUserIduserIdGet(authorization, userId, options)(fetch, basePath); - }, - }; -}; - -/** - * UserAPIApi - object-oriented interface - * @export - * @class UserAPIApi - * @extends {BaseAPI} - */ -export class UserAPIApi extends BaseAPI { - /** - * Adds a user. Adding avatarUrl, emailAddress, gender, birthDate are optional.
For avatarUrl you have to upload a file in png, jpg or jpeg.
Be aware that city is integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Calling this API only affects on user table.
For gender, [true] is male and [false] is female.
+export const UserAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { + /** + * Adds a user. Adding avatarUrl, emailAddress, gender, birthDate and birthPlace are optional.
For avatarUrl you have to upload a file in png, jpg or jpeg.
Be aware that city is integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities and the same rule is applied for birthPlace.
Calling this API only affects on user table.
For gender, [true] is male and [false] is female.
* @summary add a user * @param {string} authorization Access Token * @param {string} firstName * @param {string} lastName + * @param {string} countryCode + * @param {number} city * @param {string} userName * @param {string} password * @param {any} [avatarUrl] * @param {string} [phoneNumber] * @param {string} [emailAddress] * @param {'female' | 'male' | 'other'} [gender] - * @param {number} [cityId] + * @param {number} [birthPlace] * @param {string} [birthDate] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof UserAPIApi */ - public apiV2UserAddPost(authorization: string, firstName: string, lastName: string, userName: string, password: string, avatarUrl?: any, phoneNumber?: string, emailAddress?: string, gender?: 'female' | 'male' | 'other', cityId?: number, birthDate?: string, options?: any) { - return UserAPIApiFp(this.configuration).apiV2UserAddPost(authorization, firstName, lastName, userName, password, avatarUrl, phoneNumber, emailAddress, gender, cityId, birthDate, options)(this.fetch, this.basePath); - } - + apiV2UserAddPost( + authorization: string, + firstName: string, + lastName: string, + countryCode: string, + city: number, + userName: string, + password: string, + avatarUrl?: any, + phoneNumber?: string, + emailAddress?: string, + gender?: 'female' | 'male' | 'other', + birthPlace?: number, + birthDate?: string, + options?: any, + ) { + return UserAPIApiFp(configuration).apiV2UserAddPost( + authorization, + firstName, + lastName, + countryCode, + city, + userName, + password, + avatarUrl, + phoneNumber, + emailAddress, + gender, + birthPlace, + birthDate, + options, + )(fetch, basePath); + }, /** * Returns all children this user has.
Calling this API affects family, user_family, user, child_need, need and need_family tables.
* @summary get user children @@ -13289,12 +20276,18 @@ export class UserAPIApi extends BaseAPI { * @param {string} userId me or user_id * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof UserAPIApi */ - public apiV2UserChildrenUserIduserIdGet(authorization: string, userId: string, options?: any) { - return UserAPIApiFp(this.configuration).apiV2UserChildrenUserIduserIdGet(authorization, userId, options)(this.fetch, this.basePath); - } - + apiV2UserChildrenUserIduserIdGet( + authorization: string, + userId: string, + options?: any, + ) { + return UserAPIApiFp(configuration).apiV2UserChildrenUserIduserIdGet( + authorization, + userId, + options, + )(fetch, basePath); + }, /** * Deletes a user.
It also delete all impacts and occurrences of this user in whole database.
Deleting is managed by isDeleted tag everywhere, so we do not fully delete anything.
Calling this API affects user, need_family and user_family tables.
* @summary delete a user @@ -13302,12 +20295,18 @@ export class UserAPIApi extends BaseAPI { * @param {string} userId me or user_id * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof UserAPIApi */ - public apiV2UserDeleteUserIduserIdPatch(authorization: string, userId: string, options?: any) { - return UserAPIApiFp(this.configuration).apiV2UserDeleteUserIduserIdPatch(authorization, userId, options)(this.fetch, this.basePath); - } - + apiV2UserDeleteUserIduserIdPatch( + authorization: string, + userId: string, + options?: any, + ) { + return UserAPIApiFp(configuration).apiV2UserDeleteUserIduserIdPatch( + authorization, + userId, + options, + )(fetch, basePath); + }, /** * Returns user's role in a specific family.
* @summary get user role @@ -13316,12 +20315,22 @@ export class UserAPIApi extends BaseAPI { * @param {number} childId * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof UserAPIApi */ - public apiV2UserRoleUserIduserIdchildIdchildIdGet(authorization: string, userId: string, childId: number, options?: any) { - return UserAPIApiFp(this.configuration).apiV2UserRoleUserIduserIdchildIdchildIdGet(authorization, userId, childId, options)(this.fetch, this.basePath); - } - + apiV2UserRoleUserIduserIdchildIdchildIdGet( + authorization: string, + userId: string, + childId: number, + options?: any, + ) { + return UserAPIApiFp( + configuration, + ).apiV2UserRoleUserIduserIdchildIdchildIdGet( + authorization, + userId, + childId, + options, + )(fetch, basePath); + }, /** * * @summary Search in users @@ -13329,14 +20338,16 @@ export class UserAPIApi extends BaseAPI { * @param {string} q * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof UserAPIApi */ - public apiV2UserSearchGet(authorization: string, q: string, options?: any) { - return UserAPIApiFp(this.configuration).apiV2UserSearchGet(authorization, q, options)(this.fetch, this.basePath); - } - + apiV2UserSearchGet(authorization: string, q: string, options?: any) { + return UserAPIApiFp(configuration).apiV2UserSearchGet( + authorization, + q, + options, + )(fetch, basePath); + }, /** - * Updates a user information.
All the fields are optional.
For avatarUrl you have to upload a file in png, jpg or jpeg.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities.
Calling this API only affects on user table.
For gender, [true] is male and [false] is female.
+ * Updates a user information.
All the fields are optional.
For avatarUrl you have to upload a file in png, jpg or jpeg.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities and the same rule is applied for birthPlace.
Calling this API only affects on user table.
For gender, [true] is male and [false] is female.
* @summary update a user * @param {string} authorization Access Token * @param {string} userId me or user_id @@ -13348,7 +20359,9 @@ export class UserAPIApi extends BaseAPI { * @param {string} [postalAddress] * @param {string} [postalCode] * @param {'female' | 'male' | 'other'} [gender] - * @param {number} [cityId] + * @param {string} [countryCode] + * @param {number} [city] + * @param {number} [birthPlace] * @param {string} [birthDate] * @param {string} [userName] * @param {string} [password] @@ -13356,12 +20369,50 @@ export class UserAPIApi extends BaseAPI { * @param {boolean} [receiveEmail] * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof UserAPIApi */ - public apiV2UserUpdateUserIduserIdPatch(authorization: string, userId: string, firstName?: string, lastName?: string, avatarUrl?: any, phoneNumber?: string, emailAddress?: string, postalAddress?: string, postalCode?: string, gender?: 'female' | 'male' | 'other', cityId?: number, birthDate?: string, userName?: string, password?: string, locale?: string, receiveEmail?: boolean, options?: any) { - return UserAPIApiFp(this.configuration).apiV2UserUpdateUserIduserIdPatch(authorization, userId, firstName, lastName, avatarUrl, phoneNumber, emailAddress, postalAddress, postalCode, gender, cityId, birthDate, userName, password, locale, receiveEmail, options)(this.fetch, this.basePath); - } - + apiV2UserUpdateUserIduserIdPatch( + authorization: string, + userId: string, + firstName?: string, + lastName?: string, + avatarUrl?: any, + phoneNumber?: string, + emailAddress?: string, + postalAddress?: string, + postalCode?: string, + gender?: 'female' | 'male' | 'other', + countryCode?: string, + city?: number, + birthPlace?: number, + birthDate?: string, + userName?: string, + password?: string, + locale?: string, + receiveEmail?: boolean, + options?: any, + ) { + return UserAPIApiFp(configuration).apiV2UserUpdateUserIduserIdPatch( + authorization, + userId, + firstName, + lastName, + avatarUrl, + phoneNumber, + emailAddress, + postalAddress, + postalCode, + gender, + countryCode, + city, + birthPlace, + birthDate, + userName, + password, + locale, + receiveEmail, + options, + )(fetch, basePath); + }, /** * Returns information of a user with given id as a json object.
Calling this API affects child, need, child_need and need_family and user tables.
It contains user info, its children and those children's needs.
* @summary get user by id @@ -13369,135 +20420,435 @@ export class UserAPIApi extends BaseAPI { * @param {string} userId me or user_id * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof UserAPIApi */ - public apiV2UserUserIduserIdGet(authorization: string, userId: string, options?: any) { - return UserAPIApiFp(this.configuration).apiV2UserUserIduserIdGet(authorization, userId, options)(this.fetch, this.basePath); - } + apiV2UserUserIduserIdGet( + authorization: string, + userId: string, + options?: any, + ) { + return UserAPIApiFp(configuration).apiV2UserUserIduserIdGet( + authorization, + userId, + options, + )(fetch, basePath); + }, + }; +}; +/** + * UserAPIApi - object-oriented interface + * @export + * @class UserAPIApi + * @extends {BaseAPI} + */ +export class UserAPIApi extends BaseAPI { + /** + * Adds a user. Adding avatarUrl, emailAddress, gender, birthDate and birthPlace are optional.
For avatarUrl you have to upload a file in png, jpg or jpeg.
Be aware that city is integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities and the same rule is applied for birthPlace.
Calling this API only affects on user table.
For gender, [true] is male and [false] is female.
+ * @summary add a user + * @param {string} authorization Access Token + * @param {string} firstName + * @param {string} lastName + * @param {string} countryCode + * @param {number} city + * @param {string} userName + * @param {string} password + * @param {any} [avatarUrl] + * @param {string} [phoneNumber] + * @param {string} [emailAddress] + * @param {'female' | 'male' | 'other'} [gender] + * @param {number} [birthPlace] + * @param {string} [birthDate] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserAPIApi + */ + public apiV2UserAddPost( + authorization: string, + firstName: string, + lastName: string, + countryCode: string, + city: number, + userName: string, + password: string, + avatarUrl?: any, + phoneNumber?: string, + emailAddress?: string, + gender?: 'female' | 'male' | 'other', + birthPlace?: number, + birthDate?: string, + options?: any, + ) { + return UserAPIApiFp(this.configuration).apiV2UserAddPost( + authorization, + firstName, + lastName, + countryCode, + city, + userName, + password, + avatarUrl, + phoneNumber, + emailAddress, + gender, + birthPlace, + birthDate, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns all children this user has.
Calling this API affects family, user_family, user, child_need, need and need_family tables.
+ * @summary get user children + * @param {string} authorization Access Token + * @param {string} userId me or user_id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserAPIApi + */ + public apiV2UserChildrenUserIduserIdGet( + authorization: string, + userId: string, + options?: any, + ) { + return UserAPIApiFp(this.configuration).apiV2UserChildrenUserIduserIdGet( + authorization, + userId, + options, + )(this.fetch, this.basePath); + } + + /** + * Deletes a user.
It also delete all impacts and occurrences of this user in whole database.
Deleting is managed by isDeleted tag everywhere, so we do not fully delete anything.
Calling this API affects user, need_family and user_family tables.
+ * @summary delete a user + * @param {string} authorization Access Token + * @param {string} userId me or user_id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserAPIApi + */ + public apiV2UserDeleteUserIduserIdPatch( + authorization: string, + userId: string, + options?: any, + ) { + return UserAPIApiFp(this.configuration).apiV2UserDeleteUserIduserIdPatch( + authorization, + userId, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns user's role in a specific family.
+ * @summary get user role + * @param {string} authorization Access Token + * @param {string} userId me or user_id + * @param {number} childId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserAPIApi + */ + public apiV2UserRoleUserIduserIdchildIdchildIdGet( + authorization: string, + userId: string, + childId: number, + options?: any, + ) { + return UserAPIApiFp( + this.configuration, + ).apiV2UserRoleUserIduserIdchildIdchildIdGet( + authorization, + userId, + childId, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Search in users + * @param {string} authorization Access Token + * @param {string} q + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserAPIApi + */ + public apiV2UserSearchGet(authorization: string, q: string, options?: any) { + return UserAPIApiFp(this.configuration).apiV2UserSearchGet( + authorization, + q, + options, + )(this.fetch, this.basePath); + } + + /** + * Updates a user information.
All the fields are optional.
For avatarUrl you have to upload a file in png, jpg or jpeg.
Be aware that city and country are integer fields, so you cannot insert their names in those fields.
You have to insert the international codes for countries and cities and the same rule is applied for birthPlace.
Calling this API only affects on user table.
For gender, [true] is male and [false] is female.
+ * @summary update a user + * @param {string} authorization Access Token + * @param {string} userId me or user_id + * @param {string} [firstName] + * @param {string} [lastName] + * @param {any} [avatarUrl] + * @param {string} [phoneNumber] + * @param {string} [emailAddress] + * @param {string} [postalAddress] + * @param {string} [postalCode] + * @param {'female' | 'male' | 'other'} [gender] + * @param {string} [countryCode] + * @param {number} [city] + * @param {number} [birthPlace] + * @param {string} [birthDate] + * @param {string} [userName] + * @param {string} [password] + * @param {string} [locale] en or fa + * @param {boolean} [receiveEmail] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserAPIApi + */ + public apiV2UserUpdateUserIduserIdPatch( + authorization: string, + userId: string, + firstName?: string, + lastName?: string, + avatarUrl?: any, + phoneNumber?: string, + emailAddress?: string, + postalAddress?: string, + postalCode?: string, + gender?: 'female' | 'male' | 'other', + countryCode?: string, + city?: number, + birthPlace?: number, + birthDate?: string, + userName?: string, + password?: string, + locale?: string, + receiveEmail?: boolean, + options?: any, + ) { + return UserAPIApiFp(this.configuration).apiV2UserUpdateUserIduserIdPatch( + authorization, + userId, + firstName, + lastName, + avatarUrl, + phoneNumber, + emailAddress, + postalAddress, + postalCode, + gender, + countryCode, + city, + birthPlace, + birthDate, + userName, + password, + locale, + receiveEmail, + options, + )(this.fetch, this.basePath); + } + + /** + * Returns information of a user with given id as a json object.
Calling this API affects child, need, child_need and need_family and user tables.
It contains user info, its children and those children's needs.
+ * @summary get user by id + * @param {string} authorization Access Token + * @param {string} userId me or user_id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserAPIApi + */ + public apiV2UserUserIduserIdGet( + authorization: string, + userId: string, + options?: any, + ) { + return UserAPIApiFp(this.configuration).apiV2UserUserIduserIdGet( + authorization, + userId, + options, + )(this.fetch, this.basePath); + } } /** * VerificationAPIApi - fetch parameter creator * @export */ -export const VerificationAPIApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Verify Email API - * @param {string} email - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthVerifyEmailPost(email: string, options: any = {}): FetchArgs { - // verify required parameter 'email' is not null or undefined - if (email === null || email === undefined) { - throw new RequiredError('email', 'Required parameter email was null or undefined when calling apiV2AuthVerifyEmailPost.'); - } - const localVarPath = `/api/v2/auth/verify/email`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (email !== undefined) { - localVarFormParams.set('email', email as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Verify API - * @param {string} id - * @param {string} code - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthVerifyIdPatch(id: string, code: string, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiV2AuthVerifyIdPatch.'); - } - // verify required parameter 'code' is not null or undefined - if (code === null || code === undefined) { - throw new RequiredError('code', 'Required parameter code was null or undefined when calling apiV2AuthVerifyIdPatch.'); - } - const localVarPath = `/api/v2/auth/verify/{id}` - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'PATCH' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (code !== undefined) { - localVarFormParams.set('code', code as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Verify Phone API - * @param {string} phoneNumber - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthVerifyPhonePost(phoneNumber: string, options: any = {}): FetchArgs { - // verify required parameter 'phoneNumber' is not null or undefined - if (phoneNumber === null || phoneNumber === undefined) { - throw new RequiredError('phoneNumber', 'Required parameter phoneNumber was null or undefined when calling apiV2AuthVerifyPhonePost.'); - } - const localVarPath = `/api/v2/auth/verify/phone`; - const localVarUrlObj = url.parse(localVarPath, true); - const localVarRequestOptions = Object.assign({ method: 'POST' }, options); - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new url.URLSearchParams(); - - if (phoneNumber !== undefined) { - localVarFormParams.set('phone_number', phoneNumber as any); - } - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams.toString(); - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } +export const VerificationAPIApiFetchParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + * + * @summary Verify Email API + * @param {string} email + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2AuthVerifyEmailPost(email: string, options: any = {}): FetchArgs { + // verify required parameter 'email' is not null or undefined + if (email === null || email === undefined) { + throw new RequiredError( + 'email', + 'Required parameter email was null or undefined when calling apiV2AuthVerifyEmailPost.', + ); + } + const localVarPath = `/api/v2/auth/verify/email`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (email !== undefined) { + localVarFormParams.set('email', email as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Verify API + * @param {string} id + * @param {string} code + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2AuthVerifyIdPatch( + id: string, + code: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError( + 'id', + 'Required parameter id was null or undefined when calling apiV2AuthVerifyIdPatch.', + ); + } + // verify required parameter 'code' is not null or undefined + if (code === null || code === undefined) { + throw new RequiredError( + 'code', + 'Required parameter code was null or undefined when calling apiV2AuthVerifyIdPatch.', + ); + } + const localVarPath = `/api/v2/auth/verify/{id}`.replace( + `{${'id'}}`, + encodeURIComponent(String(id)), + ); + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign( + { method: 'PATCH' }, + options, + ); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (code !== undefined) { + localVarFormParams.set('code', code as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Verify Phone API + * @param {string} phoneNumber + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2AuthVerifyPhonePost( + phoneNumber: string, + options: any = {}, + ): FetchArgs { + // verify required parameter 'phoneNumber' is not null or undefined + if (phoneNumber === null || phoneNumber === undefined) { + throw new RequiredError( + 'phoneNumber', + 'Required parameter phoneNumber was null or undefined when calling apiV2AuthVerifyPhonePost.', + ); + } + const localVarPath = `/api/v2/auth/verify/phone`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + if (phoneNumber !== undefined) { + localVarFormParams.set('phone_number', phoneNumber as any); + } + + localVarHeaderParameter['Content-Type'] = + 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign( + {}, + localVarUrlObj.query, + localVarQueryParameter, + options.query, + ); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign( + {}, + localVarHeaderParameter, + options.headers, + ); + localVarRequestOptions.body = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; }; /** @@ -13505,127 +20856,125 @@ export const VerificationAPIApiFetchParamCreator = function (configuration?: Con * @export */ export const VerificationAPIApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Verify Email API - * @param {string} email - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthVerifyEmailPost(email: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = VerificationAPIApiFetchParamCreator(configuration).apiV2AuthVerifyEmailPost(email, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Verify API - * @param {string} id - * @param {string} code - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthVerifyIdPatch(id: string, code: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = VerificationAPIApiFetchParamCreator(configuration).apiV2AuthVerifyIdPatch(id, code, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - /** - * - * @summary Verify Phone API - * @param {string} phoneNumber - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthVerifyPhonePost(phoneNumber: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = VerificationAPIApiFetchParamCreator(configuration).apiV2AuthVerifyPhonePost(phoneNumber, options); - return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }; - }, - } + return { + /** + * + * @summary Verify Email API + * @param {string} email + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2AuthVerifyEmailPost( + email: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = VerificationAPIApiFetchParamCreator( + configuration, + ).apiV2AuthVerifyEmailPost(email, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Verify API + * @param {string} id + * @param {string} code + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2AuthVerifyIdPatch( + id: string, + code: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = VerificationAPIApiFetchParamCreator( + configuration, + ).apiV2AuthVerifyIdPatch(id, code, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Verify Phone API + * @param {string} phoneNumber + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2AuthVerifyPhonePost( + phoneNumber: string, + options?: any, + ): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = VerificationAPIApiFetchParamCreator( + configuration, + ).apiV2AuthVerifyPhonePost(phoneNumber, options); + return ( + fetch: FetchAPI = portableFetch, + basePath: string = BASE_PATH, + ) => { + return fetch( + basePath + localVarFetchArgs.url, + localVarFetchArgs.options, + ).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + }; }; /** * VerificationAPIApi - factory interface * @export */ -export const VerificationAPIApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { - return { - /** - * - * @summary Verify Email API - * @param {string} email - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthVerifyEmailPost(email: string, options?: any) { - return VerificationAPIApiFp(configuration).apiV2AuthVerifyEmailPost(email, options)(fetch, basePath); - }, - /** - * - * @summary Verify API - * @param {string} id - * @param {string} code - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthVerifyIdPatch(id: string, code: string, options?: any) { - return VerificationAPIApiFp(configuration).apiV2AuthVerifyIdPatch(id, code, options)(fetch, basePath); - }, - /** - * - * @summary Verify Phone API - * @param {string} phoneNumber - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV2AuthVerifyPhonePost(phoneNumber: string, options?: any) { - return VerificationAPIApiFp(configuration).apiV2AuthVerifyPhonePost(phoneNumber, options)(fetch, basePath); - }, - }; -}; - -/** - * VerificationAPIApi - object-oriented interface - * @export - * @class VerificationAPIApi - * @extends {BaseAPI} - */ -export class VerificationAPIApi extends BaseAPI { +export const VerificationAPIApiFactory = function ( + configuration?: Configuration, + fetch?: FetchAPI, + basePath?: string, +) { + return { /** * * @summary Verify Email API * @param {string} email * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof VerificationAPIApi */ - public apiV2AuthVerifyEmailPost(email: string, options?: any) { - return VerificationAPIApiFp(this.configuration).apiV2AuthVerifyEmailPost(email, options)(this.fetch, this.basePath); - } - + apiV2AuthVerifyEmailPost(email: string, options?: any) { + return VerificationAPIApiFp(configuration).apiV2AuthVerifyEmailPost( + email, + options, + )(fetch, basePath); + }, /** * * @summary Verify API @@ -13633,23 +20982,81 @@ export class VerificationAPIApi extends BaseAPI { * @param {string} code * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof VerificationAPIApi */ - public apiV2AuthVerifyIdPatch(id: string, code: string, options?: any) { - return VerificationAPIApiFp(this.configuration).apiV2AuthVerifyIdPatch(id, code, options)(this.fetch, this.basePath); - } - + apiV2AuthVerifyIdPatch(id: string, code: string, options?: any) { + return VerificationAPIApiFp(configuration).apiV2AuthVerifyIdPatch( + id, + code, + options, + )(fetch, basePath); + }, /** * * @summary Verify Phone API * @param {string} phoneNumber * @param {*} [options] Override http request option. * @throws {RequiredError} - * @memberof VerificationAPIApi */ - public apiV2AuthVerifyPhonePost(phoneNumber: string, options?: any) { - return VerificationAPIApiFp(this.configuration).apiV2AuthVerifyPhonePost(phoneNumber, options)(this.fetch, this.basePath); - } + apiV2AuthVerifyPhonePost(phoneNumber: string, options?: any) { + return VerificationAPIApiFp(configuration).apiV2AuthVerifyPhonePost( + phoneNumber, + options, + )(fetch, basePath); + }, + }; +}; +/** + * VerificationAPIApi - object-oriented interface + * @export + * @class VerificationAPIApi + * @extends {BaseAPI} + */ +export class VerificationAPIApi extends BaseAPI { + /** + * + * @summary Verify Email API + * @param {string} email + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof VerificationAPIApi + */ + public apiV2AuthVerifyEmailPost(email: string, options?: any) { + return VerificationAPIApiFp(this.configuration).apiV2AuthVerifyEmailPost( + email, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Verify API + * @param {string} id + * @param {string} code + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof VerificationAPIApi + */ + public apiV2AuthVerifyIdPatch(id: string, code: string, options?: any) { + return VerificationAPIApiFp(this.configuration).apiV2AuthVerifyIdPatch( + id, + code, + options, + )(this.fetch, this.basePath); + } + + /** + * + * @summary Verify Phone API + * @param {string} phoneNumber + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof VerificationAPIApi + */ + public apiV2AuthVerifyPhonePost(phoneNumber: string, options?: any) { + return VerificationAPIApiFp(this.configuration).apiV2AuthVerifyPhonePost( + phoneNumber, + options, + )(this.fetch, this.basePath); + } } - diff --git a/src/generated-sources/openapi/configuration.ts b/src/generated-sources/openapi/configuration.ts index 567658ddcd..60181c9f36 100644 --- a/src/generated-sources/openapi/configuration.ts +++ b/src/generated-sources/openapi/configuration.ts @@ -4,7 +4,7 @@ * powered by Flasgger * * OpenAPI spec version: 2.0 - * + * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -29,14 +29,14 @@ export class Configuration { apiKey?: string | ((name: string) => string); /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ username?: string; /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ @@ -50,7 +50,7 @@ export class Configuration { accessToken?: string | ((name: string, scopes?: string[]) => string); /** * override base path - * + * * @type {string} * @memberof Configuration */ diff --git a/src/generated-sources/openapi/custom.d.ts b/src/generated-sources/openapi/custom.d.ts index 4c611cc321..9a5ceb3588 100644 --- a/src/generated-sources/openapi/custom.d.ts +++ b/src/generated-sources/openapi/custom.d.ts @@ -1,2 +1,2 @@ declare module 'portable-fetch'; -declare module 'url'; +declare module 'url'; \ No newline at end of file diff --git a/src/server.ts b/src/server.ts index a6154edef0..ccfbc359fe 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1,46 +1,93 @@ import { ApplicationContext } from './context'; -import { NestFactory } from '@nestjs/core'; -// import { Transport, MicroserviceOptions } from '@nestjs/microservices'; -import { AppModule } from './app.module'; +import session from 'express-session'; import config from './config'; import * as bodyParser from 'body-parser'; +import cookieParser from 'cookie-parser'; +import connect from 'connect-pg-simple'; +import pg from 'pg'; async function startServer() { console.log('Environment:' + process.env.NODE_ENV); console.log('Started server'); console.log('Host:' + config().host); console.log('Port:' + config().serverPort); - console.log('db Host:' + config().db.host); - console.log('db Port:' + config().db.port); + console.log('db Host:' + config().db1.host); + + console.log(__filename); + console.log(__dirname); const app = await ApplicationContext(); + app.enableShutdownHooks(); app.setGlobalPrefix('api/dao'); // For large transactions app.use(bodyParser.json({ limit: '50mb' })); - app.use(bodyParser.urlencoded({ limit: '50mb', extended: true })); + // app.use(bodyParser.urlencoded({ limit: '50mb', extended: true })); app.enableCors({ - // origin: [ - // 'localhost', - // process.env.AUTHORIZED_DAPP_LOCAL, - // process.env.AUTHORIZED_PANEL_LOCAL, - // process.env.AUTHORIZED_PANEL_PRODUCTION, - // process.env.AUTHORIZED_HOST_PRODUCTION, - // process.env.AUTHORIZED_HOST_STAGING, - // process.env.AUTHORIZED_DOCS_LOCAL, - // ], - allowedHeaders: ['Origin,X-Requested-With,Content-Type,Accept,X-TAKE, X-SKIP, authorization'], + origin: [ + 'http://localhost:3000', + 'http://localhost:3002', + 'https://panel.saydao.org', + 'https://dapp.saydao.org', + 'https://beta.sayapp.company', + ], + allowedHeaders: [ + 'Origin,X-Requested-With,Content-Type ,Accept,X-TAKE, X-SKIP, X-LIMIT, authorization', + 'Access-Control-Allow-Headers', + 'Access-Control-Allow-Credentials', + 'Access-Control-Allow-Methods', + 'Access-Control-Allow-Origin', + 'flaskUserId', + 'flaskId', + 'flaskDappId' + ], + methods: ['GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS'], optionsSuccessStatus: 200, credentials: true, + preflightContinue: false, + }); + + app.use(cookieParser()); + + const pgPool = new pg.Pool({ + port: 5432, + user: process.env.DB_USER, + password: process.env.DB_PASS, + host: + process.env.NODE_ENV === 'development' + ? 'localhost' + : process.env.DB_HOST, + database: 'say_dapp', }); - console.log('Cors Enabled:' + process.env.AUTHORIZED_DAPP_LOCAL); - console.log('Cors Enabled:' + process.env.AUTHORIZED_PANEL_LOCAL); - console.log('Cors Enabled:' + process.env.AUTHORIZED_PANEL_PRODUCTION); - console.log('Cors Enabled:' + process.env.AUTHORIZED_HOST_PRODUCTION); - console.log('Cors Enabled:' + process.env.AUTHORIZED_HOST_STAGING); - console.log('Cors Enabled:' + process.env.AUTHORIZED_DOCS_LOCAL); + app.set('trust proxy', 1); // trust first proxy + + app.use( + session({ + store: new (connect(session))({ + pool: pgPool, // Connection pool + // Insert connect-pg-simple options here + }), + name: 'SAY-DAO-SESSION', + secret: process.env.DB_FLASK_PASS, + resave: true, + saveUninitialized: true, + cookie: { + domain: + process.env.NODE_ENV === 'development' + ? '127.0.0.1' + : 'nest.saydao.org', + path: '/api/dao', + secure: process.env.NODE_ENV === 'development' ? false : true, + sameSite: process.env.NODE_ENV === 'development' ? false : 'none', + maxAge: + process.env.NODE_ENV === 'development' + ? 1000 * 60 * 60 + : 1000 * 60 * 60, + }, + }), + ); await app.listen(config().serverPort); } diff --git a/src/storage/avatarStorage.ts b/src/storage/avatarStorage.ts new file mode 100644 index 0000000000..6bdec38a24 --- /dev/null +++ b/src/storage/avatarStorage.ts @@ -0,0 +1,15 @@ +import { diskStorage } from 'multer'; +import { uuid } from 'uuidv4'; +import path from 'path'; + +export const avatarStorage = { + storage: diskStorage({ + destination: './uploads/children/avatars', + filename: (req, file, cb) => { + const fileName: string = + path.parse(file.originalname).name.replace(/\s/g, '') + '-s-' + uuid(); // unique id + const extension: string = path.parse(file.originalname).ext; + return cb(null, `${fileName}${extension}`); + }, + }), +}; diff --git a/src/storage.ts b/src/storage/providerStorage.ts similarity index 93% rename from src/storage.ts rename to src/storage/providerStorage.ts index f34e991000..5d51bdf9bd 100644 --- a/src/storage.ts +++ b/src/storage/providerStorage.ts @@ -2,7 +2,7 @@ import { diskStorage } from 'multer'; import { uuid } from 'uuidv4'; import path from 'path'; -export const storage = { +export const providerStorage = { storage: diskStorage({ destination: './uploads/providers/logos', filename: (req, file, cb) => { diff --git a/src/storage/voiceStorage.ts b/src/storage/voiceStorage.ts new file mode 100644 index 0000000000..ee252ca47a --- /dev/null +++ b/src/storage/voiceStorage.ts @@ -0,0 +1,15 @@ +import { diskStorage } from 'multer'; +import { uuid } from 'uuidv4'; +import path from 'path'; + +export const voiceStorage = { + storage: diskStorage({ + destination: './uploads/children/voices', + filename: (req, file, cb) => { + const fileName: string = + path.parse(file.originalname).name.replace(/\s/g, '') + uuid(); // unique id + const extension: string = path.parse(file.originalname).ext; + return cb(null, `${fileName}${extension}`); + }, + }), +}; diff --git a/src/types/dtos/CreateChild.dto.ts b/src/types/dtos/CreateChild.dto.ts new file mode 100644 index 0000000000..21da148d2d --- /dev/null +++ b/src/types/dtos/CreateChild.dto.ts @@ -0,0 +1,99 @@ +import { IsNotEmpty } from 'class-validator'; +import { + EducationEnum, + HousingEnum, + SchoolTypeEnum, + SexEnum, +} from '../interfaces/interface'; + +export class UpdateApprovedPreRegisterDto { + addedState: number; + id: number; + id_ngo: number; + id_social_worker: number; + firstName_translations: { en: string; fa: string }; + lastName_translations: { en: string; fa: string }; + sayname_translations: { en: string; fa: string }; + phoneNumber: string; + nationality: string; + country: number; + city: number; + awakeAvatarUrl: string; + sleptAvatarUrl: string; + gender: boolean; + bio_translations: { en: string; fa: string }; + bio_summary_translations: { en: string; fa: string }; + sayFamilyCount: number; + voiceUrl: string; + birthPlace: Date; + birthDate: Date; + address: string; + housingStatus: HousingEnum; + familyCount: number; + education: EducationEnum; + avatarUrl: string; +} + +export class CreateFlaskChildDto { + @IsNotEmpty() + firstNameEn: string; + @IsNotEmpty() + lastNameEn: string; + @IsNotEmpty() + bioEn: string; +} + +export class PreparePreRegisterChildDto { + @IsNotEmpty() + bio: string; + @IsNotEmpty() + firstName: string; + @IsNotEmpty() + lastName: string; + @IsNotEmpty() + country: number; + @IsNotEmpty() + city: number; + @IsNotEmpty() + state: number; + @IsNotEmpty() + birthPlaceId: number; + @IsNotEmpty() + familyCount: number; + @IsNotEmpty() + educationLevel: EducationEnum; + @IsNotEmpty() + schoolType: SchoolTypeEnum; + @IsNotEmpty() + sex: SexEnum; + @IsNotEmpty() + phoneNumber: string; + @IsNotEmpty() + address: string; + @IsNotEmpty() + housingStatus: HousingEnum; + @IsNotEmpty() + birthDate: Date; + @IsNotEmpty() + ngoId: number; + @IsNotEmpty() + swId: number; +} + +export class UpdatePreRegisterChildDto { + flaskChildId: number; + @IsNotEmpty() + id: string; + @IsNotEmpty() + bio: string; + @IsNotEmpty() + firstName: string; + @IsNotEmpty() + lastName: string; + @IsNotEmpty() + educationLevel: EducationEnum; + @IsNotEmpty() + schoolType: SchoolTypeEnum; + @IsNotEmpty() + housingStatus: HousingEnum; +} diff --git a/src/types/dtos/CreateChildren.dto.ts b/src/types/dtos/CreateChildren.dto.ts deleted file mode 100644 index 91586af096..0000000000 --- a/src/types/dtos/CreateChildren.dto.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { IsNotEmpty } from 'class-validator' -import { EducationEnum, HousingEnum } from '../interface'; -export class CreateChildrenDto { - childData: CreateChildDto[]; -} - -export class CreateChildDto { - childId: number; - awakeAvatarUrl: string; - bio: string; - bioSummary: string; - bioSummaryTranslations: { en: string, fa: string } - bioTranslations: { en: string, fa: string } - birthDate: Date; - birthPlace: string; - city: number; - confirmDate: Date; - confirmUser: number; - country: number; - created: Date; - doneNeedsCount: number; - education: EducationEnum; - existenceStatus: number; - familyCount: number; - generatedCode: string; - housingStatus: HousingEnum; - ngoId: number; - flaskSwId: number; - isConfirmed: boolean; - isDeleted: boolean; - isMigrated: boolean; - isGone: boolean; - migrateDate: Date; - migratedId: number; - nationality: string; - phoneNumber: string; - sayFamilyCount: number; - sayName: string; - sayNameTranslations: { en: string, fa: string } - sleptAvatarUrl: string; - status: number; - updated: Date; - voiceUrl: string; - avatarUrl: string; - -} diff --git a/src/types/dtos/CreateComment.dto.ts b/src/types/dtos/CreateComment.dto.ts new file mode 100644 index 0000000000..126d47f2d5 --- /dev/null +++ b/src/types/dtos/CreateComment.dto.ts @@ -0,0 +1,11 @@ +import { IsNotEmpty } from 'class-validator'; +import { VirtualFamilyRole } from '../interfaces/interface'; + +export class CreateCommentDto { + @IsNotEmpty() + flaskNeedId: number; + @IsNotEmpty() + vRole: VirtualFamilyRole; + @IsNotEmpty() + message: string; +} diff --git a/src/types/dtos/CreateNeed.dto.ts b/src/types/dtos/CreateNeed.dto.ts deleted file mode 100644 index 6c06a40fa4..0000000000 --- a/src/types/dtos/CreateNeed.dto.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { ChildrenEntity } from '../../entities/children.entity'; -import { IsNotEmpty } from 'class-validator'; -import { CreateReceiptDto } from './CreateReceipt.dto'; -import { SocialWorkerDto } from './CreateSocialWorker.dto'; -import { CreateChildDto } from './CreateChildren.dto'; - -export class NeedsDataDto { - all_needs_count: number; - totalCount: number; - needs: NeedDto[] -} - - -export class NeedDto { - @IsNotEmpty() - needId: number; - @IsNotEmpty() - title: string; - affiliateLinkUrl: string; - link: string; - bankTrackId: string; - category: number; - childGeneratedCode: string; - childSayName: string; - childDeliveryDate: Date | null; - childId: number; - confirmDate: Date | null; - confirmUser: number; - cost: number; - created: Date | null; - deleted_at: Date | null; - description: string; - descriptionTranslations: { en: string; fa: string }; - details: string; - doing_duration: number; - donated: number; - doneAt: Date | null; - expectedDeliveryDate: Date | null; - imageUrl: string; - needRetailerImg: string; - information: string; - isConfirmed: boolean; - signatures: []; - isDeleted: boolean; - isDone: boolean; - isReported: boolean; - isUrgent: boolean; - is_done: boolean; - titleTranslations: { en: string; fa: string }; - ngoAddress: string; - ngoId: number; - ngoName: string; - ngoDeliveryDate: Date | null; - oncePurchased: boolean; - paid: number; - progress: string; - purchaseCost: any; - purchaseDate: Date | null; - receiptCount: number; - status: number; - statusDescription: any; - statusUpdatedAt: Date | null; - type: number; - typeName: string; - unavailableFrom: Date | null; - unconfirmedAt: Date | null; - unpaidCost: number; - unpayable: boolean; - unpayableFrom: Date | null; - updated: Date; - payments: CreatePaymentDto[]; - receipts: CreateReceiptDto[]; - participants: CreateParticipantDto[]; - child: CreateChildDto; - created_by_id: number; -} - -// // need from panel - flask server -export class CreatePaymentDto { - bank_amount?: number; - card_no?: string; - cart_payment_id?: string; - created?: Date | null; - credit_amount?: number; - desc?: string; - donation_amount?: number; - gateway_payment_id?: string; - gateway_track_id?: string; - hashed_card_no?: string; - id?: number; - id_need?: number; - id_user?: number; - link?: string; - need_amount?: number; - order_id?: string; - total_amount?: number; - transaction_date?: Date | null; - updated?: Date | null; - verified?: Date | null; -} - -export class CreateParticipantDto { - id_user: number; - user_avatar: string; -} diff --git a/src/types/dtos/CreateNgo.dto.ts b/src/types/dtos/CreateNgo.dto.ts deleted file mode 100644 index b6eb078294..0000000000 --- a/src/types/dtos/CreateNgo.dto.ts +++ /dev/null @@ -1,24 +0,0 @@ - -export class CreateNgoDto { - id: number - name: string; - website: string; - city: number - state: number - country: number; - logoUrl: ImageData; - isActive: boolean - isDeleted: number - socialWorkerCount: number - currentSocialWorkerCount: number - childrenCount: number - currentChildrenCount: number - postalAddress: string - emailAddress: string - phoneNumber: string - balance: number - registerDate: Date; -} - - - diff --git a/src/types/dtos/CreatePayment.dto.ts b/src/types/dtos/CreatePayment.dto.ts new file mode 100644 index 0000000000..249d10a18d --- /dev/null +++ b/src/types/dtos/CreatePayment.dto.ts @@ -0,0 +1,54 @@ +import { IsNotEmpty } from 'class-validator'; + +export class CreatePaymentDto { + id?: number; + verified?: Date; + id_need: number; + id_user: number; + order_id: string; + credit_amount: number; + donation_amount: number; + card_no: string; + gateway_payment_id: string; + gateway_track_id: string; + need_amount: number; + transaction_date: Date; + created: Date; + updated: Date; +} + +export class CreateFlaskPaymentDto { + @IsNotEmpty() + needId: number; + @IsNotEmpty() + gateWay: number; + @IsNotEmpty() + amount: number; + @IsNotEmpty() + donation: number; + @IsNotEmpty() + useCredit: boolean; +} + + +export class CreateFlaskCartPaymentDto { + @IsNotEmpty() + gateWay: number; + @IsNotEmpty() + donation: number; + @IsNotEmpty() + useCredit: boolean; +} + +export class VerifyFlaskPaymentDto { + // idpay + @IsNotEmpty() + id: number; + @IsNotEmpty() + order_id: number; + // zipal + @IsNotEmpty() + trackId: number; + @IsNotEmpty() + orderId: number; +} diff --git a/src/types/dtos/CreateProvider.dto.ts b/src/types/dtos/CreateProvider.dto.ts index a40999530a..60e2a6d07c 100644 --- a/src/types/dtos/CreateProvider.dto.ts +++ b/src/types/dtos/CreateProvider.dto.ts @@ -1,10 +1,11 @@ -import { NeedTypeDefinitionEnum } from '../interface'; +import { NeedTypeDefinitionEnum } from '../interfaces/interface'; export class CreateProviderDto { name: string; description: string; + address: string; website: string; - type: number; + type: string; typeName: NeedTypeDefinitionEnum; city: number; state: number; @@ -12,3 +13,9 @@ export class CreateProviderDto { logoUrl: ImageData; isActive: boolean } + +export class CreateProviderJoinNeedDto { + nestProviderId: string; + flaskNeedId: number; + +} diff --git a/src/types/dtos/CreateReceipt.dto.ts b/src/types/dtos/CreateReceipt.dto.ts index f9a8619977..9f92098f0a 100644 --- a/src/types/dtos/CreateReceipt.dto.ts +++ b/src/types/dtos/CreateReceipt.dto.ts @@ -1,11 +1,19 @@ export class CreateReceiptDto { - title: string; - description: string; - attachment: string; - isPublic: boolean; - code: string; - ownerId: number; - needStatus: number; id: number; - deleted: boolean | null; + need_id: number; + sw_id: number; + receipt_id: number; + deleted: number; + receipt: Receipt[];} + +export class Receipt { + id: number; + owner_id?: number; + need_id: number; + attachment: string; + need_status?: number; + description?: string; + title?: string; + code?: string; + deleted?: Date; } diff --git a/src/types/dtos/CreateSendNewsLetter.dto.ts b/src/types/dtos/CreateSendNewsLetter.dto.ts new file mode 100644 index 0000000000..8d14feefc2 --- /dev/null +++ b/src/types/dtos/CreateSendNewsLetter.dto.ts @@ -0,0 +1,14 @@ +import { IsNotEmpty } from 'class-validator'; + +export class CreateSendNewsLetterDto { + @IsNotEmpty() + isTest: boolean; + @IsNotEmpty() + fileName: string; + @IsNotEmpty() + title: string; + @IsNotEmpty() + smsLink: string; + @IsNotEmpty() + smsContent: string; +} diff --git a/src/types/dtos/CreateSignature.dto.ts b/src/types/dtos/CreateSignature.dto.ts index 7eed9ef8b9..4ecdcf558a 100644 --- a/src/types/dtos/CreateSignature.dto.ts +++ b/src/types/dtos/CreateSignature.dto.ts @@ -1,19 +1,88 @@ import { IsNotEmpty } from 'class-validator'; +import { SwmypageNeeds } from 'src/generated-sources/openapi'; +import { SAYPlatformRoles } from '../interfaces/interface'; +import { CreatePaymentDto } from './CreatePayment.dto'; +import { CreateReceiptDto } from './CreateReceipt.dto'; +import { CreateStatusDto } from './CreateStatus.dto'; +import Decimal from 'decimal.js'; -export class SwCreateSwSignatureDto { - @IsNotEmpty() - flaskSwId: number; - @IsNotEmpty() - flaskNeedId: number; - @IsNotEmpty() - flaskChildId: number; - @IsNotEmpty() - signerAddress: string +export class NeedSignatureMessage { + @IsNotEmpty() + domain: string; + @IsNotEmpty() + address: string; + @IsNotEmpty() + statement: string; + @IsNotEmpty() + uri: string; + @IsNotEmpty() + version: string; + @IsNotEmpty() + chainId: number; + @IsNotEmpty() + nonce: string; +} +export class VerifyWalletDto { + message: NeedSignatureMessage; + signature: string; +} + +// export class VerifySignatureDto { +// @IsNotEmpty() +// signature: string; +// @IsNotEmpty() +// message: string; +// } + +export class PreparePanelSignatureDto { + @IsNotEmpty() + chainId: number; + @IsNotEmpty() + flaskNeedId: number; + statuses?: CreateStatusDto[]; + receipts?: CreateReceiptDto[]; + @IsNotEmpty() + arrivedColumnNumber: number; + @IsNotEmpty() + payments?: CreatePaymentDto[]; +} + +export class VerifySignatureDto { + @IsNotEmpty() + chainId: number; + @IsNotEmpty() + flaskNeedId: number; +} + +export class VariableCreateDto { + @IsNotEmpty() + distanceRatio: Decimal; + @IsNotEmpty() + difficultyRatio: Decimal; + @IsNotEmpty() + contributionRatio: Decimal; +} + +export class PrepareDappSignatureDto { + @IsNotEmpty() + chainId: number; + @IsNotEmpty() + needId: string; + @IsNotEmpty() + variables: VariableCreateDto; +} + +export class CreateSignatureDto { + @IsNotEmpty() + sayRoles: SAYPlatformRoles[]; + @IsNotEmpty() + flaskNeedId: number; + @IsNotEmpty() + verifyVoucherAddress: string; } export class FamilyCreateSwSignatureDto { - flaskSwId: number; - flaskNeedId: number; - flaskChildId: number; - signerAddress: string; + userId: number; + needId: number; + childId: number; } diff --git a/src/types/dtos/CreateSocialWorker.dto.ts b/src/types/dtos/CreateSocialWorker.dto.ts index 1ab36266e2..03942c1975 100644 --- a/src/types/dtos/CreateSocialWorker.dto.ts +++ b/src/types/dtos/CreateSocialWorker.dto.ts @@ -1,40 +1,69 @@ +import { NgoEntity } from 'src/entities/ngo.entity'; +import { SAYPlatformRoles } from '../interfaces/interface'; -export class SocialWorkerDto { - cityId?: number; - firstName?: string; - lastName?: string; - birthCertificateNumber?: number; - passportNumber?: number; - postalAddress?: string; - bankAccountNumber?: number; - bankAccountShebaNumber?: number; - bankAccountCardNumber?: number; - birthDate?: Date | null; - telegramId?: string; - idNumber?: string; - isCoordinator?: true; - ngoId?: number; - typeId?: number; // user type - gender?: false; - phoneNumber?: string; - emergencyPhoneNumber?: string; - email?: string; - avatarUrl?: string; - idCardUrl?: string; - passportUrl?: string; - id: number; - username?: string; - generatedCode?: string; - childCount?: number; - currentChildCount?: number; - created?: Date | null; - updated?: Date | null; - needCount?: number; - currentNeedCount?: number; - lastLoginDate?: Date | null; - isActive?: true; - isDeleted?: false; - locale?: string; - typeName?: string; - ngoName?: string; +export class CreateSocialWorkerDto { + flaskId: number; + flaskNgoId: number; + birthDate: Date; + role: SAYPlatformRoles; + birth_certificate_number?: string; + id_card_url?: string; + generated_code?: string; + city_id?: string; + id_number?: string; + passport_number?: string; + postal_address?: string; + gender: boolean; + bank_account_number?: string; + bank_account_sheba_number?: string; + birth_date?: Date; + telegram_id?: string; + is_coordinator?: boolean; + phone_number?: string; + emergency_phone_number?: string; + email: string; + avatar_url?: string; + passport_url?: string; + username: string; + created: Date; + updated: Date; + last_login_date?: Date; + locale: string; + type_id?: number; + first_name?: string; + last_name?: string; + cityId?: number; + stateId?: number; + countryId?: number; + cityName?: string; + stateName?: string; + countryName?: string; + firstName?: string; + lastName?: string; + birthCertificateNumber?: Date; + idNumber?: string; + passportNumber?: string; + postalAddress?: string; + bankAccountNumber?: string; + bankAccountShebaNumber?: string; + bankAccountCardNumber?: string; + telegramId?: string; + isCoordinator?: boolean; + ngo?: NgoEntity; + phoneNumber?: string; + emergencyPhoneNumber?: string; + avatarUrl?: string; + idCardUrl?: string; + passportUrl?: string; + generatedCode?: string; + childCount?: number; + currentChildCount?: number; + needCount?: number; + currentNeedCount?: number; + lastLoginDate?: Date; + isActive?: boolean; + isDeleted?: boolean; + typeId?: number; + typeName?: string; + ngoName?: string; } diff --git a/src/types/dtos/CreateStatus.dto.ts b/src/types/dtos/CreateStatus.dto.ts new file mode 100644 index 0000000000..30b9ce779c --- /dev/null +++ b/src/types/dtos/CreateStatus.dto.ts @@ -0,0 +1,8 @@ +export class CreateStatusDto { + id?: number; + sw_id?: number; + need_id?: number; + new_status?: number; + old_status?: number; +} + diff --git a/src/types/dtos/DoneNeedRequest.dto.ts b/src/types/dtos/DoneNeedRequest.dto.ts deleted file mode 100644 index 4ecfbd4626..0000000000 --- a/src/types/dtos/DoneNeedRequest.dto.ts +++ /dev/null @@ -1,6 +0,0 @@ -export class DoneNeedRequestDto { - userId: number; - childId: number; -} - - diff --git a/src/types/dtos/SyncRequest.dto.ts b/src/types/dtos/SyncRequest.dto.ts deleted file mode 100644 index d240f32a3c..0000000000 --- a/src/types/dtos/SyncRequest.dto.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { CreateChildDto } from "./CreateChildren.dto"; -import { NeedDto } from "./CreateNeed.dto"; -import { IsNotEmpty } from 'class-validator' - -export class SyncRequestDto { - childData?: CreateChildDto[]; - @IsNotEmpty() // through the ValidationPipe - needData: NeedDto[]; - childId?: number; - ngoId?: number; - swId?: number; -} diff --git a/src/types/dtos/contribution/CreateContribution.dto.ts b/src/types/dtos/contribution/CreateContribution.dto.ts new file mode 100644 index 0000000000..11d0343463 --- /dev/null +++ b/src/types/dtos/contribution/CreateContribution.dto.ts @@ -0,0 +1,8 @@ +import { IsNotEmpty } from "class-validator"; + +export class CreateContributionDto { + @IsNotEmpty() + title: string; + @IsNotEmpty() + description: string; +} diff --git a/src/types/dtos/mine/create-mine.dto.ts b/src/types/dtos/mine/create-mine.dto.ts new file mode 100644 index 0000000000..f1aef93990 --- /dev/null +++ b/src/types/dtos/mine/create-mine.dto.ts @@ -0,0 +1 @@ +export class CreateMineDto {} diff --git a/src/types/dtos/mine/update-mine.dto.ts b/src/types/dtos/mine/update-mine.dto.ts new file mode 100644 index 0000000000..5f03417275 --- /dev/null +++ b/src/types/dtos/mine/update-mine.dto.ts @@ -0,0 +1,4 @@ +import { PartialType } from '@nestjs/swagger'; +import { CreateMineDto } from './create-mine.dto'; + +export class UpdateMineDto extends PartialType(CreateMineDto) {} diff --git a/src/types/dtos/ticket/CreateJoinRoom.dto.ts b/src/types/dtos/ticket/CreateJoinRoom.dto.ts new file mode 100644 index 0000000000..3a96aca936 --- /dev/null +++ b/src/types/dtos/ticket/CreateJoinRoom.dto.ts @@ -0,0 +1,9 @@ +import { IsNotEmpty } from "class-validator" + +export class CreateJoinRoomDto { + @IsNotEmpty() + ticketId: string + @IsNotEmpty() + flaskUserId: number +} + diff --git a/src/types/dtos/ticket/CreateTicket.dto.ts b/src/types/dtos/ticket/CreateTicket.dto.ts new file mode 100644 index 0000000000..a0419d1504 --- /dev/null +++ b/src/types/dtos/ticket/CreateTicket.dto.ts @@ -0,0 +1,35 @@ +import { IsNotEmpty } from 'class-validator'; +import { SwmypageNeeds } from 'src/generated-sources/openapi'; +import { AnnouncementEnum } from 'src/types/interfaces/interface'; +import { CreatePaymentDto } from '../CreatePayment.dto'; +import { CreateReceiptDto } from '../CreateReceipt.dto'; +import { CreateStatusDto } from '../CreateStatus.dto'; + +export class customNeed { + need: SwmypageNeeds; + child: { + id: number; + sayName: string; + firstName: string; + lastName: string; + birthDate: string; + awakeAvatarUrl: string; + }; +} + +export class CreateTicketDto { + title: string; + @IsNotEmpty() + flaskNeedId: number; + @IsNotEmpty() + flaskUserId: number; + @IsNotEmpty() + userTypeId: number; + announcement: AnnouncementEnum; + arrivalDate: Date; + statuses?: CreateStatusDto[] + receipts?: CreateReceiptDto[] + payments?: CreatePaymentDto[] + @IsNotEmpty() + roles: string[]; +} diff --git a/src/types/dtos/ticket/CreateTicketColor.dto.ts b/src/types/dtos/ticket/CreateTicketColor.dto.ts new file mode 100644 index 0000000000..b31ca6af7b --- /dev/null +++ b/src/types/dtos/ticket/CreateTicketColor.dto.ts @@ -0,0 +1,11 @@ +import { IsNotEmpty } from "class-validator" + +export class CreateTicketColorDto { + @IsNotEmpty() + ticketId: string + @IsNotEmpty() + color: number + @IsNotEmpty() + flaskUserId: number +} + diff --git a/src/types/dtos/ticket/CreateTicketContent.dto.ts b/src/types/dtos/ticket/CreateTicketContent.dto.ts new file mode 100644 index 0000000000..6c2b82f192 --- /dev/null +++ b/src/types/dtos/ticket/CreateTicketContent.dto.ts @@ -0,0 +1,9 @@ +import { IsNotEmpty } from "class-validator" + +export class CreateTicketContentDto { + @IsNotEmpty() + ticketId: string + @IsNotEmpty() + message: string +} + diff --git a/src/types/dtos/ticket/CreateTicketNotif.dto.ts b/src/types/dtos/ticket/CreateTicketNotif.dto.ts new file mode 100644 index 0000000000..aa8a86fa90 --- /dev/null +++ b/src/types/dtos/ticket/CreateTicketNotif.dto.ts @@ -0,0 +1,7 @@ +import { IsNotEmpty } from "class-validator" + +export class CreateTicketNotificationDto { + @IsNotEmpty() + flaskUserId: number +} + diff --git a/src/types/dtos/ticket/CreateTicketView.dto.ts b/src/types/dtos/ticket/CreateTicketView.dto.ts new file mode 100644 index 0000000000..893b21dd73 --- /dev/null +++ b/src/types/dtos/ticket/CreateTicketView.dto.ts @@ -0,0 +1,9 @@ +import { IsNotEmpty } from "class-validator" + +export class CreateTicketViewDto { + @IsNotEmpty() + ticketId: string + @IsNotEmpty() + flaskUserId: number +} + diff --git a/src/types/dtos/ticket/UpdateTicket.dto.ts b/src/types/dtos/ticket/UpdateTicket.dto.ts new file mode 100644 index 0000000000..9f103dc058 --- /dev/null +++ b/src/types/dtos/ticket/UpdateTicket.dto.ts @@ -0,0 +1,4 @@ +import { PartialType } from '@nestjs/swagger'; +import { CreateTicketDto } from './CreateTicket.dto'; + +export class UpdateTicketDto extends PartialType(CreateTicketDto) { } diff --git a/src/types/dtos/ticket/UpdateTicketContent.dto .ts b/src/types/dtos/ticket/UpdateTicketContent.dto .ts new file mode 100644 index 0000000000..93e1925063 --- /dev/null +++ b/src/types/dtos/ticket/UpdateTicketContent.dto .ts @@ -0,0 +1,4 @@ +import { PartialType } from '@nestjs/swagger'; +import { CreateTicketDto } from './CreateTicket.dto'; + +export class UpdateTicketContentDto extends PartialType(CreateTicketDto) { } diff --git a/src/types/dtos/url.dto.ts b/src/types/dtos/url.dto.ts new file mode 100644 index 0000000000..4e38094e95 --- /dev/null +++ b/src/types/dtos/url.dto.ts @@ -0,0 +1,7 @@ +import { IsString, IsNotEmpty } from 'class-validator'; + +export class ShortenURLDto { + @IsString() + @IsNotEmpty() + longUrl: string; +} \ No newline at end of file diff --git a/src/types/interface.ts b/src/types/interface.ts deleted file mode 100644 index 9a70d0a935..0000000000 --- a/src/types/interface.ts +++ /dev/null @@ -1,155 +0,0 @@ - -export enum RolesEnum { - NO_ROLE = 0, - SUPER_ADMIN = 1, - SOCIAL_WORKER = 2, - COORDINATOR = 3, // contributor - NGO_SUPERVISOR = 4, - SAY_SUPERVISOR = 5, - ADMIN = 6, // team lead - FAMILY = 7, - FRIEND = 8, -}; - -export interface HeaderOptions { accessToken: string, X_SKIP?: number, X_TAKE?: number } -export interface NeedApiParams { isConfirmed?: boolean, isDone?: boolean, isReported?: boolean, status?: string, type?: number, ngoId?: number, isChildConfirmed?: boolean, unpayable?: boolean, options?: any } - -export interface Domain { - name: string; - version: string; - verifyingContract: string; - chainId: string; -} - -export interface SwSignatureResult { - SocialWorkerVoucher: SwProductVoucher | SwServiceVoucher; - types: VoucherTypes; - domain: Domain; -} -export interface VoucherTypes { - Voucher: { name: string; type: string; }[]; -} - - -export interface SwServiceVoucher { - title: string; - category: CategoryDefinitionEnum; - child: string; - receipts: string; // title1, title2, ... - bankTrackId: string, - signerAddress: string; - content: string; -} - -export interface SwProductVoucher { - title: string; - category: CategoryDefinitionEnum; - child: string; - receipts: string; // title1, title2, ... - signerAddress: string; - content: string; -} - -export interface FamilyVoucher { - flaskNeedId: number; - flaskUserId: number; - child: number; - wallet: string; - content: string; -} - -export enum SignatureEnum { - FAMILY = 'family', - SW = 'social worker', - Friend = 'friend', -} - -/* ----- PAYMENT----- -partial payment status = 1 -complete payment status = 2 - ----- PRODUCT ---type = 1--- -complete purchase for product status = 3 -complete delivery for product to NGO status = 4 -complete delivery to child status = 5 - ------ SERVICE ---type = 0--- -complete money transfer to NGO for service status = 3 -complete delivery to child for service status = 4 -*/ - - -export enum PaymentStatusEnum { - PARTIAL_PAY = 1, - COMPLETE_PAY = 2, -} - -export enum ServiceStatusEnum { - PARTIAL_PAY = PaymentStatusEnum.PARTIAL_PAY, - COMPLETE_PAY = PaymentStatusEnum.COMPLETE_PAY, - MONEY_TO_NGO = 3, - DELIVERED = 4, -} - -export enum ProductStatusEnum { - PARTIAL_PAY = PaymentStatusEnum.PARTIAL_PAY, - COMPLETE_PAY = PaymentStatusEnum.COMPLETE_PAY, - PURCHASED_PRODUCT = 3, - DELIVERED_TO_NGO = 4, - DELIVERED = 5, -} - -export enum CategoryEnum { - GROWTH = 0, - JOY = 1, - HEALTH = 2, - SURROUNDING = 3, -} - -// -3:Deprived of education | -2:Kindergarten | -1:Not attending | 0:Pre-school | 1:1st grade | 2:2nd grade | ... | 13:University -export enum EducationEnum { - DEPRIVED = -3, - KINDERGARTEN = -2, - NOT_ATTENDING = -1, - PRE_SCHOOL = 0, - FIRST_GRADE = 1, - SECOND_GRADE = 2, - THIRD_GRADE = 3, - FOURTH_GRADE = 4, - FIVE_GRADE = 5, - SIX_GRADE = 6, - SEVEN_GRADE = 7, - EIGHT_GRADE = 8, - NINE_GRADE = 9, - TEN_GRADE = 10, - ELEVEN_GRADE = 11, - TWELVE_GRADE = 12, - THIRTEEN_GRADE = 13, -} - -// 0:homeless | 1:Resident| 2:Care centers -export enum HousingEnum { - HOMELESS = 0, - RESIDENT = 1, - CARE_CENTERS = 2, -} - -export enum CategoryDefinitionEnum { - GROWTH = "Growth", - JOY = "Joy", - HEALTH = "Health", - SURROUNDING = "Surrounding", -} - - -export enum NeedTypeEnum { - SERVICE = 0, - PRODUCT = 1, -} - - -export enum NeedTypeDefinitionEnum { - SERVICE = "Service", - PRODUCT = "Product", -} \ No newline at end of file diff --git a/src/types/interfaces/Children.ts b/src/types/interfaces/Children.ts new file mode 100644 index 0000000000..1c5c4013d0 --- /dev/null +++ b/src/types/interfaces/Children.ts @@ -0,0 +1,53 @@ +import { EducationEnum, HousingEnum } from './interface'; + +export class ChildrenData { + totalCount: number; + children: Children[] +} + +export class Children { + id: number; + id_ngo: number; + id_social_worker: number; + firstName_translations: { en: string; fa: string }; + firstName: string; + lastName_translations: { en: string; fa: string }; + lastName: string; + sayname_translations: { en: string; fa: string }; + sayName: string; + phoneNumber: string; + nationality: string; + country: number; + city: number; + awakeAvatarUrl: string; + sleptAvatarUrl: string; + gender: boolean; + bio_translations: { en: string; fa: string }; + bio: string; + bio_summary_translations: { en: string; fa: string }; + bioSummary: string; + sayFamilyCount: number; + voiceUrl: string; + birthPlace: Date; + birthDate: Date; + address: string; + housingStatus: HousingEnum; + familyCount: number; + education: EducationEnum; + status: number | null; + existence_status: number; + isDeleted: boolean; + isConfirmed: boolean; + confirmUser: number; + confirmDate: Date; + generatedCode: string; + isMigrated: boolean; + migratedId: number | null; + migrateDate: Date | null; + avatarUrl: string; + is_gone: boolean; + done_needs_count: number; + spent_credit: number; + created: Date; + updated: Date +} diff --git a/src/types/interfaces/Need.ts b/src/types/interfaces/Need.ts new file mode 100644 index 0000000000..75e1ec5403 --- /dev/null +++ b/src/types/interfaces/Need.ts @@ -0,0 +1,264 @@ +import { IpfsEntity } from 'src/entities/ipfs.entity'; +import { SignatureEntity } from 'src/entities/signature.entity'; +import { TicketEntity } from 'src/entities/ticket.entity'; +import { + SwmypageReceipts_, + SwmypageStatusUpdates, + SwmypageVerifiedPayments, +} from 'src/generated-sources/openapi'; +import { SAYPlatformRoles } from './interface'; + +export interface NeedsData { + all_needs_count: number; + totalCount: number; + needs: Need[]; +} + +export interface ChildNeed { + title: string; + imageUrl: string; + img: string; + name_translations: Record; + doing_duration: number; + affiliateLinkUrl?: string; + bank_track_id?: string; + category: number; + child_delivery_date?: Date; + confirmDate?: Date; + _cost: number; + description_translations: Record; + details: string; + informations: string; + doneAt: Date; + expected_delivery_date: Date; + isConfirmed: boolean; + isDeleted: boolean; + isUrgent: boolean; + link: string; + ngo_delivery_date: Date; + purchase_cost: number; + purchase_date: Date; + status: number; + status_updated_at: Date; + type: number; + unavailable_from?: Date; + unconfirmed_at?: Date; + created: Date; + updated?: Date; + deleted_at?: Date; + child_id: number; + created_by_id: number; + confirmUser: number; + id: number; + child: { + id: number; + sayName: Record; + firstName: Record; + lastName: Record; + birthDate: Date; + awakeAvatarUrl: string; + }; + ticket: TicketEntity; + ipfs: IpfsEntity; +} + +export interface Need { + id: number; + child_id: number; + created_by_id: number; + name_translations: { en: string; fa: string }; + name: string; + description_translations: { en: string; fa: string }; + description: string; + imageUrl: string; + category: number; + isUrgent: boolean; + details: string; + informations: string; + purchase_cost: number; + link: string; + affiliateLinkUrl: string; + isDeleted: boolean; + receipts: null; + isConfirmed: boolean; + confirmUser: number; + type: number; + doing_duration: number; + status: number; + status_updated_at: Date; + isReported: boolean; + img: string; + title: string; + oncePurchased: boolean; + bank_track_id: string; + unavailable_from: Date; + doneAt: Date; + purchase_date: Date; + dkc: string; + expected_delivery_date: Date; + ngo_delivery_date: Date; + child_delivery_date: Date; + confirmDate: Date; + deleted_at: Date; + unconfirmed_at: Date; + paid: number; + donated: number; + receipt_count: number; + childSayName: string; + cost: number; + unpaid_cost: number; + pretty_cost: string; + pretty_paid: string; + pretty_donated: string; + unpayable: boolean; + unpayable_from: null; + progress: number; + isDone: boolean; + is_done: boolean; + clean_title: string; + type_name: string; + status_description: string; + created: Date; + updated: Date; + ngoId: 1; + ngoName: string; + ngoAddress: string; + childGeneratedCode: string; + childFirstName: string; + childLastName: string; + payments: Payment[]; + receipt: Receipt[]; +} + +export type Receipt = { + title: string; + description: string; + attachment: string; + isPublic: boolean; + code: string; + flaskSwId: number; + socialWorker: number; + child: number; + needStatus: number; + flaskReceiptId: number; + deleted: boolean | null; + flaskNeedId: number; +}; + +export interface Payment { + id: number; + id_need: number; + id_user: number; + cart_payment_id: number; + gateway_payment_id: number; + gateway_track_id: string; + link: string; + order_id: string; + desc: string; + card_no: string; + hashed_card_no: string; + transaction_date: string; + verified: string; + is_nakama: boolean; + need_amount: number; + credit_amount: number; + donation_amount: number; + bank_amount: number; + total_amount: number; + created: Date; + updated: Date; +} + +/** + * + * @type {string} + * @memberof NeedModel from generated codes + */ +export interface NeedSummary { + id?: number; + name?: string; + imageUrl?: string; + category?: number; + isUrgent?: boolean; + description?: string; + descriptionSummary?: string; + cost?: number; + progress?: number; + paid?: number; + affiliateLinkUrl?: string; + isDone?: boolean; + isDeleted?: boolean; + created?: string; + receipts?: string; + isConfirmed?: boolean; + confirmDate?: string; + confirmUser?: number; + type?: number; + updated?: string; + details?: string; + informations?: string; +} + +export class CreateParticipantDto { + id_user: number; + user_avatar: string; +} + +export class ValidatedDupType { + validation: { + needId: number; + dupId: number; + C: boolean | null; + T: boolean | null; + R: boolean | null; + P: boolean | null; + I: boolean | null; + N: boolean | null; + D: boolean | null; + A: boolean | null; + titleResult: number | null; + isValidNeed: boolean | null; + isValidDuplicate: boolean | null; + ageOfDup: number; + msg: string; + status: number; + TT?: boolean | null; + }; + + title: string; + imageUrl: string; + img: string; + name_translations: Record; + doing_duration: number; + affiliateLinkUrl?: string; + bank_track_id?: string; // when confirming a need 4 duplicates are allow for the category 0 + category: number; + child_delivery_date?: Date; + confirmDate?: Date; + _cost: number; + description_translations: Record; + details: string; + informations: string; + doneAt: Date; + expected_delivery_date: Date; + isConfirmed: boolean; + isDeleted: boolean; + isUrgent: boolean; + link: string; + ngo_delivery_date: Date; + purchase_cost: number; + purchase_date: Date; + status: number; + status_updated_at: Date; + type: number; + unavailable_from?: Date; + unconfirmed_at?: Date; + created: Date; + updated?: Date; + deleted_at?: Date; + child_id: number; + deliveryCode: string; + created_by_id: number; + confirmUser: number; + id: number; +} diff --git a/src/types/interfaces/interface.ts b/src/types/interfaces/interface.ts new file mode 100644 index 0000000000..b0cf9ab2fd --- /dev/null +++ b/src/types/interfaces/interface.ts @@ -0,0 +1,321 @@ +export const SAY_DAPP_ID = 208; +export const SUPER_ADMIN_ID_PANEL = 25; +export const SUPER_ADMIN_ID_DAPP = 115; +export enum eEthereumNetworkChainId { + mainnet = 1, + goerli = 5, + sepolia = 11155111, +} +export enum VirtualFamilyRole { + SAY = -2, + FATHER = 0, + MOTHER = 1, + AMOO = 2, + KHALEH = 3, + DAEI = 4, + AMME = 5, +} + +export enum Colors { + WHITE = 0, + BLUE = 1, + YELLOW = 2, + RED = 3, +} + +export enum SexEnum { + FEMALE = 1, + MALE = 2, +} +export enum AnnouncementEnum { + ERROR = -1, + NONE = 0, + ARRIVED_AT_NGO = 1, + NGO_RECEIVED_MONEY = 2, +} + +export enum FlaskUserTypesEnum { + NO_ROLE = 0, + SUPER_ADMIN = 1, + SOCIAL_WORKER = 2, + COORDINATOR = 3, + NGO_SUPERVISOR = 4, + SAY_SUPERVISOR = 5, + ADMIN = 6, + FAMILY = 7, + RELATIVE = 8, +} + +export enum PanelContributors { + NO_ROLE = 0, + SOCIAL_WORKER = 1, + NGO_SUPERVISOR = 2, + PURCHASER = 3, + AUDITOR = 4, +} +export enum AppContributors { + FAMILY = 7, + RELATIVE = 8, +} +export enum SAYPlatformRoles { + NGO = -2, + CHILD = -1, + NO_ROLE = 0, + SOCIAL_WORKER = PanelContributors.SOCIAL_WORKER, + NGO_SUPERVISOR = PanelContributors.NGO_SUPERVISOR, + PURCHASER = PanelContributors.PURCHASER, + AUDITOR = PanelContributors.AUDITOR, + FAMILY = AppContributors.FAMILY, + RELATIVE = AppContributors.RELATIVE, +} + +export enum ChildExistence { + DEAD = 0, + AlivePresent = 1, + AliveGone = 2, + TempGone = 3, +} + +export enum ChildConfirmation { + NOT_CONFIRMED = 0, + CONFIRMED = 1, + BOTH = 2, +} + +export interface AuthenticationType { + token: string; + sayRole: SAYPlatformRoles; + flaskUserType: FlaskUserTypesEnum; + createdAt: Date; + isExpired: boolean; +} + +export interface HeaderOptions { + accessToken: string; + X_SKIP?: number; + X_TAKE?: number; +} +export interface NeedApiParams { + createdBy?: number; + confirmedBy?: number; + purchasedBy?: number; + isConfirmed?: boolean; + isDone?: boolean; + isReported?: boolean; + status?: string; + type?: number; + ngoId?: number; + isChildConfirmed?: boolean; + unpayable?: boolean; + options?: any; +} + +export interface ChildApiParams { + confirm: number; + ngoId?: any; + swId?: any; + existenceStatus?: any; + options?: any; +} + +export interface Domain { + name: string; + version: string; + verifyingContract: string; + chainId: number; +} + +export interface SwSignatureResult { + message: SwProductVoucher | SwServiceVoucher; + types: any; + domain: Domain; + sayRoles: SAYPlatformRoles[]; +} + +export interface SwServiceVoucher { + needId: number; + title: string; + category: CategoryDefinitionPersianEnum; + child: string; + paid: number; + bankTrackId: string; + receipts: number; + signer: string; + role: string; + content: string; +} + +export interface serviceSignatureTypes { + readonly Voucher: readonly [ + { readonly name: 'title'; readonly type: 'string' }, + { readonly name: 'category'; readonly type: 'string' }, + { readonly name: 'paid'; readonly type: 'uint256' }, + { readonly name: 'child'; readonly type: 'string' }, + { readonly name: 'bankTrackId'; readonly type: 'string' }, + { readonly name: 'receipts'; readonly type: 'uint256' }, + { readonly name: 'role'; readonly type: 'string' }, + { readonly name: 'content'; readonly type: 'string' }, + ]; +} + +export interface productSignatureTypes { + readonly Voucher: readonly [ + { readonly name: 'needId'; readonly type: 'uint256' }, + { readonly name: 'title'; readonly type: 'string' }, + { readonly name: 'category'; readonly type: 'string' }, + { readonly name: 'paid'; readonly type: 'uint256' }, + { readonly name: 'deliveryCode'; readonly type: 'string' }, + { readonly name: 'child'; readonly type: 'string' }, + { readonly name: 'role'; readonly type: 'string' }, + { readonly name: 'content'; readonly type: 'string' }, + ]; +} +export interface ServiceSignatureTypes { + needId: number; + title: string; + category: CategoryDefinitionPersianEnum; + child: string; + paid: number; + bankTrackId: string; + receipts: number; + signer: string; + role: string; + content: string; +} + +export interface SwProductVoucher { + needId: number; + title: string; + category: CategoryDefinitionPersianEnum; + paid: number; + deliveryCode: string; + child: string; + signer: string; + role: string; + content: string; +} + +export interface FamilyVoucher { + userId: number; + childId: number; + signerAddress: string; + content: string; +} + +/* +---- PAYMENT----- +partial payment status = 1 +complete payment status = 2 + +---- PRODUCT ---type = 1--- +complete purchase for product status = 3 +complete delivery for product to NGO status = 4 +complete delivery to child status = 5 + +----- SERVICE ---type = 0--- +complete money transfer to NGO for service status = 3 +complete delivery to child for service status = 4 +*/ + +export enum PreRegisterStatusEnum { + NOT_REGISTERED = 0, + PRE_REGISTERED = 1, + CONFIRMED = 2, +} + +export enum PaymentStatusEnum { + NOT_PAID = 0, + PARTIAL_PAY = 1, + COMPLETE_PAY = 2, +} + +export enum ServiceStatusEnum { + PARTIAL_PAY = PaymentStatusEnum.PARTIAL_PAY, + COMPLETE_PAY = PaymentStatusEnum.COMPLETE_PAY, + MONEY_TO_NGO = 3, + DELIVERED = 4, +} + +export enum ProductStatusEnum { + PARTIAL_PAY = PaymentStatusEnum.PARTIAL_PAY, + COMPLETE_PAY = PaymentStatusEnum.COMPLETE_PAY, + PURCHASED_PRODUCT = 3, + DELIVERED_TO_NGO = 4, + DELIVERED = 5, +} + +export enum CategoryEnum { + GROWTH = 0, + JOY = 1, + HEALTH = 2, + SURROUNDING = 3, +} + +export enum SchoolTypeEnum { + DEAF = 6, + BLIND = 7, + DOWN_SYNDROME = 8, + PUBLIC = 9, +} + +// -3:Deprived of education | -2:Kindergarten | -1:Not attending | 0:Pre-school | 1:1st grade | 2:2nd grade | ... | 13:University +export enum EducationEnum { + DEPRIVED = -3, + KINDERGARTEN = -2, + NOT_ATTENDING = -1, + PRE_SCHOOL = 0, + FIRST_GRADE = 1, + SECOND_GRADE = 2, + THIRD_GRADE = 3, + FOURTH_GRADE = 4, + FIVE_GRADE = 5, + SIX_GRADE = 6, + SEVEN_GRADE = 7, + EIGHT_GRADE = 8, + NINE_GRADE = 9, + TEN_GRADE = 10, + ELEVEN_GRADE = 11, + TWELVE_GRADE = 12, + THIRTEEN_GRADE = 13, +} + +// 0:homeless | 1:Resident| 2:Care centers +export enum HousingEnum { + HOMELESS = 0, + RESIDENT = 1, + CARE_CENTERS = 2, +} + +export enum CategoryDefinitionEnum { + GROWTH = 'Growth', + JOY = 'Joy', + HEALTH = 'Health', + SURROUNDING = 'Surrounding', +} + +export enum CategoryDefinitionPersianEnum { + GROWTH = 'رشد', + JOY = 'تفریح', + HEALTH = 'سلامت', + SURROUNDING = 'پیرامون', +} +export enum NeedTypeEnum { + SERVICE = 0, + PRODUCT = 1, +} + +export enum NeedTypeDefinitionEnum { + SERVICE = 'Service', + PRODUCT = 'Product', +} + +export enum CampaignNameEnum { + MONTHLY_CAMPAIGNS = 'MONTHLY_CAMPAIGNS', + CHILD_CONFIRMATION = 'CHILD_CONFIRMATION', + NEWS_LETTER = 'NEWS_LETTER', +} + +export enum CampaignTypeEnum { + EMAIL = 1, + SMS = 2, +} diff --git a/src/types/parameters/ChildParameters.ts b/src/types/parameters/ChildParameters.ts index dbad6cb19a..833d8fa45d 100644 --- a/src/types/parameters/ChildParameters.ts +++ b/src/types/parameters/ChildParameters.ts @@ -1,46 +1,118 @@ -import { NgoEntity } from "../../entities/ngo.entity"; -import { NeedEntity } from "../../entities/need.entity"; -import { EducationEnum, HousingEnum } from "../interface"; -import { SocialWorkerEntity } from "src/entities/user.entity"; +import { + EducationEnum, + HousingEnum, + PreRegisterStatusEnum, + SchoolTypeEnum, + SexEnum, +} from '../interfaces/interface'; export type ChildParams = { - flaskChildId: number; - flaskSupervisorId?: number; - awakeAvatarUrl?: string; - bio?: string; - bioSummary?: string; - bioSummaryTranslations?: { en: string; fa: string }; - bioTranslations?: { en: string; fa: string }; - birthDate?: Date; - birthPlace?: string; - city?: number; - confirmDate?: Date; - country?: number; - created?: Date; - doneNeedsCount?: number; - education?: EducationEnum; - existenceStatus?: number; - familyCount?: number; - generatedCode?: string; - housingStatus?: HousingEnum; - flaskSwId?: number; - ngo: NgoEntity; - socialWorker: SocialWorkerEntity; - supervisor?: SocialWorkerEntity; - isConfirmed?: boolean; - isDeleted?: boolean; - isMigrated?: boolean; - isGone?: boolean; - migrateDate?: Date; - migratedId?: number; - nationality?: string; - sayFamilyCount?: number; - sayName?: string; - sayNameTranslations?: { en: string; fa: string }; - sleptAvatarUrl?: string; - status?: number; - updated?: Date; - voiceUrl?: string; - needs?: NeedEntity[] -} + flaskId: number; + sayNameTranslations: Record; + sayName: string; + phoneNumber?: string; + nationality?: number; + country?: number; + city?: number; + awakeAvatarUrl: string; + sleptAvatarUrl: string; + adultAvatarUrl?: string; + bioSummaryTranslations?: Record; + bioTranslations?: Record; + voiceUrl?: string; + birthPlace?: string; + birthDate?: Date; + housingStatus?: number; + familyCount?: number; + sayFamilyCount?: number; + education?: number; + status?: number; + spentCredit?: number; + created?: Date; + updated?: Date; + isDeleted?: boolean; + isConfirmed?: boolean; + flaskConfirmUser?: number; + confirmDate?: Date; + generatedCode?: string; + isMigrated?: boolean; + migratedId?: number; + migrateDate?: Date; +}; +export type createFlaskChildParams = { + awakeAvatarUrl: any; + sleptAvatarUrl: any; + voiceUrl: any; + saynameTranslations: any; + bioTranslations: any; + bioSummaryTranslations: any; + phoneNumber: string; + country: number; + city: number; + gender: boolean; + ngoId?: number; + swId?: number; + firstNameTranslations?: any; + lastNameTranslations?: any; + nationalityId?: number; + birthPlace?: string; + birthDate?: string; + address?: string; + housingStatus?: HousingEnum; + familyCount?: number; + education?: number; +}; +export type PreRegisterChildPrepareParams = { + phoneNumber: string; + address: string; + country: number; + state: number; + city: number; + status: PreRegisterStatusEnum; + bio: { fa: string; en: string }; + voiceUrl: string; + birthPlaceId: number; + flaskChildId?: number; + birthPlaceName: string; + birthDate: Date; + housingStatus: HousingEnum; + familyCount: number; + educationLevel: EducationEnum; + schoolType: SchoolTypeEnum; + flaskNgoId: number; + flaskSwId: number; + firstName: { fa: string; en: string }; + lastName: { fa: string; en: string }; +}; + +export type PreRegisterChildUpdateParams = { + bio: { fa: string; en: string }; + voiceUrl?: string; + housingStatus: HousingEnum; + educationLevel: EducationEnum; + schoolType: SchoolTypeEnum; + firstName: { fa: string; en: string }; + lastName: { fa: string; en: string }; +}; + +export type PreRegisterChildUpdateApprovedParams = { + awakeUrl: string; + sleptUrl: string; + sayName: { fa: string; en: string }; + firstName: { fa: string; en: string }; + lastName: { fa: string; en: string }; + bio: { fa: string; en: string }; + birthDate: Date; + birthPlaceId: number; + city: number; + state: number; + country: number; + sex: SexEnum; + educationLevel: EducationEnum; + housingStatus: HousingEnum; + address: string; + familyCount: number; + phoneNumber: string; + voiceUrl: string; +}; diff --git a/src/types/parameters/CityParameters.ts b/src/types/parameters/CityParameters.ts new file mode 100644 index 0000000000..5efefbf4bd --- /dev/null +++ b/src/types/parameters/CityParameters.ts @@ -0,0 +1,12 @@ +export type CityParams = { + flaskCityId: number; + name: string; + stateId: number; + stateCode: string; + stateName: string; + countryId: number; + countryCode: string; + countryName: string; + latitude: string; + longitude: string; +}; diff --git a/src/types/parameters/CreateTicketContentParameters.ts b/src/types/parameters/CreateTicketContentParameters.ts new file mode 100644 index 0000000000..636ab5d1cf --- /dev/null +++ b/src/types/parameters/CreateTicketContentParameters.ts @@ -0,0 +1,9 @@ +import { AnnouncementEnum, Colors } from "../interfaces/interface" + +export class CreateTicketContentParams { + from: number + message: string + announcement: AnnouncementEnum + announcedArrivalDate?: Date + color?: Colors |null +} diff --git a/src/types/parameters/CreateTicketParameters.ts b/src/types/parameters/CreateTicketParameters.ts new file mode 100644 index 0000000000..215aed9a6f --- /dev/null +++ b/src/types/parameters/CreateTicketParameters.ts @@ -0,0 +1,12 @@ +import { NeedEntity } from 'src/entities/need.entity'; +import { AnnouncementEnum, Colors } from '../interfaces/interface'; + +export class CreateTicketParams { + title: string; + need: NeedEntity; + role: number; + flaskUserId: number; + flaskNeedId: number; + lastAnnouncement: AnnouncementEnum; + color?: Colors | null; +} diff --git a/src/types/parameters/NeedParameters.ts b/src/types/parameters/NeedParameters.ts index 6c0519f885..59be12d225 100644 --- a/src/types/parameters/NeedParameters.ts +++ b/src/types/parameters/NeedParameters.ts @@ -1,64 +1,36 @@ -import { NgoEntity } from "../../entities/ngo.entity"; -import { SocialWorkerEntity } from "../../entities/user.entity"; -import { NeedTypeEnum } from "../interface"; +import { NeedTypeEnum } from "../interfaces/interface"; export type NeedParams = { - flaskNeedId: number; - flaskChildId: number; - flaskNgoId: number; - flaskSwId: number, - flaskSupervisorId: number; - title: string; - affiliateLinkUrl: string; - link: string; - bankTrackId: string | null; - category: number; - childGeneratedCode: string; - childSayName: string; - childDeliveryDate: Date | null; - confirmDate: Date | null; - cost: number; - created: Date | null; - socialWorker: SocialWorkerEntity; - supervisor: SocialWorkerEntity; - deletedAt: Date | null; - description: string; - descriptionTranslations: { en: string, fa: string }; - details: string; - donated: number; - doneAt: Date | null; - expectedDeliveryDate: Date | null; - imageUrl: string; - needRetailerImg: string; - information: string; - isConfirmed: boolean; - doingDuration: number; - isDeleted: boolean; - isDone: boolean; - isReported: boolean; - isUrgent: boolean; - titleTranslations: { en: string; fa: string }; - ngoAddress: string; - ngo: NgoEntity; - ngoName: string; - ngoDeliveryDate: Date | null; - oncePurchased: boolean; - paid: number; - progress: string; - purchaseCost: any; - purchaseDate: Date | null; - receiptCount: number; - status: number; - statusDescription: any; - statusUpdatedAt: Date | null; - type: NeedTypeEnum; - typeName: string; - unavailableFrom: Date | null; - unconfirmedAt: Date | null; - unpaidCost: number; - unpayable: boolean; - unpayableFrom: Date | null; - updated: Date; -} - + flaskId: number + flaskChildId: number + name?: string, + nameTranslations: Record; + descriptionTranslations: Record; + title?: string; + status?: number; + imageUrl?: string; + category?: number; + type?: NeedTypeEnum; + isUrgent?: boolean; + affiliateLinkUrl?: string; + link?: string; + doingDuration?: number; + needRetailerImg?: string; + deliveryCode: string; + purchaseCost?: any; + cost?: number; + information?: string; + details?: string; + doneAt?: Date | null; + isConfirmed?: boolean; + unavailableFrom?: Date | null; + created?: Date; + updated?: Date; + purchaseDate?: Date + ngoDeliveryDate?: Date + expectedDeliveryDate?: Date + childDeliveryDate?: Date + confirmDate?: Date; + bankTrackId?: string | null; +} diff --git a/src/types/parameters/NgoParammeters.ts b/src/types/parameters/NgoParammeters.ts index f8377fecbb..247d55dd23 100644 --- a/src/types/parameters/NgoParammeters.ts +++ b/src/types/parameters/NgoParammeters.ts @@ -1,16 +1,16 @@ -import { SocialWorkerEntity } from "src/entities/user.entity"; +import { ContributorEntity } from "src/entities/contributor.entity"; export type NgoParams = { - flaskNgoId: number; - socialWorker?: SocialWorkerEntity; + flaskNgoId?: number; + socialWorkers?: ContributorEntity[]; name?: string; website?: string; - city?: number - state?: number - country?: number; + flaskCityId?: number + flaskStateId?: number + flaskCountryId?: number; logoUrl?: string; isActive?: boolean - isDeleted?: number + isDeleted?: boolean socialWorkerCount?: number currentSocialWorkerCount?: number childrenCount?: number @@ -20,4 +20,5 @@ export type NgoParams = { phoneNumber?: string balance?: number registerDate?: Date; + updated: Date, } diff --git a/src/types/parameters/PaymentParameters.ts b/src/types/parameters/PaymentParameters.ts index a1f964cb8d..931a04cc79 100644 --- a/src/types/parameters/PaymentParameters.ts +++ b/src/types/parameters/PaymentParameters.ts @@ -1,25 +1,18 @@ -import { FamilyEntity } from "src/entities/user.entity"; +import { AllUserEntity } from 'src/entities/user.entity'; export type PaymentParams = { - bankAmount: number; - cardNumber: string; - cartPaymentId: string; - created: Date | null; - creditAmount: number; - description: string; - donationAmount: number; - gatewayPaymentId: string; - gatewayTrackId: string; - hashedCardNumber: string; - flaskPaymentId: number; + flaskId: number; flaskNeedId: number; flaskUserId: number; - user: FamilyEntity; - link: string; - needAmount: number; orderId: string; - totalAmount: number; - transactionDate: Date | null; - updated: Date | null; - verified: Date | null; -} + verified?: Date; + needAmount?: number; + donationAmount?: number; + creditAmount?: number; + cardNumber: string; + gatewayPaymentId: string; + gatewayTrackId: string; + transactionDate: Date; + created: Date; + updated: Date; +}; diff --git a/src/types/parameters/ProviderParams.ts b/src/types/parameters/ProviderParams.ts index 0adf1d44a0..07eeac6356 100644 --- a/src/types/parameters/ProviderParams.ts +++ b/src/types/parameters/ProviderParams.ts @@ -1,8 +1,9 @@ -import { NeedTypeDefinitionEnum, NeedTypeEnum } from "../interface"; +import { NeedTypeDefinitionEnum, NeedTypeEnum } from "../interfaces/interface"; export type ProviderParams = { name: string; description: string; + address: string; website: string; type: NeedTypeEnum; typeName: NeedTypeDefinitionEnum; diff --git a/src/types/parameters/ReceiptParameter.ts b/src/types/parameters/ReceiptParameter.ts index 9b5580b2ed..7757944f69 100644 --- a/src/types/parameters/ReceiptParameter.ts +++ b/src/types/parameters/ReceiptParameter.ts @@ -1,17 +1,11 @@ -import { ChildrenEntity } from "src/entities/children.entity"; -import { SocialWorkerEntity } from "../../entities/user.entity"; - export type ReceiptParams = { title: string; description: string; attachment: string; - isPublic: boolean; code: string; flaskSwId: number; - socialWorker: SocialWorkerEntity; - child: ChildrenEntity; needStatus: number; flaskReceiptId: number; - deleted: boolean | null; + deleted: Date; flaskNeedId: number; } diff --git a/src/types/parameters/StausParameters.ts b/src/types/parameters/StausParameters.ts new file mode 100644 index 0000000000..6705f5cf63 --- /dev/null +++ b/src/types/parameters/StausParameters.ts @@ -0,0 +1,9 @@ +export type StatusParams = { + flaskId:number + swId?: number; + flaskNeedId?: number; + newStatus?: number; + oldStatus?: number; + created?: Date; + updated?: Date; +} diff --git a/src/types/parameters/UpdateTicketContentParameters.ts b/src/types/parameters/UpdateTicketContentParameters.ts new file mode 100644 index 0000000000..b8367c700f --- /dev/null +++ b/src/types/parameters/UpdateTicketContentParameters.ts @@ -0,0 +1,4 @@ +import { PartialType } from '@nestjs/swagger'; +import { CreateTicketDto } from '../dtos/ticket/CreateTicket.dto'; + +export class UpdateTicketContentParams extends PartialType(CreateTicketDto) { } diff --git a/src/types/parameters/UpdateTicketParameters.ts b/src/types/parameters/UpdateTicketParameters.ts new file mode 100644 index 0000000000..2f73955bad --- /dev/null +++ b/src/types/parameters/UpdateTicketParameters.ts @@ -0,0 +1,4 @@ +import { PartialType } from '@nestjs/swagger'; +import { CreateTicketDto } from '../dtos/ticket/CreateTicket.dto'; + +export class UpdateTicketParams extends PartialType(CreateTicketDto) { } diff --git a/src/types/parameters/UserParameters.ts b/src/types/parameters/UserParameters.ts index 37adb6efd0..0de6ed760c 100644 --- a/src/types/parameters/UserParameters.ts +++ b/src/types/parameters/UserParameters.ts @@ -1,61 +1,21 @@ -import { NgoEntity } from "../../entities/ngo.entity"; -import { NeedEntity } from "../../entities/need.entity"; -import { PaymentEntity } from "../../entities/payment.entity"; +import { NeedEntity } from '../../entities/need.entity'; +import { PanelContributors } from '../interfaces/interface'; +import { EthereumAccountEntity } from 'src/entities/ethereum.account.entity'; - -export type FamilyParams = { - createdAt?: Date; - updatedAt?: Date; - flaskUserId?: number; - avatarUrl?: string; - isActive?: boolean; - doneNeeds?: NeedEntity[] - payments?: PaymentEntity[] -} - -export type SocialWorkerParams = { - cityId?: number; - firstName?: string; - lastName?: string; - birthCertificateNumber?: number; - passportNumber?: number; - postalAddress?: string; - bankAccountNumber?: number; - bankAccountShebaNumber?: number; - bankAccountCardNumber?: number; - birthDate?: Date | null; - telegramId?: string; - idNumber?: string; - isCoordinator?: true; - flaskNgoId?: number; - ngo: NgoEntity; - gender?: false; - phoneNumber?: string; - emergencyPhoneNumber?: string; - email?: string; - avatarUrl?: string; - idCardUrl?: string; - passportUrl?: string; - flaskSwId: number; - username?: string; - generatedCode?: string; - childCount?: number; - currentChildCount?: number; - created?: Date | null; - updated?: Date | null; - needCount?: number; - currentNeedCount?: number; - lastLoginDate?: Date | null; - isActive?: true; - isDeleted?: false; - locale?: string; - typeId?: number; // user type - typeName?: string; - ngoName?: string; -} +export type UserParams = { + typeId?: number; + birthDate?: Date; + flaskUserId: number; + wallet?: EthereumAccountEntity; + firstName?: string; + lastName?: string; + avatarUrl?: string; + panelRole?: PanelContributors; + need?: NeedEntity; + userName: string; +}; export class CreateParticipantDto { - id_user: number; - user_avatar: string; + id_user: number; + user_avatar: string; } - diff --git a/src/utils/auth.ts b/src/utils/auth.ts new file mode 100644 index 0000000000..67e2371eef --- /dev/null +++ b/src/utils/auth.ts @@ -0,0 +1,161 @@ +import { ForbiddenException, Logger } from '@nestjs/common'; +import config from 'src/config'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { SocialWorkerAPIApi, UserAPIApi } from 'src/generated-sources/openapi'; +import { convertFlaskToSayRoles, timeDifference } from './helpers'; +import { + FlaskUserTypesEnum, +} from 'src/types/interfaces/interface'; + +export async function updateFlaskCacheAuthentication(req, logger: Logger) { + logger.warn('Passing through MiddleWare...'); + + const accessToken = req.headers['authorization']; + const requestDappFlaskId = Number(req.headers['flaskdappid']); + const requestPanelFlaskId = Number(req.headers['flaskid']); + + if (!accessToken || (!requestPanelFlaskId && !requestDappFlaskId)) { + throw new ForbiddenException('Access Token and the ID is required!'); + } + + + try { + // for Dapp + if (requestDappFlaskId) { + // If in Cache + logger.log('fetching dapp cache token...'); + let fetched = config().dataCache.fetchDappAuthentication(requestDappFlaskId); + if (fetched) { + logger.log('fetched dapp cache token...'); + if ( + timeDifference(fetched.createdAt, new Date()).mm >= 1 || + fetched.token !== accessToken + ) { + logger.warn('removing old user token...'); + config().dataCache.expireDappAccessToken(requestDappFlaskId); + req.headers['dappFlaskUserId'] = ''; + req.headers['flaskId'] = ''; + fetched = config().dataCache.fetchDappAuthentication(requestDappFlaskId); + } else { + logger.log('Got the cache token!...'); + req.headers['dappFlaskUserId'] = requestDappFlaskId; + return; + } + } + + // If not in Cache + if (!fetched || fetched.isExpired) { + logger.warn( + 'No token at cache, Authenticating from Family Flask Api...', + ); + const userFlaskApi = new UserAPIApi(); + const familyMember = await userFlaskApi.apiV2UserUserIduserIdGet( + accessToken, + 'me', + ); + if (!familyMember) { + throw new ForbiddenException('You Do not have Access!'); + } else { + req.headers['dappFlaskUserId'] = familyMember.id; + + config().dataCache.storeDappAccessToken( + accessToken, + familyMember.id, + new Date(), + ); + + logger.log('saved token...'); + logger.log('Authenticated...'); + } + } + } + // for panel + else if (requestPanelFlaskId) { + logger.log('fetching panel cache token...'); + let fetched = config().dataCache.fetchPanelAuthentication(requestPanelFlaskId); + if (fetched) { + if ( + timeDifference(fetched.createdAt, new Date()).mm > 1 || + fetched.token !== accessToken + ) { + logger.warn('removing old user token...'); + config().dataCache.expirePanelAccessToken(requestPanelFlaskId); + req.headers['panelFlaskTypeId'] = ''; + req.headers['panelFlaskUserId'] = ''; + req.headers['flaskId'] = ''; + fetched = config().dataCache.fetchPanelAuthentication(requestPanelFlaskId); + } else { + logger.log('Got the cache token!...'); + req.headers['panelFlaskUserId'] = requestPanelFlaskId; + req.headers['panelFlaskTypeId'] = fetched.flaskUserType; + return; + } + } + + if (!fetched || fetched.isExpired) { + logger.warn( + 'No token at cache, Authenticating from Social worker Flask Api...', + ); + const flaskApi = new SocialWorkerAPIApi(); + const socialWorker = await flaskApi.apiV2SocialworkersIdGet( + accessToken, + Number(requestPanelFlaskId), + ); + + if (!socialWorker) { + throw new ForbiddenException('You Do not have Access!'); + } + + req.headers['panelFlaskUserId'] = socialWorker.id; + req.headers['panelFlaskTypeId'] = socialWorker.typeId; + + config().dataCache.storePanelAccessToken( + accessToken, + socialWorker.id, + socialWorker.typeId, + convertFlaskToSayRoles(socialWorker.typeId), + new Date(), + ); + + logger.log('saved token...'); + console.log( + config().dataCache.fetchPanelAuthentication(socialWorker.id), + ); + logger.log('Authenticated...'); + } + } else { + throw new ServerError('Hmmm, something is not right!', 500); + } + } catch (e) { + throw new ForbiddenException(e); + } +} + +export function isAuthenticated( + flaskUserId: number, + userType: FlaskUserTypesEnum, +): boolean { + console.log('checking authentication...'); + console.log(flaskUserId); + console.log(userType); + + if (userType === FlaskUserTypesEnum.FAMILY) { + const dappAuthentication = + config().dataCache.fetchDappAuthentication(flaskUserId); + if (!dappAuthentication || dappAuthentication.isExpired === true) { + return false; + } else { + console.log('Authenticated...'); + return true; + } + } else { + const panelAuthentication = + config().dataCache.fetchPanelAuthentication(flaskUserId); + if (!panelAuthentication || panelAuthentication.isExpired === true) { + return false; + } else { + console.log('Authenticated...'); + return true; + } + } +} diff --git a/src/utils/dataCache.ts b/src/utils/dataCache.ts new file mode 100644 index 0000000000..d7112b8d1f --- /dev/null +++ b/src/utils/dataCache.ts @@ -0,0 +1,337 @@ +import { + AuthenticationType, + FlaskUserTypesEnum, + SAYPlatformRoles, + VirtualFamilyRole, +} from 'src/types/interfaces/interface'; +import { quantileSeq, median } from 'mathjs'; +import { getScattered } from './helpers'; + +export default class DataCache { + childrenEcosystem = null; + authentication: { + [flaskId: number]: AuthenticationType; + } = {}; + + familyData = null; + familyRolesCount = null; + childActiveFamilies = null; + medianList = []; + midjourneyList = []; + ToBeConfirmed = { + list: [], + createdAt: null, + }; + countChildrenNoNeeds = null; + + updateChildrenNoNeeds(count: number) { + this.countChildrenNoNeeds = count; + } + + storeActiveFamilies = (activesList) => { + this.childActiveFamilies = { actives: activesList, created: new Date() }; + }; + // panel analytic bar chart + storeChildrenEcosystem = (result: { + meanNeedsPerChild: number; + meanConfirmedPerChild: number; + meanUnConfirmedPerChild: number; + meanConfirmedNotPaidPerChild: number; + meanCompletePayPerChild: number; + meanPartialPayPerChild: number; + meanPurchasedPerChild: number; + meanMoneyToNgoPerChild: number; + meanDeliveredNgoPerChild: number; + meanDeliveredChildPerChild: number; + totalFamilies: number; + totalFamilyMembers: number; + meanFamilyMembers: number; + childrenList: any[]; + }) => { + this.childrenEcosystem = { ...result, created: new Date() }; + }; + + storePanelAccessToken = ( + token: string, + flaskSwId: number, + flaskUserType: FlaskUserTypesEnum, + sayRole: SAYPlatformRoles, + createdAt: Date, + ) => { + this.authentication[flaskSwId] = { + token, + flaskUserType, + sayRole, + createdAt, + isExpired: false, + }; + }; + + storeDappAccessToken = ( + token: string, + flaskFamilyId: number, + createdAt: Date, + ) => { + this.authentication[flaskFamilyId] = { + token, + sayRole: SAYPlatformRoles.FAMILY, + flaskUserType: FlaskUserTypesEnum.FAMILY, + createdAt, + isExpired: false, + }; + }; + + storeMidjourney = (list: any[]) => { + list.forEach((e) => this.midjourneyList.push(e)); + }; + + storeToBeConfirmed = (list: any[], createdAt: Date) => { + this.ToBeConfirmed.list = list; + this.ToBeConfirmed.createdAt = createdAt; + }; + + // dApp user ratio in different roles / distance ratio + storeFamilyData = ({ + fathersData, + mothersData, + amoosData, + khalehsData, + daeisData, + ammesData, + }) => { + this.familyData = { + fathersData, + mothersData, + amoosData, + khalehsData, + daeisData, + ammesData, + created: new Date(), + }; + this.roleScatteredData(); + this.theQuartile(); + }; + + // dApp user ratio in different roles / distance ratio + storeRolesCount = ({ + fathersCount, + mothersCount, + amoosCount, + khalehsCount, + daeisCount, + ammesCount, + }) => { + this.familyRolesCount = { + fathersCount, + mothersCount, + amoosCount, + khalehsCount, + daeisCount, + ammesCount, + created: new Date(), + }; + }; + + fetchMidjourney = () => this.midjourneyList; + fetchToBeConfirmed = () => this.ToBeConfirmed; + fetchChildrenNoNeeds() { + return this.countChildrenNoNeeds; + } + fetchChildrenEcosystem = () => this.childrenEcosystem; + fetchFamilyAll = () => this.familyData; + fetchFamilyCount = () => this.familyRolesCount; + fetchActiveFamilies = () => this.childActiveFamilies; + fetchPanelAuthentication = (flaskSwId: number) => { + if (this.authentication[String(flaskSwId)]) { + return this.authentication[flaskSwId]; + } else { + return null; + } + }; + fetchDappAuthentication = (flaskFamilyId: number) => { + if (this.authentication[String(flaskFamilyId)]) { + return this.authentication[flaskFamilyId]; + } else { + return null; + } + }; + + expirePanelAccessToken = (flaskSwId: number) => + (this.authentication[String(flaskSwId)] = { + ...this.authentication[String(flaskSwId)], + isExpired: true, + }); + expireDappAccessToken = (flaskFamilyId: number) => + (this.authentication[String(flaskFamilyId)] = { + ...this.authentication[String(flaskFamilyId)], + isExpired: true, + }); + + // panel analytic scatter chart + roleScatteredData() { + return { + father: getScattered( + this.familyData && this.familyData.fathersData, + VirtualFamilyRole.FATHER, + this.medianList, + ), + mother: getScattered( + this.familyData && this.familyData.mothersData, + VirtualFamilyRole.MOTHER, + this.medianList, + ), + amoo: getScattered( + this.familyData && this.familyData.amoosData, + VirtualFamilyRole.AMOO, + this.medianList, + ), + khaleh: getScattered( + this.familyData && this.familyData.khalehsData, + VirtualFamilyRole.KHALEH, + this.medianList, + ), + daei: getScattered( + this.familyData && this.familyData.daeisData, + VirtualFamilyRole.DAEI, + this.medianList, + ), + amme: getScattered( + this.familyData && this.familyData.ammesData, + VirtualFamilyRole.AMME, + this.medianList, + ), + }; + } + + theQuartile() { + const medianObject = { + father: 0, + mother: 0, + amoo: 0, + khaleh: 0, + daei: 0, + amme: 0, + }; + + // Q1 (also called the lower quartile), Q2 (the median), and Q3 (also called the upper quartile). + // delivered <= Q1, Q1 < delivered <= Q2 , Q2 < delivered <= Q3, delivered > Q3 + const IQRObject = { + min: { + father: 0, + mother: 0, + amoo: 0, + khaleh: 0, + daei: 0, + amme: 0, + }, + Q1: { + father: 0, + mother: 0, + amoo: 0, + khaleh: 0, + daei: 0, + amme: 0, + }, + Q2: { + father: 0, + mother: 0, + amoo: 0, + khaleh: 0, + daei: 0, + amme: 0, + }, + // median of upper half + Q3: { + father: 0, + mother: 0, + amoo: 0, + khaleh: 0, + daei: 0, + amme: 0, + }, + max: { + father: 0, + mother: 0, + amoo: 0, + khaleh: 0, + daei: 0, + amme: 0, + }, + IQR: { + father: 0, + mother: 0, + amoo: 0, + khaleh: 0, + daei: 0, + amme: 0, + }, + }; + // this.medianList = { father: [[1,2], [1,2], [2,3], [1,6], [#users, totalPaid],...], mother: [...], ...} + // [#users, totalPaid] + this.medianList.forEach((item) => { + const father = item[VirtualFamilyRole.FATHER]; + const mother = item[VirtualFamilyRole.MOTHER]; + const amoo = item[VirtualFamilyRole.AMOO]; + const khaleh = item[VirtualFamilyRole.KHALEH]; + const daei = item[VirtualFamilyRole.DAEI]; + const amme = item[VirtualFamilyRole.AMME]; + + if (father && father[0]) { + medianObject.father = median(father); + IQRObject.min.father = Number(quantileSeq(father, 0)); //min + IQRObject.Q1.father = Number(quantileSeq(father, 0.25)); + IQRObject.Q2.father = Number(quantileSeq(father, 0.5)); + IQRObject.Q3.father = Number(quantileSeq(father, 0.75)); + IQRObject.max.father = Number(quantileSeq(father, 1)); + IQRObject.IQR.father = IQRObject.Q3.father - IQRObject.Q1.father; + } + if (mother && mother[0]) { + medianObject.mother = median(mother); + IQRObject.min.mother = Number(quantileSeq(mother, 0)); // min + IQRObject.Q1.mother = Number(quantileSeq(mother, 0.25)); + IQRObject.Q2.mother = Number(quantileSeq(mother, 0.5)); + IQRObject.Q3.mother = Number(quantileSeq(mother, 0.75)); + IQRObject.max.mother = Number(quantileSeq(mother, 1)); // max + IQRObject.IQR.mother = IQRObject.Q3.mother - IQRObject.Q1.mother; + } + if (amoo && amoo[0]) { + medianObject.amoo = median(amoo); + IQRObject.min.amoo = Number(quantileSeq(amoo, 0)); // min + IQRObject.Q1.amoo = Number(quantileSeq(amoo, 0.25)); + IQRObject.Q2.amoo = Number(quantileSeq(amoo, 0.5)); + IQRObject.Q3.amoo = Number(quantileSeq(amoo, 0.75)); + IQRObject.max.amoo = Number(quantileSeq(amoo, 1)); // max + IQRObject.IQR.amoo = IQRObject.Q3.amoo - IQRObject.Q1.amoo; + } + if (khaleh && khaleh[0]) { + medianObject.khaleh = median(khaleh); + IQRObject.min.khaleh = Number(quantileSeq(khaleh, 0)); // min + IQRObject.Q1.khaleh = Number(quantileSeq(khaleh, 0.25)); + IQRObject.Q2.khaleh = Number(quantileSeq(khaleh, 0.5)); + IQRObject.Q3.khaleh = Number(quantileSeq(khaleh, 0.75)); + IQRObject.max.khaleh = Number(quantileSeq(khaleh, 1)); // max + IQRObject.IQR.khaleh = IQRObject.Q3.khaleh - IQRObject.Q1.khaleh; + } + if (daei && daei[0]) { + medianObject.daei = median(daei); + IQRObject.min.daei = Number(quantileSeq(daei, 0)); // min + IQRObject.Q1.daei = Number(quantileSeq(daei, 0.25)); + IQRObject.Q2.daei = Number(quantileSeq(daei, 0.5)); + IQRObject.Q3.daei = Number(quantileSeq(daei, 0.75)); + IQRObject.max.daei = Number(quantileSeq(daei, 1)); // max + IQRObject.IQR.daei = IQRObject.Q3.daei - IQRObject.Q1.daei; + } + if (amme && amme[0]) { + medianObject.amme = median(amme); + IQRObject.min.amme = Number(quantileSeq(amme, 0)); // min + IQRObject.Q1.amme = Number(quantileSeq(amme, 0.25)); + IQRObject.Q2.amme = Number(quantileSeq(amme, 0.5)); + IQRObject.Q3.amme = Number(quantileSeq(amme, 0.75)); + IQRObject.max.amme = Number(quantileSeq(amme, 1)); // max + IQRObject.IQR.amme = IQRObject.Q3.amme - IQRObject.Q1.amme; + } + }); + + return { medianObject, IQRObject }; + } +} diff --git a/src/utils/decimal.transformer.ts b/src/utils/decimal.transformer.ts new file mode 100644 index 0000000000..95460bd1e7 --- /dev/null +++ b/src/utils/decimal.transformer.ts @@ -0,0 +1,21 @@ +import Decimal from 'decimal.js'; +import { ValueTransformer } from 'typeorm'; + +export class DecimalTransformer implements ValueTransformer { + /** + * Used to marshal Decimal when writing to the database. + */ + to(decimal?: Decimal): string | null { + return decimal?.toString(); + } + /** + * Used to unmarshal Decimal when reading from the database. + */ + from(decimal?: string): Decimal | null { + return decimal ? new Decimal(decimal) : null; + } +} +export const DecimalToString = + (decimals = 2) => + (decimal) => + decimal?.toFixed?.(decimals) || decimal; diff --git a/src/utils/file.ts b/src/utils/file.ts new file mode 100644 index 0000000000..7ba881e76d --- /dev/null +++ b/src/utils/file.ts @@ -0,0 +1,114 @@ +// This file should exist in `src/common/helpers` +import fs from 'fs'; +import { promisify } from 'util'; + +/** + * Check if a file exists at a given path. + * + * @param {string} path + * + * @returns {boolean} + */ +export const checkIfDirectoryExists = (path: string): boolean => { + console.log(`Checking if folder exists: ${path}`); + return fs.existsSync(path); +}; + +export const renameFile = (currPath: string, newPath: string) => { + fs.rename(currPath, newPath, function (err) { + if (err) { + console.log(err) + } else { + console.log("Successfully renamed the directory.") + } + }) +}; + + + +/** + * Gets file data from a given path via a promise interface. + * + * @param {string} path + * @param {string} encoding + * + * @returns {Promise} + */ +export const getFile = async ( + path: string, + encoding: { encoding?: null; flag?: string }, +): Promise => { + const readFile = promisify(fs.readFile); + + return encoding ? readFile(path, encoding) : readFile(path, {}); +}; + +/** + * Writes a file at a given path via a promise interface. + * + * @param {string} path + * @param {string} fileName + * @param {string} data + * + * @return {Promise} + */ +export const createFile = async ( + path: string, + fileName: string, + data: string | NodeJS.ArrayBufferView, +): Promise => { + if (!checkIfDirectoryExists(path)) { + fs.mkdirSync(path); + } + console.log(`${path}/${fileName}`); + + const writeFile = promisify(fs.writeFile); + return await writeFile(`${path}/${fileName}`, data, 'utf8'); +}; + +/** + * Delete file at the given path via a promise interface + * + * @param {string} path + * + * @returns {Promise} + */ +export const deleteFile = async (path: string): Promise => { + const unlink = promisify(fs.unlink); + + return await unlink(path); +}; + +export const moveFile = async (oldPath: string, newPath: string) => { + fs.rename(oldPath, newPath, (err) => { + if (err) throw err; + console.log('Rename complete!'); + }); +}; + + +// Function to get current filenames +// in directory +export const getCurrentFilenames = () => { + console.log("\nCurrent filenames:"); + fs.readdirSync(__dirname).forEach(file => { + console.log(file); + }); + console.log("\n"); +} + + +export function getAllFilesFromFolder(dir: string) { + let results = []; + if (checkIfDirectoryExists(dir)) { + fs.readdirSync(dir).forEach(function (file) { + file = dir + '/' + file; + const stat = fs.statSync(file); + if (stat && stat.isDirectory()) { + results = results.concat(getAllFilesFromFolder(file)); + } else results.push(file); + }); + } + + return results; +} \ No newline at end of file diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts new file mode 100644 index 0000000000..84f540d3cd --- /dev/null +++ b/src/utils/helpers.ts @@ -0,0 +1,993 @@ +import { PRODUCT_UNPAYABLE_PERIOD } from 'src/config'; +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { TicketEntity } from 'src/entities/ticket.entity'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { + NeedTypeEnum, + PaymentStatusEnum, + ProductStatusEnum, + FlaskUserTypesEnum, + SAYPlatformRoles, + ServiceStatusEnum, + PanelContributors, + VirtualFamilyRole, + ChildExistence, + AppContributors, + CampaignNameEnum, + CampaignTypeEnum, + AnnouncementEnum, +} from 'src/types/interfaces/interface'; +import fs from 'fs'; +import { checkIfDirectoryExists } from './file'; + +export const Q1_LOWER_COEFFICIENT = 0.75; +export const Q1_TO_Q2_COEFFICIENT = 1; +export const Q2_TO_Q3_COEFFICIENT = 1.25; +export const Q3_UPPER_COEFFICIENT = 1.5; +export const CONTRIBUTION_COEFFICIENT = 1.2; +const PARENTS_DELIVERED_RANGE = 1; +const RELETIVES_DELIVERED_RANGE = 3; + +export function sleep(time) { + console.log('Sleeping...'); + return new Promise((resolve) => setTimeout(resolve, time)); +} + +// {id: 44 } +export function removeSpecialDuplicates(array: any[]) { + return array.filter((obj, index) => { + return index === array.findIndex((o) => obj.id === o.id); + }); +} + +export function removeDuplicates(array: any[]) { + return array.filter((item, index) => array.indexOf(item) === index); +} + +export function getSAYRoleInteger(sayRole: string) { + let roleInteger: SAYPlatformRoles; + if (sayRole === 'AUDITOR') { + roleInteger = SAYPlatformRoles.AUDITOR; + } else if (sayRole === 'SOCIAL_WORKER') { + roleInteger = SAYPlatformRoles.SOCIAL_WORKER; + } else if (sayRole === 'PURCHASER') { + roleInteger = SAYPlatformRoles.PURCHASER; + } else if (sayRole === 'NGO_SUPERVISOR') { + roleInteger = SAYPlatformRoles.NGO_SUPERVISOR; + } else if (sayRole === 'FAMILY') { + roleInteger = SAYPlatformRoles.FAMILY; + } else if (sayRole === 'RELATIVE') { + roleInteger = SAYPlatformRoles.RELATIVE; + } else if (sayRole === 'NO_ROLE') { + roleInteger = SAYPlatformRoles.NO_ROLE; + } + return roleInteger; +} + +export function convertFlaskToSayRoles(flaskUserType: number) { + if (typeof flaskUserType != 'number') { + throw new ServerError('bad role type'); + } + let role: SAYPlatformRoles; + if (flaskUserType === FlaskUserTypesEnum.SAY_SUPERVISOR) { + role = SAYPlatformRoles.AUDITOR; + } else if (flaskUserType === FlaskUserTypesEnum.ADMIN) { + role = SAYPlatformRoles.AUDITOR; + } else if (flaskUserType === FlaskUserTypesEnum.SUPER_ADMIN) { + role = SAYPlatformRoles.AUDITOR; + } else if (flaskUserType === FlaskUserTypesEnum.SOCIAL_WORKER) { + role = SAYPlatformRoles.SOCIAL_WORKER; + } else if (flaskUserType === FlaskUserTypesEnum.COORDINATOR) { + role = SAYPlatformRoles.PURCHASER; + } else if (flaskUserType === FlaskUserTypesEnum.NGO_SUPERVISOR) { + role = SAYPlatformRoles.NGO_SUPERVISOR; + } else if (flaskUserType === FlaskUserTypesEnum.FAMILY) { + role = SAYPlatformRoles.FAMILY; + } else if (flaskUserType === FlaskUserTypesEnum.RELATIVE) { + role = SAYPlatformRoles.RELATIVE; + } + return role; +} + +export function convertFlaskToSayAppRoles(flaskUserType: number) { + if (typeof flaskUserType != 'number') { + throw new ServerError('bad role type'); + } + let panelRole: AppContributors; + if (flaskUserType === FlaskUserTypesEnum.FAMILY) { + panelRole = AppContributors.FAMILY; + } else if (flaskUserType === FlaskUserTypesEnum.RELATIVE) { + panelRole = AppContributors.RELATIVE; + } + return panelRole; +} + +export function convertFlaskToSayPanelRoles(flaskUserType: number) { + if (typeof flaskUserType != 'number') { + throw new ServerError('bad role type'); + } + let panelRole: PanelContributors; + + if (flaskUserType === FlaskUserTypesEnum.SUPER_ADMIN) { + panelRole = PanelContributors.AUDITOR; + } else if (flaskUserType === FlaskUserTypesEnum.SOCIAL_WORKER) { + panelRole = PanelContributors.SOCIAL_WORKER; + } else if (flaskUserType === FlaskUserTypesEnum.COORDINATOR) { + panelRole = PanelContributors.PURCHASER; + } else if (flaskUserType === FlaskUserTypesEnum.NGO_SUPERVISOR) { + panelRole = PanelContributors.NGO_SUPERVISOR; + } else if (flaskUserType === FlaskUserTypesEnum.SAY_SUPERVISOR) { + panelRole = PanelContributors.AUDITOR; + } else if (flaskUserType === FlaskUserTypesEnum.ADMIN) { + panelRole = PanelContributors.AUDITOR; + } + return panelRole; +} + +export function getSAYRoleString(sayRole: number) { + let roleString: string; + if (sayRole === SAYPlatformRoles.AUDITOR) { + roleString = 'auditor'; + } else if (sayRole === SAYPlatformRoles.SOCIAL_WORKER) { + roleString = 'socialWorker'; + } else if (sayRole === SAYPlatformRoles.PURCHASER) { + roleString = 'purchaser'; + } else if (sayRole === SAYPlatformRoles.NGO_SUPERVISOR) { + roleString = 'ngoSupervisor'; + } else if (sayRole === SAYPlatformRoles.FAMILY) { + roleString = 'familyMember'; + } else if (sayRole === SAYPlatformRoles.RELATIVE) { + roleString = 'relative'; + } else if (sayRole === SAYPlatformRoles.NO_ROLE) { + roleString = 'noRole'; + } + return roleString; +} + +export function getSAYRolePersian(sayRole: number) { + let roleString: string; + if (sayRole === SAYPlatformRoles.AUDITOR) { + roleString = 'شاهد'; + } else if (sayRole === SAYPlatformRoles.SOCIAL_WORKER) { + roleString = 'مددکار'; + } else if (sayRole === SAYPlatformRoles.PURCHASER) { + roleString = 'میانجی'; + } else if (sayRole === SAYPlatformRoles.NGO_SUPERVISOR) { + roleString = 'نماینده انجمن'; + } else if (sayRole === SAYPlatformRoles.FAMILY) { + roleString = 'خانواده'; + } else if (sayRole === SAYPlatformRoles.RELATIVE) { + roleString = 'خویش‌آوند'; + } else if (sayRole === SAYPlatformRoles.NO_ROLE) { + roleString = 'noRole'; + } + return roleString; +} + +export function getUserSAYRoleString(userTypeId: number) { + if (userTypeId === FlaskUserTypesEnum.SOCIAL_WORKER) { + return 'socialWorker'; + } + if (userTypeId === FlaskUserTypesEnum.NGO_SUPERVISOR) { + return 'ngoSupervisor'; + } + if ( + userTypeId === FlaskUserTypesEnum.ADMIN || + userTypeId === FlaskUserTypesEnum.SUPER_ADMIN || + userTypeId === FlaskUserTypesEnum.SAY_SUPERVISOR + ) { + return 'auditor'; + } + return 'noRole'; +} + +export function dateConvertToPersian(value: string) { + const d = new Date(value); + return new Intl.DateTimeFormat('fa-IR-u-ca-persian', { + dateStyle: 'full', + }).format(d); +} + +export function persianMonthString(value: Date) { + return new Intl.DateTimeFormat('en-US-u-ca-persian', { + month: 'short', + }).format(value); +} + +export function persianMonthStringFarsi(value: Date) { + const pm = persianMonthString(value); + return pm === 'Farvardin' + ? 'فروردین' + : pm === 'Ordibehesht' + ? 'اردیبهست' + : pm === 'Khordad' + ? 'خرداد' + : pm === 'Tir' + ? 'تیر' + : pm === 'Mordad' + ? 'مرداد' + : pm === 'Shahrivar' + ? 'شهریور' + : pm === 'Mehr' + ? 'مهر' + : pm === 'Aban' + ? 'آبان' + : pm === 'Azar' + ? 'آذر' + : pm === 'Dey' + ? 'دی' + : pm === 'Bahman' + ? 'بهمن' + : pm === 'Esfand' + ? 'اسفند' + : null; +} + +export function persianDay(value: Date) { + if (!value) { + return null; + } + return parseInt( + new Intl.DateTimeFormat('en-US-u-ca-persian', { day: 'numeric' }).format( + value, + ), + ); +} + +export function persianMonth(value: Date) { + if (!value) { + return null; + } + return parseInt( + new Intl.DateTimeFormat('en-US-u-ca-persian', { month: 'numeric' }).format( + value, + ), + ); +} + +export function persianYear(value: Date) { + return parseInt( + new Intl.DateTimeFormat('en-US-u-ca-persian', { year: 'numeric' }).format( + value, + ), + ); +} + +export function daysDifference(time1: Date, time2: Date) { + const date1 = new Date(time1); + const date2 = new Date(time2); + //calculate days difference by dividing total milliseconds in a day + return (date2.getTime() - date1.getTime()) / (1000 * 60 * 60 * 24); +} + +export function prepareUrl(imageUrl: string) { + let url: string; + if (imageUrl && imageUrl.startsWith('/')) { + url = `https://api.sayapp.company/${imageUrl.slice(1)}`; + } else { + url = `https://api.sayapp.company/${imageUrl}`; + } + return url; +} + +export function timeDifference(time1: Date, time2: Date) { + const diff = time2.getTime() - time1.getTime(); + let msec = diff; + const hh = Math.floor(msec / 1000 / 60 / 60); + msec -= hh * 1000 * 60 * 60; + const mm = Math.floor(msec / 1000 / 60); + msec -= mm * 1000 * 60; + const ss = Math.floor(msec / 1000); + msec -= ss * 1000; + return { hh, mm, ss, diff }; +} + +export function timeDifferenceWithComment( + time1: number, + time2: number, + comment: string, +) { + const diff = time2 - time1; + let msec = diff; + const hh = Math.floor(msec / 1000 / 60 / 60); + msec -= hh * 1000 * 60 * 60; + const mm = Math.floor(msec / 1000 / 60); + msec -= mm * 1000 * 60; + const ss = Math.floor(msec / 1000); + msec -= ss * 1000; + + console.log(comment + hh + ':' + mm + ':' + ss); +} + +export function getNeedsTimeLine(needs: Need[]) { + const farvardin = { created: 0, confirmed: 0 }; + const ordibehesht = { created: 0, confirmed: 0 }; + const khordad = { created: 0, confirmed: 0 }; + const tir = { created: 0, confirmed: 0 }; + const mordad = { created: 0, confirmed: 0 }; + const shahrivar = { created: 0, confirmed: 0 }; + const mehr = { created: 0, confirmed: 0 }; + const aban = { created: 0, confirmed: 0 }; + const azar = { created: 0, confirmed: 0 }; + const dey = { created: 0, confirmed: 0 }; + const bahman = { created: 0, confirmed: 0 }; + const esfand = { created: 0, confirmed: 0 }; + + for (let i = 0; i < needs.length; i++) { + const thePersianMonthCreated = persianMonth(needs[i].created); + const thePersianMonthConfirm = persianMonth(needs[i].confirmDate); + + // farvardin + if (thePersianMonthCreated === 1) { + farvardin.created += 1; + } + // ordibehesht + else if (thePersianMonthCreated === 2) { + ordibehesht.created += 1; + } + // khordad + else if (thePersianMonthCreated === 3) { + khordad.created += 1; + } + // tir + else if (thePersianMonthCreated === 4) { + tir.created += 1; + } + // mordad + else if (thePersianMonthCreated === 5) { + mordad.created += 1; + } + // shahrivar + else if (thePersianMonthCreated === 6) { + shahrivar.created += 1; + } + // mehr + else if (thePersianMonthCreated === 7) { + mehr.created += 1; + } + // aban + else if (thePersianMonthCreated === 8) { + aban.created += 1; + } + // azar + else if (thePersianMonthCreated === 9) { + azar.created += 1; + } + // dey + else if (thePersianMonthCreated === 10) { + dey.created += 1; + } + // bahman + else if (thePersianMonthCreated === 11) { + bahman.created += 1; + } + + // esfand + else if (thePersianMonthCreated === 12) { + esfand.created += 1; + } + + // farvardin + if (thePersianMonthConfirm === 1) { + farvardin.confirmed += 1; + } + // ordibehesht + else if (thePersianMonthConfirm === 2) { + ordibehesht.confirmed += 1; + } + // khordad + else if (thePersianMonthConfirm === 3) { + khordad.confirmed += 1; + } + // tir + else if (thePersianMonthConfirm === 4) { + tir.confirmed += 1; + } + // mordad + else if (thePersianMonthConfirm === 5) { + mordad.confirmed += 1; + } + // shahrivar + else if (thePersianMonthConfirm === 6) { + shahrivar.confirmed += 1; + } + // mehr + else if (thePersianMonthConfirm === 7) { + mehr.confirmed += 1; + } + // aban + else if (thePersianMonthConfirm === 8) { + aban.confirmed += 1; + } + // azar + else if (thePersianMonthConfirm === 9) { + azar.confirmed += 1; + } + // dey + else if (thePersianMonthConfirm === 10) { + dey.confirmed += 1; + } + // bahman + else if (thePersianMonthConfirm === 11) { + bahman.confirmed += 1; + } + // esfand + else if (thePersianMonthConfirm === 12) { + esfand.confirmed += 1; + } + } + + const twoDaysAgo = new Date(); + twoDaysAgo.setDate(twoDaysAgo.getDate() - 1); + const weekAgo = new Date(); + weekAgo.setDate(weekAgo.getDate() - 7); + const monthAgo = new Date(); + monthAgo.setDate(monthAgo.getDate() - 30); + + const inTwoDays = needs.filter( + (n) => new Date(n.confirmDate).getTime() >= twoDaysAgo.getTime(), + ); + const inWeek = needs.filter( + (n) => new Date(n.confirmDate).getTime() >= weekAgo.getTime(), + ); + const inThirtyDays = needs.filter( + (n) => new Date(n.confirmDate).getTime() >= monthAgo.getTime(), + ); + const summary = { + inTwoDays: inTwoDays.length, + inWeek: inWeek.length, + inThirtyDays: inThirtyDays.length, + }; + + return { + summary, + inMonth: { + Farvardin: farvardin, + Ordibehesht: ordibehesht, + Khordad: khordad, + Tir: tir, + Mordad: mordad, + Shahrivar: shahrivar, + Mehr: mehr, + Aban: aban, + Azar: azar, + Dey: dey, + Bahman: bahman, + Esfand: esfand, + }, + }; +} + +// faster than the dictionary one below +export function getOrganizedNeeds(needsData) { + const organizedNeeds = [[], [], [], []]; // [[not paid], [payment], [purchased/delivered Ngo], [Done]] + if (needsData) { + needsData = sortNeeds(needsData, 'created'); + for (let i = 0; i < needsData.length; i++) { + // not Paid + if (needsData[i].status === 0) { + organizedNeeds[0].push(needsData[i]); + } + // Payment Received + else if ( + needsData[i].status === PaymentStatusEnum.PARTIAL_PAY || + needsData[i].status === PaymentStatusEnum.COMPLETE_PAY + ) { + organizedNeeds[1].push(needsData[i]); + } + + if (needsData[i].type === NeedTypeEnum.SERVICE) { + // Payment sent to NGO + if (needsData[i].status === ServiceStatusEnum.MONEY_TO_NGO) { + organizedNeeds[2].push(needsData[i]); + } + // Delivered to child + if (needsData[i].status === ServiceStatusEnum.DELIVERED) { + organizedNeeds[3].push(needsData[i]); + } + } else if (needsData[i].type === NeedTypeEnum.PRODUCT) { + // Purchased + if (needsData[i].status === ProductStatusEnum.PURCHASED_PRODUCT) { + organizedNeeds[2].push(needsData[i]); + } + // Delivered to Ngo + if (needsData[i].status === ProductStatusEnum.DELIVERED_TO_NGO) { + organizedNeeds[2].push(needsData[i]); + } + // Delivered to child + if (needsData[i].status === ProductStatusEnum.DELIVERED) { + organizedNeeds[3].push(needsData[i]); + } + } + } + organizedNeeds[3] = sortNeeds(organizedNeeds[3], 'doneAt'); + return organizedNeeds; + } +} + +export function sortNeeds(theNeeds: any[], sortBy: string) { + return theNeeds.sort((a, b) => { + // Sort needs by create date Ascending + return new Date(b[sortBy]).getTime() - new Date(a[sortBy]).getTime(); + }); +} + +export function ticketNotifications( + myTickets: TicketEntity[], + flaskUserId: number, +) { + const unReads = myTickets + .filter( + (t) => + t.lastAnnouncement !== AnnouncementEnum.ARRIVED_AT_NGO && + t.lastAnnouncement !== AnnouncementEnum.NGO_RECEIVED_MONEY, + ) + .filter((t) => { + // when a user creates a ticket, the participants won't have a view assigned to them + const myView = t.views.find((v) => v.flaskUserId === flaskUserId); + const latestView = t.views.find( + (v) => + Date.parse(v.viewed.toUTCString()) === + Math.max(...t.views.map((t) => Date.parse(t.viewed.toUTCString()))), + ); + // if (myView) { + // const { diff } = timeDifference( + // new Date( + // t.views.find((v) => v.flaskUserId === flaskUserId) && + // t.views.find((v) => v.flaskUserId === flaskUserId).viewed, + // ), new Date(t.updatedAt)) + // diffMilSeconds = diff + + // } else { + // diffMilSeconds = 1 + + // } + + return ( + !myView || + (latestView.flaskUserId !== myView.flaskUserId && + Date.parse(myView.viewed.toUTCString()) < + Date.parse(latestView.viewed.toUTCString())) + ); + }); + + return unReads; +} + +export function isUnpayable(need: Need) { + return ( + need.unavailable_from && + timeDifference(new Date(), need.unavailable_from).hh < + PRODUCT_UNPAYABLE_PERIOD + ); +} + +export function getVFamilyRoleString(vfamilyRole: number) { + let roleString: string; + if (vfamilyRole === VirtualFamilyRole.FATHER) { + roleString = 'Father'; + } else if (vfamilyRole === VirtualFamilyRole.MOTHER) { + roleString = 'Mother'; + } else if (vfamilyRole === VirtualFamilyRole.AMOO) { + roleString = 'Ammo'; + } else if (vfamilyRole === VirtualFamilyRole.KHALEH) { + roleString = 'Khaleh'; + } else if (vfamilyRole === VirtualFamilyRole.DAEI) { + roleString = 'Daei'; + } else if (vfamilyRole === VirtualFamilyRole.AMME) { + roleString = 'Amme'; + } + return roleString; +} + +// https://en.wikipedia.org/wiki/File:Boxplot_vs_PDF.svg +export function findQuartileGrant( + userValues: { + fatherCompletePay: any; + motherCompletePay: any; + amooCompletePay: any; + khalehCompletePay: any; + daeiCompletePay: any; + ammeCompletePay: any; + }, + childrenList: any[], + Qs: { + Q1: { + father: number; + mother: number; + amoo: number; + khaleh: number; + daei: number; + amme: number; + }; + Q2: { + father: number; + mother: number; + amoo: number; + khaleh: number; + daei: number; + amme: number; + }; + Q3: { + father: number; + mother: number; + amoo: number; + khaleh: number; + daei: number; + amme: number; + }; + IQR?: { + father: number; + mother: number; + amoo: number; + khaleh: number; + daei: number; + amme: number; + }; + }, +) { + let fatherQGrant: number; + let motherQGrant: number; + let amooQGrant: number; + let khalehQGrant: number; + let daeiQGrant: number; + let ammeQGrant: number; + + // do not add Grant when even one child has no payment => user need to pay at least one need per child or leave family to gain Grant + if ( + childrenList.find( + (c) => c.caredFor === false && c.status === ChildExistence.AlivePresent, + ) + ) { + return { + allChildrenCaredFor: false, + fatherQGrant: 0, + motherQGrant: 0, + amooQGrant: 0, + khalehQGrant: 0, + daeiQGrant: 0, + ammeQGrant: 0, + avg: 0, + }; + } + // paid <= Q1, Q1 < paid <= Q2 , Q2 < paid <= Q3, paid > Q3 + if ( + 0 < userValues.fatherCompletePay && + userValues.fatherCompletePay <= Qs.Q1.father + ) { + fatherQGrant = Q1_LOWER_COEFFICIENT; + } else if ( + Qs.Q1.father < userValues.fatherCompletePay && + userValues.fatherCompletePay <= Qs.Q2.father + ) { + fatherQGrant = Q1_TO_Q2_COEFFICIENT; + } else if ( + Qs.Q2.father < userValues.fatherCompletePay && + userValues.fatherCompletePay <= Qs.Q3.father + ) { + fatherQGrant = Q2_TO_Q3_COEFFICIENT; + } else if (userValues.fatherCompletePay > Qs.Q3.father) { + fatherQGrant = Q3_UPPER_COEFFICIENT; + } else { + fatherQGrant = 0; + } + // Mother + if ( + 0 < userValues.motherCompletePay && + userValues.motherCompletePay <= Qs.Q1.mother + ) { + motherQGrant = Q1_LOWER_COEFFICIENT; + } else if ( + Qs.Q1.mother < userValues.motherCompletePay && + userValues.motherCompletePay <= Qs.Q2.mother + ) { + motherQGrant = Q1_TO_Q2_COEFFICIENT; + } else if ( + Qs.Q2.mother < userValues.motherCompletePay && + userValues.motherCompletePay <= Qs.Q3.mother + ) { + motherQGrant = Q2_TO_Q3_COEFFICIENT; + } else if (userValues.motherCompletePay > Qs.Q3.mother) { + motherQGrant = Q3_UPPER_COEFFICIENT; + } else { + motherQGrant = 0; + } + // Amoo + if ( + 0 < userValues.amooCompletePay && + userValues.amooCompletePay <= Qs.Q1.amoo + ) { + amooQGrant = Q1_LOWER_COEFFICIENT; + } else if ( + Qs.Q1.amoo < userValues.amooCompletePay && + userValues.amooCompletePay <= Qs.Q2.amoo + ) { + amooQGrant = Q1_TO_Q2_COEFFICIENT; + } else if ( + Qs.Q2.amoo < userValues.amooCompletePay && + userValues.amooCompletePay <= Qs.Q3.amoo + ) { + amooQGrant = Q2_TO_Q3_COEFFICIENT; + } else if (userValues.amooCompletePay > Qs.Q3.amoo) { + amooQGrant = Q3_UPPER_COEFFICIENT; + } else { + amooQGrant = 0; + } + // Khaleh + if ( + 0 < userValues.khalehCompletePay && + userValues.khalehCompletePay <= Qs.Q1.khaleh + ) { + khalehQGrant = Q1_LOWER_COEFFICIENT; + } else if ( + Qs.Q1.khaleh < userValues.khalehCompletePay && + userValues.khalehCompletePay <= Qs.Q2.khaleh + ) { + khalehQGrant = Q1_TO_Q2_COEFFICIENT; + } else if ( + Qs.Q2.khaleh < userValues.khalehCompletePay && + userValues.khalehCompletePay <= Qs.Q3.khaleh + ) { + khalehQGrant = Q2_TO_Q3_COEFFICIENT; + } else if (userValues.khalehCompletePay > Qs.Q3.khaleh) { + khalehQGrant = Q3_UPPER_COEFFICIENT; + } else { + khalehQGrant = 0; + } + // Daei + if ( + 0 < userValues.daeiCompletePay && + userValues.daeiCompletePay <= Qs.Q1.daei + ) { + daeiQGrant = Q1_LOWER_COEFFICIENT; + } else if ( + Qs.Q1.daei < userValues.daeiCompletePay && + userValues.daeiCompletePay <= Qs.Q2.daei + ) { + daeiQGrant = Q1_TO_Q2_COEFFICIENT; + } else if ( + Qs.Q2.daei < userValues.daeiCompletePay && + userValues.daeiCompletePay <= Qs.Q3.daei + ) { + daeiQGrant = Q2_TO_Q3_COEFFICIENT; + } else if (userValues.daeiCompletePay > Qs.Q3.daei) { + daeiQGrant = Q3_UPPER_COEFFICIENT; + } else { + daeiQGrant = 0; + } + // Amme + if ( + 0 < userValues.ammeCompletePay && + userValues.ammeCompletePay <= Qs.Q1.amme + ) { + ammeQGrant = Q1_LOWER_COEFFICIENT; + } else if ( + Qs.Q1.amme < userValues.ammeCompletePay && + userValues.ammeCompletePay <= Qs.Q2.amme + ) { + ammeQGrant = Q1_TO_Q2_COEFFICIENT; + } else if ( + Qs.Q2.amme < userValues.ammeCompletePay && + userValues.ammeCompletePay <= Qs.Q3.amme + ) { + ammeQGrant = Q2_TO_Q3_COEFFICIENT; + } else if (userValues.ammeCompletePay > Qs.Q3.amme) { + ammeQGrant = Q3_UPPER_COEFFICIENT; + } else { + ammeQGrant = 0; + } + let total = 0; + if (fatherQGrant > 0) total++; + if (motherQGrant > 0) total++; + if (amooQGrant > 0) total++; + if (khalehQGrant > 0) total++; + if (daeiQGrant > 0) total++; + if (ammeQGrant > 0) total++; + + const avg = + (fatherQGrant + + motherQGrant + + amooQGrant + + khalehQGrant + + daeiQGrant + + ammeQGrant) / + total; + + return { + allChildrenCaredFor: true, + fatherQGrant, + motherQGrant, + amooQGrant, + khalehQGrant, + daeiQGrant, + ammeQGrant, + avg, + }; +} + +export function getScattered( + data: any[], + vRole: VirtualFamilyRole, + medianList: any[], +) { + const series = []; + const usersPays = []; + if (data) { + // 1- go over all needs and seperate users who has paid + data.forEach((n) => { + n.participants.forEach((partic) => { + // get the payment of the participant + const payment = n.payments.find( + (p) => p.id_user === partic.id_user && p.need_amount > 0, + ); + if (payment && payment.id_user) { + usersPays.push({ + userId: payment.id_user, + created: payment.created, + }); + } + }); + }); + } + // 2- count total pays per users + const listOfIds = []; + const finalList = []; + usersPays.forEach((u) => { + const onlyThisUserPays = usersPays.filter((p) => p.userId === u.userId); + if (!listOfIds.find((item) => item.userId === u.userId)) { + listOfIds.push({ userId: u.userId }); + series.push({ userId: u.userId, total: onlyThisUserPays.length }); + } + }); + + // {userId: 126, total: 101} + const sorted = series.sort((a, b) => a.total - b.total); + const myList = []; + // [[1,162],[4, 5], ...] + sorted.forEach((s) => { + if (!myList.find((e) => e === s.total)) { + myList.push(s.total); + finalList.push([ + s.total, + sorted.filter((o) => o.total === s.total).length, + ]); + } + }); + + // for quartile + medianList.push({ [vRole]: finalList.map((el) => el[0]) }); + return finalList; +} + +export function truncateString(str: string, num: number) { + // If the length of str is less than or equal to num + // just return str--don't truncate it. + if (str.length <= num) { + return str; + } + // Return str truncated with '...' concatenated to the end of str. + return str.slice(0, num) + '...'; +} + +// format to yyyy-mm-dd +export function formatDate(date) { + const d = new Date(date); + let month = '' + (d.getMonth() + 1); + let day = '' + d.getDate(); + const year = d.getFullYear(); + + if (month.length < 2) month = '0' + month; + if (day.length < 2) day = '0' + day; + + return [year, month, day].join('-'); +} + +export function shuffleArray(array: any[]) { + let currentIndex = array.length, + randomIndex: number; + + // While there remain elements to shuffle. + while (currentIndex > 0) { + // Pick a remaining element. + randomIndex = Math.floor(Math.random() * currentIndex); + currentIndex--; + + // And swap it with the current element. + [array[currentIndex], array[randomIndex]] = [ + array[randomIndex], + array[currentIndex], + ]; + } + + return array; +} + +export function capitalizeFirstLetter(word: string) { + return word.charAt(0).toUpperCase() + word.slice(1); +} + +export function fetchCampaignCode( + name: CampaignNameEnum, + type: CampaignTypeEnum, +) { + const today = new Date(); + const pMonth = persianMonth(today); // If it is January, getMonth() will return 0 + const pYear = persianYear(today); + return `${type}:${name}-${pMonth}/${pYear}`; +} + +export function getMonthsAgo(date: Date, priorMonths: number) { + // accessing month of the date + const month = date.getMonth(); + // subtracting required number of months + date.setMonth(month - priorMonths); + return date; +} + +export function urlSimilarityPercentage(url1: string, url2: string) { + // Convert URLs to lowercase to make the comparison case-insensitive + url1 = url1.toLowerCase(); + url2 = url2.toLowerCase(); + + // Calculate Levenshtein distance + function levenshteinDistance(s1: string | any[], s2: string | any[]) { + const len1 = s1.length; + const len2 = s2.length; + const matrix = []; + + // Initialize the matrix with default values + for (let i = 0; i <= len1; i++) { + matrix[i] = [i]; + } + for (let j = 0; j <= len2; j++) { + matrix[0][j] = j; + } + + // Calculate Levenshtein distance + for (let j = 1; j <= len2; j++) { + for (let i = 1; i <= len1; i++) { + if (s1[i - 1] === s2[j - 1]) { + matrix[i][j] = matrix[i - 1][j - 1]; + } else { + matrix[i][j] = Math.min( + matrix[i - 1][j - 1] + 1, // substitution + matrix[i][j - 1] + 1, // insertion + matrix[i - 1][j] + 1, // deletion + ); + } + } + } + + return matrix[len1][len2]; + } + + // Calculate similarity percentage + const distance = levenshteinDistance(url1, url2); + const maxLength = Math.max(url1.length, url2.length); + const similarityPercentage = ((maxLength - distance) / maxLength) * 100; + + return similarityPercentage.toFixed(2); +} + +export function getSimilarityPercentage(sentence1: string, sentence2: string) { + // Convert sentences to sets of words + const set1 = new Set(sentence1.split(' ')); + const set2 = new Set(sentence2.split(' ')); + + // Calculate intersection and union of the sets + let intersection = 0; + set1.forEach((word) => { + if (set2.has(word)) { + intersection++; + } + }); + const union = set1.size + set2.size - intersection; + + // Calculate Jaccard similarity coefficient + const similarity = intersection / union; + + // Convert similarity coefficient to percentage + const similarityPercentage = Math.round(similarity * 100); + + return similarityPercentage; +} diff --git a/src/utils/math.ts b/src/utils/math.ts new file mode 100644 index 0000000000..db5ec53bfb --- /dev/null +++ b/src/utils/math.ts @@ -0,0 +1,10 @@ +export function median(values: any[]) { + if (values.length === 0) throw new Error('No inputs'); + values.sort((a, b) => { + return a - b; + }); + + const half = Math.floor(values.length / 2); + if (values.length % 2) return values[half]; + return (values[half - 1] + values[half]) / 2.0; +} diff --git a/src/utils/needConfirm.ts b/src/utils/needConfirm.ts new file mode 100644 index 0000000000..853bd07bfa --- /dev/null +++ b/src/utils/needConfirm.ts @@ -0,0 +1,525 @@ +import { Need } from 'src/entities/flaskEntities/need.entity'; +import { ServerError } from 'src/filters/server-exception.filter'; +import { + AnnouncementEnum, + CategoryEnum, + Colors, + FlaskUserTypesEnum, + NeedTypeEnum, + PaymentStatusEnum, + SAYPlatformRoles, + SUPER_ADMIN_ID_PANEL, +} from 'src/types/interfaces/interface'; +import { + convertFlaskToSayRoles, + daysDifference, + getSimilarityPercentage, + prepareUrl, + urlSimilarityPercentage, +} from './helpers'; +import { round } from 'mathjs'; +import axios from 'axios'; +import { CreateTicketParams } from 'src/types/parameters/CreateTicketParameters'; +import { NeedEntity } from 'src/entities/need.entity'; +import { AllUserEntity } from 'src/entities/user.entity'; + +const BASE_AGE_OF_DUPLICATE_0 = 30; +const BASE_AGE_OF_DUPLICATE_1 = 30; +const BASE_AGE_OF_DUPLICATE_2 = 30; +const BASE_AGE_OF_DUPLICATE_3 = 30; +const MIN_TITLE_LENGTH = 5; +const SIMILAR_URL_PERCENTAGE = 57; // percentage +const SIMILAR_TXT_PERCENTAGE = 10; // percentage +export const SIMILAR_NAME_LIMIT_PRODUCT = 20; +export const SIMILAR_NAME_LIMIT_SERVICE = 10; +export const GRACE_PERIOD = 15; // days left after ticket to fix the problem mentioned in ticket +export async function validateNeed( + nestNeed: NeedEntity, + SuperAdmin: AllUserEntity, +): Promise<{ + needId: string; + isValidNeed: boolean; + participants: AllUserEntity[] | null[]; + ticket?: CreateTicketParams; + ticketDetails?: CreateTicketParams; + message: string; +}> { + const type = nestNeed.type; + const category = nestNeed.category; + const retailerLink = nestNeed.link; + const price = nestNeed.cost; + const icon = nestNeed.imageUrl; + const title = nestNeed.title; + const name_en = nestNeed.nameTranslations.en; + const description_en = nestNeed.descriptionTranslations.en; + const confirmDate = nestNeed.confirmDate; + const isDeleted = nestNeed.isDeleted; + const information = nestNeed.information; + const details = nestNeed.details; + + let result = { + needId: nestNeed.id, + isValidNeed: true, + participants: [], + ticketDetails: null, + message: null, + }; + // validate Confirm and delete + if (isDeleted || confirmDate) { + const createTicketDetails: CreateTicketParams = { + title: `Bad Need`, + flaskNeedId: nestNeed.flaskId, + need: nestNeed, + flaskUserId: SUPER_ADMIN_ID_PANEL, + role: convertFlaskToSayRoles(FlaskUserTypesEnum.SUPER_ADMIN), + lastAnnouncement: AnnouncementEnum.ERROR, + color: Colors.RED, + }; + result = { + needId: nestNeed.id, + isValidNeed: false, + participants: [SuperAdmin], + ticketDetails: createTicketDetails, + message: 'Automated Message: Check need confirmation and existence!', + }; + return result; + } + // validate need information/details + const list = [ + 'شلوار', + 'لباس زیر', + 'لباس', + 'مانتو', + 'کفش', + 'دمپایی', + 'شورت', + 'سوتین', + 'کاپشن', + 'دمپایی', + 'دستکش', + 'جوراب', + ]; + const listResult = []; + for (let i = 0; i < list.length; i++) { + const titleResult = Number( + title && Number(getSimilarityPercentage(title, list[i])), + ); + listResult.push(titleResult); + } + + if ( + type === NeedTypeEnum.PRODUCT && + category === CategoryEnum.GROWTH && + Math.max(...listResult) >= SIMILAR_TXT_PERCENTAGE && + (!details || details.split(' ').join('').length < 3) && + (!information || information.split(' ').join('').length < 3) + ) { + const createTicketDetails: CreateTicketParams = { + title: `More info`, + flaskNeedId: nestNeed.flaskId, + need: nestNeed, + flaskUserId: nestNeed.socialWorker.flaskUserId, + role: convertFlaskToSayRoles(FlaskUserTypesEnum.SOCIAL_WORKER), + lastAnnouncement: AnnouncementEnum.ERROR, + color: Colors.RED, + }; + result = { + needId: nestNeed.id, + isValidNeed: false, + participants: [nestNeed.socialWorker, SuperAdmin], + ticketDetails: createTicketDetails, + message: 'Automated Message: Please add the size, ...!', + }; + return result; + } + + // validate Retailer Link + if (type === NeedTypeEnum.PRODUCT) { + if (retailerLink && retailerLink.length > 10) { + axios + .get(retailerLink) + .then(async (response) => { + if (response.status !== 200) { + const createTicketDetails: CreateTicketParams = { + title: `${response.status} - Need retailerLink is corrupted`, + flaskNeedId: nestNeed.flaskId, + need: nestNeed, + flaskUserId: SUPER_ADMIN_ID_PANEL, + role: convertFlaskToSayRoles(FlaskUserTypesEnum.SUPER_ADMIN), + lastAnnouncement: AnnouncementEnum.ERROR, + color: Colors.RED, + }; + + result = { + needId: nestNeed.id, + isValidNeed: false, + participants: [SuperAdmin], + ticketDetails: createTicketDetails, + message: `Automated Message: Check retailer link to continue! - ${response.status}.`, + }; + } + }) + .catch(async (error) => { + const createTicketDetails: CreateTicketParams = { + title: `${error.status} - Error fetching retailerLink`, + flaskNeedId: nestNeed.flaskId, + need: nestNeed, + flaskUserId: SUPER_ADMIN_ID_PANEL, + role: convertFlaskToSayRoles(FlaskUserTypesEnum.SUPER_ADMIN), + lastAnnouncement: AnnouncementEnum.ERROR, + color: Colors.RED, + }; + + result = { + needId: nestNeed.id, + isValidNeed: false, + participants: [SuperAdmin], + ticketDetails: createTicketDetails, + message: `Automated Message: ${error.message}!`, + }; + return result; + }); + } else { + const createTicketDetails: CreateTicketParams = { + title: 'We need retailer Link', + flaskNeedId: nestNeed.flaskId, + need: nestNeed, + flaskUserId: nestNeed.socialWorker.flaskUserId, + role: convertFlaskToSayRoles(FlaskUserTypesEnum.SOCIAL_WORKER), + lastAnnouncement: AnnouncementEnum.ERROR, + color: Colors.RED, + }; + console.log('\x1b[36m%s\x1b[0m', 'Creating Social workerTicket ...\n'); + result = { + needId: nestNeed.id, + isValidNeed: false, + participants: [nestNeed.socialWorker, SuperAdmin], + ticketDetails: createTicketDetails, + message: `Automated Message: Please add the product link or change to Service!`, + }; + return result; + } + } + + // validate icon + if (icon && icon.length > 10) { + const iconUrl = prepareUrl(icon); + axios + .get(iconUrl) + .then(async (response) => { + if (response.status !== 200) { + const createTicketDetails: CreateTicketParams = { + title: `${response.status} - Need Icon is corrupted`, + flaskNeedId: nestNeed.flaskId, + need: nestNeed, + flaskUserId: SUPER_ADMIN_ID_PANEL, + role: convertFlaskToSayRoles(FlaskUserTypesEnum.SUPER_ADMIN), + lastAnnouncement: AnnouncementEnum.ERROR, + color: Colors.RED, + }; + + result = { + needId: nestNeed.id, + isValidNeed: false, + participants: [SuperAdmin], + ticketDetails: createTicketDetails, + message: `Automated Message: Please check the icon url! - ${response.status}`, + }; + return result; + } + }) + .catch(async (error) => { + const createTicketDetails: CreateTicketParams = { + title: `${error.status} - Error fetching Icon`, + flaskNeedId: nestNeed.flaskId, + need: nestNeed, + flaskUserId: SUPER_ADMIN_ID_PANEL, + role: convertFlaskToSayRoles(FlaskUserTypesEnum.SUPER_ADMIN), + lastAnnouncement: AnnouncementEnum.ERROR, + color: Colors.RED, + }; + result = { + needId: nestNeed.id, + isValidNeed: false, + participants: [SuperAdmin], + ticketDetails: createTicketDetails, + message: `Automated Message: ${error.message}!`, + }; + return result; + }); + } else { + const createTicketDetails: CreateTicketParams = { + title: 'We need Icon Link', + flaskNeedId: nestNeed.flaskId, + need: nestNeed, + flaskUserId: nestNeed.socialWorker.flaskUserId, + role: convertFlaskToSayRoles(FlaskUserTypesEnum.SOCIAL_WORKER), + lastAnnouncement: AnnouncementEnum.ERROR, + color: Colors.RED, + }; + console.log('\x1b[36m%s\x1b[0m', 'Creating Auditor Ticket ...\n'); + result = { + needId: nestNeed.id, + isValidNeed: false, + participants: [SuperAdmin], + ticketDetails: createTicketDetails, + message: `Automated Message: Please add the icon!`, + }; + return result; + } + + // validate details + if ( + !name_en || + !description_en || + (type === NeedTypeEnum.PRODUCT && (!title || title.length < 5)) || + name_en.length < 3 || + description_en.length < 5 || + price < 500 + ) { + const createTicketDetails: CreateTicketParams = { + title: `Check ${ + price < 500 + ? 'Price' + : type === NeedTypeEnum.PRODUCT && (!title || title.length < 5) + ? 'Title' + : !name_en || name_en.length < 3 + ? 'Name' + : !description_en || (description_en.length < 5 && 'Description') + }`, + flaskNeedId: nestNeed.flaskId, + need: nestNeed, + flaskUserId: nestNeed.socialWorker.flaskUserId, + role: convertFlaskToSayRoles(FlaskUserTypesEnum.SOCIAL_WORKER), + lastAnnouncement: AnnouncementEnum.ERROR, + color: Colors.RED, + }; + result = { + needId: nestNeed.id, + isValidNeed: false, + participants: [nestNeed.socialWorker, SuperAdmin], + ticketDetails: createTicketDetails, + message: `Automated Message: Please check ${ + price < 500 + ? 'Price' + : type === NeedTypeEnum.PRODUCT && (!title || title.length < MIN_TITLE_LENGTH) + ? 'Title' + : !name_en || name_en.length < 3 + ? 'Name' + : !description_en || (description_en.length < 5 && 'Description') + }`, + }; + return result; + } + return result; +} + +export function checkNeed(need: Need, duplicate: Need) { + let C: boolean | null; // category + let T: boolean | null; // type + let R: boolean | null; // retailerLink + let P: boolean | null; // price + let I: boolean | null; // icon + let N: boolean | null; // name_en + let D: boolean | null; // description_en + let TT: boolean | null; // title + let ageOfDup: number; // e.g 50 days ago was created or confirmed + let A: boolean | null; // age range check result - consider duplicate only if in range + let msg: string; + + const category = need.category; + const type = need.type; + const retailerLink = need.link; + const price = need._cost; + const icon = need.imageUrl; + const title = need.title; + const name_en = need.name_translations.en; + const description_en = need.description_translations.en; + + if (duplicate.id) { + // 1- check how old is the duplicate, if not confirmed use created time. + // e.g: to consider it as a duplicate or if dismiss if too old + if (duplicate.confirmDate) { + ageOfDup = daysDifference(duplicate.confirmDate, new Date()); + } else { + ageOfDup = daysDifference(duplicate.created, new Date()); + } + + if ( + duplicate.category === CategoryEnum.GROWTH && + ageOfDup < BASE_AGE_OF_DUPLICATE_0 + ) { + A = true; + } else if ( + duplicate.category === CategoryEnum.JOY && + ageOfDup < BASE_AGE_OF_DUPLICATE_1 + ) { + A = true; + } else if ( + duplicate.category === CategoryEnum.HEALTH && + ageOfDup < BASE_AGE_OF_DUPLICATE_2 + ) { + A = true; + } else if ( + duplicate.category === CategoryEnum.SURROUNDING && + ageOfDup < BASE_AGE_OF_DUPLICATE_3 + ) { + A = true; + } else { + A = false; + let age: number; + if (duplicate.category === CategoryEnum.GROWTH) + age = BASE_AGE_OF_DUPLICATE_0; + if (duplicate.category === CategoryEnum.JOY) + age = BASE_AGE_OF_DUPLICATE_1; + if (duplicate.category === CategoryEnum.HEALTH) + age = BASE_AGE_OF_DUPLICATE_2; + if (duplicate.category === CategoryEnum.SURROUNDING) + age = BASE_AGE_OF_DUPLICATE_3; + msg = `Age of Need error ${round(ageOfDup)}/${age} days`; + } + + // 2- compare need and the duplicate by their variables + if (category === duplicate.category) { + C = true; + } else { + C = false; + msg = 'Categories are different'; + } + + if (type === duplicate.type) { + T = true; + } else { + T = false; + msg = 'Types are different'; + } + let titleResult: number; + // compare only first 10 chars + if (type === NeedTypeEnum.PRODUCT) { + titleResult = + duplicate.title && + Number( + getSimilarityPercentage( + title.length > 15 ? title.substring(0, 15) : title, + duplicate.title.length > 15 + ? duplicate.title.substring(0, 15) + : duplicate.title, + ), + ); + if ( + !duplicate.title || + duplicate.title.length < 1 || + (duplicate.title && titleResult > SIMILAR_TXT_PERCENTAGE) + ) { + TT = true; + } else { + TT = false; + msg = 'title is not That similar'; + } + } else if (type === NeedTypeEnum.SERVICE) { + if ( + !duplicate.name_translations || + !duplicate.name_translations.fa || + duplicate.name_translations.fa.length < 1 + ) { + TT = true; + } else { + TT = false; + msg = 'title is not That similar'; + } + } + + // check icons similarity + if ( + icon && + duplicate.imageUrl && + Number( + urlSimilarityPercentage( + prepareUrl(icon), + prepareUrl(duplicate.imageUrl), + ), + ) >= SIMILAR_URL_PERCENTAGE + ) { + I = true; + } else { + I = false; + msg = 'Icon similarity error'; + } + if (price && Number(price && duplicate._cost && duplicate._cost > 0) > 0) { + P = true; + } else { + P = false; + msg = 'Price error'; + } + if ( + type === NeedTypeEnum.PRODUCT && + retailerLink && + retailerLink.length > 10 && + duplicate.link && + duplicate.link.length > 10 + ) { + R = true; + } else if (type === NeedTypeEnum.SERVICE) { + R = true; + } else { + R = false; + msg = 'retailerLink error'; + } + if (name_en === duplicate.name_translations.en) { + N = true; + } else { + N = false; + msg = 'name_en error'; + } + if (description_en === duplicate.description_translations.en) { + D = true; + } else { + D = false; + msg = 'description_en error'; + } + + let isValidDuplicate = false; + if (C && T && R && P && I && D && N && A && TT) { + isValidDuplicate = true; + } + + return { + needId: need.id, + dupId: duplicate.id, + C, // category + T, // type + R, // retailerLink + P, // price + I, // icon + N, // name_en + TT, // title + D, // description_en + A, // ageOfDup + titleResult, + isValidNeed: true, + isValidDuplicate, + ageOfDup, + msg: isValidDuplicate ? 'Valid Duplicate!' : msg, + status: 200, + }; + } else { + return { + needId: need.id, + dupId: duplicate.id, + C: null, // category + T: null, // type + R: null, // retailerLink + P: null, // price + I: null, // icon + N: null, // name_en + D: null, // description_en + A: null, // ageOfDup + titleResult: null, + isValidNeed: null, + isValidDuplicate: false, + ageOfDup: 0, + msg: 'This need does not exist!', + status: 599, + }; + } +} diff --git a/src/utils/signatures.ts b/src/utils/signatures.ts new file mode 100644 index 0000000000..ac8461e656 --- /dev/null +++ b/src/utils/signatures.ts @@ -0,0 +1,108 @@ +import { NeedEntity } from 'src/entities/need.entity'; +import { + CategoryDefinitionPersianEnum, + CategoryEnum, +} from 'src/types/interfaces/interface'; + +export function fetchProductMessageContent( + need: NeedEntity, + signerAddress: string, + role: string, + signatureVersion: string, +) { + const theContent = + signatureVersion === 'v1' + ? ` با امضای دیجیتال این نیاز امکان ذخیره غیر متمرکز و ثبت این نیاز بر روی بلاکچین را فراهم می‌کنید. نیازی که دارای امضای دیجیتال مددکار، شاهد، میانجی و خانواده مجازی باشد نه تنها به شفافیت تراکنش‌ها کمک می‌کند، بلکه امکان تولید ارز دیجیتال (توکن / سهام) را به خویش‌آوندان می‌دهد تا سِی در جهت تبدیل شدن به مجموعه‌ای خودمختار و غیر متمرکز گام بردارد. توکن های تولید شده از هر نیاز به افرادی که در برطرف شدن نیاز مشارکت داشته‌اند ارسال می‌شود، که می‌توانند از آن برای رای دادن، ارتقا کیفیت کودکان و سِی استفاده کنند.` + : signatureVersion === 'v2' + ? `با امضای دیجیتال این نیاز امکان ذخیره غیر متمرکز و ثبت این نیاز بر روی بلاکچین را فراهم می‌کنید. نیازی که دارای امضای دیجیتال مددکار، شاهد، میانجی و خانواده مجازی باشد نه تنها به شفافیت تراکنش‌ها کمک می‌کند، بلکه امکان تولید ارز دیجیتال (توکن / سهام) را به خویش‌آوندان می‌دهد تا سِی در جهت تبدیل شدن به مجموعه‌ای خودمختار و غیر متمرکز گام بردارد.` + : signatureVersion === 'v3' && + 'با امضای دیجیتال این نیاز شما جزئیات آن را تایید می‌کنید و همچنین امکان ذخیره غیر متمرکز و ثبت این نیاز بر روی بلاکچین را فراهم می‌کنید. نیازی که دارای امضای دیجیتال مددکار، شاهد، میانجی و خانواده مجازی باشد نه تنها به شفافیت تراکنش‌ها کمک می‌کند، بلکه امکان تولید ارز دیجیتال (توکن / سهام) را به خویش‌آوندان می‌دهد تا سِی در جهت تبدیل شدن به مجموعه‌ای خودمختار و غیر متمرکز گام بردارد.'; + + const productVoucher = { + needId: need.flaskId, + title: need.title || 'No Title', + category: + need.category === CategoryEnum.GROWTH + ? CategoryDefinitionPersianEnum.GROWTH + : need.category === CategoryEnum.HEALTH + ? CategoryDefinitionPersianEnum.HEALTH + : need.category === CategoryEnum.JOY + ? CategoryDefinitionPersianEnum.JOY + : CategoryDefinitionPersianEnum.SURROUNDING, + paid: need.cost, + deliveryCode: need.deliveryCode, + child: need.child.sayNameTranslations.fa, + signer: signerAddress, + role: role, // string human readable + content: theContent, + } as const; + + const productTypes = { + Voucher: [ + { name: 'needId', type: 'uint256' }, + { name: 'title', type: 'string' }, + { name: 'category', type: 'string' }, + { name: 'paid', type: 'uint256' }, + { name: 'deliveryCode', type: 'string' }, + { name: 'child', type: 'string' }, + { name: 'role', type: 'string' }, + { name: 'content', type: 'string' }, + ], + } as const; + return { + productVoucher, + productTypes, + }; +} + +export function fetchServiceMessageContent( + need: NeedEntity, + signerAddress: string, + role: string, + signatureVersion: string, +) { + const theContent = + signatureVersion === 'v1' + ? ` با امضای دیجیتال این نیاز امکان ذخیره غیر متمرکز و ثبت این نیاز بر روی بلاکچین را فراهم می‌کنید. نیازی که دارای امضای دیجیتال مددکار، شاهد، میانجی و خانواده مجازی باشد نه تنها به شفافیت تراکنش‌ها کمک می‌کند، بلکه امکان تولید ارز دیجیتال (توکن / سهام) را به خویش‌آوندان می‌دهد تا سِی در جهت تبدیل شدن به مجموعه‌ای خودمختار و غیر متمرکز گام بردارد. توکن های تولید شده از هر نیاز به افرادی که در برطرف شدن نیاز مشارکت داشته‌اند ارسال می‌شود، که می‌توانند از آن برای رای دادن، ارتقا کیفیت کودکان و سِی استفاده کنند.` + : signatureVersion === 'v2' + ? `با امضای دیجیتال این نیاز امکان ذخیره غیر متمرکز و ثبت این نیاز بر روی بلاکچین را فراهم می‌کنید. نیازی که دارای امضای دیجیتال مددکار، شاهد، میانجی و خانواده مجازی باشد نه تنها به شفافیت تراکنش‌ها کمک می‌کند، بلکه امکان تولید ارز دیجیتال (توکن / سهام) را به خویش‌آوندان می‌دهد تا سِی در جهت تبدیل شدن به مجموعه‌ای خودمختار و غیر متمرکز گام بردارد.` + : signatureVersion === 'v3' && + 'با امضای دیجیتال این نیاز شما جزئیات آن را تایید می‌کنید و همچنین امکان ذخیره غیر متمرکز و ثبت این نیاز بر روی بلاکچین را فراهم می‌کنید. نیازی که دارای امضای دیجیتال مددکار، شاهد، میانجی و خانواده مجازی باشد نه تنها به شفافیت تراکنش‌ها کمک می‌کند، بلکه امکان تولید ارز دیجیتال (توکن / سهام) را به خویش‌آوندان می‌دهد تا سِی در جهت تبدیل شدن به مجموعه‌ای خودمختار و غیر متمرکز گام بردارد.'; + + const serviceVoucher = { + title: need.title || 'No Title', + needId: need.flaskId, + category: + need.category === CategoryEnum.GROWTH + ? CategoryDefinitionPersianEnum.GROWTH + : need.category === CategoryEnum.HEALTH + ? CategoryDefinitionPersianEnum.HEALTH + : need.category === CategoryEnum.JOY + ? CategoryDefinitionPersianEnum.JOY + : CategoryDefinitionPersianEnum.SURROUNDING, + paid: need.cost, + bankTrackId: need.bankTrackId || 'N/A', + child: need.child.sayNameTranslations.fa, + receipts: need.receipts.length, + signer: signerAddress, + role: role, // string human readable + content: theContent, + } as const; + + const serviceTypes = { + Voucher: [ + { name: 'title', type: 'string' }, + { name: 'category', type: 'string' }, + { name: 'paid', type: 'uint256' }, + { name: 'child', type: 'string' }, + { name: 'bankTrackId', type: 'string' }, + { name: 'receipts', type: 'uint256' }, + { name: 'role', type: 'string' }, + { name: 'content', type: 'string' }, + ], + } as const; + return { + serviceVoucher, + serviceTypes, + }; +} diff --git a/test/app.e2e-spec.ts b/test/app.e2e-spec.ts deleted file mode 100644 index 50cda62332..0000000000 --- a/test/app.e2e-spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { INestApplication } from '@nestjs/common'; -import * as request from 'supertest'; -import { AppModule } from './../src/app.module'; - -describe('AppController (e2e)', () => { - let app: INestApplication; - - beforeEach(async () => { - const moduleFixture: TestingModule = await Test.createTestingModule({ - imports: [AppModule], - }).compile(); - - app = moduleFixture.createNestApplication(); - await app.init(); - }); - - it('/ (GET)', () => { - return request(app.getHttpServer()) - .get('/') - .expect(200) - .expect('Hello World!'); - }); -}); diff --git a/test/jest-e2e.json b/test/jest-e2e.json deleted file mode 100644 index e9d912f3e3..0000000000 --- a/test/jest-e2e.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "moduleFileExtensions": ["js", "json", "ts"], - "rootDir": ".", - "testEnvironment": "node", - "testRegex": ".e2e-spec.ts$", - "transform": { - "^.+\\.(t|j)s$": "ts-jest" - } -} diff --git a/tsconfig.json b/tsconfig.json index 1892829b1f..fe4fd5d8a6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,7 @@ "emitDecoratorMetadata": true, "experimentalDecorators": true, "allowSyntheticDefaultImports": true, - "target": "es2017", + "target": "ES2022", "sourceMap": true, "outDir": "./dist", "baseUrl": "./", @@ -19,5 +19,8 @@ "noFallthroughCasesInSwitch": false, "resolveJsonModule": true, "esModuleInterop": true, - } + "useDefineForClassFields": true, // for discord package + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "**/*.spec.ts", "src/test.js", "src/features/schedule/backup.js"] } diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index 347fd098c9..0000000000 --- a/yarn.lock +++ /dev/null @@ -1,5956 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@ampproject/remapping@^2.1.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d" - integrity sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w== - dependencies: - "@jridgewell/gen-mapping" "^0.1.0" - "@jridgewell/trace-mapping" "^0.3.9" - -"@angular-devkit/core@14.2.1": - version "14.2.1" - resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-14.2.1.tgz#7ce14efdb5fce687bb4f13bef03d4b67e971b22e" - integrity sha512-lW8oNGuJqr4r31FWBjfWQYkSXdiOHBGOThIEtHvUVBKfPF/oVrupLueCUgBPel+NvxENXdo93uPsqHN7bZbmsQ== - dependencies: - ajv "8.11.0" - ajv-formats "2.1.1" - jsonc-parser "3.1.0" - rxjs "6.6.7" - source-map "0.7.4" - -"@angular-devkit/core@14.2.2": - version "14.2.2" - resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-14.2.2.tgz#d616ada7c9a0610454da47445e64520a0b34e400" - integrity sha512-ofDhTmJqoAkmkJP0duwUaCxDBMxPlc+AWYwgs3rKKZeJBb0d+tchEXHXevD5bYbbRfXtnwM+Vye2XYHhA4nWAA== - dependencies: - ajv "8.11.0" - ajv-formats "2.1.1" - jsonc-parser "3.1.0" - rxjs "6.6.7" - source-map "0.7.4" - -"@angular-devkit/schematics-cli@14.2.2": - version "14.2.2" - resolved "https://registry.yarnpkg.com/@angular-devkit/schematics-cli/-/schematics-cli-14.2.2.tgz#0f3779e1ea066e8bff015208a7dc2a8c2dba9d67" - integrity sha512-timCty5tO1A5VOcy8nVJ+jL98i6+ct5/Hg+4rQxc3J6agmmNL9fALboJBEz1ckTt7MewlGtrpohMMy+YGhuWOg== - dependencies: - "@angular-devkit/core" "14.2.2" - "@angular-devkit/schematics" "14.2.2" - ansi-colors "4.1.3" - inquirer "8.2.4" - symbol-observable "4.0.0" - yargs-parser "21.1.1" - -"@angular-devkit/schematics@14.2.1": - version "14.2.1" - resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-14.2.1.tgz#9d66080e60ab32d1b44c854cabc8f5cbb421d877" - integrity sha512-0U18FwDYt4zROBPrvewH6iBTkf2ozVHN4/gxUb9jWrqVw8mPU5AWc/iYxQLHBSinkr2Egjo1H/i9aBqgJSeh3g== - dependencies: - "@angular-devkit/core" "14.2.1" - jsonc-parser "3.1.0" - magic-string "0.26.2" - ora "5.4.1" - rxjs "6.6.7" - -"@angular-devkit/schematics@14.2.2": - version "14.2.2" - resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-14.2.2.tgz#ceb024214aee56f0c61e26e768775f69045b4f4c" - integrity sha512-90hseNg1yQ2AR+lVr/NByZRHnYAlzCL6hr9p9q1KPHxA3Owo04yX6n6dvR/xf27hCopXInXKPsasR59XCx5ZOQ== - dependencies: - "@angular-devkit/core" "14.2.2" - jsonc-parser "3.1.0" - magic-string "0.26.2" - ora "5.4.1" - rxjs "6.6.7" - -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" - integrity sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q== - dependencies: - "@babel/highlight" "^7.18.6" - -"@babel/compat-data@^7.20.0": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.0.tgz#9b61938c5f688212c7b9ae363a819df7d29d4093" - integrity sha512-Gt9jszFJYq7qzXVK4slhc6NzJXnOVmRECWcVjF/T23rNXD9NtWQ0W3qxdg+p9wWIB+VQw3GYV/U2Ha9bRTfs4w== - -"@babel/core@^7.11.6", "@babel/core@^7.12.3": - version "7.19.6" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.19.6.tgz#7122ae4f5c5a37c0946c066149abd8e75f81540f" - integrity sha512-D2Ue4KHpc6Ys2+AxpIx1BZ8+UegLLLE2p3KJEuJRKmokHOtl49jQ5ny1773KsGLZs8MQvBidAF6yWUJxRqtKtg== - dependencies: - "@ampproject/remapping" "^2.1.0" - "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.19.6" - "@babel/helper-compilation-targets" "^7.19.3" - "@babel/helper-module-transforms" "^7.19.6" - "@babel/helpers" "^7.19.4" - "@babel/parser" "^7.19.6" - "@babel/template" "^7.18.10" - "@babel/traverse" "^7.19.6" - "@babel/types" "^7.19.4" - convert-source-map "^1.7.0" - debug "^4.1.0" - gensync "^1.0.0-beta.2" - json5 "^2.2.1" - semver "^6.3.0" - -"@babel/generator@^7.19.6", "@babel/generator@^7.20.0", "@babel/generator@^7.7.2": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.20.0.tgz#0bfc5379e0efb05ca6092091261fcdf7ec36249d" - integrity sha512-GUPcXxWibClgmYJuIwC2Bc2Lg+8b9VjaJ+HlNdACEVt+Wlr1eoU1OPZjZRm7Hzl0gaTsUZNQfeihvZJhG7oc3w== - dependencies: - "@babel/types" "^7.20.0" - "@jridgewell/gen-mapping" "^0.3.2" - jsesc "^2.5.1" - -"@babel/helper-compilation-targets@^7.19.3": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.0.tgz#6bf5374d424e1b3922822f1d9bdaa43b1a139d0a" - integrity sha512-0jp//vDGp9e8hZzBc6N/KwA5ZK3Wsm/pfm4CrY7vzegkVxc65SgSn6wYOnwHe9Js9HRQ1YTCKLGPzDtaS3RoLQ== - dependencies: - "@babel/compat-data" "^7.20.0" - "@babel/helper-validator-option" "^7.18.6" - browserslist "^4.21.3" - semver "^6.3.0" - -"@babel/helper-environment-visitor@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz#0c0cee9b35d2ca190478756865bb3528422f51be" - integrity sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg== - -"@babel/helper-function-name@^7.19.0": - version "7.19.0" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz#941574ed5390682e872e52d3f38ce9d1bef4648c" - integrity sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w== - dependencies: - "@babel/template" "^7.18.10" - "@babel/types" "^7.19.0" - -"@babel/helper-hoist-variables@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678" - integrity sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q== - dependencies: - "@babel/types" "^7.18.6" - -"@babel/helper-module-imports@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz#1e3ebdbbd08aad1437b428c50204db13c5a3ca6e" - integrity sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA== - dependencies: - "@babel/types" "^7.18.6" - -"@babel/helper-module-transforms@^7.19.6": - version "7.19.6" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.19.6.tgz#6c52cc3ac63b70952d33ee987cbee1c9368b533f" - integrity sha512-fCmcfQo/KYr/VXXDIyd3CBGZ6AFhPFy1TfSEJ+PilGVlQT6jcbqtHAM4C1EciRqMza7/TpOUZliuSH+U6HAhJw== - dependencies: - "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-module-imports" "^7.18.6" - "@babel/helper-simple-access" "^7.19.4" - "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/helper-validator-identifier" "^7.19.1" - "@babel/template" "^7.18.10" - "@babel/traverse" "^7.19.6" - "@babel/types" "^7.19.4" - -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.8.0": - version "7.19.0" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.19.0.tgz#4796bb14961521f0f8715990bee2fb6e51ce21bf" - integrity sha512-40Ryx7I8mT+0gaNxm8JGTZFUITNqdLAgdg0hXzeVZxVD6nFsdhQvip6v8dqkRHzsz1VFpFAaOCHNn0vKBL7Czw== - -"@babel/helper-simple-access@^7.19.4": - version "7.19.4" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.19.4.tgz#be553f4951ac6352df2567f7daa19a0ee15668e7" - integrity sha512-f9Xq6WqBFqaDfbCzn2w85hwklswz5qsKlh7f08w4Y9yhJHpnNC0QemtSkK5YyOY8kPGvyiwdzZksGUhnGdaUIg== - dependencies: - "@babel/types" "^7.19.4" - -"@babel/helper-split-export-declaration@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz#7367949bc75b20c6d5a5d4a97bba2824ae8ef075" - integrity sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA== - dependencies: - "@babel/types" "^7.18.6" - -"@babel/helper-string-parser@^7.19.4": - version "7.19.4" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63" - integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw== - -"@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1": - version "7.19.1" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" - integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== - -"@babel/helper-validator-option@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz#bf0d2b5a509b1f336099e4ff36e1a63aa5db4db8" - integrity sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw== - -"@babel/helpers@^7.19.4": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.20.0.tgz#27c8ffa8cc32a2ed3762fba48886e7654dbcf77f" - integrity sha512-aGMjYraN0zosCEthoGLdqot1oRsmxVTQRHadsUPz5QM44Zej2PYRz7XiDE7GqnkZnNtLbOuxqoZw42vkU7+XEQ== - dependencies: - "@babel/template" "^7.18.10" - "@babel/traverse" "^7.20.0" - "@babel/types" "^7.20.0" - -"@babel/highlight@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" - integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== - dependencies: - "@babel/helper-validator-identifier" "^7.18.6" - chalk "^2.0.0" - js-tokens "^4.0.0" - -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.18.10", "@babel/parser@^7.19.6", "@babel/parser@^7.20.0": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.0.tgz#b26133c888da4d79b0d3edcf42677bcadc783046" - integrity sha512-G9VgAhEaICnz8iiJeGJQyVl6J2nTjbW0xeisva0PK6XcKsga7BIaqm4ZF8Rg1Wbaqmy6znspNqhPaPkyukujzg== - -"@babel/plugin-syntax-async-generators@^7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" - integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-bigint@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" - integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-class-properties@^7.8.3": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" - integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== - dependencies: - "@babel/helper-plugin-utils" "^7.12.13" - -"@babel/plugin-syntax-import-meta@^7.8.3": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" - integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-json-strings@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" - integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-logical-assignment-operators@^7.8.3": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" - integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" - integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-numeric-separator@^7.8.3": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" - integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-object-rest-spread@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" - integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-optional-catch-binding@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" - integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-optional-chaining@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" - integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-top-level-await@^7.8.3": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" - integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-syntax-typescript@^7.7.2": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.20.0.tgz#4e9a0cfc769c85689b77a2e642d24e9f697fc8c7" - integrity sha512-rd9TkG+u1CExzS4SM1BlMEhMXwFLKVjOAFFCDx9PbX5ycJWDoWMcwdJH9RhkPu1dOgn5TrxLot/Gx6lWFuAUNQ== - dependencies: - "@babel/helper-plugin-utils" "^7.19.0" - -"@babel/template@^7.18.10", "@babel/template@^7.3.3": - version "7.18.10" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.18.10.tgz#6f9134835970d1dbf0835c0d100c9f38de0c5e71" - integrity sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA== - dependencies: - "@babel/code-frame" "^7.18.6" - "@babel/parser" "^7.18.10" - "@babel/types" "^7.18.10" - -"@babel/traverse@^7.19.6", "@babel/traverse@^7.20.0", "@babel/traverse@^7.7.2": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.20.0.tgz#538c4c6ce6255f5666eba02252a7b59fc2d5ed98" - integrity sha512-5+cAXQNARgjRUK0JWu2UBwja4JLSO/rBMPJzpsKb+oBF5xlUuCfljQepS4XypBQoiigL0VQjTZy6WiONtUdScQ== - dependencies: - "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.20.0" - "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.19.0" - "@babel/helper-hoist-variables" "^7.18.6" - "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.20.0" - "@babel/types" "^7.20.0" - debug "^4.1.0" - globals "^11.1.0" - -"@babel/types@^7.0.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.19.0", "@babel/types@^7.19.4", "@babel/types@^7.20.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.20.0.tgz#52c94cf8a7e24e89d2a194c25c35b17a64871479" - integrity sha512-Jlgt3H0TajCW164wkTOTzHkZb075tMQMULzrLUoUeKmO7eFL96GgDxf7/Axhc5CAuKE3KFyVW1p6ysKsi2oXAg== - dependencies: - "@babel/helper-string-parser" "^7.19.4" - "@babel/helper-validator-identifier" "^7.19.1" - to-fast-properties "^2.0.0" - -"@bcoe/v8-coverage@^0.2.3": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" - integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== - -"@colors/colors@1.5.0": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" - integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== - -"@cspotcode/source-map-support@^0.8.0": - version "0.8.1" - resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" - integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== - dependencies: - "@jridgewell/trace-mapping" "0.3.9" - -"@eslint/eslintrc@^1.3.3": - version "1.3.3" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.3.tgz#2b044ab39fdfa75b4688184f9e573ce3c5b0ff95" - integrity sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg== - dependencies: - ajv "^6.12.4" - debug "^4.3.2" - espree "^9.4.0" - globals "^13.15.0" - ignore "^5.2.0" - import-fresh "^3.2.1" - js-yaml "^4.1.0" - minimatch "^3.1.2" - strip-json-comments "^3.1.1" - -"@ethers-ancillary/bsc@0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@ethers-ancillary/bsc/-/bsc-0.0.3.tgz#91ad0b80fe9cbf2c3634b1c0df7f0df60c084c2c" - integrity sha512-dBxaXap10Lpu9R6JOpLQO1GgueA7Lyq6tU2vrWfpV9FhUSSAbLAHAnUFXld+jBhqkl7TBfgtfsavvy2wp5jj0A== - dependencies: - ethers "^5.4.1" - -"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" - integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== - dependencies: - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/hash" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - -"@ethersproject/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz#b0a8550f88b6bf9d51f90e4795d48294630cb9ef" - integrity sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/networks" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ethersproject/web" "^5.7.0" - -"@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz#13f4f32117868452191a4649723cb086d2b596b2" - integrity sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ== - dependencies: - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - -"@ethersproject/address@5.7.0", "@ethersproject/address@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" - integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/rlp" "^5.7.0" - -"@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.7.0.tgz#ac4ee92aa36c1628173e221d0d01f53692059e1c" - integrity sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ== - dependencies: - "@ethersproject/bytes" "^5.7.0" - -"@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.7.0.tgz#97034dc7e8938a8ca943ab20f8a5e492ece4020b" - integrity sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - -"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz#e2f03837f268ba655ffba03a57853e18a18dc9c2" - integrity sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - bn.js "^5.2.1" - -"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz#a00f6ea8d7e7534d6d87f47188af1148d71f155d" - integrity sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A== - dependencies: - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.7.0.tgz#df80a9705a7e08984161f09014ea012d1c75295e" - integrity sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - -"@ethersproject/contracts@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" - integrity sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg== - dependencies: - "@ethersproject/abi" "^5.7.0" - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - -"@ethersproject/hash@5.7.0", "@ethersproject/hash@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.7.0.tgz#eb7aca84a588508369562e16e514b539ba5240a7" - integrity sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g== - dependencies: - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/base64" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - -"@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.7.0.tgz#e627ddc6b466bc77aebf1a6b9e47405ca5aef9cf" - integrity sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg== - dependencies: - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/basex" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/pbkdf2" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/sha2" "^5.7.0" - "@ethersproject/signing-key" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ethersproject/wordlists" "^5.7.0" - -"@ethersproject/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz#5e3355287b548c32b368d91014919ebebddd5360" - integrity sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g== - dependencies: - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/hdnode" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/pbkdf2" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/random" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - aes-js "3.0.0" - scrypt-js "3.0.1" - -"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a" - integrity sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg== - dependencies: - "@ethersproject/bytes" "^5.7.0" - js-sha3 "0.8.0" - -"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" - integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== - -"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.7.0": - version "5.7.1" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6" - integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ== - dependencies: - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102" - integrity sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/sha2" "^5.7.0" - -"@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz#a6e12cb0439b878aaf470f1902a176033067ed30" - integrity sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw== - dependencies: - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/providers@5.7.2": - version "5.7.2" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" - integrity sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg== - dependencies: - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/base64" "^5.7.0" - "@ethersproject/basex" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/hash" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/networks" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/random" "^5.7.0" - "@ethersproject/rlp" "^5.7.0" - "@ethersproject/sha2" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ethersproject/web" "^5.7.0" - bech32 "1.1.4" - ws "7.4.6" - -"@ethersproject/random@5.7.0", "@ethersproject/random@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.7.0.tgz#af19dcbc2484aae078bb03656ec05df66253280c" - integrity sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz#de39e4d5918b9d74d46de93af80b7685a9c21304" - integrity sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" - integrity sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - hash.js "1.1.7" - -"@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz#06b2df39411b00bc57c7c09b01d1e41cf1b16ab3" - integrity sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - bn.js "^5.2.1" - elliptic "6.5.4" - hash.js "1.1.7" - -"@ethersproject/solidity@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" - integrity sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/sha2" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - -"@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.7.0.tgz#54c9d2a7c57ae8f1205c88a9d3a56471e14d5ed2" - integrity sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" - integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== - dependencies: - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/rlp" "^5.7.0" - "@ethersproject/signing-key" "^5.7.0" - -"@ethersproject/units@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.7.0.tgz#637b563d7e14f42deeee39245275d477aae1d8b1" - integrity sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/wallet@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d" - integrity sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA== - dependencies: - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/hash" "^5.7.0" - "@ethersproject/hdnode" "^5.7.0" - "@ethersproject/json-wallets" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/random" "^5.7.0" - "@ethersproject/signing-key" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ethersproject/wordlists" "^5.7.0" - -"@ethersproject/web@5.7.1", "@ethersproject/web@^5.7.0": - version "5.7.1" - resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae" - integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w== - dependencies: - "@ethersproject/base64" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - -"@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.7.0.tgz#8fb2c07185d68c3e09eb3bfd6e779ba2774627f5" - integrity sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/hash" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - -"@humanwhocodes/config-array@^0.11.6": - version "0.11.6" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.6.tgz#6a51d603a3aaf8d4cf45b42b3f2ac9318a4adc4b" - integrity sha512-jJr+hPTJYKyDILJfhNSHsjiwXYf26Flsz8DvNndOsHs5pwSnpGUEy8yzF0JYhCEvTDdV2vuOK5tt8BVhwO5/hg== - dependencies: - "@humanwhocodes/object-schema" "^1.2.1" - debug "^4.1.1" - minimatch "^3.0.4" - -"@humanwhocodes/module-importer@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" - integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== - -"@humanwhocodes/object-schema@^1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" - integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== - -"@istanbuljs/load-nyc-config@^1.0.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" - integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== - dependencies: - camelcase "^5.3.1" - find-up "^4.1.0" - get-package-type "^0.1.0" - js-yaml "^3.13.1" - resolve-from "^5.0.0" - -"@istanbuljs/schema@^0.1.2": - version "0.1.3" - resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" - integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== - -"@jest/console@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-28.1.3.tgz#2030606ec03a18c31803b8a36382762e447655df" - integrity sha512-QPAkP5EwKdK/bxIr6C1I4Vs0rm2nHiANzj/Z5X2JQkrZo6IqvC4ldZ9K95tF0HdidhA8Bo6egxSzUFPYKcEXLw== - dependencies: - "@jest/types" "^28.1.3" - "@types/node" "*" - chalk "^4.0.0" - jest-message-util "^28.1.3" - jest-util "^28.1.3" - slash "^3.0.0" - -"@jest/core@^28.1.2", "@jest/core@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-28.1.3.tgz#0ebf2bd39840f1233cd5f2d1e6fc8b71bd5a1ac7" - integrity sha512-CIKBrlaKOzA7YG19BEqCw3SLIsEwjZkeJzf5bdooVnW4bH5cktqe3JX+G2YV1aK5vP8N9na1IGWFzYaTp6k6NA== - dependencies: - "@jest/console" "^28.1.3" - "@jest/reporters" "^28.1.3" - "@jest/test-result" "^28.1.3" - "@jest/transform" "^28.1.3" - "@jest/types" "^28.1.3" - "@types/node" "*" - ansi-escapes "^4.2.1" - chalk "^4.0.0" - ci-info "^3.2.0" - exit "^0.1.2" - graceful-fs "^4.2.9" - jest-changed-files "^28.1.3" - jest-config "^28.1.3" - jest-haste-map "^28.1.3" - jest-message-util "^28.1.3" - jest-regex-util "^28.0.2" - jest-resolve "^28.1.3" - jest-resolve-dependencies "^28.1.3" - jest-runner "^28.1.3" - jest-runtime "^28.1.3" - jest-snapshot "^28.1.3" - jest-util "^28.1.3" - jest-validate "^28.1.3" - jest-watcher "^28.1.3" - micromatch "^4.0.4" - pretty-format "^28.1.3" - rimraf "^3.0.0" - slash "^3.0.0" - strip-ansi "^6.0.0" - -"@jest/environment@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-28.1.3.tgz#abed43a6b040a4c24fdcb69eab1f97589b2d663e" - integrity sha512-1bf40cMFTEkKyEf585R9Iz1WayDjHoHqvts0XFYEqyKM3cFWDpeMoqKKTAF9LSYQModPUlh8FKptoM2YcMWAXA== - dependencies: - "@jest/fake-timers" "^28.1.3" - "@jest/types" "^28.1.3" - "@types/node" "*" - jest-mock "^28.1.3" - -"@jest/expect-utils@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-28.1.3.tgz#58561ce5db7cd253a7edddbc051fb39dda50f525" - integrity sha512-wvbi9LUrHJLn3NlDW6wF2hvIMtd4JUl2QNVrjq+IBSHirgfrR3o9RnVtxzdEGO2n9JyIWwHnLfby5KzqBGg2YA== - dependencies: - jest-get-type "^28.0.2" - -"@jest/expect@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-28.1.3.tgz#9ac57e1d4491baca550f6bdbd232487177ad6a72" - integrity sha512-lzc8CpUbSoE4dqT0U+g1qODQjBRHPpCPXissXD4mS9+sWQdmmpeJ9zSH1rS1HEkrsMN0fb7nKrJ9giAR1d3wBw== - dependencies: - expect "^28.1.3" - jest-snapshot "^28.1.3" - -"@jest/fake-timers@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-28.1.3.tgz#230255b3ad0a3d4978f1d06f70685baea91c640e" - integrity sha512-D/wOkL2POHv52h+ok5Oj/1gOG9HSywdoPtFsRCUmlCILXNn5eIWmcnd3DIiWlJnpGvQtmajqBP95Ei0EimxfLw== - dependencies: - "@jest/types" "^28.1.3" - "@sinonjs/fake-timers" "^9.1.2" - "@types/node" "*" - jest-message-util "^28.1.3" - jest-mock "^28.1.3" - jest-util "^28.1.3" - -"@jest/globals@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-28.1.3.tgz#a601d78ddc5fdef542728309894895b4a42dc333" - integrity sha512-XFU4P4phyryCXu1pbcqMO0GSQcYe1IsalYCDzRNyhetyeyxMcIxa11qPNDpVNLeretItNqEmYYQn1UYz/5x1NA== - dependencies: - "@jest/environment" "^28.1.3" - "@jest/expect" "^28.1.3" - "@jest/types" "^28.1.3" - -"@jest/reporters@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-28.1.3.tgz#9adf6d265edafc5fc4a434cfb31e2df5a67a369a" - integrity sha512-JuAy7wkxQZVNU/V6g9xKzCGC5LVXx9FDcABKsSXp5MiKPEE2144a/vXTEDoyzjUpZKfVwp08Wqg5A4WfTMAzjg== - dependencies: - "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^28.1.3" - "@jest/test-result" "^28.1.3" - "@jest/transform" "^28.1.3" - "@jest/types" "^28.1.3" - "@jridgewell/trace-mapping" "^0.3.13" - "@types/node" "*" - chalk "^4.0.0" - collect-v8-coverage "^1.0.0" - exit "^0.1.2" - glob "^7.1.3" - graceful-fs "^4.2.9" - istanbul-lib-coverage "^3.0.0" - istanbul-lib-instrument "^5.1.0" - istanbul-lib-report "^3.0.0" - istanbul-lib-source-maps "^4.0.0" - istanbul-reports "^3.1.3" - jest-message-util "^28.1.3" - jest-util "^28.1.3" - jest-worker "^28.1.3" - slash "^3.0.0" - string-length "^4.0.1" - strip-ansi "^6.0.0" - terminal-link "^2.0.0" - v8-to-istanbul "^9.0.1" - -"@jest/schemas@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-28.1.3.tgz#ad8b86a66f11f33619e3d7e1dcddd7f2d40ff905" - integrity sha512-/l/VWsdt/aBXgjshLWOFyFt3IVdYypu5y2Wn2rOO1un6nkqIn8SLXzgIMYXFyYsRWDyF5EthmKJMIdJvk08grg== - dependencies: - "@sinclair/typebox" "^0.24.1" - -"@jest/source-map@^28.1.2": - version "28.1.2" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-28.1.2.tgz#7fe832b172b497d6663cdff6c13b0a920e139e24" - integrity sha512-cV8Lx3BeStJb8ipPHnqVw/IM2VCMWO3crWZzYodSIkxXnRcXJipCdx1JCK0K5MsJJouZQTH73mzf4vgxRaH9ww== - dependencies: - "@jridgewell/trace-mapping" "^0.3.13" - callsites "^3.0.0" - graceful-fs "^4.2.9" - -"@jest/test-result@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-28.1.3.tgz#5eae945fd9f4b8fcfce74d239e6f725b6bf076c5" - integrity sha512-kZAkxnSE+FqE8YjW8gNuoVkkC9I7S1qmenl8sGcDOLropASP+BkcGKwhXoyqQuGOGeYY0y/ixjrd/iERpEXHNg== - dependencies: - "@jest/console" "^28.1.3" - "@jest/types" "^28.1.3" - "@types/istanbul-lib-coverage" "^2.0.0" - collect-v8-coverage "^1.0.0" - -"@jest/test-sequencer@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-28.1.3.tgz#9d0c283d906ac599c74bde464bc0d7e6a82886c3" - integrity sha512-NIMPEqqa59MWnDi1kvXXpYbqsfQmSJsIbnd85mdVGkiDfQ9WQQTXOLsvISUfonmnBT+w85WEgneCigEEdHDFxw== - dependencies: - "@jest/test-result" "^28.1.3" - graceful-fs "^4.2.9" - jest-haste-map "^28.1.3" - slash "^3.0.0" - -"@jest/transform@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-28.1.3.tgz#59d8098e50ab07950e0f2fc0fc7ec462371281b0" - integrity sha512-u5dT5di+oFI6hfcLOHGTAfmUxFRrjK+vnaP0kkVow9Md/M7V/MxqQMOz/VV25UZO8pzeA9PjfTpOu6BDuwSPQA== - dependencies: - "@babel/core" "^7.11.6" - "@jest/types" "^28.1.3" - "@jridgewell/trace-mapping" "^0.3.13" - babel-plugin-istanbul "^6.1.1" - chalk "^4.0.0" - convert-source-map "^1.4.0" - fast-json-stable-stringify "^2.0.0" - graceful-fs "^4.2.9" - jest-haste-map "^28.1.3" - jest-regex-util "^28.0.2" - jest-util "^28.1.3" - micromatch "^4.0.4" - pirates "^4.0.4" - slash "^3.0.0" - write-file-atomic "^4.0.1" - -"@jest/types@^28.1.1", "@jest/types@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-28.1.3.tgz#b05de80996ff12512bc5ceb1d208285a7d11748b" - integrity sha512-RyjiyMUZrKz/c+zlMFO1pm70DcIlST8AeWTkoUdZevew44wcNZQHsEVOiCVtgVnlFFD82FPaXycys58cf2muVQ== - dependencies: - "@jest/schemas" "^28.1.3" - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^3.0.0" - "@types/node" "*" - "@types/yargs" "^17.0.8" - chalk "^4.0.0" - -"@jridgewell/gen-mapping@^0.1.0": - version "0.1.1" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz#e5d2e450306a9491e3bd77e323e38d7aff315996" - integrity sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w== - dependencies: - "@jridgewell/set-array" "^1.0.0" - "@jridgewell/sourcemap-codec" "^1.4.10" - -"@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": - version "0.3.2" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9" - integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A== - dependencies: - "@jridgewell/set-array" "^1.0.1" - "@jridgewell/sourcemap-codec" "^1.4.10" - "@jridgewell/trace-mapping" "^0.3.9" - -"@jridgewell/resolve-uri@3.1.0", "@jridgewell/resolve-uri@^3.0.3": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" - integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== - -"@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" - integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== - -"@jridgewell/source-map@^0.3.2": - version "0.3.2" - resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.2.tgz#f45351aaed4527a298512ec72f81040c998580fb" - integrity sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw== - dependencies: - "@jridgewell/gen-mapping" "^0.3.0" - "@jridgewell/trace-mapping" "^0.3.9" - -"@jridgewell/sourcemap-codec@1.4.14", "@jridgewell/sourcemap-codec@^1.4.10": - version "1.4.14" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" - integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== - -"@jridgewell/trace-mapping@0.3.9": - version "0.3.9" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" - integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== - dependencies: - "@jridgewell/resolve-uri" "^3.0.3" - "@jridgewell/sourcemap-codec" "^1.4.10" - -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.13", "@jridgewell/trace-mapping@^0.3.14", "@jridgewell/trace-mapping@^0.3.9": - version "0.3.17" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz#793041277af9073b0951a7fe0f0d8c4c98c36985" - integrity sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g== - dependencies: - "@jridgewell/resolve-uri" "3.1.0" - "@jridgewell/sourcemap-codec" "1.4.14" - -"@nestjs/axios@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@nestjs/axios/-/axios-1.0.1.tgz#7a872e032b9d12037f2663a7316b81507cd7957a" - integrity sha512-TpoZM/0ZJ9xiC04qkRDFod93LCZ12TQARRU3ejDvBK2E8emvzM4HThOs5ePklVxce4Q1ZsnrIWqnImvoDmJYnQ== - dependencies: - axios "1.2.1" - -"@nestjs/cli@^9.0.0": - version "9.1.5" - resolved "https://registry.yarnpkg.com/@nestjs/cli/-/cli-9.1.5.tgz#aa150991b209dc2b459c974cc1c43ea10a276ff8" - integrity sha512-rSp26+Nv7PFtYrRSP18Gv5ZK8rRSc2SCCF5wh4SdZaVGgkxShpNq9YEfI+ik/uziN3KC5o74ppYRXGj+aHGVsA== - dependencies: - "@angular-devkit/core" "14.2.2" - "@angular-devkit/schematics" "14.2.2" - "@angular-devkit/schematics-cli" "14.2.2" - "@nestjs/schematics" "^9.0.0" - chalk "3.0.0" - chokidar "3.5.3" - cli-table3 "0.6.2" - commander "4.1.1" - fork-ts-checker-webpack-plugin "7.2.13" - inquirer "7.3.3" - node-emoji "1.11.0" - ora "5.4.1" - os-name "4.0.1" - rimraf "3.0.2" - shelljs "0.8.5" - source-map-support "0.5.21" - tree-kill "1.2.2" - tsconfig-paths "4.1.0" - tsconfig-paths-webpack-plugin "4.0.0" - typescript "4.8.4" - webpack "5.74.0" - webpack-node-externals "3.0.0" - -"@nestjs/common@8.4.4": - version "8.4.4" - resolved "https://registry.yarnpkg.com/@nestjs/common/-/common-8.4.4.tgz#0914c6c0540b5a344c7c8fd6072faa1a49af1158" - integrity sha512-QHi7QcgH/5Jinz+SCfIZJkFHc6Cch1YsAEGFEhi6wSp6MILb0sJMQ1CX06e9tCOAjSlBwaJj4PH0eFCVau5v9Q== - dependencies: - axios "0.26.1" - iterare "1.2.1" - tslib "2.3.1" - uuid "8.3.2" - -"@nestjs/common@^9.2.1": - version "9.2.1" - resolved "https://registry.yarnpkg.com/@nestjs/common/-/common-9.2.1.tgz#24de19ee85a8f1747288980fe517b12753cf66ea" - integrity sha512-nZuo3oDsSSlC5mti/M2aCWTEIfHPGDXmBwWgPeCpRbrNz3IWd109rkajll+yxgidVjznAdBS9y00JkAVJblNYw== - dependencies: - iterare "1.2.1" - tslib "2.4.1" - uuid "9.0.0" - -"@nestjs/config@^2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@nestjs/config/-/config-2.2.0.tgz#9f3da35f7c4a58724c0a0817d6f04b66e6703430" - integrity sha512-78Eg6oMbCy3D/YvqeiGBTOWei1Jwi3f2pSIZcZ1QxY67kYsJzTRTkwRT8Iv30DbK0sGKc1mcloDLD5UXgZAZtg== - dependencies: - dotenv "16.0.1" - dotenv-expand "8.0.3" - lodash "4.17.21" - uuid "8.3.2" - -"@nestjs/core@8.4.4": - version "8.4.4" - resolved "https://registry.yarnpkg.com/@nestjs/core/-/core-8.4.4.tgz#94fd2d63fd77791f616fbecafb79faa2235eeeff" - integrity sha512-Ef3yJPuzAttpNfehnGqIV5kHIL9SHptB5F4ERxoU7pT61H3xiYpZw6hSjx68cJO7cc6rm7/N+b4zeuJvFHtvBg== - dependencies: - "@nuxtjs/opencollective" "0.3.2" - fast-safe-stringify "2.1.1" - iterare "1.2.1" - object-hash "3.0.0" - path-to-regexp "3.2.0" - tslib "2.3.1" - uuid "8.3.2" - -"@nestjs/core@^9.2.1": - version "9.2.1" - resolved "https://registry.yarnpkg.com/@nestjs/core/-/core-9.2.1.tgz#598e51a421a0aaafc568c1a02499f7c1f9491caf" - integrity sha512-a9GkXuu8uXgNgCVW+17iI8kLCltO+HwHpU2IhR+32JKnN2WEQ1YEWU4t3GJ2MNq44YkjIw9zrKvFkjJBlYrNbQ== - dependencies: - "@nuxtjs/opencollective" "0.3.2" - fast-safe-stringify "2.1.1" - iterare "1.2.1" - object-hash "3.0.0" - path-to-regexp "3.2.0" - tslib "2.4.1" - uuid "9.0.0" - -"@nestjs/mapped-types@1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@nestjs/mapped-types/-/mapped-types-1.2.0.tgz#1bbdbb5c956f0adb3fd76add929137bc6ad3183f" - integrity sha512-NTFwPZkQWsArQH8QSyFWGZvJ08gR+R4TofglqZoihn/vU+ktHEJjMqsIsADwb7XD97DhiD+TVv5ac+jG33BHrg== - -"@nestjs/platform-express@^9.0.0": - version "9.1.6" - resolved "https://registry.yarnpkg.com/@nestjs/platform-express/-/platform-express-9.1.6.tgz#01e0dc29bb02d1a3820a5da4f2a0a534b97c75cb" - integrity sha512-zZuB1g6yIPytPIzp0EYKWT+1d02hOQ5aU6VdtO6Qg0Wn1RjdjGh3kScsqdamMEjzt0WAfL8DjE5oqrLgvashsw== - dependencies: - body-parser "1.20.1" - cors "2.8.5" - express "4.18.2" - multer "1.4.4-lts.1" - tslib "2.4.0" - -"@nestjs/schedule@^2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@nestjs/schedule/-/schedule-2.1.0.tgz#a2e21b2078a0c3d56552d40cc97336aa5bbfecdf" - integrity sha512-4Xaw56WiW3VsxEPPnj/iDtfjcO+sUZyYAeRxD0gnF5havncxjAnv52Iw7UH3DuzzUA784xPGgGje3Fq0Gu925g== - dependencies: - cron "2.0.0" - uuid "8.3.2" - -"@nestjs/schematics@^9.0.0": - version "9.0.3" - resolved "https://registry.yarnpkg.com/@nestjs/schematics/-/schematics-9.0.3.tgz#175218350fb3829c9a903e980046a11950310e24" - integrity sha512-kZrU/lrpVd2cnK8I3ibDb3Wi1ppl3wX3U3lVWoL+DzRRoezWKkh8upEL4q0koKmuXnsmLiu3UPxFeMOrJV7TSA== - dependencies: - "@angular-devkit/core" "14.2.1" - "@angular-devkit/schematics" "14.2.1" - fs-extra "10.1.0" - jsonc-parser "3.2.0" - pluralize "8.0.0" - -"@nestjs/swagger@^6.1.0": - version "6.1.3" - resolved "https://registry.yarnpkg.com/@nestjs/swagger/-/swagger-6.1.3.tgz#ee274ceb645cb73cb7986027663a742394d51869" - integrity sha512-H9C/yRgLFb5QrAt6iGrYmIX9X7Q0zXkgZaTNUATljUBra+RCWrEUbLHBcGjTAOtcIyGV/vmyCLv68YSVcZoE0Q== - dependencies: - "@nestjs/mapped-types" "1.2.0" - js-yaml "4.1.0" - lodash "4.17.21" - path-to-regexp "3.2.0" - swagger-ui-dist "4.15.1" - -"@nestjs/terminus@^9.1.1": - version "9.1.2" - resolved "https://registry.yarnpkg.com/@nestjs/terminus/-/terminus-9.1.2.tgz#2732971e9d1d9e4c42e6823aca2a311dbce3bf9f" - integrity sha512-6itH7tVucUyN/NTImnIiVmdiIVbvUCUXVzDjlNiHzl9DLx3dRyN4fyfFFS1ICcg7O0OhXNOCuDd/onV8ceH1Hg== - dependencies: - boxen "5.1.2" - check-disk-space "3.3.1" - -"@nestjs/testing@^9.0.0": - version "9.1.6" - resolved "https://registry.yarnpkg.com/@nestjs/testing/-/testing-9.1.6.tgz#e85601d8cb5158bec4a5029b435c352dc440be9c" - integrity sha512-3kdTgiv5DHRHMQ/befLWd/60LZWjOM2V+SwOLqGkITt1yjo+jpkDze8/f0ZXVGEa6pcWYZ5oeedbL2T1nyUKSQ== - dependencies: - tslib "2.4.0" - -"@nestjs/typeorm@^9.0.1": - version "9.0.1" - resolved "https://registry.yarnpkg.com/@nestjs/typeorm/-/typeorm-9.0.1.tgz#f78bfc00e71731ea860288e4a03830107daf3d9c" - integrity sha512-A2BgLIPsMtmMI0bPKEf4bmzgFPsnvHqNBx3KkvaJ7hJrBQy0OqYOb+Rr06ifblKWDWS2tUPNrAFQbZjtk3PI+g== - dependencies: - uuid "8.3.2" - -"@nodelib/fs.scandir@2.1.5": - version "2.1.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" - integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== - dependencies: - "@nodelib/fs.stat" "2.0.5" - run-parallel "^1.1.9" - -"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": - version "2.0.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" - integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== - -"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": - version "1.2.8" - resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" - integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== - dependencies: - "@nodelib/fs.scandir" "2.1.5" - fastq "^1.6.0" - -"@nuxtjs/opencollective@0.3.2": - version "0.3.2" - resolved "https://registry.yarnpkg.com/@nuxtjs/opencollective/-/opencollective-0.3.2.tgz#620ce1044f7ac77185e825e1936115bb38e2681c" - integrity sha512-um0xL3fO7Mf4fDxcqx9KryrB7zgRM5JSlvGN5AGkP6JLM5XEKyjeAiPbNxdXVXQ16isuAhYpvP88NgL2BGd6aA== - dependencies: - chalk "^4.1.0" - consola "^2.15.0" - node-fetch "^2.6.1" - -"@openapitools/openapi-generator-cli@^2.5.2": - version "2.5.2" - resolved "https://registry.yarnpkg.com/@openapitools/openapi-generator-cli/-/openapi-generator-cli-2.5.2.tgz#727a0f29fec1f91ffb467003d0d12ef35554e0ef" - integrity sha512-FLgkjzpDiHVsH821db0VDSElDoA6TcspGyq3RD4zLBJaJhbSsRwr4u87sNoyuHKBg4OMJbZMT4iJxAhkosKrzw== - dependencies: - "@nestjs/common" "8.4.4" - "@nestjs/core" "8.4.4" - "@nuxtjs/opencollective" "0.3.2" - chalk "4.1.2" - commander "8.3.0" - compare-versions "4.1.3" - concurrently "6.5.1" - console.table "0.10.0" - fs-extra "10.0.1" - glob "7.1.6" - inquirer "8.2.2" - lodash "4.17.21" - reflect-metadata "0.1.13" - rxjs "7.5.5" - tslib "2.0.3" - -"@sinclair/typebox@^0.24.1": - version "0.24.51" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.51.tgz#645f33fe4e02defe26f2f5c0410e1c094eac7f5f" - integrity sha512-1P1OROm/rdubP5aFDSZQILU0vrLCJ4fvHt6EoqHEM+2D/G5MK3bIaymUKLit8Js9gbns5UyJnkP/TZROLw4tUA== - -"@sinonjs/commons@^1.7.0": - version "1.8.3" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d" - integrity sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ== - dependencies: - type-detect "4.0.8" - -"@sinonjs/fake-timers@^9.1.2": - version "9.1.2" - resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz#4eaab737fab77332ab132d396a3c0d364bd0ea8c" - integrity sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw== - dependencies: - "@sinonjs/commons" "^1.7.0" - -"@sqltools/formatter@^1.2.2": - version "1.2.5" - resolved "https://registry.yarnpkg.com/@sqltools/formatter/-/formatter-1.2.5.tgz#3abc203c79b8c3e90fd6c156a0c62d5403520e12" - integrity sha512-Uy0+khmZqUrUGm5dmMqVlnvufZRSK0FbYzVgp0UMstm+F5+W2/jnEEQyc9vo1ZR/E5ZI/B1WjjoTqBqwJL6Krw== - -"@tsconfig/node10@^1.0.7": - version "1.0.9" - resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" - integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== - -"@tsconfig/node12@^1.0.7": - version "1.0.11" - resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" - integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== - -"@tsconfig/node14@^1.0.0": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" - integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== - -"@tsconfig/node16@^1.0.2": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" - integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== - -"@types/babel__core@^7.1.14": - version "7.1.19" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.19.tgz#7b497495b7d1b4812bdb9d02804d0576f43ee460" - integrity sha512-WEOTgRsbYkvA/KCsDwVEGkd7WAr1e3g31VHQ8zy5gul/V1qKullU/BU5I68X5v7V3GnB9eotmom4v5a5gjxorw== - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - "@types/babel__generator" "*" - "@types/babel__template" "*" - "@types/babel__traverse" "*" - -"@types/babel__generator@*": - version "7.6.4" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.4.tgz#1f20ce4c5b1990b37900b63f050182d28c2439b7" - integrity sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg== - dependencies: - "@babel/types" "^7.0.0" - -"@types/babel__template@*": - version "7.4.1" - resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.1.tgz#3d1a48fd9d6c0edfd56f2ff578daed48f36c8969" - integrity sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g== - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - -"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.18.2" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.18.2.tgz#235bf339d17185bdec25e024ca19cce257cc7309" - integrity sha512-FcFaxOr2V5KZCviw1TnutEMVUVsGt4D2hP1TAfXZAMKuHYW3xQhe3jTxNPWutgCJ3/X1c5yX8ZoGVEItxKbwBg== - dependencies: - "@babel/types" "^7.3.0" - -"@types/body-parser@*": - version "1.19.2" - resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.2.tgz#aea2059e28b7658639081347ac4fab3de166e6f0" - integrity sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g== - dependencies: - "@types/connect" "*" - "@types/node" "*" - -"@types/connect@*": - version "3.4.35" - resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.35.tgz#5fcf6ae445e4021d1fc2219a4873cc73a3bb2ad1" - integrity sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ== - dependencies: - "@types/node" "*" - -"@types/cookiejar@*": - version "2.1.2" - resolved "https://registry.yarnpkg.com/@types/cookiejar/-/cookiejar-2.1.2.tgz#66ad9331f63fe8a3d3d9d8c6e3906dd10f6446e8" - integrity sha512-t73xJJrvdTjXrn4jLS9VSGRbz0nUY3cl2DMGDU48lKl+HR9dbbjW2A9r3g40VA++mQpy6uuHg33gy7du2BKpog== - -"@types/cron@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@types/cron/-/cron-2.0.0.tgz#4fe75f2720a3b69a1f7b80e656749f4c2c96d727" - integrity sha512-xZM08fqvwIXgghtPVkSPKNgC+JoMQ2OHazEvyTKnNf7aWu1aB6/4lBbQFrb03Td2cUGG7ITzMv3mFYnMu6xRaQ== - dependencies: - "@types/luxon" "*" - "@types/node" "*" - -"@types/eslint-scope@^3.7.3": - version "3.7.4" - resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.4.tgz#37fc1223f0786c39627068a12e94d6e6fc61de16" - integrity sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA== - dependencies: - "@types/eslint" "*" - "@types/estree" "*" - -"@types/eslint@*": - version "8.4.8" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.4.8.tgz#720dd6a32b8219b9aba1a07b13e9d03b622695fd" - integrity sha512-zUCKQI1bUCTi+0kQs5ZQzQ/XILWRLIlh15FXWNykJ+NG3TMKMVvwwC6GP3DR1Ylga15fB7iAExSzc4PNlR5i3w== - dependencies: - "@types/estree" "*" - "@types/json-schema" "*" - -"@types/estree@*": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.0.tgz#5fb2e536c1ae9bf35366eed879e827fa59ca41c2" - integrity sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ== - -"@types/estree@^0.0.51": - version "0.0.51" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.51.tgz#cfd70924a25a3fd32b218e5e420e6897e1ac4f40" - integrity sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ== - -"@types/express-serve-static-core@^4.17.18": - version "4.17.31" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.31.tgz#a1139efeab4e7323834bb0226e62ac019f474b2f" - integrity sha512-DxMhY+NAsTwMMFHBTtJFNp5qiHKJ7TeqOo23zVEM9alT1Ml27Q3xcTH0xwxn7Q0BbMcVEJOs/7aQtUWupUQN3Q== - dependencies: - "@types/node" "*" - "@types/qs" "*" - "@types/range-parser" "*" - -"@types/express@*", "@types/express@^4.17.13": - version "4.17.14" - resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.14.tgz#143ea0557249bc1b3b54f15db4c81c3d4eb3569c" - integrity sha512-TEbt+vaPFQ+xpxFLFssxUDXj5cWCxZJjIcB7Yg0k0GMHGtgtQgpvx/MUQUeAkNbA9AAGrwkAsoeItdTgS7FMyg== - dependencies: - "@types/body-parser" "*" - "@types/express-serve-static-core" "^4.17.18" - "@types/qs" "*" - "@types/serve-static" "*" - -"@types/graceful-fs@^4.1.3": - version "4.1.5" - resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15" - integrity sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw== - dependencies: - "@types/node" "*" - -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44" - integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g== - -"@types/istanbul-lib-report@*": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" - integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== - dependencies: - "@types/istanbul-lib-coverage" "*" - -"@types/istanbul-reports@^3.0.0": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" - integrity sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw== - dependencies: - "@types/istanbul-lib-report" "*" - -"@types/jest@28.1.4": - version "28.1.4" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-28.1.4.tgz#a11ee6c8fd0b52c19c9c18138b78bbcc201dad5a" - integrity sha512-telv6G5N7zRJiLcI3Rs3o+ipZ28EnE+7EvF0pSrt2pZOMnAVI/f+6/LucDxOvcBcTeTL3JMF744BbVQAVBUQRA== - dependencies: - jest-matcher-utils "^28.0.0" - pretty-format "^28.0.0" - -"@types/json-schema@*", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": - version "7.0.11" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" - integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== - -"@types/luxon@*": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@types/luxon/-/luxon-3.0.2.tgz#11361eb3c8a81e9b8d6b35b6ffe155e8eb95480d" - integrity sha512-HM2OVWckUMmXbWYZufmWT2XMURGDZ6XbyNyQ+Lx+gCFGFqbZaIjsz7b+AGeGP/AuVYHBiuGY+wXfweP1RremnA== - -"@types/mime@*": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@types/mime/-/mime-3.0.1.tgz#5f8f2bca0a5863cb69bc0b0acd88c96cb1d4ae10" - integrity sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA== - -"@types/multer@^1.4.7": - version "1.4.7" - resolved "https://registry.yarnpkg.com/@types/multer/-/multer-1.4.7.tgz#89cf03547c28c7bbcc726f029e2a76a7232cc79e" - integrity sha512-/SNsDidUFCvqqcWDwxv2feww/yqhNeTRL5CVoL3jU4Goc4kKEL10T7Eye65ZqPNi4HRx8sAEX59pV1aEH7drNA== - dependencies: - "@types/express" "*" - -"@types/node@*": - version "18.11.7" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.7.tgz#8ccef136f240770c1379d50100796a6952f01f94" - integrity sha512-LhFTglglr63mNXUSRYD8A+ZAIu5sFqNJ4Y2fPuY7UlrySJH87rRRlhtVmMHplmfk5WkoJGmDjE9oiTfyX94CpQ== - -"@types/node@^16.0.0": - version "16.18.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.2.tgz#77878acc68c5f6241454008beedd39513bd8e851" - integrity sha512-KIGQJyya+opDCFvDSZMNNS899ov5jlNdtN7PypgHWeb8e+5vWISdwTRo/ClsNVlmDihzOGqFyNBDamUs7TQQCA== - -"@types/parse-json@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" - integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== - -"@types/prettier@^2.1.5": - version "2.7.1" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.1.tgz#dfd20e2dc35f027cdd6c1908e80a5ddc7499670e" - integrity sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow== - -"@types/qs@*": - version "6.9.7" - resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.7.tgz#63bb7d067db107cc1e457c303bc25d511febf6cb" - integrity sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw== - -"@types/range-parser@*": - version "1.2.4" - resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc" - integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw== - -"@types/semver@^7.3.12": - version "7.3.13" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91" - integrity sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw== - -"@types/serve-static@*": - version "1.15.0" - resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.15.0.tgz#c7930ff61afb334e121a9da780aac0d9b8f34155" - integrity sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg== - dependencies: - "@types/mime" "*" - "@types/node" "*" - -"@types/stack-utils@^2.0.0": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" - integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== - -"@types/superagent@*": - version "4.1.15" - resolved "https://registry.yarnpkg.com/@types/superagent/-/superagent-4.1.15.tgz#63297de457eba5e2bc502a7609426c4cceab434a" - integrity sha512-mu/N4uvfDN2zVQQ5AYJI/g4qxn2bHB6521t1UuH09ShNWjebTqN0ZFuYK9uYjcgmI0dTQEs+Owi1EO6U0OkOZQ== - dependencies: - "@types/cookiejar" "*" - "@types/node" "*" - -"@types/supertest@^2.0.11": - version "2.0.12" - resolved "https://registry.yarnpkg.com/@types/supertest/-/supertest-2.0.12.tgz#ddb4a0568597c9aadff8dbec5b2e8fddbe8692fc" - integrity sha512-X3HPWTwXRerBZS7Mo1k6vMVR1Z6zmJcDVn5O/31whe0tnjE4te6ZJSJGq1RiqHPjzPdMTfjCFogDJmwng9xHaQ== - dependencies: - "@types/superagent" "*" - -"@types/uuid@8.3.4": - version "8.3.4" - resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.4.tgz#bd86a43617df0594787d38b735f55c805becf1bc" - integrity sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw== - -"@types/yargs-parser@*": - version "21.0.0" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" - integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== - -"@types/yargs@^17.0.8": - version "17.0.13" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.13.tgz#34cced675ca1b1d51fcf4d34c3c6f0fa142a5c76" - integrity sha512-9sWaruZk2JGxIQU+IhI1fhPYRcQ0UuTNuKuCW9bR5fp7qi2Llf7WDzNa17Cy7TKnh3cdxDOiyTu6gaLS0eDatg== - dependencies: - "@types/yargs-parser" "*" - -"@typescript-eslint/eslint-plugin@^5.0.0": - version "5.41.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.41.0.tgz#f8eeb1c6bb2549f795f3ba71aec3b38d1ab6b1e1" - integrity sha512-DXUS22Y57/LAFSg3x7Vi6RNAuLpTXwxB9S2nIA7msBb/Zt8p7XqMwdpdc1IU7CkOQUPgAqR5fWvxuKCbneKGmA== - dependencies: - "@typescript-eslint/scope-manager" "5.41.0" - "@typescript-eslint/type-utils" "5.41.0" - "@typescript-eslint/utils" "5.41.0" - debug "^4.3.4" - ignore "^5.2.0" - regexpp "^3.2.0" - semver "^7.3.7" - tsutils "^3.21.0" - -"@typescript-eslint/parser@^5.0.0": - version "5.41.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.41.0.tgz#0414a6405007e463dc527b459af1f19430382d67" - integrity sha512-HQVfix4+RL5YRWZboMD1pUfFN8MpRH4laziWkkAzyO1fvNOY/uinZcvo3QiFJVS/siNHupV8E5+xSwQZrl6PZA== - dependencies: - "@typescript-eslint/scope-manager" "5.41.0" - "@typescript-eslint/types" "5.41.0" - "@typescript-eslint/typescript-estree" "5.41.0" - debug "^4.3.4" - -"@typescript-eslint/scope-manager@5.41.0": - version "5.41.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.41.0.tgz#28e3a41d626288d0628be14cf9de8d49fc30fadf" - integrity sha512-xOxPJCnuktUkY2xoEZBKXO5DBCugFzjrVndKdUnyQr3+9aDWZReKq9MhaoVnbL+maVwWJu/N0SEtrtEUNb62QQ== - dependencies: - "@typescript-eslint/types" "5.41.0" - "@typescript-eslint/visitor-keys" "5.41.0" - -"@typescript-eslint/type-utils@5.41.0": - version "5.41.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.41.0.tgz#2371601171e9f26a4e6da918a7913f7266890cdf" - integrity sha512-L30HNvIG6A1Q0R58e4hu4h+fZqaO909UcnnPbwKiN6Rc3BUEx6ez2wgN7aC0cBfcAjZfwkzE+E2PQQ9nEuoqfA== - dependencies: - "@typescript-eslint/typescript-estree" "5.41.0" - "@typescript-eslint/utils" "5.41.0" - debug "^4.3.4" - tsutils "^3.21.0" - -"@typescript-eslint/types@5.41.0": - version "5.41.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.41.0.tgz#6800abebc4e6abaf24cdf220fb4ce28f4ab09a85" - integrity sha512-5BejraMXMC+2UjefDvrH0Fo/eLwZRV6859SXRg+FgbhA0R0l6lDqDGAQYhKbXhPN2ofk2kY5sgGyLNL907UXpA== - -"@typescript-eslint/typescript-estree@5.41.0": - version "5.41.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.41.0.tgz#bf5c6b3138adbdc73ba4871d060ae12c59366c61" - integrity sha512-SlzFYRwFSvswzDSQ/zPkIWcHv8O5y42YUskko9c4ki+fV6HATsTODUPbRbcGDFYP86gaJL5xohUEytvyNNcXWg== - dependencies: - "@typescript-eslint/types" "5.41.0" - "@typescript-eslint/visitor-keys" "5.41.0" - debug "^4.3.4" - globby "^11.1.0" - is-glob "^4.0.3" - semver "^7.3.7" - tsutils "^3.21.0" - -"@typescript-eslint/utils@5.41.0": - version "5.41.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.41.0.tgz#f41ae5883994a249d00b2ce69f4188f3a23fa0f9" - integrity sha512-QlvfwaN9jaMga9EBazQ+5DDx/4sAdqDkcs05AsQHMaopluVCUyu1bTRUVKzXbgjDlrRAQrYVoi/sXJ9fmG+KLQ== - dependencies: - "@types/json-schema" "^7.0.9" - "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.41.0" - "@typescript-eslint/types" "5.41.0" - "@typescript-eslint/typescript-estree" "5.41.0" - eslint-scope "^5.1.1" - eslint-utils "^3.0.0" - semver "^7.3.7" - -"@typescript-eslint/visitor-keys@5.41.0": - version "5.41.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.41.0.tgz#d3510712bc07d5540160ed3c0f8f213b73e3bcd9" - integrity sha512-vilqeHj267v8uzzakbm13HkPMl7cbYpKVjgFWZPIOHIJHZtinvypUhJ5xBXfWYg4eFKqztbMMpOgFpT9Gfx4fw== - dependencies: - "@typescript-eslint/types" "5.41.0" - eslint-visitor-keys "^3.3.0" - -"@webassemblyjs/ast@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.1.tgz#2bfd767eae1a6996f432ff7e8d7fc75679c0b6a7" - integrity sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw== - dependencies: - "@webassemblyjs/helper-numbers" "1.11.1" - "@webassemblyjs/helper-wasm-bytecode" "1.11.1" - -"@webassemblyjs/floating-point-hex-parser@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz#f6c61a705f0fd7a6aecaa4e8198f23d9dc179e4f" - integrity sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ== - -"@webassemblyjs/helper-api-error@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz#1a63192d8788e5c012800ba6a7a46c705288fd16" - integrity sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg== - -"@webassemblyjs/helper-buffer@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz#832a900eb444884cde9a7cad467f81500f5e5ab5" - integrity sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA== - -"@webassemblyjs/helper-numbers@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz#64d81da219fbbba1e3bd1bfc74f6e8c4e10a62ae" - integrity sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ== - dependencies: - "@webassemblyjs/floating-point-hex-parser" "1.11.1" - "@webassemblyjs/helper-api-error" "1.11.1" - "@xtuc/long" "4.2.2" - -"@webassemblyjs/helper-wasm-bytecode@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz#f328241e41e7b199d0b20c18e88429c4433295e1" - integrity sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q== - -"@webassemblyjs/helper-wasm-section@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz#21ee065a7b635f319e738f0dd73bfbda281c097a" - integrity sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg== - dependencies: - "@webassemblyjs/ast" "1.11.1" - "@webassemblyjs/helper-buffer" "1.11.1" - "@webassemblyjs/helper-wasm-bytecode" "1.11.1" - "@webassemblyjs/wasm-gen" "1.11.1" - -"@webassemblyjs/ieee754@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz#963929e9bbd05709e7e12243a099180812992614" - integrity sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ== - dependencies: - "@xtuc/ieee754" "^1.2.0" - -"@webassemblyjs/leb128@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.11.1.tgz#ce814b45574e93d76bae1fb2644ab9cdd9527aa5" - integrity sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw== - dependencies: - "@xtuc/long" "4.2.2" - -"@webassemblyjs/utf8@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.11.1.tgz#d1f8b764369e7c6e6bae350e854dec9a59f0a3ff" - integrity sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ== - -"@webassemblyjs/wasm-edit@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz#ad206ebf4bf95a058ce9880a8c092c5dec8193d6" - integrity sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA== - dependencies: - "@webassemblyjs/ast" "1.11.1" - "@webassemblyjs/helper-buffer" "1.11.1" - "@webassemblyjs/helper-wasm-bytecode" "1.11.1" - "@webassemblyjs/helper-wasm-section" "1.11.1" - "@webassemblyjs/wasm-gen" "1.11.1" - "@webassemblyjs/wasm-opt" "1.11.1" - "@webassemblyjs/wasm-parser" "1.11.1" - "@webassemblyjs/wast-printer" "1.11.1" - -"@webassemblyjs/wasm-gen@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz#86c5ea304849759b7d88c47a32f4f039ae3c8f76" - integrity sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA== - dependencies: - "@webassemblyjs/ast" "1.11.1" - "@webassemblyjs/helper-wasm-bytecode" "1.11.1" - "@webassemblyjs/ieee754" "1.11.1" - "@webassemblyjs/leb128" "1.11.1" - "@webassemblyjs/utf8" "1.11.1" - -"@webassemblyjs/wasm-opt@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz#657b4c2202f4cf3b345f8a4c6461c8c2418985f2" - integrity sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw== - dependencies: - "@webassemblyjs/ast" "1.11.1" - "@webassemblyjs/helper-buffer" "1.11.1" - "@webassemblyjs/wasm-gen" "1.11.1" - "@webassemblyjs/wasm-parser" "1.11.1" - -"@webassemblyjs/wasm-parser@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz#86ca734534f417e9bd3c67c7a1c75d8be41fb199" - integrity sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA== - dependencies: - "@webassemblyjs/ast" "1.11.1" - "@webassemblyjs/helper-api-error" "1.11.1" - "@webassemblyjs/helper-wasm-bytecode" "1.11.1" - "@webassemblyjs/ieee754" "1.11.1" - "@webassemblyjs/leb128" "1.11.1" - "@webassemblyjs/utf8" "1.11.1" - -"@webassemblyjs/wast-printer@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz#d0c73beda8eec5426f10ae8ef55cee5e7084c2f0" - integrity sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg== - dependencies: - "@webassemblyjs/ast" "1.11.1" - "@xtuc/long" "4.2.2" - -"@xtuc/ieee754@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" - integrity sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA== - -"@xtuc/long@4.2.2": - version "4.2.2" - resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" - integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== - -abort-controller@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" - integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== - dependencies: - event-target-shim "^5.0.0" - -accepts@~1.3.8: - version "1.3.8" - resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" - integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== - dependencies: - mime-types "~2.1.34" - negotiator "0.6.3" - -acorn-import-assertions@^1.7.6: - version "1.8.0" - resolved "https://registry.yarnpkg.com/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz#ba2b5939ce62c238db6d93d81c9b111b29b855e9" - integrity sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw== - -acorn-jsx@^5.3.2: - version "5.3.2" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" - integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== - -acorn-walk@^8.1.1: - version "8.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" - integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== - -acorn@^8.4.1, acorn@^8.5.0, acorn@^8.7.1, acorn@^8.8.0: - version "8.8.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.1.tgz#0a3f9cbecc4ec3bea6f0a80b66ae8dd2da250b73" - integrity sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA== - -aes-js@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" - integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== - -ajv-formats@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ajv-formats/-/ajv-formats-2.1.1.tgz#6e669400659eb74973bbf2e33327180a0996b520" - integrity sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA== - dependencies: - ajv "^8.0.0" - -ajv-keywords@^3.5.2: - version "3.5.2" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" - integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== - -ajv@8.11.0, ajv@^8.0.0: - version "8.11.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.11.0.tgz#977e91dd96ca669f54a11e23e378e33b884a565f" - integrity sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg== - dependencies: - fast-deep-equal "^3.1.1" - json-schema-traverse "^1.0.0" - require-from-string "^2.0.2" - uri-js "^4.2.2" - -ajv@^6.10.0, ajv@^6.12.4, ajv@^6.12.5: - version "6.12.6" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" - integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== - dependencies: - fast-deep-equal "^3.1.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - -ansi-align@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.1.tgz#0cdf12e111ace773a86e9a1fad1225c43cb19a59" - integrity sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w== - dependencies: - string-width "^4.1.0" - -ansi-colors@4.1.3: - version "4.1.3" - resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" - integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== - -ansi-escapes@^4.2.1: - version "4.3.2" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" - integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== - dependencies: - type-fest "^0.21.3" - -ansi-regex@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" - integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== - -ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== - dependencies: - color-convert "^1.9.0" - -ansi-styles@^4.0.0, ansi-styles@^4.1.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" - integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== - dependencies: - color-convert "^2.0.1" - -ansi-styles@^5.0.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" - integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== - -any-promise@^1.0.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" - integrity sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A== - -anymatch@^3.0.3, anymatch@~3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" - integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - -app-root-path@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-3.1.0.tgz#5971a2fc12ba170369a7a1ef018c71e6e47c2e86" - integrity sha512-biN3PwB2gUtjaYy/isrU3aNWI5w+fAfvHkSvCKeQGxhmYpwKFUxudR3Yya+KqVRHBmEDYh+/lTozYCFbmzX4nA== - -append-field@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/append-field/-/append-field-1.0.0.tgz#1e3440e915f0b1203d23748e78edd7b9b5b43e56" - integrity sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw== - -arg@^4.1.0: - version "4.1.3" - resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" - integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== - -argparse@^1.0.7: - version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== - dependencies: - sprintf-js "~1.0.2" - -argparse@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" - integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== - -array-flatten@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" - integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== - -array-union@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" - integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== - -asap@^2.0.0: - version "2.0.6" - resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" - integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== - -atomic-sleep@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/atomic-sleep/-/atomic-sleep-1.0.0.tgz#eb85b77a601fc932cfe432c5acd364a9e2c9075b" - integrity sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ== - -axios@0.26.1: - version "0.26.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9" - integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA== - dependencies: - follow-redirects "^1.14.8" - -axios@1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.2.1.tgz#44cf04a3c9f0c2252ebd85975361c026cb9f864a" - integrity sha512-I88cFiGu9ryt/tfVEi4kX2SITsvDddTajXTOFmt2uK1ZVA8LytjtdeyefdQWEf5PU8w+4SSJDoYnggflB5tW4A== - dependencies: - follow-redirects "^1.15.0" - form-data "^4.0.0" - proxy-from-env "^1.1.0" - -babel-jest@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-28.1.3.tgz#c1187258197c099072156a0a121c11ee1e3917d5" - integrity sha512-epUaPOEWMk3cWX0M/sPvCHHCe9fMFAa/9hXEgKP8nFfNl/jlGkE9ucq9NqkZGXLDduCJYS0UvSlPUwC0S+rH6Q== - dependencies: - "@jest/transform" "^28.1.3" - "@types/babel__core" "^7.1.14" - babel-plugin-istanbul "^6.1.1" - babel-preset-jest "^28.1.3" - chalk "^4.0.0" - graceful-fs "^4.2.9" - slash "^3.0.0" - -babel-plugin-istanbul@^6.1.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" - integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@istanbuljs/load-nyc-config" "^1.0.0" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-instrument "^5.0.4" - test-exclude "^6.0.0" - -babel-plugin-jest-hoist@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-28.1.3.tgz#1952c4d0ea50f2d6d794353762278d1d8cca3fbe" - integrity sha512-Ys3tUKAmfnkRUpPdpa98eYrAR0nV+sSFUZZEGuQ2EbFd1y4SOLtD5QDNHAq+bb9a+bbXvYQC4b+ID/THIMcU6Q== - dependencies: - "@babel/template" "^7.3.3" - "@babel/types" "^7.3.3" - "@types/babel__core" "^7.1.14" - "@types/babel__traverse" "^7.0.6" - -babel-preset-current-node-syntax@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz#b4399239b89b2a011f9ddbe3e4f401fc40cff73b" - integrity sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ== - dependencies: - "@babel/plugin-syntax-async-generators" "^7.8.4" - "@babel/plugin-syntax-bigint" "^7.8.3" - "@babel/plugin-syntax-class-properties" "^7.8.3" - "@babel/plugin-syntax-import-meta" "^7.8.3" - "@babel/plugin-syntax-json-strings" "^7.8.3" - "@babel/plugin-syntax-logical-assignment-operators" "^7.8.3" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" - "@babel/plugin-syntax-numeric-separator" "^7.8.3" - "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" - "@babel/plugin-syntax-optional-chaining" "^7.8.3" - "@babel/plugin-syntax-top-level-await" "^7.8.3" - -babel-preset-jest@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-28.1.3.tgz#5dfc20b99abed5db994406c2b9ab94c73aaa419d" - integrity sha512-L+fupJvlWAHbQfn74coNX3zf60LXMJsezNvvx8eIh7iOR1luJ1poxYgQk1F8PYtNq/6QODDHCqsSnTFSWC491A== - dependencies: - babel-plugin-jest-hoist "^28.1.3" - babel-preset-current-node-syntax "^1.0.0" - -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== - -base64-js@^1.3.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" - integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== - -bech32@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" - integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== - -binary-extensions@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" - integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== - -bl@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" - integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== - dependencies: - buffer "^5.5.0" - inherits "^2.0.4" - readable-stream "^3.4.0" - -bn.js@^4.11.9: - version "4.12.0" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" - integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== - -bn.js@^5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" - integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== - -body-parser@1.20.1: - version "1.20.1" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.1.tgz#b1812a8912c195cd371a3ee5e66faa2338a5c668" - integrity sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw== - dependencies: - bytes "3.1.2" - content-type "~1.0.4" - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - http-errors "2.0.0" - iconv-lite "0.4.24" - on-finished "2.4.1" - qs "6.11.0" - raw-body "2.5.1" - type-is "~1.6.18" - unpipe "1.0.0" - -boxen@5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/boxen/-/boxen-5.1.2.tgz#788cb686fc83c1f486dfa8a40c68fc2b831d2b50" - integrity sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ== - dependencies: - ansi-align "^3.0.0" - camelcase "^6.2.0" - chalk "^4.1.0" - cli-boxes "^2.2.1" - string-width "^4.2.2" - type-fest "^0.20.2" - widest-line "^3.1.0" - wrap-ansi "^7.0.0" - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@^3.0.2, braces@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== - dependencies: - fill-range "^7.0.1" - -brorand@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" - integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== - -browserslist@^4.14.5, browserslist@^4.21.3: - version "4.21.4" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.4.tgz#e7496bbc67b9e39dd0f98565feccdcb0d4ff6987" - integrity sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw== - dependencies: - caniuse-lite "^1.0.30001400" - electron-to-chromium "^1.4.251" - node-releases "^2.0.6" - update-browserslist-db "^1.0.9" - -bs-logger@0.x: - version "0.2.6" - resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" - integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== - dependencies: - fast-json-stable-stringify "2.x" - -bser@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" - integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== - dependencies: - node-int64 "^0.4.0" - -buffer-from@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" - integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== - -buffer-writer@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/buffer-writer/-/buffer-writer-2.0.0.tgz#ce7eb81a38f7829db09c873f2fbb792c0c98ec04" - integrity sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw== - -buffer@^5.5.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" - integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.1.13" - -buffer@^6.0.3: - version "6.0.3" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" - integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.2.1" - -busboy@^1.0.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/busboy/-/busboy-1.6.0.tgz#966ea36a9502e43cdb9146962523b92f531f6893" - integrity sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA== - dependencies: - streamsearch "^1.1.0" - -bytes@3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" - integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== - -call-bind@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" - integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== - dependencies: - function-bind "^1.1.1" - get-intrinsic "^1.0.2" - -callsites@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" - integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== - -camelcase@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" - integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== - -camelcase@^6.2.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" - integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== - -caniuse-lite@^1.0.30001400: - version "1.0.30001426" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001426.tgz#58da20446ccd0cb1dfebd11d2350c907ee7c2eaa" - integrity sha512-n7cosrHLl8AWt0wwZw/PJZgUg3lV0gk9LMI7ikGJwhyhgsd2Nb65vKvmSexCqq/J7rbH3mFG6yZZiPR5dLPW5A== - -chalk@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" - integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -chalk@4.1.2, chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -chalk@^2.0.0: - version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" - integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - -char-regex@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" - integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== - -chardet@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" - integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== - -check-disk-space@3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/check-disk-space/-/check-disk-space-3.3.1.tgz#10c4c8706fdd16d3e5c3572a16aa95efd0b4d40b" - integrity sha512-iOrT8yCZjSnyNZ43476FE2rnssvgw5hnuwOM0hm8Nj1qa0v4ieUUEbCyxxsEliaoDUb/75yCOL71zkDiDBLbMQ== - -chokidar@3.5.3, chokidar@^3.5.3: - version "3.5.3" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" - integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== - dependencies: - anymatch "~3.1.2" - braces "~3.0.2" - glob-parent "~5.1.2" - is-binary-path "~2.1.0" - is-glob "~4.0.1" - normalize-path "~3.0.0" - readdirp "~3.6.0" - optionalDependencies: - fsevents "~2.3.2" - -chrome-trace-event@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac" - integrity sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg== - -ci-info@^3.2.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.5.0.tgz#bfac2a29263de4c829d806b1ab478e35091e171f" - integrity sha512-yH4RezKOGlOhxkmhbeNuC4eYZKAUsEaGtBuBzDDP1eFUKiccDWzBABxBfOx31IDwDIXMTxWuwAxUGModvkbuVw== - -cjs-module-lexer@^1.0.0: - version "1.2.2" - resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz#9f84ba3244a512f3a54e5277e8eef4c489864e40" - integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== - -class-transformer@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/class-transformer/-/class-transformer-0.5.1.tgz#24147d5dffd2a6cea930a3250a677addf96ab336" - integrity sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw== - -class-validator@^0.13.2: - version "0.13.2" - resolved "https://registry.yarnpkg.com/class-validator/-/class-validator-0.13.2.tgz#64b031e9f3f81a1e1dcd04a5d604734608b24143" - integrity sha512-yBUcQy07FPlGzUjoLuUfIOXzgynnQPPruyK1Ge2B74k9ROwnle1E+NxLWnUv5OLU8hA/qL5leAE9XnXq3byaBw== - dependencies: - libphonenumber-js "^1.9.43" - validator "^13.7.0" - -cli-boxes@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.1.tgz#ddd5035d25094fce220e9cab40a45840a440318f" - integrity sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw== - -cli-cursor@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" - integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== - dependencies: - restore-cursor "^3.1.0" - -cli-highlight@^2.1.11: - version "2.1.11" - resolved "https://registry.yarnpkg.com/cli-highlight/-/cli-highlight-2.1.11.tgz#49736fa452f0aaf4fae580e30acb26828d2dc1bf" - integrity sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg== - dependencies: - chalk "^4.0.0" - highlight.js "^10.7.1" - mz "^2.4.0" - parse5 "^5.1.1" - parse5-htmlparser2-tree-adapter "^6.0.0" - yargs "^16.0.0" - -cli-spinners@^2.5.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.7.0.tgz#f815fd30b5f9eaac02db604c7a231ed7cb2f797a" - integrity sha512-qu3pN8Y3qHNgE2AFweciB1IfMnmZ/fsNTEE+NOFjmGB2F/7rLhnhzppvpCnN4FovtP26k8lHyy9ptEbNwWFLzw== - -cli-table3@0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.6.2.tgz#aaf5df9d8b5bf12634dc8b3040806a0c07120d2a" - integrity sha512-QyavHCaIC80cMivimWu4aWHilIpiDpfm3hGmqAmXVL1UsnbLuBSMd21hTX6VY4ZSDSM73ESLeF8TOYId3rBTbw== - dependencies: - string-width "^4.2.0" - optionalDependencies: - "@colors/colors" "1.5.0" - -cli-width@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" - integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw== - -cliui@^7.0.2: - version "7.0.4" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" - integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.0" - wrap-ansi "^7.0.0" - -cliui@^8.0.1: - version "8.0.1" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" - integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.1" - wrap-ansi "^7.0.0" - -clone@^1.0.2: - version "1.0.4" - resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" - integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg== - -co@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== - -collect-v8-coverage@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz#cc2c8e94fc18bbdffe64d6534570c8a673b27f59" - integrity sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg== - -color-convert@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" - -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" - integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== - dependencies: - color-name "~1.1.4" - -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== - -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - -combined-stream@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" - -commander@4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" - integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== - -commander@8.3.0: - version "8.3.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" - integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== - -commander@^2.20.0: - version "2.20.3" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== - -compare-versions@4.1.3: - version "4.1.3" - resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-4.1.3.tgz#8f7b8966aef7dc4282b45dfa6be98434fc18a1a4" - integrity sha512-WQfnbDcrYnGr55UwbxKiQKASnTtNnaAWVi8jZyy8NTpVAXWACSne8lMD1iaIo9AiU6mnuLvSVshCzewVuWxHUg== - -component-emitter@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" - integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== - -concat-stream@^1.5.2: - version "1.6.2" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" - integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== - dependencies: - buffer-from "^1.0.0" - inherits "^2.0.3" - readable-stream "^2.2.2" - typedarray "^0.0.6" - -concurrently@6.5.1: - version "6.5.1" - resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-6.5.1.tgz#4518c67f7ac680cf5c34d5adf399a2a2047edc8c" - integrity sha512-FlSwNpGjWQfRwPLXvJ/OgysbBxPkWpiVjy1042b0U7on7S7qwwMIILRj7WTN1mTgqa582bG6NFuScOoh6Zgdag== - dependencies: - chalk "^4.1.0" - date-fns "^2.16.1" - lodash "^4.17.21" - rxjs "^6.6.3" - spawn-command "^0.0.2-1" - supports-color "^8.1.0" - tree-kill "^1.2.2" - yargs "^16.2.0" - -consola@^2.15.0: - version "2.15.3" - resolved "https://registry.yarnpkg.com/consola/-/consola-2.15.3.tgz#2e11f98d6a4be71ff72e0bdf07bd23e12cb61550" - integrity sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw== - -console.table@0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/console.table/-/console.table-0.10.0.tgz#0917025588875befd70cf2eff4bef2c6e2d75d04" - integrity sha512-dPyZofqggxuvSf7WXvNjuRfnsOk1YazkVP8FdxH4tcH2c37wc79/Yl6Bhr7Lsu00KMgy2ql/qCMuNu8xctZM8g== - dependencies: - easy-table "1.1.0" - -content-disposition@0.5.4: - version "0.5.4" - resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" - integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== - dependencies: - safe-buffer "5.2.1" - -content-type@~1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" - integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== - -convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" - integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== - -cookie-signature@1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" - integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== - -cookie@0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b" - integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== - -cookiejar@^2.1.3: - version "2.1.3" - resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.3.tgz#fc7a6216e408e74414b90230050842dacda75acc" - integrity sha512-JxbCBUdrfr6AQjOXrxoTvAMJO4HBTUIlBzslcJPAz+/KT8yk53fXun51u+RenNYvad/+Vc2DIz5o9UxlCDymFQ== - -core-util-is@~1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" - integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== - -cors@2.8.5: - version "2.8.5" - resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29" - integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g== - dependencies: - object-assign "^4" - vary "^1" - -cosmiconfig@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.1.tgz#714d756522cace867867ccb4474c5d01bbae5d6d" - integrity sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ== - dependencies: - "@types/parse-json" "^4.0.0" - import-fresh "^3.2.1" - parse-json "^5.0.0" - path-type "^4.0.0" - yaml "^1.10.0" - -create-require@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" - integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== - -cron@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/cron/-/cron-2.0.0.tgz#15c6bf37c1cebf6da1d7a688b9ba1c68338bfe6b" - integrity sha512-RPeRunBCFr/WEo7WLp8Jnm45F/ziGJiHVvVQEBSDTSGu6uHW49b2FOP2O14DcXlGJRLhwE7TIoDzHHK4KmlL6g== - dependencies: - luxon "^1.23.x" - -cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: - version "7.0.3" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" - integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - -date-fns@^2.16.1, date-fns@^2.28.0: - version "2.29.3" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8" - integrity sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA== - -debug@2.6.9: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - -debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: - version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - -dedent@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" - integrity sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA== - -deep-is@^0.1.3: - version "0.1.4" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" - integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== - -deepmerge@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" - integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== - -defaults@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.4.tgz#b0b02062c1e2aa62ff5d9528f0f98baa90978d7a" - integrity sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A== - dependencies: - clone "^1.0.2" - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== - -depd@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" - integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== - -destroy@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" - integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== - -detect-newline@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" - integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== - -dezalgo@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/dezalgo/-/dezalgo-1.0.3.tgz#7f742de066fc748bc8db820569dddce49bf0d456" - integrity sha512-K7i4zNfT2kgQz3GylDw40ot9GAE47sFZ9EXHFSPP6zONLgH6kWXE0KWJchkbQJLBkRazq4APwZ4OwiFFlT95OQ== - dependencies: - asap "^2.0.0" - wrappy "1" - -diff-sequences@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-28.1.1.tgz#9989dc731266dc2903457a70e996f3a041913ac6" - integrity sha512-FU0iFaH/E23a+a718l8Qa/19bF9p06kgE0KipMOMadwa3SjnaElKzPaUC0vnibs6/B/9ni97s61mcejk8W1fQw== - -diff@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" - integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== - -dir-glob@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" - integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== - dependencies: - path-type "^4.0.0" - -doctrine@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" - integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== - dependencies: - esutils "^2.0.2" - -dotenv-expand@8.0.3: - version "8.0.3" - resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-8.0.3.tgz#29016757455bcc748469c83a19b36aaf2b83dd6e" - integrity sha512-SErOMvge0ZUyWd5B0NXMQlDkN+8r+HhVUsxgOO7IoPDOdDRD2JjExpN6y3KnFR66jsJMwSn1pqIivhU5rcJiNg== - -dotenv@16.0.1: - version "16.0.1" - resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.1.tgz#8f8f9d94876c35dac989876a5d3a82a267fdce1d" - integrity sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ== - -dotenv@^16.0.0, dotenv@^16.0.1: - version "16.0.3" - resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07" - integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ== - -easy-table@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/easy-table/-/easy-table-1.1.0.tgz#86f9ab4c102f0371b7297b92a651d5824bc8cb73" - integrity sha512-oq33hWOSSnl2Hoh00tZWaIPi1ievrD9aFG82/IgjlycAnW9hHx5PkJiXpxPsgEE+H7BsbVQXFVFST8TEXS6/pA== - optionalDependencies: - wcwidth ">=1.0.1" - -ee-first@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" - integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== - -electron-to-chromium@^1.4.251: - version "1.4.284" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz#61046d1e4cab3a25238f6bf7413795270f125592" - integrity sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA== - -elliptic@6.5.4: - version "6.5.4" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" - integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== - dependencies: - bn.js "^4.11.9" - brorand "^1.1.0" - hash.js "^1.0.0" - hmac-drbg "^1.0.1" - inherits "^2.0.4" - minimalistic-assert "^1.0.1" - minimalistic-crypto-utils "^1.0.1" - -emittery@^0.10.2: - version "0.10.2" - resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.10.2.tgz#902eec8aedb8c41938c46e9385e9db7e03182933" - integrity sha512-aITqOwnLanpHLNXZJENbOgjUBeHocD+xsSJmNrjovKBW5HbSpW3d1pEls7GFQPUWXiwG9+0P4GtHfEqC/4M0Iw== - -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== - -encodeurl@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" - integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== - -encoding@^0.1.11: - version "0.1.13" - resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.13.tgz#56574afdd791f54a8e9b2785c0582a2d26210fa9" - integrity sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A== - dependencies: - iconv-lite "^0.6.2" - -end-of-stream@^1.1.0: - version "1.4.4" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" - integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== - dependencies: - once "^1.4.0" - -enhanced-resolve@^5.0.0, enhanced-resolve@^5.10.0, enhanced-resolve@^5.7.0: - version "5.10.0" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.10.0.tgz#0dc579c3bb2a1032e357ac45b8f3a6f3ad4fb1e6" - integrity sha512-T0yTFjdpldGY8PmuXXR0PyQ1ufZpEGiHVrp7zHKB7jdR4qlmZHhONVM5AQOAWXuF/w3dnHbEQVrNptJgt7F+cQ== - dependencies: - graceful-fs "^4.2.4" - tapable "^2.2.0" - -error-ex@^1.3.1: - version "1.3.2" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" - integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== - dependencies: - is-arrayish "^0.2.1" - -es-module-lexer@^0.9.0: - version "0.9.3" - resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.9.3.tgz#6f13db00cc38417137daf74366f535c8eb438f19" - integrity sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ== - -es6-promise@^4.2.8: - version "4.2.8" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" - integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== - -escalade@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" - integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== - -escape-html@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" - integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== - -escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== - -escape-string-regexp@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" - integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== - -escape-string-regexp@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" - integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== - -eslint-config-prettier@^8.3.0: - version "8.5.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz#5a81680ec934beca02c7b1a61cf8ca34b66feab1" - integrity sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q== - -eslint-plugin-prettier@^4.0.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b" - integrity sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ== - dependencies: - prettier-linter-helpers "^1.0.0" - -eslint-scope@5.1.1, eslint-scope@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" - integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== - dependencies: - esrecurse "^4.3.0" - estraverse "^4.1.1" - -eslint-scope@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" - integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== - dependencies: - esrecurse "^4.3.0" - estraverse "^5.2.0" - -eslint-utils@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" - integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== - dependencies: - eslint-visitor-keys "^2.0.0" - -eslint-visitor-keys@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" - integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== - -eslint-visitor-keys@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" - integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== - -eslint@^8.0.1: - version "8.26.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.26.0.tgz#2bcc8836e6c424c4ac26a5674a70d44d84f2181d" - integrity sha512-kzJkpaw1Bfwheq4VXUezFriD1GxszX6dUekM7Z3aC2o4hju+tsR/XyTC3RcoSD7jmy9VkPU3+N6YjVU2e96Oyg== - dependencies: - "@eslint/eslintrc" "^1.3.3" - "@humanwhocodes/config-array" "^0.11.6" - "@humanwhocodes/module-importer" "^1.0.1" - "@nodelib/fs.walk" "^1.2.8" - ajv "^6.10.0" - chalk "^4.0.0" - cross-spawn "^7.0.2" - debug "^4.3.2" - doctrine "^3.0.0" - escape-string-regexp "^4.0.0" - eslint-scope "^7.1.1" - eslint-utils "^3.0.0" - eslint-visitor-keys "^3.3.0" - espree "^9.4.0" - esquery "^1.4.0" - esutils "^2.0.2" - fast-deep-equal "^3.1.3" - file-entry-cache "^6.0.1" - find-up "^5.0.0" - glob-parent "^6.0.2" - globals "^13.15.0" - grapheme-splitter "^1.0.4" - ignore "^5.2.0" - import-fresh "^3.0.0" - imurmurhash "^0.1.4" - is-glob "^4.0.0" - is-path-inside "^3.0.3" - js-sdsl "^4.1.4" - js-yaml "^4.1.0" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.4.1" - lodash.merge "^4.6.2" - minimatch "^3.1.2" - natural-compare "^1.4.0" - optionator "^0.9.1" - regexpp "^3.2.0" - strip-ansi "^6.0.1" - strip-json-comments "^3.1.0" - text-table "^0.2.0" - -espree@^9.4.0: - version "9.4.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.4.0.tgz#cd4bc3d6e9336c433265fc0aa016fc1aaf182f8a" - integrity sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw== - dependencies: - acorn "^8.8.0" - acorn-jsx "^5.3.2" - eslint-visitor-keys "^3.3.0" - -esprima@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== - -esquery@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" - integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== - dependencies: - estraverse "^5.1.0" - -esrecurse@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" - integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== - dependencies: - estraverse "^5.2.0" - -estraverse@^4.1.1: - version "4.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" - integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== - -estraverse@^5.1.0, estraverse@^5.2.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" - integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== - -esutils@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" - integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== - -etag@~1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" - integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== - -ethers@^5.0.0, ethers@^5.4.1, ethers@^5.6.9: - version "5.7.2" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" - integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== - dependencies: - "@ethersproject/abi" "5.7.0" - "@ethersproject/abstract-provider" "5.7.0" - "@ethersproject/abstract-signer" "5.7.0" - "@ethersproject/address" "5.7.0" - "@ethersproject/base64" "5.7.0" - "@ethersproject/basex" "5.7.0" - "@ethersproject/bignumber" "5.7.0" - "@ethersproject/bytes" "5.7.0" - "@ethersproject/constants" "5.7.0" - "@ethersproject/contracts" "5.7.0" - "@ethersproject/hash" "5.7.0" - "@ethersproject/hdnode" "5.7.0" - "@ethersproject/json-wallets" "5.7.0" - "@ethersproject/keccak256" "5.7.0" - "@ethersproject/logger" "5.7.0" - "@ethersproject/networks" "5.7.1" - "@ethersproject/pbkdf2" "5.7.0" - "@ethersproject/properties" "5.7.0" - "@ethersproject/providers" "5.7.2" - "@ethersproject/random" "5.7.0" - "@ethersproject/rlp" "5.7.0" - "@ethersproject/sha2" "5.7.0" - "@ethersproject/signing-key" "5.7.0" - "@ethersproject/solidity" "5.7.0" - "@ethersproject/strings" "5.7.0" - "@ethersproject/transactions" "5.7.0" - "@ethersproject/units" "5.7.0" - "@ethersproject/wallet" "5.7.0" - "@ethersproject/web" "5.7.1" - "@ethersproject/wordlists" "5.7.0" - -event-target-shim@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" - integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== - -events@^3.2.0, events@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" - integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== - -execa@^4.0.2: - version "4.1.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" - integrity sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA== - dependencies: - cross-spawn "^7.0.0" - get-stream "^5.0.0" - human-signals "^1.1.1" - is-stream "^2.0.0" - merge-stream "^2.0.0" - npm-run-path "^4.0.0" - onetime "^5.1.0" - signal-exit "^3.0.2" - strip-final-newline "^2.0.0" - -execa@^5.0.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" - integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== - dependencies: - cross-spawn "^7.0.3" - get-stream "^6.0.0" - human-signals "^2.1.0" - is-stream "^2.0.0" - merge-stream "^2.0.0" - npm-run-path "^4.0.1" - onetime "^5.1.2" - signal-exit "^3.0.3" - strip-final-newline "^2.0.0" - -exit@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" - integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== - -expect@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/expect/-/expect-28.1.3.tgz#90a7c1a124f1824133dd4533cce2d2bdcb6603ec" - integrity sha512-eEh0xn8HlsuOBxFgIss+2mX85VAS4Qy3OSkjV7rlBWljtA4oWH37glVGyOZSZvErDT/yBywZdPGwCXuTvSG85g== - dependencies: - "@jest/expect-utils" "^28.1.3" - jest-get-type "^28.0.2" - jest-matcher-utils "^28.1.3" - jest-message-util "^28.1.3" - jest-util "^28.1.3" - -express@4.18.2: - version "4.18.2" - resolved "https://registry.yarnpkg.com/express/-/express-4.18.2.tgz#3fabe08296e930c796c19e3c516979386ba9fd59" - integrity sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ== - dependencies: - accepts "~1.3.8" - array-flatten "1.1.1" - body-parser "1.20.1" - content-disposition "0.5.4" - content-type "~1.0.4" - cookie "0.5.0" - cookie-signature "1.0.6" - debug "2.6.9" - depd "2.0.0" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - finalhandler "1.2.0" - fresh "0.5.2" - http-errors "2.0.0" - merge-descriptors "1.0.1" - methods "~1.1.2" - on-finished "2.4.1" - parseurl "~1.3.3" - path-to-regexp "0.1.7" - proxy-addr "~2.0.7" - qs "6.11.0" - range-parser "~1.2.1" - safe-buffer "5.2.1" - send "0.18.0" - serve-static "1.15.0" - setprototypeof "1.2.0" - statuses "2.0.1" - type-is "~1.6.18" - utils-merge "1.0.1" - vary "~1.1.2" - -external-editor@^3.0.3: - version "3.1.0" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" - integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== - dependencies: - chardet "^0.7.0" - iconv-lite "^0.4.24" - tmp "^0.0.33" - -fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" - integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== - -fast-diff@^1.1.2: - version "1.2.0" - resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" - integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== - -fast-glob@^3.2.9: - version "3.2.12" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" - integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== - dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.2" - merge2 "^1.3.0" - micromatch "^4.0.4" - -fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" - integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== - -fast-levenshtein@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" - integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== - -fast-redact@^3.1.1: - version "3.1.2" - resolved "https://registry.yarnpkg.com/fast-redact/-/fast-redact-3.1.2.tgz#d58e69e9084ce9fa4c1a6fa98a3e1ecf5d7839aa" - integrity sha512-+0em+Iya9fKGfEQGcd62Yv6onjBmmhV1uh86XVfOU8VwAe6kaFdQCWI9s0/Nnugx5Vd9tdbZ7e6gE2tR9dzXdw== - -fast-safe-stringify@2.1.1, fast-safe-stringify@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz#c406a83b6e70d9e35ce3b30a81141df30aeba884" - integrity sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA== - -fast-url-parser@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/fast-url-parser/-/fast-url-parser-1.1.3.tgz#f4af3ea9f34d8a271cf58ad2b3759f431f0b318d" - integrity sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ== - dependencies: - punycode "^1.3.2" - -fastq@^1.6.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c" - integrity sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw== - dependencies: - reusify "^1.0.4" - -fb-watchman@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" - integrity sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA== - dependencies: - bser "2.1.1" - -figures@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" - integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== - dependencies: - escape-string-regexp "^1.0.5" - -file-entry-cache@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" - integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== - dependencies: - flat-cache "^3.0.4" - -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== - dependencies: - to-regex-range "^5.0.1" - -finalhandler@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.2.0.tgz#7d23fe5731b207b4640e4fcd00aec1f9207a7b32" - integrity sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg== - dependencies: - debug "2.6.9" - encodeurl "~1.0.2" - escape-html "~1.0.3" - on-finished "2.4.1" - parseurl "~1.3.3" - statuses "2.0.1" - unpipe "~1.0.0" - -find-up@^4.0.0, find-up@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" - integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== - dependencies: - locate-path "^5.0.0" - path-exists "^4.0.0" - -find-up@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" - integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== - dependencies: - locate-path "^6.0.0" - path-exists "^4.0.0" - -flat-cache@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" - integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== - dependencies: - flatted "^3.1.0" - rimraf "^3.0.2" - -flatted@^3.1.0: - version "3.2.7" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" - integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== - -follow-redirects@^1.14.8, follow-redirects@^1.15.0: - version "1.15.2" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" - integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== - -fork-ts-checker-webpack-plugin@7.2.13: - version "7.2.13" - resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-7.2.13.tgz#51ffd6a2f96f03ab64b92f8aedf305dbf3dee0f1" - integrity sha512-fR3WRkOb4bQdWB/y7ssDUlVdrclvwtyCUIHCfivAoYxq9dF7XfrDKbMdZIfwJ7hxIAqkYSGeU7lLJE6xrxIBdg== - dependencies: - "@babel/code-frame" "^7.16.7" - chalk "^4.1.2" - chokidar "^3.5.3" - cosmiconfig "^7.0.1" - deepmerge "^4.2.2" - fs-extra "^10.0.0" - memfs "^3.4.1" - minimatch "^3.0.4" - node-abort-controller "^3.0.1" - schema-utils "^3.1.1" - semver "^7.3.5" - tapable "^2.2.1" - -form-data@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" - integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - -formidable@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/formidable/-/formidable-2.0.1.tgz#4310bc7965d185536f9565184dee74fbb75557ff" - integrity sha512-rjTMNbp2BpfQShhFbR3Ruk3qk2y9jKpvMW78nJgx8QKtxjDVrwbZG+wvDOmVbifHyOUOQJXxqEy6r0faRrPzTQ== - dependencies: - dezalgo "1.0.3" - hexoid "1.0.0" - once "1.4.0" - qs "6.9.3" - -forwarded@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" - integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== - -fresh@0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" - integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== - -fs-extra@10.0.1: - version "10.0.1" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.0.1.tgz#27de43b4320e833f6867cc044bfce29fdf0ef3b8" - integrity sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag== - dependencies: - graceful-fs "^4.2.0" - jsonfile "^6.0.1" - universalify "^2.0.0" - -fs-extra@10.1.0, fs-extra@^10.0.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" - integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ== - dependencies: - graceful-fs "^4.2.0" - jsonfile "^6.0.1" - universalify "^2.0.0" - -fs-monkey@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/fs-monkey/-/fs-monkey-1.0.3.tgz#ae3ac92d53bb328efe0e9a1d9541f6ad8d48e2d3" - integrity sha512-cybjIfiiE+pTWicSCLFHSrXZ6EilF30oh91FDP9S2B051prEa7QWfrVTQm10/dDpswBDXZugPa1Ogu8Yh+HV0Q== - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== - -fsevents@^2.3.2, fsevents@~2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== - -function-bind@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" - integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== - -gensync@^1.0.0-beta.2: - version "1.0.0-beta.2" - resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" - integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== - -get-caller-file@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" - integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== - -get-intrinsic@^1.0.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.3.tgz#063c84329ad93e83893c7f4f243ef63ffa351385" - integrity sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A== - dependencies: - function-bind "^1.1.1" - has "^1.0.3" - has-symbols "^1.0.3" - -get-package-type@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" - integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== - -get-stream@^5.0.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" - integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== - dependencies: - pump "^3.0.0" - -get-stream@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" - integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== - -glob-parent@^5.1.2, glob-parent@~5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" - integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== - dependencies: - is-glob "^4.0.1" - -glob-parent@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" - integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== - dependencies: - is-glob "^4.0.3" - -glob-to-regexp@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" - integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== - -glob@7.1.6: - version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" - integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob@^7.0.0, glob@^7.1.3, glob@^7.1.4, glob@^7.2.0: - version "7.2.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" - integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.1.1" - once "^1.3.0" - path-is-absolute "^1.0.0" - -globals@^11.1.0: - version "11.12.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" - integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== - -globals@^13.15.0: - version "13.17.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.17.0.tgz#902eb1e680a41da93945adbdcb5a9f361ba69bd4" - integrity sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw== - dependencies: - type-fest "^0.20.2" - -globby@^11.1.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" - integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== - dependencies: - array-union "^2.1.0" - dir-glob "^3.0.1" - fast-glob "^3.2.9" - ignore "^5.2.0" - merge2 "^1.4.1" - slash "^3.0.0" - -graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.9: - version "4.2.10" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" - integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== - -grapheme-splitter@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" - integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== - -has-flag@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" - integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== - -has-symbols@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" - integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== - -has@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" - integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== - dependencies: - function-bind "^1.1.1" - -hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" - integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== - dependencies: - inherits "^2.0.3" - minimalistic-assert "^1.0.1" - -hexoid@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/hexoid/-/hexoid-1.0.0.tgz#ad10c6573fb907de23d9ec63a711267d9dc9bc18" - integrity sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g== - -highlight.js@^10.7.1: - version "10.7.3" - resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.7.3.tgz#697272e3991356e40c3cac566a74eef681756531" - integrity sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A== - -hmac-drbg@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" - integrity sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg== - dependencies: - hash.js "^1.0.3" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.1" - -html-escaper@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" - integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== - -http-errors@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" - integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== - dependencies: - depd "2.0.0" - inherits "2.0.4" - setprototypeof "1.2.0" - statuses "2.0.1" - toidentifier "1.0.1" - -human-signals@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" - integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== - -human-signals@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" - integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== - -iconv-lite@0.4.24, iconv-lite@^0.4.24: - version "0.4.24" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" - integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== - dependencies: - safer-buffer ">= 2.1.2 < 3" - -iconv-lite@^0.6.2: - version "0.6.3" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" - integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== - dependencies: - safer-buffer ">= 2.1.2 < 3.0.0" - -ieee754@^1.1.13, ieee754@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" - integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== - -ignore@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" - integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== - -import-fresh@^3.0.0, import-fresh@^3.2.1: - version "3.3.0" - resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" - integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== - dependencies: - parent-module "^1.0.0" - resolve-from "^4.0.0" - -import-local@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" - integrity sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg== - dependencies: - pkg-dir "^4.2.0" - resolve-cwd "^3.0.0" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -inquirer@7.3.3: - version "7.3.3" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.3.3.tgz#04d176b2af04afc157a83fd7c100e98ee0aad003" - integrity sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA== - dependencies: - ansi-escapes "^4.2.1" - chalk "^4.1.0" - cli-cursor "^3.1.0" - cli-width "^3.0.0" - external-editor "^3.0.3" - figures "^3.0.0" - lodash "^4.17.19" - mute-stream "0.0.8" - run-async "^2.4.0" - rxjs "^6.6.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - through "^2.3.6" - -inquirer@8.2.2: - version "8.2.2" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-8.2.2.tgz#1310517a87a0814d25336c78a20b44c3d9b7629d" - integrity sha512-pG7I/si6K/0X7p1qU+rfWnpTE1UIkTONN1wxtzh0d+dHXtT/JG6qBgLxoyHVsQa8cFABxAPh0pD6uUUHiAoaow== - dependencies: - ansi-escapes "^4.2.1" - chalk "^4.1.1" - cli-cursor "^3.1.0" - cli-width "^3.0.0" - external-editor "^3.0.3" - figures "^3.0.0" - lodash "^4.17.21" - mute-stream "0.0.8" - ora "^5.4.1" - run-async "^2.4.0" - rxjs "^7.5.5" - string-width "^4.1.0" - strip-ansi "^6.0.0" - through "^2.3.6" - -inquirer@8.2.4: - version "8.2.4" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-8.2.4.tgz#ddbfe86ca2f67649a67daa6f1051c128f684f0b4" - integrity sha512-nn4F01dxU8VeKfq192IjLsxu0/OmMZ4Lg3xKAns148rCaXP6ntAoEkVYZThWjwON8AlzdZZi6oqnhNbxUG9hVg== - dependencies: - ansi-escapes "^4.2.1" - chalk "^4.1.1" - cli-cursor "^3.1.0" - cli-width "^3.0.0" - external-editor "^3.0.3" - figures "^3.0.0" - lodash "^4.17.21" - mute-stream "0.0.8" - ora "^5.4.1" - run-async "^2.4.0" - rxjs "^7.5.5" - string-width "^4.1.0" - strip-ansi "^6.0.0" - through "^2.3.6" - wrap-ansi "^7.0.0" - -interpret@^1.0.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" - integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== - -ipaddr.js@1.9.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" - integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== - -is-arrayish@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" - integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== - -is-binary-path@~2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" - integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== - dependencies: - binary-extensions "^2.0.0" - -is-core-module@^2.9.0: - version "2.11.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144" - integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw== - dependencies: - has "^1.0.3" - -is-extglob@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== - -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - -is-generator-fn@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" - integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== - -is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" - integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== - dependencies: - is-extglob "^2.1.1" - -is-interactive@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-interactive/-/is-interactive-1.0.0.tgz#cea6e6ae5c870a7b0a0004070b7b587e0252912e" - integrity sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w== - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - -is-path-inside@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" - integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== - -is-stream@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - integrity sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ== - -is-stream@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" - integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== - -is-unicode-supported@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" - integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== - -isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== - -istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz#189e7909d0a39fa5a3dfad5b03f71947770191d3" - integrity sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw== - -istanbul-lib-instrument@^5.0.4, istanbul-lib-instrument@^5.1.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz#d10c8885c2125574e1c231cacadf955675e1ce3d" - integrity sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg== - dependencies: - "@babel/core" "^7.12.3" - "@babel/parser" "^7.14.7" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-coverage "^3.2.0" - semver "^6.3.0" - -istanbul-lib-report@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#7518fe52ea44de372f460a76b5ecda9ffb73d8a6" - integrity sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw== - dependencies: - istanbul-lib-coverage "^3.0.0" - make-dir "^3.0.0" - supports-color "^7.1.0" - -istanbul-lib-source-maps@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" - integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== - dependencies: - debug "^4.1.1" - istanbul-lib-coverage "^3.0.0" - source-map "^0.6.1" - -istanbul-reports@^3.1.3: - version "3.1.5" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.5.tgz#cc9a6ab25cb25659810e4785ed9d9fb742578bae" - integrity sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w== - dependencies: - html-escaper "^2.0.0" - istanbul-lib-report "^3.0.0" - -iterare@1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/iterare/-/iterare-1.2.1.tgz#139c400ff7363690e33abffa33cbba8920f00042" - integrity sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q== - -jest-changed-files@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-28.1.3.tgz#d9aeee6792be3686c47cb988a8eaf82ff4238831" - integrity sha512-esaOfUWJXk2nfZt9SPyC8gA1kNfdKLkQWyzsMlqq8msYSlNKfmZxfRgZn4Cd4MGVUF+7v6dBs0d5TOAKa7iIiA== - dependencies: - execa "^5.0.0" - p-limit "^3.1.0" - -jest-circus@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-28.1.3.tgz#d14bd11cf8ee1a03d69902dc47b6bd4634ee00e4" - integrity sha512-cZ+eS5zc79MBwt+IhQhiEp0OeBddpc1n8MBo1nMB8A7oPMKEO+Sre+wHaLJexQUj9Ya/8NOBY0RESUgYjB6fow== - dependencies: - "@jest/environment" "^28.1.3" - "@jest/expect" "^28.1.3" - "@jest/test-result" "^28.1.3" - "@jest/types" "^28.1.3" - "@types/node" "*" - chalk "^4.0.0" - co "^4.6.0" - dedent "^0.7.0" - is-generator-fn "^2.0.0" - jest-each "^28.1.3" - jest-matcher-utils "^28.1.3" - jest-message-util "^28.1.3" - jest-runtime "^28.1.3" - jest-snapshot "^28.1.3" - jest-util "^28.1.3" - p-limit "^3.1.0" - pretty-format "^28.1.3" - slash "^3.0.0" - stack-utils "^2.0.3" - -jest-cli@^28.1.2: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-28.1.3.tgz#558b33c577d06de55087b8448d373b9f654e46b2" - integrity sha512-roY3kvrv57Azn1yPgdTebPAXvdR2xfezaKKYzVxZ6It/5NCxzJym6tUI5P1zkdWhfUYkxEI9uZWcQdaFLo8mJQ== - dependencies: - "@jest/core" "^28.1.3" - "@jest/test-result" "^28.1.3" - "@jest/types" "^28.1.3" - chalk "^4.0.0" - exit "^0.1.2" - graceful-fs "^4.2.9" - import-local "^3.0.2" - jest-config "^28.1.3" - jest-util "^28.1.3" - jest-validate "^28.1.3" - prompts "^2.0.1" - yargs "^17.3.1" - -jest-config@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-28.1.3.tgz#e315e1f73df3cac31447eed8b8740a477392ec60" - integrity sha512-MG3INjByJ0J4AsNBm7T3hsuxKQqFIiRo/AUqb1q9LRKI5UU6Aar9JHbr9Ivn1TVwfUD9KirRoM/T6u8XlcQPHQ== - dependencies: - "@babel/core" "^7.11.6" - "@jest/test-sequencer" "^28.1.3" - "@jest/types" "^28.1.3" - babel-jest "^28.1.3" - chalk "^4.0.0" - ci-info "^3.2.0" - deepmerge "^4.2.2" - glob "^7.1.3" - graceful-fs "^4.2.9" - jest-circus "^28.1.3" - jest-environment-node "^28.1.3" - jest-get-type "^28.0.2" - jest-regex-util "^28.0.2" - jest-resolve "^28.1.3" - jest-runner "^28.1.3" - jest-util "^28.1.3" - jest-validate "^28.1.3" - micromatch "^4.0.4" - parse-json "^5.2.0" - pretty-format "^28.1.3" - slash "^3.0.0" - strip-json-comments "^3.1.1" - -jest-diff@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-28.1.3.tgz#948a192d86f4e7a64c5264ad4da4877133d8792f" - integrity sha512-8RqP1B/OXzjjTWkqMX67iqgwBVJRgCyKD3L9nq+6ZqJMdvjE8RgHktqZ6jNrkdMT+dJuYNI3rhQpxaz7drJHfw== - dependencies: - chalk "^4.0.0" - diff-sequences "^28.1.1" - jest-get-type "^28.0.2" - pretty-format "^28.1.3" - -jest-docblock@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-28.1.1.tgz#6f515c3bf841516d82ecd57a62eed9204c2f42a8" - integrity sha512-3wayBVNiOYx0cwAbl9rwm5kKFP8yHH3d/fkEaL02NPTkDojPtheGB7HZSFY4wzX+DxyrvhXz0KSCVksmCknCuA== - dependencies: - detect-newline "^3.0.0" - -jest-each@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-28.1.3.tgz#bdd1516edbe2b1f3569cfdad9acd543040028f81" - integrity sha512-arT1z4sg2yABU5uogObVPvSlSMQlDA48owx07BDPAiasW0yYpYHYOo4HHLz9q0BVzDVU4hILFjzJw0So9aCL/g== - dependencies: - "@jest/types" "^28.1.3" - chalk "^4.0.0" - jest-get-type "^28.0.2" - jest-util "^28.1.3" - pretty-format "^28.1.3" - -jest-environment-node@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-28.1.3.tgz#7e74fe40eb645b9d56c0c4b70ca4357faa349be5" - integrity sha512-ugP6XOhEpjAEhGYvp5Xj989ns5cB1K6ZdjBYuS30umT4CQEETaxSiPcZ/E1kFktX4GkrcM4qu07IIlDYX1gp+A== - dependencies: - "@jest/environment" "^28.1.3" - "@jest/fake-timers" "^28.1.3" - "@jest/types" "^28.1.3" - "@types/node" "*" - jest-mock "^28.1.3" - jest-util "^28.1.3" - -jest-get-type@^28.0.2: - version "28.0.2" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-28.0.2.tgz#34622e628e4fdcd793d46db8a242227901fcf203" - integrity sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA== - -jest-haste-map@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-28.1.3.tgz#abd5451129a38d9841049644f34b034308944e2b" - integrity sha512-3S+RQWDXccXDKSWnkHa/dPwt+2qwA8CJzR61w3FoYCvoo3Pn8tvGcysmMF0Bj0EX5RYvAI2EIvC57OmotfdtKA== - dependencies: - "@jest/types" "^28.1.3" - "@types/graceful-fs" "^4.1.3" - "@types/node" "*" - anymatch "^3.0.3" - fb-watchman "^2.0.0" - graceful-fs "^4.2.9" - jest-regex-util "^28.0.2" - jest-util "^28.1.3" - jest-worker "^28.1.3" - micromatch "^4.0.4" - walker "^1.0.8" - optionalDependencies: - fsevents "^2.3.2" - -jest-leak-detector@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-28.1.3.tgz#a6685d9b074be99e3adee816ce84fd30795e654d" - integrity sha512-WFVJhnQsiKtDEo5lG2mM0v40QWnBM+zMdHHyJs8AWZ7J0QZJS59MsyKeJHWhpBZBH32S48FOVvGyOFT1h0DlqA== - dependencies: - jest-get-type "^28.0.2" - pretty-format "^28.1.3" - -jest-matcher-utils@^28.0.0, jest-matcher-utils@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-28.1.3.tgz#5a77f1c129dd5ba3b4d7fc20728806c78893146e" - integrity sha512-kQeJ7qHemKfbzKoGjHHrRKH6atgxMk8Enkk2iPQ3XwO6oE/KYD8lMYOziCkeSB9G4adPM4nR1DE8Tf5JeWH6Bw== - dependencies: - chalk "^4.0.0" - jest-diff "^28.1.3" - jest-get-type "^28.0.2" - pretty-format "^28.1.3" - -jest-message-util@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-28.1.3.tgz#232def7f2e333f1eecc90649b5b94b0055e7c43d" - integrity sha512-PFdn9Iewbt575zKPf1286Ht9EPoJmYT7P0kY+RibeYZ2XtOr53pDLEFoTWXbd1h4JiGiWpTBC84fc8xMXQMb7g== - dependencies: - "@babel/code-frame" "^7.12.13" - "@jest/types" "^28.1.3" - "@types/stack-utils" "^2.0.0" - chalk "^4.0.0" - graceful-fs "^4.2.9" - micromatch "^4.0.4" - pretty-format "^28.1.3" - slash "^3.0.0" - stack-utils "^2.0.3" - -jest-mock@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-28.1.3.tgz#d4e9b1fc838bea595c77ab73672ebf513ab249da" - integrity sha512-o3J2jr6dMMWYVH4Lh/NKmDXdosrsJgi4AviS8oXLujcjpCMBb1FMsblDnOXKZKfSiHLxYub1eS0IHuRXsio9eA== - dependencies: - "@jest/types" "^28.1.3" - "@types/node" "*" - -jest-pnp-resolver@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz#b704ac0ae028a89108a4d040b3f919dfddc8e33c" - integrity sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w== - -jest-regex-util@^28.0.2: - version "28.0.2" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-28.0.2.tgz#afdc377a3b25fb6e80825adcf76c854e5bf47ead" - integrity sha512-4s0IgyNIy0y9FK+cjoVYoxamT7Zeo7MhzqRGx7YDYmaQn1wucY9rotiGkBzzcMXTtjrCAP/f7f+E0F7+fxPNdw== - -jest-resolve-dependencies@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-28.1.3.tgz#8c65d7583460df7275c6ea2791901fa975c1fe66" - integrity sha512-qa0QO2Q0XzQoNPouMbCc7Bvtsem8eQgVPNkwn9LnS+R2n8DaVDPL/U1gngC0LTl1RYXJU0uJa2BMC2DbTfFrHA== - dependencies: - jest-regex-util "^28.0.2" - jest-snapshot "^28.1.3" - -jest-resolve@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-28.1.3.tgz#cfb36100341ddbb061ec781426b3c31eb51aa0a8" - integrity sha512-Z1W3tTjE6QaNI90qo/BJpfnvpxtaFTFw5CDgwpyE/Kz8U/06N1Hjf4ia9quUhCh39qIGWF1ZuxFiBiJQwSEYKQ== - dependencies: - chalk "^4.0.0" - graceful-fs "^4.2.9" - jest-haste-map "^28.1.3" - jest-pnp-resolver "^1.2.2" - jest-util "^28.1.3" - jest-validate "^28.1.3" - resolve "^1.20.0" - resolve.exports "^1.1.0" - slash "^3.0.0" - -jest-runner@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-28.1.3.tgz#5eee25febd730b4713a2cdfd76bdd5557840f9a1" - integrity sha512-GkMw4D/0USd62OVO0oEgjn23TM+YJa2U2Wu5zz9xsQB1MxWKDOlrnykPxnMsN0tnJllfLPinHTka61u0QhaxBA== - dependencies: - "@jest/console" "^28.1.3" - "@jest/environment" "^28.1.3" - "@jest/test-result" "^28.1.3" - "@jest/transform" "^28.1.3" - "@jest/types" "^28.1.3" - "@types/node" "*" - chalk "^4.0.0" - emittery "^0.10.2" - graceful-fs "^4.2.9" - jest-docblock "^28.1.1" - jest-environment-node "^28.1.3" - jest-haste-map "^28.1.3" - jest-leak-detector "^28.1.3" - jest-message-util "^28.1.3" - jest-resolve "^28.1.3" - jest-runtime "^28.1.3" - jest-util "^28.1.3" - jest-watcher "^28.1.3" - jest-worker "^28.1.3" - p-limit "^3.1.0" - source-map-support "0.5.13" - -jest-runtime@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-28.1.3.tgz#a57643458235aa53e8ec7821949e728960d0605f" - integrity sha512-NU+881ScBQQLc1JHG5eJGU7Ui3kLKrmwCPPtYsJtBykixrM2OhVQlpMmFWJjMyDfdkGgBMNjXCGB/ebzsgNGQw== - dependencies: - "@jest/environment" "^28.1.3" - "@jest/fake-timers" "^28.1.3" - "@jest/globals" "^28.1.3" - "@jest/source-map" "^28.1.2" - "@jest/test-result" "^28.1.3" - "@jest/transform" "^28.1.3" - "@jest/types" "^28.1.3" - chalk "^4.0.0" - cjs-module-lexer "^1.0.0" - collect-v8-coverage "^1.0.0" - execa "^5.0.0" - glob "^7.1.3" - graceful-fs "^4.2.9" - jest-haste-map "^28.1.3" - jest-message-util "^28.1.3" - jest-mock "^28.1.3" - jest-regex-util "^28.0.2" - jest-resolve "^28.1.3" - jest-snapshot "^28.1.3" - jest-util "^28.1.3" - slash "^3.0.0" - strip-bom "^4.0.0" - -jest-snapshot@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-28.1.3.tgz#17467b3ab8ddb81e2f605db05583d69388fc0668" - integrity sha512-4lzMgtiNlc3DU/8lZfmqxN3AYD6GGLbl+72rdBpXvcV+whX7mDrREzkPdp2RnmfIiWBg1YbuFSkXduF2JcafJg== - dependencies: - "@babel/core" "^7.11.6" - "@babel/generator" "^7.7.2" - "@babel/plugin-syntax-typescript" "^7.7.2" - "@babel/traverse" "^7.7.2" - "@babel/types" "^7.3.3" - "@jest/expect-utils" "^28.1.3" - "@jest/transform" "^28.1.3" - "@jest/types" "^28.1.3" - "@types/babel__traverse" "^7.0.6" - "@types/prettier" "^2.1.5" - babel-preset-current-node-syntax "^1.0.0" - chalk "^4.0.0" - expect "^28.1.3" - graceful-fs "^4.2.9" - jest-diff "^28.1.3" - jest-get-type "^28.0.2" - jest-haste-map "^28.1.3" - jest-matcher-utils "^28.1.3" - jest-message-util "^28.1.3" - jest-util "^28.1.3" - natural-compare "^1.4.0" - pretty-format "^28.1.3" - semver "^7.3.5" - -jest-util@^28.0.0, jest-util@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-28.1.3.tgz#f4f932aa0074f0679943220ff9cbba7e497028b0" - integrity sha512-XdqfpHwpcSRko/C35uLYFM2emRAltIIKZiJ9eAmhjsj0CqZMa0p1ib0R5fWIqGhn1a103DebTbpqIaP1qCQ6tQ== - dependencies: - "@jest/types" "^28.1.3" - "@types/node" "*" - chalk "^4.0.0" - ci-info "^3.2.0" - graceful-fs "^4.2.9" - picomatch "^2.2.3" - -jest-validate@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-28.1.3.tgz#e322267fd5e7c64cea4629612c357bbda96229df" - integrity sha512-SZbOGBWEsaTxBGCOpsRWlXlvNkvTkY0XxRfh7zYmvd8uL5Qzyg0CHAXiXKROflh801quA6+/DsT4ODDthOC/OA== - dependencies: - "@jest/types" "^28.1.3" - camelcase "^6.2.0" - chalk "^4.0.0" - jest-get-type "^28.0.2" - leven "^3.1.0" - pretty-format "^28.1.3" - -jest-watcher@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-28.1.3.tgz#c6023a59ba2255e3b4c57179fc94164b3e73abd4" - integrity sha512-t4qcqj9hze+jviFPUN3YAtAEeFnr/azITXQEMARf5cMwKY2SMBRnCQTXLixTl20OR6mLh9KLMrgVJgJISym+1g== - dependencies: - "@jest/test-result" "^28.1.3" - "@jest/types" "^28.1.3" - "@types/node" "*" - ansi-escapes "^4.2.1" - chalk "^4.0.0" - emittery "^0.10.2" - jest-util "^28.1.3" - string-length "^4.0.1" - -jest-worker@^27.4.5: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" - integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== - dependencies: - "@types/node" "*" - merge-stream "^2.0.0" - supports-color "^8.0.0" - -jest-worker@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-28.1.3.tgz#7e3c4ce3fa23d1bb6accb169e7f396f98ed4bb98" - integrity sha512-CqRA220YV/6jCo8VWvAt1KKx6eek1VIHMPeLEbpcfSfkEeWyBNppynM/o6q+Wmw+sOhos2ml34wZbSX3G13//g== - dependencies: - "@types/node" "*" - merge-stream "^2.0.0" - supports-color "^8.0.0" - -jest@28.1.2: - version "28.1.2" - resolved "https://registry.yarnpkg.com/jest/-/jest-28.1.2.tgz#451ff24081ce31ca00b07b60c61add13aa96f8eb" - integrity sha512-Tuf05DwLeCh2cfWCQbcz9UxldoDyiR1E9Igaei5khjonKncYdc6LDfynKCEWozK0oLE3GD+xKAo2u8x/0s6GOg== - dependencies: - "@jest/core" "^28.1.2" - "@jest/types" "^28.1.1" - import-local "^3.0.2" - jest-cli "^28.1.2" - -js-sdsl@^4.1.4: - version "4.1.5" - resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.1.5.tgz#1ff1645e6b4d1b028cd3f862db88c9d887f26e2a" - integrity sha512-08bOAKweV2NUC1wqTtf3qZlnpOX/R2DU9ikpjOHs0H+ibQv3zpncVQg6um4uYtRtrwIX8M4Nh3ytK4HGlYAq7Q== - -js-sha3@0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" - integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== - -js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== - -js-yaml@4.1.0, js-yaml@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" - integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== - dependencies: - argparse "^2.0.1" - -js-yaml@^3.13.1: - version "3.14.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" - integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -jsesc@^2.5.1: - version "2.5.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" - integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== - -json-parse-even-better-errors@^2.3.0, json-parse-even-better-errors@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" - integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== - -json-schema-traverse@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" - integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== - -json-schema-traverse@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" - integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== - -json-stable-stringify-without-jsonify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" - integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== - -json5@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" - integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== - -jsonc-parser@3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.1.0.tgz#73b8f0e5c940b83d03476bc2e51a20ef0932615d" - integrity sha512-DRf0QjnNeCUds3xTjKlQQ3DpJD51GvDjJfnxUVWg6PZTo2otSm+slzNAxU/35hF8/oJIKoG9slq30JYOsF2azg== - -jsonc-parser@3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76" - integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w== - -jsonfile@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" - integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== - dependencies: - universalify "^2.0.0" - optionalDependencies: - graceful-fs "^4.1.6" - -kleur@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" - integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== - -leven@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" - integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== - -levn@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" - integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== - dependencies: - prelude-ls "^1.2.1" - type-check "~0.4.0" - -libphonenumber-js@^1.9.43: - version "1.10.14" - resolved "https://registry.yarnpkg.com/libphonenumber-js/-/libphonenumber-js-1.10.14.tgz#e29da7f539751f724ac54017a098e3c7ca23de94" - integrity sha512-McGS7GV/WjJ2KjfOGhJU1oJn29RYeo7Q+RpANRbUNMQ9gj5XArpbjurSuyYPTejFwbaUojstQ4XyWCrAzGOUXw== - -lines-and-columns@^1.1.6: - version "1.2.4" - resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" - integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== - -loader-runner@^4.2.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" - integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg== - -locate-path@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" - integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== - dependencies: - p-locate "^4.1.0" - -locate-path@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" - integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== - dependencies: - p-locate "^5.0.0" - -lodash.memoize@4.x: - version "4.1.2" - resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" - integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== - -lodash.merge@^4.6.2: - version "4.6.2" - resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" - integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== - -lodash@4.17.21, lodash@^4.17.19, lodash@^4.17.21: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== - -log-symbols@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" - integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== - dependencies: - chalk "^4.1.0" - is-unicode-supported "^0.1.0" - -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== - dependencies: - yallist "^4.0.0" - -luxon@^1.23.x: - version "1.28.0" - resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.28.0.tgz#e7f96daad3938c06a62de0fb027115d251251fbf" - integrity sha512-TfTiyvZhwBYM/7QdAVDh+7dBTBA29v4ik0Ce9zda3Mnf8on1S5KJI8P2jKFZ8+5C0jhmr0KwJEO/Wdpm0VeWJQ== - -macos-release@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.5.0.tgz#067c2c88b5f3fb3c56a375b2ec93826220fa1ff2" - integrity sha512-EIgv+QZ9r+814gjJj0Bt5vSLJLzswGmSUbUpbi9AIr/fsN2IWFBl2NucV9PAiek+U1STK468tEkxmVYUtuAN3g== - -magic-string@0.26.2: - version "0.26.2" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.26.2.tgz#5331700e4158cd6befda738bb6b0c7b93c0d4432" - integrity sha512-NzzlXpclt5zAbmo6h6jNc8zl2gNRGHvmsZW4IvZhTC4W7k4OlLP+S5YLussa/r3ixNT66KOQfNORlXHSOy/X4A== - dependencies: - sourcemap-codec "^1.4.8" - -make-dir@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" - integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== - dependencies: - semver "^6.0.0" - -make-error@1.x, make-error@^1.1.1: - version "1.3.6" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" - integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== - -makeerror@1.0.12: - version "1.0.12" - resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a" - integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg== - dependencies: - tmpl "1.0.5" - -media-typer@0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" - integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== - -memfs@^3.4.1: - version "3.4.7" - resolved "https://registry.yarnpkg.com/memfs/-/memfs-3.4.7.tgz#e5252ad2242a724f938cb937e3c4f7ceb1f70e5a" - integrity sha512-ygaiUSNalBX85388uskeCyhSAoOSgzBbtVCr9jA2RROssFL9Q19/ZXFqS+2Th2sr1ewNIWgFdLzLC3Yl1Zv+lw== - dependencies: - fs-monkey "^1.0.3" - -merge-descriptors@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" - integrity sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w== - -merge-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" - integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== - -merge2@^1.3.0, merge2@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" - integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== - -methods@^1.1.2, methods@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" - integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== - -micromatch@^4.0.0, micromatch@^4.0.4: - version "4.0.5" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" - integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== - dependencies: - braces "^3.0.2" - picomatch "^2.3.1" - -mime-db@1.52.0: - version "1.52.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" - integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== - -mime-types@^2.1.12, mime-types@^2.1.27, mime-types@~2.1.24, mime-types@~2.1.34: - version "2.1.35" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" - integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== - dependencies: - mime-db "1.52.0" - -mime@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" - integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== - -mime@2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-2.6.0.tgz#a2a682a95cd4d0cb1d6257e28f83da7e35800367" - integrity sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg== - -mimic-fn@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== - -minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" - integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== - -minimalistic-crypto-utils@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" - integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== - -minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== - dependencies: - brace-expansion "^1.1.7" - -minimist@^1.2.6: - version "1.2.7" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18" - integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g== - -mkdirp@^0.5.4: - version "0.5.6" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" - integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== - dependencies: - minimist "^1.2.6" - -mkdirp@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" - integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== - -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -ms@2.1.3: - version "2.1.3" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - -multer@1.4.4-lts.1: - version "1.4.4-lts.1" - resolved "https://registry.yarnpkg.com/multer/-/multer-1.4.4-lts.1.tgz#24100f701a4611211cfae94ae16ea39bb314e04d" - integrity sha512-WeSGziVj6+Z2/MwQo3GvqzgR+9Uc+qt8SwHKh3gvNPiISKfsMfG4SvCOFYlxxgkXt7yIV2i1yczehm0EOKIxIg== - dependencies: - append-field "^1.0.0" - busboy "^1.0.0" - concat-stream "^1.5.2" - mkdirp "^0.5.4" - object-assign "^4.1.1" - type-is "^1.6.4" - xtend "^4.0.0" - -mute-stream@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" - integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== - -mz@^2.4.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" - integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== - dependencies: - any-promise "^1.0.0" - object-assign "^4.0.1" - thenify-all "^1.0.0" - -natural-compare@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== - -negotiator@0.6.3: - version "0.6.3" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" - integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== - -neo-async@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" - integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== - -nestjs-ethers@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/nestjs-ethers/-/nestjs-ethers-1.0.3.tgz#53eb72bd2d227e6890266fc42fe3ee66837e4ae8" - integrity sha512-/fHlSjcfPKDdFNHsWbtV0piNq8B1qA0AUm0aAOlijD3nieOfANNbdO+qmenR63+ILhigogri3OyvCZ2TLW344g== - dependencies: - "@ethers-ancillary/bsc" "0.0.3" - ethers "^5.6.9" - -nestjs-pino@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/nestjs-pino/-/nestjs-pino-3.1.1.tgz#ae313d387ae879be511b8af006f905976467f3bc" - integrity sha512-T7ajfqYTSHKrirzrElQJ3EWO/OZF5fFFkgaRvD+I7F5YY2hU3X295E/CnTkgpHZozL0s/3Ud4OtTZlT3NisTBw== - -nestjs-typeorm-paginate@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/nestjs-typeorm-paginate/-/nestjs-typeorm-paginate-4.0.2.tgz#8c4bb25d801574210832db0c8292318e5b9beee7" - integrity sha512-9rUXFy3A2BKeWkGwP2aDB4KNQrJsTSNzmVyMW+N07tWhzqcrRiEaJNDxmfT/eiN53A/AVHQTeTucJ/f5iqYZPQ== - -node-abort-controller@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/node-abort-controller/-/node-abort-controller-3.0.1.tgz#f91fa50b1dee3f909afabb7e261b1e1d6b0cb74e" - integrity sha512-/ujIVxthRs+7q6hsdjHMaj8hRG9NuWmwrz+JdRwZ14jdFoKSkm+vDsCbF9PLpnSqjaWQJuTmVtcWHNLr+vrOFw== - -node-emoji@1.11.0: - version "1.11.0" - resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.11.0.tgz#69a0150e6946e2f115e9d7ea4df7971e2628301c" - integrity sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A== - dependencies: - lodash "^4.17.21" - -node-fetch@^1.0.1: - version "1.7.3" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" - integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ== - dependencies: - encoding "^0.1.11" - is-stream "^1.0.1" - -node-fetch@^2.6.1: - version "2.6.7" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" - integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== - dependencies: - whatwg-url "^5.0.0" - -node-int64@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" - integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== - -node-releases@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.6.tgz#8a7088c63a55e493845683ebf3c828d8c51c5503" - integrity sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg== - -normalize-path@^3.0.0, normalize-path@~3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== - -npm-run-path@^4.0.0, npm-run-path@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" - integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== - dependencies: - path-key "^3.0.0" - -object-assign@^4, object-assign@^4.0.1, object-assign@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== - -object-hash@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9" - integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw== - -object-inspect@^1.9.0: - version "1.12.2" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea" - integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ== - -on-exit-leak-free@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/on-exit-leak-free/-/on-exit-leak-free-2.1.0.tgz#5c703c968f7e7f851885f6459bf8a8a57edc9cc4" - integrity sha512-VuCaZZAjReZ3vUwgOB8LxAosIurDiAW0s13rI1YwmaP++jvcxP77AWoQvenZebpCA2m8WC1/EosPYPMjnRAp/w== - -on-finished@2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" - integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== - dependencies: - ee-first "1.1.1" - -once@1.4.0, once@^1.3.0, once@^1.3.1, once@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== - dependencies: - wrappy "1" - -onetime@^5.1.0, onetime@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" - integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== - dependencies: - mimic-fn "^2.1.0" - -optionator@^0.9.1: - version "0.9.1" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" - integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== - dependencies: - deep-is "^0.1.3" - fast-levenshtein "^2.0.6" - levn "^0.4.1" - prelude-ls "^1.2.1" - type-check "^0.4.0" - word-wrap "^1.2.3" - -ora@5.4.1, ora@^5.4.1: - version "5.4.1" - resolved "https://registry.yarnpkg.com/ora/-/ora-5.4.1.tgz#1b2678426af4ac4a509008e5e4ac9e9959db9e18" - integrity sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ== - dependencies: - bl "^4.1.0" - chalk "^4.1.0" - cli-cursor "^3.1.0" - cli-spinners "^2.5.0" - is-interactive "^1.0.0" - is-unicode-supported "^0.1.0" - log-symbols "^4.1.0" - strip-ansi "^6.0.0" - wcwidth "^1.0.1" - -os-name@4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/os-name/-/os-name-4.0.1.tgz#32cee7823de85a8897647ba4d76db46bf845e555" - integrity sha512-xl9MAoU97MH1Xt5K9ERft2YfCAoaO6msy1OBA0ozxEC0x0TmIoE6K3QvgJMMZA9yKGLmHXNY/YZoDbiGDj4zYw== - dependencies: - macos-release "^2.5.0" - windows-release "^4.0.0" - -os-tmpdir@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - integrity sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g== - -p-limit@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" - integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== - dependencies: - p-try "^2.0.0" - -p-limit@^3.0.2, p-limit@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" - integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== - dependencies: - yocto-queue "^0.1.0" - -p-locate@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" - integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== - dependencies: - p-limit "^2.2.0" - -p-locate@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" - integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== - dependencies: - p-limit "^3.0.2" - -p-try@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" - integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== - -packet-reader@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/packet-reader/-/packet-reader-1.0.0.tgz#9238e5480dedabacfe1fe3f2771063f164157d74" - integrity sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ== - -parent-module@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" - integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== - dependencies: - callsites "^3.0.0" - -parse-json@^5.0.0, parse-json@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" - integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== - dependencies: - "@babel/code-frame" "^7.0.0" - error-ex "^1.3.1" - json-parse-even-better-errors "^2.3.0" - lines-and-columns "^1.1.6" - -parse5-htmlparser2-tree-adapter@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz#2cdf9ad823321140370d4dbf5d3e92c7c8ddc6e6" - integrity sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA== - dependencies: - parse5 "^6.0.1" - -parse5@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.1.tgz#f68e4e5ba1852ac2cadc00f4555fff6c2abb6178" - integrity sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug== - -parse5@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" - integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== - -parseurl@~1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" - integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== - -path-exists@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" - integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== - -path-key@^3.0.0, path-key@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" - integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== - -path-parse@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" - integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== - -path-to-regexp@0.1.7: - version "0.1.7" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" - integrity sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ== - -path-to-regexp@3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-3.2.0.tgz#fa7877ecbc495c601907562222453c43cc204a5f" - integrity sha512-jczvQbCUS7XmS7o+y1aEO9OBVFeZBQ1MDSEqmO7xSoPgOPoowY/SxLpZ6Vh97/8qHZOteiCKb7gkG9gA2ZUxJA== - -path-type@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" - integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== - -pg-connection-string@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.5.0.tgz#538cadd0f7e603fc09a12590f3b8a452c2c0cf34" - integrity sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ== - -pg-int8@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/pg-int8/-/pg-int8-1.0.1.tgz#943bd463bf5b71b4170115f80f8efc9a0c0eb78c" - integrity sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw== - -pg-pool@^3.5.2: - version "3.5.2" - resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.5.2.tgz#ed1bed1fb8d79f1c6fd5fb1c99e990fbf9ddf178" - integrity sha512-His3Fh17Z4eg7oANLob6ZvH8xIVen3phEZh2QuyrIl4dQSDVEabNducv6ysROKpDNPSD+12tONZVWfSgMvDD9w== - -pg-protocol@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/pg-protocol/-/pg-protocol-1.5.0.tgz#b5dd452257314565e2d54ab3c132adc46565a6a0" - integrity sha512-muRttij7H8TqRNu/DxrAJQITO4Ac7RmX3Klyr/9mJEOBeIpgnF8f9jAfRz5d3XwQZl5qBjF9gLsUtMPJE0vezQ== - -pg-types@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/pg-types/-/pg-types-2.2.0.tgz#2d0250d636454f7cfa3b6ae0382fdfa8063254a3" - integrity sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA== - dependencies: - pg-int8 "1.0.1" - postgres-array "~2.0.0" - postgres-bytea "~1.0.0" - postgres-date "~1.0.4" - postgres-interval "^1.1.0" - -pg@^8.8.0: - version "8.8.0" - resolved "https://registry.yarnpkg.com/pg/-/pg-8.8.0.tgz#a77f41f9d9ede7009abfca54667c775a240da686" - integrity sha512-UXYN0ziKj+AeNNP7VDMwrehpACThH7LUl/p8TDFpEUuSejCUIwGSfxpHsPvtM6/WXFy6SU4E5RG4IJV/TZAGjw== - dependencies: - buffer-writer "2.0.0" - packet-reader "1.0.0" - pg-connection-string "^2.5.0" - pg-pool "^3.5.2" - pg-protocol "^1.5.0" - pg-types "^2.1.0" - pgpass "1.x" - -pgpass@1.x: - version "1.0.5" - resolved "https://registry.yarnpkg.com/pgpass/-/pgpass-1.0.5.tgz#9b873e4a564bb10fa7a7dbd55312728d422a223d" - integrity sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug== - dependencies: - split2 "^4.1.0" - -picocolors@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" - integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== - -picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== - -pino-abstract-transport@v1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/pino-abstract-transport/-/pino-abstract-transport-1.0.0.tgz#cc0d6955fffcadb91b7b49ef220a6cc111d48bb3" - integrity sha512-c7vo5OpW4wIS42hUVcT5REsL8ZljsUfBjqV/e2sFxmFEFZiq1XLUp5EYLtuDH6PEHq9W1egWqRbnLUP5FuZmOA== - dependencies: - readable-stream "^4.0.0" - split2 "^4.0.0" - -pino-http@^8.2.0: - version "8.2.1" - resolved "https://registry.yarnpkg.com/pino-http/-/pino-http-8.2.1.tgz#24df377d7681a9c57318f6ecc4ac7c09327f1c8e" - integrity sha512-bdWAE4HYfFjDhKw2/N7BLNSIFAs+WDLZnetsGRpBdNEKq7/RoZUgblLS5OlMY257RPQml6J5QiiLkwxbstzWbA== - dependencies: - fast-url-parser "^1.1.3" - get-caller-file "^2.0.5" - pino "^8.0.0" - pino-std-serializers "^6.0.0" - process-warning "^2.0.0" - -pino-std-serializers@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-6.0.0.tgz#4c20928a1bafca122fdc2a7a4a171ca1c5f9c526" - integrity sha512-mMMOwSKrmyl+Y12Ri2xhH1lbzQxwwpuru9VjyJpgFIH4asSj88F2csdMwN6+M5g1Ll4rmsYghHLQJw81tgZ7LQ== - -pino@^8.0.0: - version "8.7.0" - resolved "https://registry.yarnpkg.com/pino/-/pino-8.7.0.tgz#58621608a3d8540ae643cdd9194cdd94130c78d9" - integrity sha512-l9sA5uPxmZzwydhMWUcm1gI0YxNnYl8MfSr2h8cwLvOAzQLBLewzF247h/vqHe3/tt6fgtXeG9wdjjoetdI/vA== - dependencies: - atomic-sleep "^1.0.0" - fast-redact "^3.1.1" - on-exit-leak-free "^2.1.0" - pino-abstract-transport v1.0.0 - pino-std-serializers "^6.0.0" - process-warning "^2.0.0" - quick-format-unescaped "^4.0.3" - real-require "^0.2.0" - safe-stable-stringify "^2.3.1" - sonic-boom "^3.1.0" - thread-stream "^2.0.0" - -pirates@^4.0.4: - version "4.0.5" - resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.5.tgz#feec352ea5c3268fb23a37c702ab1699f35a5f3b" - integrity sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ== - -pkg-dir@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" - integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== - dependencies: - find-up "^4.0.0" - -pluralize@8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1" - integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== - -portable-fetch@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/portable-fetch/-/portable-fetch-3.0.0.tgz#3cbf4aa6dbc5a5734b41c0419c9273313bfd9ad8" - integrity sha512-2Gl204JKeJSFH3sIboK4iMPPaZI223xfBMHfQMcULTwySt2skWEd5OnYhtciPtHoxGzyaNLkGCalNfivCKxhQQ== - dependencies: - node-fetch "^1.0.1" - whatwg-fetch ">=0.10.0" - -postgres-array@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/postgres-array/-/postgres-array-2.0.0.tgz#48f8fce054fbc69671999329b8834b772652d82e" - integrity sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA== - -postgres-bytea@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/postgres-bytea/-/postgres-bytea-1.0.0.tgz#027b533c0aa890e26d172d47cf9ccecc521acd35" - integrity sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w== - -postgres-date@~1.0.4: - version "1.0.7" - resolved "https://registry.yarnpkg.com/postgres-date/-/postgres-date-1.0.7.tgz#51bc086006005e5061c591cee727f2531bf641a8" - integrity sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q== - -postgres-interval@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/postgres-interval/-/postgres-interval-1.2.0.tgz#b460c82cb1587507788819a06aa0fffdb3544695" - integrity sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ== - dependencies: - xtend "^4.0.0" - -prelude-ls@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" - integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== - -prettier-linter-helpers@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" - integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== - dependencies: - fast-diff "^1.1.2" - -prettier@^2.3.2: - version "2.7.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" - integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== - -pretty-format@^28.0.0, pretty-format@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-28.1.3.tgz#c9fba8cedf99ce50963a11b27d982a9ae90970d5" - integrity sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q== - dependencies: - "@jest/schemas" "^28.1.3" - ansi-regex "^5.0.1" - ansi-styles "^5.0.0" - react-is "^18.0.0" - -process-nextick-args@~2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" - integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== - -process-warning@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/process-warning/-/process-warning-2.0.0.tgz#341dbeaac985b90a04ebcd844d50097c7737b2ee" - integrity sha512-+MmoAXoUX+VTHAlwns0h+kFUWFs/3FZy+ZuchkgjyOu3oioLAo2LB5aCfKPh2+P9O18i3m43tUEv3YqttSy0Ww== - -process@^0.11.10: - version "0.11.10" - resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" - integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== - -prompts@^2.0.1: - version "2.4.2" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" - integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== - dependencies: - kleur "^3.0.3" - sisteransi "^1.0.5" - -proxy-addr@~2.0.7: - version "2.0.7" - resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" - integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg== - dependencies: - forwarded "0.2.0" - ipaddr.js "1.9.1" - -proxy-from-env@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" - integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== - -pump@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" - integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== - dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" - -punycode@^1.3.2: - version "1.4.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" - integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== - -punycode@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== - -qs@6.11.0, qs@^6.11.0: - version "6.11.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" - integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== - dependencies: - side-channel "^1.0.4" - -qs@6.9.3: - version "6.9.3" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.3.tgz#bfadcd296c2d549f1dffa560619132c977f5008e" - integrity sha512-EbZYNarm6138UKKq46tdx08Yo/q9ZhFoAXAI1meAFd2GtbRDhbZY2WQSICskT0c5q99aFzLG1D4nvTk9tqfXIw== - -queue-microtask@^1.2.2: - version "1.2.3" - resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" - integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== - -quick-format-unescaped@^4.0.3: - version "4.0.4" - resolved "https://registry.yarnpkg.com/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz#93ef6dd8d3453cbc7970dd614fad4c5954d6b5a7" - integrity sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg== - -randombytes@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" - integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== - dependencies: - safe-buffer "^5.1.0" - -range-parser@~1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" - integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== - -raw-body@2.5.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857" - integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig== - dependencies: - bytes "3.1.2" - http-errors "2.0.0" - iconv-lite "0.4.24" - unpipe "1.0.0" - -react-is@^18.0.0: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" - integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== - -readable-stream@^2.2.2: - version "2.3.7" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" - integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -readable-stream@^3.4.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - -readable-stream@^4.0.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-4.2.0.tgz#a7ef523d3b39e4962b0db1a1af22777b10eeca46" - integrity sha512-gJrBHsaI3lgBoGMW/jHZsQ/o/TIWiu5ENCJG1BB7fuCKzpFM8GaS2UoBVt9NO+oI+3FcrBNbUkl3ilDe09aY4A== - dependencies: - abort-controller "^3.0.0" - buffer "^6.0.3" - events "^3.3.0" - process "^0.11.10" - -readdirp@~3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" - integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== - dependencies: - picomatch "^2.2.1" - -real-require@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/real-require/-/real-require-0.2.0.tgz#209632dea1810be2ae063a6ac084fee7e33fba78" - integrity sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg== - -rechoir@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" - integrity sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw== - dependencies: - resolve "^1.1.6" - -reflect-metadata@0.1.13, reflect-metadata@^0.1.13: - version "0.1.13" - resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08" - integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg== - -regexpp@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" - integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== - -require-from-string@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" - integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== - -resolve-cwd@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" - integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== - dependencies: - resolve-from "^5.0.0" - -resolve-from@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" - integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== - -resolve-from@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" - integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== - -resolve.exports@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-1.1.0.tgz#5ce842b94b05146c0e03076985d1d0e7e48c90c9" - integrity sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ== - -resolve@^1.1.6, resolve@^1.20.0: - version "1.22.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" - integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== - dependencies: - is-core-module "^2.9.0" - path-parse "^1.0.7" - supports-preserve-symlinks-flag "^1.0.0" - -restore-cursor@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" - integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== - dependencies: - onetime "^5.1.0" - signal-exit "^3.0.2" - -reusify@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" - integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== - -rimraf@3.0.2, rimraf@^3.0.0, rimraf@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" - integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== - dependencies: - glob "^7.1.3" - -run-async@^2.4.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" - integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== - -run-parallel@^1.1.9: - version "1.2.0" - resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" - integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== - dependencies: - queue-microtask "^1.2.2" - -rxjs@6.6.7, rxjs@^6.6.0, rxjs@^6.6.3: - version "6.6.7" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" - integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== - dependencies: - tslib "^1.9.0" - -rxjs@7.5.5: - version "7.5.5" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.5.tgz#2ebad89af0f560f460ad5cc4213219e1f7dd4e9f" - integrity sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw== - dependencies: - tslib "^2.1.0" - -rxjs@^7.2.0, rxjs@^7.5.5: - version "7.5.7" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.7.tgz#2ec0d57fdc89ece220d2e702730ae8f1e49def39" - integrity sha512-z9MzKh/UcOqB3i20H6rtrlaE/CgjLOvheWK/9ILrbhROGTweAi1BaFsTT9FbwZi5Trr1qNRs+MXkhmR06awzQA== - dependencies: - tslib "^2.1.0" - -safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@~5.2.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - -safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - -safe-stable-stringify@^2.3.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.1.tgz#34694bd8a30575b7f94792aa51527551bd733d61" - integrity sha512-dVHE6bMtS/bnL2mwualjc6IxEv1F+OCUpA46pKUj6F8uDbUM0jCCulPqRNPSnWwGNKx5etqMjZYdXtrm5KJZGA== - -"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - -sax@>=0.6.0: - version "1.2.4" - resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" - integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== - -schema-utils@^3.1.0, schema-utils@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.1.1.tgz#bc74c4b6b6995c1d88f76a8b77bea7219e0c8281" - integrity sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw== - dependencies: - "@types/json-schema" "^7.0.8" - ajv "^6.12.5" - ajv-keywords "^3.5.2" - -scrypt-js@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" - integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== - -semver@7.x, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8: - version "7.3.8" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" - integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== - dependencies: - lru-cache "^6.0.0" - -semver@^6.0.0, semver@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" - integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== - -send@0.18.0: - version "0.18.0" - resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" - integrity sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg== - dependencies: - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - fresh "0.5.2" - http-errors "2.0.0" - mime "1.6.0" - ms "2.1.3" - on-finished "2.4.1" - range-parser "~1.2.1" - statuses "2.0.1" - -serialize-javascript@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" - integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== - dependencies: - randombytes "^2.1.0" - -serve-static@1.15.0: - version "1.15.0" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.15.0.tgz#faaef08cffe0a1a62f60cad0c4e513cff0ac9540" - integrity sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g== - dependencies: - encodeurl "~1.0.2" - escape-html "~1.0.3" - parseurl "~1.3.3" - send "0.18.0" - -setprototypeof@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" - integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== - -sha.js@^2.4.11: - version "2.4.11" - resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" - integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -shebang-command@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" - integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== - dependencies: - shebang-regex "^3.0.0" - -shebang-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" - integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== - -shelljs@0.8.5: - version "0.8.5" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c" - integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow== - dependencies: - glob "^7.0.0" - interpret "^1.0.0" - rechoir "^0.6.2" - -side-channel@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" - integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== - dependencies: - call-bind "^1.0.0" - get-intrinsic "^1.0.2" - object-inspect "^1.9.0" - -signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: - version "3.0.7" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" - integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== - -sisteransi@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" - integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== - -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" - integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== - -sonic-boom@^3.1.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-3.2.0.tgz#ce9f2de7557e68be2e52c8df6d9b052e7d348143" - integrity sha512-SbbZ+Kqj/XIunvIAgUZRlqd6CGQYq71tRRbXR92Za8J/R3Yh4Av+TWENiSiEgnlwckYLyP0YZQWVfyNC0dzLaA== - dependencies: - atomic-sleep "^1.0.0" - -source-map-support@0.5.13: - version "0.5.13" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" - integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map-support@0.5.21, source-map-support@^0.5.20, source-map-support@~0.5.20: - version "0.5.21" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" - integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map@0.7.4: - version "0.7.4" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" - integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== - -source-map@^0.6.0, source-map@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - -sourcemap-codec@^1.4.8: - version "1.4.8" - resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" - integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== - -spawn-command@^0.0.2-1: - version "0.0.2-1" - resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0" - integrity sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg== - -split2@^4.0.0, split2@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/split2/-/split2-4.1.0.tgz#101907a24370f85bb782f08adaabe4e281ecf809" - integrity sha512-VBiJxFkxiXRlUIeyMQi8s4hgvKCSjtknJv/LVYbrgALPwf5zSKmEwV9Lst25AkvMDnvxODugjdl6KZgwKM1WYQ== - -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== - -stack-utils@^2.0.3: - version "2.0.5" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.5.tgz#d25265fca995154659dbbfba3b49254778d2fdd5" - integrity sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA== - dependencies: - escape-string-regexp "^2.0.0" - -statuses@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" - integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== - -streamsearch@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764" - integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== - -string-length@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" - integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== - dependencies: - char-regex "^1.0.2" - strip-ansi "^6.0.0" - -string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-bom@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" - integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA== - -strip-bom@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" - integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== - -strip-final-newline@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" - integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== - -strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" - integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== - -superagent@^8.0.3: - version "8.0.3" - resolved "https://registry.yarnpkg.com/superagent/-/superagent-8.0.3.tgz#15c8ec5611a1f01386994cfeeda5aa138bcb7b17" - integrity sha512-oBC+aNsCjzzjmO5AOPBPFS+Z7HPzlx+DQr/aHwM08kI+R24gsDmAS1LMfza1fK+P+SKlTAoNZpOvooE/pRO1HA== - dependencies: - component-emitter "^1.3.0" - cookiejar "^2.1.3" - debug "^4.3.4" - fast-safe-stringify "^2.1.1" - form-data "^4.0.0" - formidable "^2.0.1" - methods "^1.1.2" - mime "2.6.0" - qs "^6.11.0" - semver "^7.3.8" - -supertest@^6.1.3: - version "6.3.1" - resolved "https://registry.yarnpkg.com/supertest/-/supertest-6.3.1.tgz#a8ad362fc6f323c88730ac191ce30427dc869088" - integrity sha512-hRohNeIfk/cA48Cxpa/w48hktP6ZaRqXb0QV5rLvW0C7paRsBU3Q5zydzYrslOJtj/gd48qx540jKtcs6vG1fQ== - dependencies: - methods "^1.1.2" - superagent "^8.0.3" - -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - -supports-color@^7.0.0, supports-color@^7.1.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" - integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - dependencies: - has-flag "^4.0.0" - -supports-color@^8.0.0, supports-color@^8.1.0: - version "8.1.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" - integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== - dependencies: - has-flag "^4.0.0" - -supports-hyperlinks@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz#3943544347c1ff90b15effb03fc14ae45ec10624" - integrity sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA== - dependencies: - has-flag "^4.0.0" - supports-color "^7.0.0" - -supports-preserve-symlinks-flag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" - integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== - -swagger-ui-dist@4.15.1: - version "4.15.1" - resolved "https://registry.yarnpkg.com/swagger-ui-dist/-/swagger-ui-dist-4.15.1.tgz#79952306cfb0d18cc05b10dff4c9896193f673c9" - integrity sha512-DlZARu6ckUFqDe0j5IPayO4k0gQvYQw9Un02MhxAgaMtVnTH2vmyyDe+yKeV0r1LiiPx3JbasdS/5Yyb/AV3iw== - -symbol-observable@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-4.0.0.tgz#5b425f192279e87f2f9b937ac8540d1984b39205" - integrity sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ== - -tapable@^2.1.1, tapable@^2.2.0, tapable@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" - integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== - -terminal-link@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/terminal-link/-/terminal-link-2.1.1.tgz#14a64a27ab3c0df933ea546fba55f2d078edc994" - integrity sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ== - dependencies: - ansi-escapes "^4.2.1" - supports-hyperlinks "^2.0.0" - -terser-webpack-plugin@^5.1.3: - version "5.3.6" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.6.tgz#5590aec31aa3c6f771ce1b1acca60639eab3195c" - integrity sha512-kfLFk+PoLUQIbLmB1+PZDMRSZS99Mp+/MHqDNmMA6tOItzRt+Npe3E+fsMs5mfcM0wCtrrdU387UnV+vnSffXQ== - dependencies: - "@jridgewell/trace-mapping" "^0.3.14" - jest-worker "^27.4.5" - schema-utils "^3.1.1" - serialize-javascript "^6.0.0" - terser "^5.14.1" - -terser@^5.14.1: - version "5.15.1" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.15.1.tgz#8561af6e0fd6d839669c73b92bdd5777d870ed6c" - integrity sha512-K1faMUvpm/FBxjBXud0LWVAGxmvoPbZbfTCYbSgaaYQaIXI3/TdI7a7ZGA73Zrou6Q8Zmz3oeUTsp/dj+ag2Xw== - dependencies: - "@jridgewell/source-map" "^0.3.2" - acorn "^8.5.0" - commander "^2.20.0" - source-map-support "~0.5.20" - -test-exclude@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" - integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== - dependencies: - "@istanbuljs/schema" "^0.1.2" - glob "^7.1.4" - minimatch "^3.0.4" - -text-table@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" - integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== - -thenify-all@^1.0.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" - integrity sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA== - dependencies: - thenify ">= 3.1.0 < 4" - -"thenify@>= 3.1.0 < 4": - version "3.3.1" - resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f" - integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== - dependencies: - any-promise "^1.0.0" - -thread-stream@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/thread-stream/-/thread-stream-2.2.0.tgz#310c03a253f729094ce5d4638ef5186dfa80a9e8" - integrity sha512-rUkv4/fnb4rqy/gGy7VuqK6wE1+1DOCOWy4RMeaV69ZHMP11tQKZvZSip1yTgrKCMZzEMcCL/bKfHvSfDHx+iQ== - dependencies: - real-require "^0.2.0" - -through@^2.3.6: - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== - -tmp@^0.0.33: - version "0.0.33" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" - integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== - dependencies: - os-tmpdir "~1.0.2" - -tmpl@1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" - integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== - -to-fast-properties@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" - integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" - -toidentifier@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" - integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== - -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== - -tree-kill@1.2.2, tree-kill@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc" - integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== - -ts-jest@28.0.5: - version "28.0.5" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-28.0.5.tgz#31776f768fba6dfc8c061d488840ed0c8eeac8b9" - integrity sha512-Sx9FyP9pCY7pUzQpy4FgRZf2bhHY3za576HMKJFs+OnQ9jS96Du5vNsDKkyedQkik+sEabbKAnCliv9BEsHZgQ== - dependencies: - bs-logger "0.x" - fast-json-stable-stringify "2.x" - jest-util "^28.0.0" - json5 "^2.2.1" - lodash.memoize "4.x" - make-error "1.x" - semver "7.x" - yargs-parser "^21.0.1" - -ts-loader@^9.2.3: - version "9.4.1" - resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-9.4.1.tgz#b6f3d82db0eac5a8295994f8cb5e4940ff6b1060" - integrity sha512-384TYAqGs70rn9F0VBnh6BPTfhga7yFNdC5gXbQpDrBj9/KsT4iRkGqKXhziofHOlE2j6YEaiTYVGKKvPhGWvw== - dependencies: - chalk "^4.1.0" - enhanced-resolve "^5.0.0" - micromatch "^4.0.0" - semver "^7.3.4" - -ts-node@^10.0.0: - version "10.9.1" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" - integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== - dependencies: - "@cspotcode/source-map-support" "^0.8.0" - "@tsconfig/node10" "^1.0.7" - "@tsconfig/node12" "^1.0.7" - "@tsconfig/node14" "^1.0.0" - "@tsconfig/node16" "^1.0.2" - acorn "^8.4.1" - acorn-walk "^8.1.1" - arg "^4.1.0" - create-require "^1.1.0" - diff "^4.0.1" - make-error "^1.1.1" - v8-compile-cache-lib "^3.0.1" - yn "3.1.1" - -tsconfig-paths-webpack-plugin@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/tsconfig-paths-webpack-plugin/-/tsconfig-paths-webpack-plugin-4.0.0.tgz#84008fc3e3e0658fdb0262758b07b4da6265ff1a" - integrity sha512-fw/7265mIWukrSHd0i+wSwx64kYUSAKPfxRDksjKIYTxSAp9W9/xcZVBF4Kl0eqQd5eBpAQ/oQrc5RyM/0c1GQ== - dependencies: - chalk "^4.1.0" - enhanced-resolve "^5.7.0" - tsconfig-paths "^4.0.0" - -tsconfig-paths@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-4.0.0.tgz#1082f5d99fd127b72397eef4809e4dd06d229b64" - integrity sha512-SLBg2GBKlR6bVtMgJJlud/o3waplKtL7skmLkExomIiaAtLGtVsoXIqP3SYdjbcH9lq/KVv7pMZeCBpLYOit6Q== - dependencies: - json5 "^2.2.1" - minimist "^1.2.6" - strip-bom "^3.0.0" - -tsconfig-paths@4.1.0, tsconfig-paths@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-4.1.0.tgz#f8ef7d467f08ae3a695335bf1ece088c5538d2c1" - integrity sha512-AHx4Euop/dXFC+Vx589alFba8QItjF+8hf8LtmuiCwHyI4rHXQtOOENaM8kvYf5fR0dRChy3wzWIZ9WbB7FWow== - dependencies: - json5 "^2.2.1" - minimist "^1.2.6" - strip-bom "^3.0.0" - -tslib@2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.3.tgz#8e0741ac45fc0c226e58a17bfc3e64b9bc6ca61c" - integrity sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ== - -tslib@2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" - integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== - -tslib@2.4.0, tslib@^2.1.0, tslib@^2.3.1: - version "2.4.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" - integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== - -tslib@2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e" - integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA== - -tslib@^1.8.1, tslib@^1.9.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" - integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== - -tsutils@^3.21.0: - version "3.21.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" - integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== - dependencies: - tslib "^1.8.1" - -type-check@^0.4.0, type-check@~0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" - integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== - dependencies: - prelude-ls "^1.2.1" - -type-detect@4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" - integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== - -type-fest@^0.20.2: - version "0.20.2" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" - integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== - -type-fest@^0.21.3: - version "0.21.3" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" - integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== - -type-is@^1.6.4, type-is@~1.6.18: - version "1.6.18" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" - integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== - dependencies: - media-typer "0.3.0" - mime-types "~2.1.24" - -typedarray@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" - integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== - -typeorm@^0.3.8: - version "0.3.10" - resolved "https://registry.yarnpkg.com/typeorm/-/typeorm-0.3.10.tgz#aa2857fd4b078c912ca693b7eee01b6535704458" - integrity sha512-VMKiM84EpJQ+Mz9xDIPqnfplWhyUy1d8ccaKdMY9obifxJOTFnv8GYVyPsGwG8Lk7Nb8MlttHyHWENGAhBA3WA== - dependencies: - "@sqltools/formatter" "^1.2.2" - app-root-path "^3.0.0" - buffer "^6.0.3" - chalk "^4.1.0" - cli-highlight "^2.1.11" - date-fns "^2.28.0" - debug "^4.3.3" - dotenv "^16.0.0" - glob "^7.2.0" - js-yaml "^4.1.0" - mkdirp "^1.0.4" - reflect-metadata "^0.1.13" - sha.js "^2.4.11" - tslib "^2.3.1" - uuid "^8.3.2" - xml2js "^0.4.23" - yargs "^17.3.1" - -typescript@4.8.4, typescript@^4.8.2: - version "4.8.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" - integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== - -universalify@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" - integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== - -unpipe@1.0.0, unpipe@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" - integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== - -update-browserslist-db@^1.0.9: - version "1.0.10" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz#0f54b876545726f17d00cd9a2561e6dade943ff3" - integrity sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ== - dependencies: - escalade "^3.1.1" - picocolors "^1.0.0" - -uri-js@^4.2.2: - version "4.4.1" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" - integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== - dependencies: - punycode "^2.1.0" - -util-deprecate@^1.0.1, util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== - -utils-merge@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" - integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== - -uuid@8.3.2, uuid@^8.3.2: - version "8.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" - integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== - -uuid@9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5" - integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg== - -uuidv4@^6.2.13: - version "6.2.13" - resolved "https://registry.yarnpkg.com/uuidv4/-/uuidv4-6.2.13.tgz#8f95ec5ef22d1f92c8e5d4c70b735d1c89572cb7" - integrity sha512-AXyzMjazYB3ovL3q051VLH06Ixj//Knx7QnUSi1T//Ie3io6CpsPu9nVMOx5MoLWh6xV0B9J0hIaxungxXUbPQ== - dependencies: - "@types/uuid" "8.3.4" - uuid "8.3.2" - -v8-compile-cache-lib@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" - integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== - -v8-to-istanbul@^9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz#b6f994b0b5d4ef255e17a0d17dc444a9f5132fa4" - integrity sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w== - dependencies: - "@jridgewell/trace-mapping" "^0.3.12" - "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^1.6.0" - -validator@^13.7.0: - version "13.7.0" - resolved "https://registry.yarnpkg.com/validator/-/validator-13.7.0.tgz#4f9658ba13ba8f3d82ee881d3516489ea85c0857" - integrity sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw== - -vary@^1, vary@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" - integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== - -walker@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" - integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== - dependencies: - makeerror "1.0.12" - -watchpack@^2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.0.tgz#fa33032374962c78113f93c7f2fb4c54c9862a5d" - integrity sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg== - dependencies: - glob-to-regexp "^0.4.1" - graceful-fs "^4.1.2" - -wcwidth@>=1.0.1, wcwidth@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" - integrity sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg== - dependencies: - defaults "^1.0.3" - -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== - -webpack-node-externals@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/webpack-node-externals/-/webpack-node-externals-3.0.0.tgz#1a3407c158d547a9feb4229a9e3385b7b60c9917" - integrity sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ== - -webpack-sources@^3.2.3: - version "3.2.3" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" - integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== - -webpack@5.74.0: - version "5.74.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.74.0.tgz#02a5dac19a17e0bb47093f2be67c695102a55980" - integrity sha512-A2InDwnhhGN4LYctJj6M1JEaGL7Luj6LOmyBHjcI8529cm5p6VXiTIW2sn6ffvEAKmveLzvu4jrihwXtPojlAA== - dependencies: - "@types/eslint-scope" "^3.7.3" - "@types/estree" "^0.0.51" - "@webassemblyjs/ast" "1.11.1" - "@webassemblyjs/wasm-edit" "1.11.1" - "@webassemblyjs/wasm-parser" "1.11.1" - acorn "^8.7.1" - acorn-import-assertions "^1.7.6" - browserslist "^4.14.5" - chrome-trace-event "^1.0.2" - enhanced-resolve "^5.10.0" - es-module-lexer "^0.9.0" - eslint-scope "5.1.1" - events "^3.2.0" - glob-to-regexp "^0.4.1" - graceful-fs "^4.2.9" - json-parse-even-better-errors "^2.3.1" - loader-runner "^4.2.0" - mime-types "^2.1.27" - neo-async "^2.6.2" - schema-utils "^3.1.0" - tapable "^2.1.1" - terser-webpack-plugin "^5.1.3" - watchpack "^2.4.0" - webpack-sources "^3.2.3" - -whatwg-fetch@>=0.10.0: - version "3.6.2" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz#dced24f37f2624ed0281725d51d0e2e3fe677f8c" - integrity sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA== - -whatwg-url@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" - integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - -which@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== - dependencies: - isexe "^2.0.0" - -widest-line@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-3.1.0.tgz#8292333bbf66cb45ff0de1603b136b7ae1496eca" - integrity sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg== - dependencies: - string-width "^4.0.0" - -windows-release@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/windows-release/-/windows-release-4.0.0.tgz#4725ec70217d1bf6e02c7772413b29cdde9ec377" - integrity sha512-OxmV4wzDKB1x7AZaZgXMVsdJ1qER1ed83ZrTYd5Bwq2HfJVg3DJS8nqlAG4sMoJ7mu8cuRmLEYyU13BKwctRAg== - dependencies: - execa "^4.0.2" - -word-wrap@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" - integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== - -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== - -write-file-atomic@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" - integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== - dependencies: - imurmurhash "^0.1.4" - signal-exit "^3.0.7" - -ws@7.4.6: - version "7.4.6" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" - integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== - -xml2js@^0.4.23: - version "0.4.23" - resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.23.tgz#a0c69516752421eb2ac758ee4d4ccf58843eac66" - integrity sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug== - dependencies: - sax ">=0.6.0" - xmlbuilder "~11.0.0" - -xmlbuilder@~11.0.0: - version "11.0.1" - resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-11.0.1.tgz#be9bae1c8a046e76b31127726347d0ad7002beb3" - integrity sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA== - -xtend@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" - integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== - -y18n@^5.0.5: - version "5.0.8" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" - integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== - -yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - -yaml@^1.10.0: - version "1.10.2" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" - integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== - -yargs-parser@21.1.1, yargs-parser@^21.0.0, yargs-parser@^21.0.1: - version "21.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" - integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== - -yargs-parser@^20.2.2: - version "20.2.9" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" - integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== - -yargs@^16.0.0, yargs@^16.2.0: - version "16.2.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" - integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== - dependencies: - cliui "^7.0.2" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.0" - y18n "^5.0.5" - yargs-parser "^20.2.2" - -yargs@^17.3.1: - version "17.6.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.6.0.tgz#e134900fc1f218bc230192bdec06a0a5f973e46c" - integrity sha512-8H/wTDqlSwoSnScvV2N/JHfLWOKuh5MVla9hqLjK3nsfyy6Y4kDSYSvkU5YCUEPOSnRXfIyx3Sq+B/IWudTo4g== - dependencies: - cliui "^8.0.1" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.3" - y18n "^5.0.5" - yargs-parser "^21.0.0" - -yn@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" - integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== - -yocto-queue@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" - integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==