mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
Compare commits
82 Commits
v0.16.0
...
attachment
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82dc228cfe | ||
|
|
4f30f72d36 | ||
|
|
3f68d11062 | ||
|
|
370a8a4b91 | ||
|
|
c9ba9500cc | ||
|
|
23d27cafc1 | ||
|
|
92e3d31360 | ||
|
|
8aefa7709c | ||
|
|
3020295841 | ||
|
|
7f31a48755 | ||
|
|
8c0ef61038 | ||
|
|
76bb82f2b4 | ||
|
|
4c0dc276dd | ||
|
|
a69c4b4067 | ||
|
|
d81e544e82 | ||
|
|
6eeda23559 | ||
|
|
cd046cbe27 | ||
|
|
9b7bc1e5b9 | ||
|
|
987341ed29 | ||
|
|
d7cad17f1b | ||
|
|
dd02ae471e | ||
|
|
a5bfb0b02b | ||
|
|
f4440c9a03 | ||
|
|
cb88c234d1 | ||
|
|
f6a0476fb4 | ||
|
|
63cdc45295 | ||
|
|
83a5010dc5 | ||
|
|
55aab76c9b | ||
|
|
495941f43a | ||
|
|
00a1e070c6 | ||
|
|
fab71d2b65 | ||
|
|
9504bb5ccd | ||
|
|
7e89966f20 | ||
|
|
8a96c41258 | ||
|
|
4a713980bf | ||
|
|
2a1cbf6ced | ||
|
|
9103b60653 | ||
|
|
b9fc0cdd9e | ||
|
|
4368c18479 | ||
|
|
7e5c6b6487 | ||
|
|
b7214044bb | ||
|
|
93cb3615c3 | ||
|
|
7abfa6a162 | ||
|
|
1372a1f0a8 | ||
|
|
484024ec28 | ||
|
|
46639c7b86 | ||
|
|
d10d1654c1 | ||
|
|
2f06070ecb | ||
|
|
deefdb9bfd | ||
|
|
3cc62d80de | ||
|
|
4962c5d4d3 | ||
|
|
571a332658 | ||
|
|
b44c318a5d | ||
|
|
bd9717f4dc | ||
|
|
f48aea8e5a | ||
|
|
0ac3a5dea9 | ||
|
|
56b40ad4cb | ||
|
|
9b6f934990 | ||
|
|
80e3522f8a | ||
|
|
7975643765 | ||
|
|
2ac7f86bdb | ||
|
|
956b9b6812 | ||
|
|
60248ec3f6 | ||
|
|
9d3f1541eb | ||
|
|
9b5f1a36ab | ||
|
|
8ee691e1ed | ||
|
|
f9cb14da9e | ||
|
|
5e87581f4e | ||
|
|
8ca9cf39da | ||
|
|
9001fea524 | ||
|
|
dea0d71732 | ||
|
|
c191c4bd26 | ||
|
|
47d82ce591 | ||
|
|
9321db2a3a | ||
|
|
e486333c96 | ||
|
|
a9748b23c0 | ||
|
|
693ae61141 | ||
|
|
9807ac04b0 | ||
|
|
bddfde4138 | ||
|
|
a39dcd00d5 | ||
|
|
4d616e9287 | ||
|
|
dc52fb1de5 |
@@ -105,6 +105,33 @@
|
|||||||
"contributions": [
|
"contributions": [
|
||||||
"bug"
|
"bug"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "benpsnyder",
|
||||||
|
"name": "Ben Snyder",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/707567?v=4",
|
||||||
|
"profile": "https://snyder.tech",
|
||||||
|
"contributions": [
|
||||||
|
"code"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "cloudsbird",
|
||||||
|
"name": "Vederis Leunardus",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/13505006?v=4",
|
||||||
|
"profile": "http://vederis.id",
|
||||||
|
"contributions": [
|
||||||
|
"code"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "ccantrell72",
|
||||||
|
"name": "Chris Cantrell",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/104120598?v=4",
|
||||||
|
"profile": "http://www.pivoten.com",
|
||||||
|
"contributions": [
|
||||||
|
"bug"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"contributorsPerLine": 7,
|
"contributorsPerLine": 7,
|
||||||
|
|||||||
@@ -48,6 +48,9 @@ SIGNUP_DISABLED=false
|
|||||||
SIGNUP_ALLOWED_DOMAINS=
|
SIGNUP_ALLOWED_DOMAINS=
|
||||||
SIGNUP_ALLOWED_EMAILS=
|
SIGNUP_ALLOWED_EMAILS=
|
||||||
|
|
||||||
|
# Sign-up Email Confirmation
|
||||||
|
SIGNUP_EMAIL_CONFIRMATION=false
|
||||||
|
|
||||||
# API rate limit (points,duration,block duration).
|
# API rate limit (points,duration,block duration).
|
||||||
API_RATE_LIMIT=120,60,600
|
API_RATE_LIMIT=120,60,600
|
||||||
|
|
||||||
@@ -95,3 +98,8 @@ PLAID_LINK_WEBHOOK=
|
|||||||
|
|
||||||
PLAID_SANDBOX_REDIRECT_URI=
|
PLAID_SANDBOX_REDIRECT_URI=
|
||||||
PLAID_DEVELOPMENT_REDIRECT_URI=
|
PLAID_DEVELOPMENT_REDIRECT_URI=
|
||||||
|
|
||||||
|
# https://docs.lemonsqueezy.com/guides/developer-guide/getting-started#create-an-api-key
|
||||||
|
LEMONSQUEEZY_API_KEY=
|
||||||
|
LEMONSQUEEZY_STORE_ID=
|
||||||
|
LEMONSQUEEZY_WEBHOOK_SECRET=
|
||||||
|
|||||||
94
.github/workflows/build-deploy-container.yml
vendored
94
.github/workflows/build-deploy-container.yml
vendored
@@ -6,43 +6,66 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
WEBAPP_IMAGE_NAME: bigcapitalhq/webapp
|
||||||
WEBAPP_IMAGE_NAME: bigcapital/bigcapital-webapp
|
SERVER_IMAGE_NAME: bigcapitalhq/server
|
||||||
SERVER_IMAGE_NAME: bigcapital/bigcapital-server
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-publish-webapp:
|
build-publish-webapp:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
name: Build and deploy webapp container
|
name: Build and deploy webapp container
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
environment: production
|
environment: production
|
||||||
steps:
|
steps:
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
platform=${{ matrix.platform }}
|
||||||
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
# Login to Container registry.
|
# Login to Container registry.
|
||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
username: ${{ github.actor }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
password: ${{ secrets.GH_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY }}/${{ env.WEBAPP_IMAGE_NAME }}
|
images: ${{ env.WEBAPP_IMAGE_NAME }}
|
||||||
|
|
||||||
# Builds and push the Docker image.
|
# Builds and push the Docker image.
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v5
|
||||||
|
id: build
|
||||||
with:
|
with:
|
||||||
context: .
|
context: ./
|
||||||
file: ./packages/webapp/Dockerfile
|
file: ./packages/webapp/Dockerfile
|
||||||
push: true
|
platforms: linux/amd64,linux/arm64
|
||||||
tags: ghcr.io/bigcapitalhq/webapp:latest
|
push: true
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
tags: bigcapitalhq/webapp:latest, bigcapitalhq/webapp:${{github.ref_name}}
|
||||||
|
|
||||||
|
- name: Export digest
|
||||||
|
run: |
|
||||||
|
mkdir -p /tmp/digests
|
||||||
|
digest="${{ steps.build.outputs.digest }}"
|
||||||
|
touch "/tmp/digests/${digest#sha256:}"
|
||||||
|
|
||||||
|
- name: Upload digest
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: digests-webapp
|
||||||
|
path: /tmp/digests/*
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 1
|
||||||
# Send notification to Slack channel.
|
# Send notification to Slack channel.
|
||||||
- name: Slack Notification built and published webapp container successfully.
|
- name: Slack Notification built and published webapp container successfully.
|
||||||
uses: rtCamp/action-slack-notify@v2
|
uses: rtCamp/action-slack-notify@v2
|
||||||
@@ -53,29 +76,52 @@ jobs:
|
|||||||
name: Build and deploy server container
|
name: Build and deploy server container
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Prepare
|
||||||
uses: actions/checkout@v2
|
run: |
|
||||||
|
platform=${{ matrix.platform }}
|
||||||
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
# Login to Container registry.
|
# Login to Container registry.
|
||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
username: ${{ github.actor }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
password: ${{ secrets.GH_TOKEN }}
|
|
||||||
|
|
||||||
# Builds and push the Docker image.
|
# Builds and push the Docker image.
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v5
|
||||||
|
id: build
|
||||||
with:
|
with:
|
||||||
context: ./
|
context: ./
|
||||||
file: ./packages/server/Dockerfile
|
file: ./packages/server/Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: ghcr.io/bigcapitalhq/server:latest
|
tags: bigcapitalhq/server:latest, bigcapitalhq/server:${{github.ref_name}}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
|
- name: Export digest
|
||||||
|
run: |
|
||||||
|
mkdir -p /tmp/digests
|
||||||
|
digest="${{ steps.build.outputs.digest }}"
|
||||||
|
touch "/tmp/digests/${digest#sha256:}"
|
||||||
|
|
||||||
|
- name: Upload digest
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: digests-server
|
||||||
|
path: /tmp/digests/*
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
# Send notification to Slack channel.
|
# Send notification to Slack channel.
|
||||||
- name: Slack Notification built and published server container successfully.
|
- name: Slack Notification built and published server container successfully.
|
||||||
uses: rtCamp/action-slack-notify@v2
|
uses: rtCamp/action-slack-notify@v2
|
||||||
env:
|
env:
|
||||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
||||||
|
|||||||
4
.github/workflows/e2e.yml
vendored
4
.github/workflows/e2e.yml
vendored
@@ -8,14 +8,14 @@ on:
|
|||||||
- '**.ts'
|
- '**.ts'
|
||||||
- '**.tsx'
|
- '**.tsx'
|
||||||
- '**/tsconfig.json'
|
- '**/tsconfig.json'
|
||||||
- 'yarn.lock'
|
- 'pnpm-lock.yaml'
|
||||||
- '.github/workflows/e2e.yml'
|
- '.github/workflows/e2e.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- '**.ts'
|
- '**.ts'
|
||||||
- '**.tsx'
|
- '**.tsx'
|
||||||
- '**/tsconfig.json'
|
- '**/tsconfig.json'
|
||||||
- 'yarn.lock'
|
- 'pnpm-lock.yaml'
|
||||||
- '.github/workflows/e2e.yml'
|
- '.github/workflows/e2e.yml'
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
. "$(dirname -- "$0")/_/husky.sh"
|
. "$(dirname -- "$0")/_/husky.sh"
|
||||||
|
|
||||||
yarn commitlint --edit
|
pnpx commitlint --edit
|
||||||
|
|||||||
70
CHANGELOG.md
70
CHANGELOG.md
@@ -2,6 +2,76 @@
|
|||||||
|
|
||||||
All notable changes to Bigcapital server-side will be in this file.
|
All notable changes to Bigcapital server-side will be in this file.
|
||||||
|
|
||||||
|
## [0.16.11] - 06-05-2024
|
||||||
|
|
||||||
|
### improvements
|
||||||
|
|
||||||
|
* feat: Export resource data to csv, xlsx by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/430
|
||||||
|
* feat: User email verification after signing-up. by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/426
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
* feat(repo): upgrade to latest lerna v8 and pnpm v9 by @benpsnyder in https://github.com/bigcapitalhq/bigcapital/pull/414
|
||||||
|
* feat: Update Docker Build-Push Action and Add ARM64 Support by @cloudsbird in https://github.com/bigcapitalhq/bigcapital/pull/412
|
||||||
|
* feat: Pushing docker containers by version tag by @cloudsbird in https://github.com/bigcapitalhq/bigcapital/pull/421
|
||||||
|
|
||||||
|
## [0.16.10]
|
||||||
|
|
||||||
|
* fix: Running migration Docker container on Windows by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/432
|
||||||
|
|
||||||
|
## [0.16.9]
|
||||||
|
|
||||||
|
* feat: New Relic for tracking by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/429
|
||||||
|
|
||||||
|
## [0.16.8]
|
||||||
|
|
||||||
|
* feat: Ability to enable/disable the bank connect feature by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/423
|
||||||
|
|
||||||
|
## [0.16.6]
|
||||||
|
|
||||||
|
* hotfix: fix the subscription plan when subscribe on cloud by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/422
|
||||||
|
|
||||||
|
## [0.16.5]
|
||||||
|
|
||||||
|
IMPORTANT: If you upgraded to the v0.16 recently you should upgrade to v0.16.4 as soon as possible, because there're some breaking changes affected the sign-in and some users reported couldn't sign-in.
|
||||||
|
|
||||||
|
* feat: Seed free subscription to tenants that have no subscription. by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/410
|
||||||
|
|
||||||
|
## [0.16.3]
|
||||||
|
|
||||||
|
* feat: Integrate Lemon Squeezy payment by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/402
|
||||||
|
* feat: optimize the onboarding subscription experience. by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/404
|
||||||
|
* feat: subscription page content by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/405
|
||||||
|
* feat: auto subscribe to free plan once signup on community version. by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/406
|
||||||
|
* chore: add default value to env variable by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/407
|
||||||
|
* fix: absolute storage imports path. by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/408
|
||||||
|
|
||||||
|
## [0.16.0]
|
||||||
|
|
||||||
|
* feat: add convert to invoice button on estimate drawer toolbar by @ANasouf in https://github.com/bigcapitalhq/bigcapital/pull/361
|
||||||
|
* feat(webapp): add mark as delivered to action bar of invoice details … by @ANasouf in https://github.com/bigcapitalhq/bigcapital/pull/360
|
||||||
|
* feat(webapp): Dialog to choose the bank service provider by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/378
|
||||||
|
* feat: Categorize the bank synced transactions by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/377
|
||||||
|
* feat: uncategorize the cashflow transaction by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/381
|
||||||
|
* Import resources from csv/xlsx by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/382
|
||||||
|
* feat(webapp): import resource UI by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/386
|
||||||
|
* fix: import resources improvements by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/388
|
||||||
|
* feat: add sample sheet to accounts and bank transactions by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/389
|
||||||
|
* fix: show the unique row value in the import preview by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/392
|
||||||
|
* feat: advanced parser for numeric and boolean import values by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/394
|
||||||
|
* feat: validate the given imported sheet whether is empty by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/395
|
||||||
|
* feat: linking relation with id in importing by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/393
|
||||||
|
* feat: Aggregate rows import by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/396
|
||||||
|
* feat: clean up the imported temp files by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/400
|
||||||
|
* feat: add hints to import fields by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/401
|
||||||
|
|
||||||
|
## [0.15.0]
|
||||||
|
|
||||||
|
* feat: Printing financial reports by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/363
|
||||||
|
* feat: Convert invoice status after sending mail notification by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/332
|
||||||
|
* feat: Bigcapital <> Plaid Integration by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/346
|
||||||
|
* fix: Broken transactions by vendor report by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/369
|
||||||
|
* fix: Optimize the print style some financial reports by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/370
|
||||||
|
|
||||||
## [0.14.0] - 30-01-2024
|
## [0.14.0] - 30-01-2024
|
||||||
|
|
||||||
* feat: purchases by items exporting by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/327
|
* feat: purchases by items exporting by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/327
|
||||||
|
|||||||
13
README.md
13
README.md
@@ -1,6 +1,6 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://bigcapital.ly" target="_blank">
|
<a href="https://bigcapital.app" target="_blank">
|
||||||
<img src="https://raw.githubusercontent.com/abouolia/blog/main/public/bigcapital.svg" alt="Bigcapital" width="280" height="75">
|
<img src="https://raw.githubusercontent.com/abouolia/blog/main/public/bigcapital.svg" alt="Bigcapital" width="280" height="75">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
@@ -25,6 +25,10 @@
|
|||||||
<img src="https://img.shields.io/twitter/follow/bigcapitalhq?style=social" alt="twitter" />
|
<img src="https://img.shields.io/twitter/follow/bigcapitalhq?style=social" alt="twitter" />
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://my.bigcapital.app">Bigcapital Cloud</a>
|
||||||
|
</p>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
# What's Bigcapital?
|
# What's Bigcapital?
|
||||||
@@ -47,7 +51,7 @@ Bigcapital is available open-source under AGPL license. You can host it on your
|
|||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
To get started with self-hosted with Docker and Docker Compose, take a look at the [Docker guide](https://docs.bigcapital.ly/deployment/docker).
|
To get started with self-hosted with Docker and Docker Compose, take a look at the [Docker guide](https://docs.bigcapital.app/deployment/docker).
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
@@ -70,7 +74,7 @@ You can integrate Bigcapital API with your system to organize your transactions
|
|||||||
|
|
||||||
# Resources
|
# Resources
|
||||||
|
|
||||||
- [Documentation](https://docs.bigcapital.ly/) - Learn how to use.
|
- [Documentation](https://docs.bigcapital.app/) - Learn how to use.
|
||||||
- [Contribution](https://github.com/bigcapitalhq/bigcapital/blob/develop/CONTRIBUTING.md) - Welcome to any contributions.
|
- [Contribution](https://github.com/bigcapitalhq/bigcapital/blob/develop/CONTRIBUTING.md) - Welcome to any contributions.
|
||||||
- [Discord](https://discord.com/invite/c8nPBJafeb) - Ask for help.
|
- [Discord](https://discord.com/invite/c8nPBJafeb) - Ask for help.
|
||||||
- [Bug Tracker](https://github.com/bigcapitalhq/bigcapital/issues) - Notify us new bugs.
|
- [Bug Tracker](https://github.com/bigcapitalhq/bigcapital/issues) - Notify us new bugs.
|
||||||
@@ -118,6 +122,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|||||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ANasouf"><img src="https://avatars.githubusercontent.com/u/19536487?v=4?s=100" width="100px;" alt="ANasouf"/><br /><sub><b>ANasouf</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/commits?author=ANasouf" title="Code">💻</a></td>
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ANasouf"><img src="https://avatars.githubusercontent.com/u/19536487?v=4?s=100" width="100px;" alt="ANasouf"/><br /><sub><b>ANasouf</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/commits?author=ANasouf" title="Code">💻</a></td>
|
||||||
<td align="center" valign="top" width="14.28%"><a href="https://ragnarlaud.dev"><img src="https://avatars.githubusercontent.com/u/3042904?v=4?s=100" width="100px;" alt="Ragnar Laud"/><br /><sub><b>Ragnar Laud</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/issues?q=author%3Axprnio" title="Bug reports">🐛</a></td>
|
<td align="center" valign="top" width="14.28%"><a href="https://ragnarlaud.dev"><img src="https://avatars.githubusercontent.com/u/3042904?v=4?s=100" width="100px;" alt="Ragnar Laud"/><br /><sub><b>Ragnar Laud</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/issues?q=author%3Axprnio" title="Bug reports">🐛</a></td>
|
||||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/asenawritescode"><img src="https://avatars.githubusercontent.com/u/67445192?v=4?s=100" width="100px;" alt="Asena"/><br /><sub><b>Asena</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/issues?q=author%3Aasenawritescode" title="Bug reports">🐛</a></td>
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/asenawritescode"><img src="https://avatars.githubusercontent.com/u/67445192?v=4?s=100" width="100px;" alt="Asena"/><br /><sub><b>Asena</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/issues?q=author%3Aasenawritescode" title="Bug reports">🐛</a></td>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="https://snyder.tech"><img src="https://avatars.githubusercontent.com/u/707567?v=4?s=100" width="100px;" alt="Ben Snyder"/><br /><sub><b>Ben Snyder</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/commits?author=benpsnyder" title="Code">💻</a></td>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="http://vederis.id"><img src="https://avatars.githubusercontent.com/u/13505006?v=4?s=100" width="100px;" alt="Vederis Leunardus"/><br /><sub><b>Vederis Leunardus</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/commits?author=cloudsbird" title="Code">💻</a></td>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="http://www.pivoten.com"><img src="https://avatars.githubusercontent.com/u/104120598?v=4?s=100" width="100px;" alt="Chris Cantrell"/><br /><sub><b>Chris Cantrell</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/issues?q=author%3Accantrell72" title="Bug reports">🐛</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -21,20 +21,16 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- server
|
- server
|
||||||
- webapp
|
- webapp
|
||||||
deploy:
|
restart: on-failure
|
||||||
restart_policy:
|
|
||||||
condition: unless-stopped
|
|
||||||
|
|
||||||
webapp:
|
webapp:
|
||||||
container_name: bigcapital-webapp
|
container_name: bigcapital-webapp
|
||||||
image: ghcr.io/bigcapitalhq/webapp:latest
|
image: bigcapitalhq/webapp:latest
|
||||||
deploy:
|
restart: on-failure
|
||||||
restart_policy:
|
|
||||||
condition: unless-stopped
|
|
||||||
|
|
||||||
server:
|
server:
|
||||||
container_name: bigcapital-server
|
container_name: bigcapital-server
|
||||||
image: ghcr.io/bigcapitalhq/server:latest
|
image: bigcapitalhq/server:latest
|
||||||
expose:
|
expose:
|
||||||
- '3000'
|
- '3000'
|
||||||
links:
|
links:
|
||||||
@@ -45,9 +41,7 @@ services:
|
|||||||
- mysql
|
- mysql
|
||||||
- mongo
|
- mongo
|
||||||
- redis
|
- redis
|
||||||
deploy:
|
restart: on-failure
|
||||||
restart_policy:
|
|
||||||
condition: unless-stopped
|
|
||||||
environment:
|
environment:
|
||||||
# Mail
|
# Mail
|
||||||
- MAIL_HOST=${MAIL_HOST}
|
- MAIL_HOST=${MAIL_HOST}
|
||||||
@@ -92,6 +86,30 @@ services:
|
|||||||
- GOTENBERG_URL=${GOTENBERG_URL}
|
- GOTENBERG_URL=${GOTENBERG_URL}
|
||||||
- GOTENBERG_DOCS_URL=${GOTENBERG_DOCS_URL}
|
- GOTENBERG_DOCS_URL=${GOTENBERG_DOCS_URL}
|
||||||
|
|
||||||
|
# Bank Sync
|
||||||
|
- BANKING_CONNECT=${BANKING_CONNECT}
|
||||||
|
|
||||||
|
# Plaid
|
||||||
|
- PLAID_ENV=${PLAID_ENV}
|
||||||
|
- PLAID_CLIENT_ID=${PLAID_CLIENT_ID}
|
||||||
|
- PLAID_SECRET_DEVELOPMENT=${PLAID_SECRET_DEVELOPMENT}
|
||||||
|
- PLAID_SECRET_SANDBOX=${b8cf42b441e110451e2f69ad7e1e9f}
|
||||||
|
- PLAID_LINK_WEBHOOK=${PLAID_LINK_WEBHOOK}
|
||||||
|
|
||||||
|
# Lemon Squeez
|
||||||
|
- LEMONSQUEEZY_API_KEY=${LEMONSQUEEZY_API_KEY}
|
||||||
|
- LEMONSQUEEZY_STORE_ID=${LEMONSQUEEZY_STORE_ID}
|
||||||
|
- LEMONSQUEEZY_WEBHOOK_SECRET=${LEMONSQUEEZY_WEBHOOK_SECRET}
|
||||||
|
- HOSTED_ON_BIGCAPITAL_CLOUD=${HOSTED_ON_BIGCAPITAL_CLOUD}
|
||||||
|
|
||||||
|
# New Relic matrics tracking.
|
||||||
|
- NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=${NEW_RELIC_DISTRIBUTED_TRACING_ENABLED}
|
||||||
|
- NEW_RELIC_LOG=${NEW_RELIC_LOG}
|
||||||
|
- NEW_RELIC_AI_MONITORING_ENABLED=${NEW_RELIC_AI_MONITORING_ENABLED}
|
||||||
|
- NEW_RELIC_CUSTOM_INSIGHTS_EVENTS_MAX_SAMPLES_STORED=${NEW_RELIC_CUSTOM_INSIGHTS_EVENTS_MAX_SAMPLES_STORED}
|
||||||
|
- NEW_RELIC_SPAN_EVENTS_MAX_SAMPLES_STORED=${NEW_RELIC_SPAN_EVENTS_MAX_SAMPLES_STORED}
|
||||||
|
|
||||||
|
|
||||||
database_migration:
|
database_migration:
|
||||||
container_name: bigcapital-database-migration
|
container_name: bigcapital-database-migration
|
||||||
build:
|
build:
|
||||||
@@ -111,9 +129,7 @@ services:
|
|||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
container_name: bigcapital-mysql
|
container_name: bigcapital-mysql
|
||||||
deploy:
|
restart: on-failure
|
||||||
restart_policy:
|
|
||||||
condition: unless-stopped
|
|
||||||
build:
|
build:
|
||||||
context: ./docker/mariadb
|
context: ./docker/mariadb
|
||||||
environment:
|
environment:
|
||||||
@@ -128,9 +144,7 @@ services:
|
|||||||
|
|
||||||
mongo:
|
mongo:
|
||||||
container_name: bigcapital-mongo
|
container_name: bigcapital-mongo
|
||||||
deploy:
|
restart: on-failure
|
||||||
restart_policy:
|
|
||||||
condition: unless-stopped
|
|
||||||
build: ./docker/mongo
|
build: ./docker/mongo
|
||||||
expose:
|
expose:
|
||||||
- '27017'
|
- '27017'
|
||||||
@@ -139,9 +153,7 @@ services:
|
|||||||
|
|
||||||
redis:
|
redis:
|
||||||
container_name: bigcapital-redis
|
container_name: bigcapital-redis
|
||||||
deploy:
|
restart: on-failure
|
||||||
restart_policy:
|
|
||||||
condition: unless-stopped
|
|
||||||
build:
|
build:
|
||||||
context: ./docker/redis
|
context: ./docker/redis
|
||||||
expose:
|
expose:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM ghcr.io/bigcapitalhq/server:latest as build
|
FROM bigcapitalhq/server:latest as build
|
||||||
|
|
||||||
ARG DB_HOST= \
|
ARG DB_HOST= \
|
||||||
DB_USER= \
|
DB_USER= \
|
||||||
@@ -34,7 +34,5 @@ WORKDIR /app/packages/server
|
|||||||
|
|
||||||
RUN git clone https://github.com/vishnubob/wait-for-it.git
|
RUN git clone https://github.com/vishnubob/wait-for-it.git
|
||||||
|
|
||||||
ADD docker/migration/start.sh /
|
# Once we listen the mysql port run the migration task.
|
||||||
RUN chmod +x /start.sh
|
CMD ./wait-for-it/wait-for-it.sh mysql:3306 -- sh -c "node ./build/commands.js system:migrate:latest && node ./build/commands.js tenants:migrate:latest"
|
||||||
|
|
||||||
CMD ["/start.sh"]
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
# Migrate the master system database.
|
|
||||||
./wait-for-it/wait-for-it.sh mysql:3306 -- node ./build/commands.js system:migrate:latest
|
|
||||||
|
|
||||||
# Migrate all tenants.
|
|
||||||
./wait-for-it/wait-for-it.sh mysql:3306 -- node ./build/commands.js tenants:migrate:latest
|
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
||||||
"version": "independent",
|
"version": "independent",
|
||||||
"npmClient": "pnpm",
|
"npmClient": "pnpm",
|
||||||
"useWorkspaces": true,
|
"packages": [
|
||||||
"packages": ["packages/*"]
|
"packages/*"
|
||||||
}
|
]
|
||||||
|
}
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
"@faker-js/faker": "^8.0.2",
|
"@faker-js/faker": "^8.0.2",
|
||||||
"@playwright/test": "^1.32.3",
|
"@playwright/test": "^1.32.3",
|
||||||
"husky": "^8.0.3",
|
"husky": "^8.0.3",
|
||||||
"lerna": "^6.4.1"
|
"lerna": "^8.1.2",
|
||||||
|
"pnpm": "^9.0.5"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "16.x || 17.x || 18.x"
|
"node": "16.x || 17.x || 18.x"
|
||||||
|
|||||||
4
packages/server/.gitignore
vendored
4
packages/server/.gitignore
vendored
@@ -3,4 +3,6 @@
|
|||||||
stdout.log
|
stdout.log
|
||||||
/dist
|
/dist
|
||||||
/build
|
/build
|
||||||
/public/imports
|
/public/imports
|
||||||
|
|
||||||
|
dist
|
||||||
@@ -78,6 +78,9 @@ ENV MAIL_HOST=$MAIL_HOST \
|
|||||||
SIGNUP_ALLOWED_DOMAINS=$SIGNUP_ALLOWED_DOMAINS \
|
SIGNUP_ALLOWED_DOMAINS=$SIGNUP_ALLOWED_DOMAINS \
|
||||||
SIGNUP_ALLOWED_EMAILS=$SIGNUP_ALLOWED_EMAILS
|
SIGNUP_ALLOWED_EMAILS=$SIGNUP_ALLOWED_EMAILS
|
||||||
|
|
||||||
|
# New Relic config file.
|
||||||
|
ENV NEW_RELIC_NO_CONFIG_FILE=true
|
||||||
|
|
||||||
# Create app directory.
|
# Create app directory.
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -89,8 +92,8 @@ RUN npm install -g pnpm
|
|||||||
# Copy application dependency manifests to the container image.
|
# Copy application dependency manifests to the container image.
|
||||||
COPY ./package*.json ./
|
COPY ./package*.json ./
|
||||||
COPY ./pnpm-lock.yaml ./pnpm-lock.yaml
|
COPY ./pnpm-lock.yaml ./pnpm-lock.yaml
|
||||||
COPY ./pnpm-workspace.yaml ./pnpm-workspace.yaml
|
|
||||||
COPY ./lerna.json ./lerna.json
|
COPY ./lerna.json ./lerna.json
|
||||||
|
COPY ./pnpm-workspace.yaml ./pnpm-workspace.yaml
|
||||||
COPY ./packages/server/package*.json ./packages/server/
|
COPY ./packages/server/package*.json ./packages/server/
|
||||||
|
|
||||||
# Install application dependencies
|
# Install application dependencies
|
||||||
|
|||||||
24
packages/server/newrelic_agent.log
Normal file
24
packages/server/newrelic_agent.log
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":4846,"time":"2024-05-15T09:09:09.492Z","msg":"Unable to find configuration file. If a configuration file is desired (common for non-containerized environments), a base configuration file can be copied from /Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/newrelic.js and renamed to \"newrelic.js\" in the directory from which you will start your application. Attempting to start agent using environment variables."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":4846,"time":"2024-05-15T09:09:09.514Z","msg":"Using New Relic for Node.js. Agent version: 11.16.0; Node version: v18.18.2."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":4846,"time":"2024-05-15T09:09:09.791Z","msg":"Using AsyncLocalContextManager"}
|
||||||
|
{"v":0,"level":50,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":4846,"time":"2024-05-15T09:09:09.793Z","msg":"New Relic for Node.js was unable to bootstrap itself due to an error:","stack":"Error: New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!\n at createAgent (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:160:11)\n at initialize (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:105:15)\n at Object.<anonymous> (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:39:3)\n at Module._compile (node:internal/modules/cjs/loader:1256:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)\n at Module.load (node:internal/modules/cjs/loader:1119:32)\n at Module._load (node:internal/modules/cjs/loader:960:12)\n at Module.require (node:internal/modules/cjs/loader:1143:19)\n at require (node:internal/modules/cjs/helpers:119:18)\n at Object.newrelic (/Users/ahmedbouhuolia/repos/bigcapital/packages/server/build/index.js:15954:18)","message":"New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!"}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":4883,"time":"2024-05-15T09:09:27.758Z","msg":"Unable to find configuration file. If a configuration file is desired (common for non-containerized environments), a base configuration file can be copied from /Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/newrelic.js and renamed to \"newrelic.js\" in the directory from which you will start your application. Attempting to start agent using environment variables."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":4883,"time":"2024-05-15T09:09:27.771Z","msg":"Using New Relic for Node.js. Agent version: 11.16.0; Node version: v18.18.2."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":4883,"time":"2024-05-15T09:09:27.927Z","msg":"Using AsyncLocalContextManager"}
|
||||||
|
{"v":0,"level":50,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":4883,"time":"2024-05-15T09:09:27.929Z","msg":"New Relic for Node.js was unable to bootstrap itself due to an error:","stack":"Error: New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!\n at createAgent (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:160:11)\n at initialize (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:105:15)\n at Object.<anonymous> (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:39:3)\n at Module._compile (node:internal/modules/cjs/loader:1256:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)\n at Module.load (node:internal/modules/cjs/loader:1119:32)\n at Module._load (node:internal/modules/cjs/loader:960:12)\n at Module.require (node:internal/modules/cjs/loader:1143:19)\n at require (node:internal/modules/cjs/helpers:119:18)\n at Object.newrelic (/Users/ahmedbouhuolia/repos/bigcapital/packages/server/build/index.js:15954:18)","message":"New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!"}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":5411,"time":"2024-05-15T09:15:10.318Z","msg":"Unable to find configuration file. If a configuration file is desired (common for non-containerized environments), a base configuration file can be copied from /Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/newrelic.js and renamed to \"newrelic.js\" in the directory from which you will start your application. Attempting to start agent using environment variables."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":5411,"time":"2024-05-15T09:15:10.326Z","msg":"Using New Relic for Node.js. Agent version: 11.16.0; Node version: v18.18.2."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":5411,"time":"2024-05-15T09:15:10.420Z","msg":"Using AsyncLocalContextManager"}
|
||||||
|
{"v":0,"level":50,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":5411,"time":"2024-05-15T09:15:10.421Z","msg":"New Relic for Node.js was unable to bootstrap itself due to an error:","stack":"Error: New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!\n at createAgent (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:160:11)\n at initialize (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:105:15)\n at Object.<anonymous> (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:39:3)\n at Module._compile (node:internal/modules/cjs/loader:1256:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)\n at Module.load (node:internal/modules/cjs/loader:1119:32)\n at Module._load (node:internal/modules/cjs/loader:960:12)\n at Module.require (node:internal/modules/cjs/loader:1143:19)\n at require (node:internal/modules/cjs/helpers:119:18)\n at Object.newrelic (/Users/ahmedbouhuolia/repos/bigcapital/packages/server/build/index.js:15954:18)","message":"New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!"}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":8856,"time":"2024-05-15T11:47:03.324Z","msg":"Unable to find configuration file. If a configuration file is desired (common for non-containerized environments), a base configuration file can be copied from /Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/newrelic.js and renamed to \"newrelic.js\" in the directory from which you will start your application. Attempting to start agent using environment variables."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":8856,"time":"2024-05-15T11:47:03.335Z","msg":"Using New Relic for Node.js. Agent version: 11.16.0; Node version: v18.18.2."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":8856,"time":"2024-05-15T11:47:03.504Z","msg":"Using AsyncLocalContextManager"}
|
||||||
|
{"v":0,"level":50,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":8856,"time":"2024-05-15T11:47:03.505Z","msg":"New Relic for Node.js was unable to bootstrap itself due to an error:","stack":"Error: New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!\n at createAgent (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:160:11)\n at initialize (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:105:15)\n at Object.<anonymous> (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:39:3)\n at Module._compile (node:internal/modules/cjs/loader:1256:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)\n at Module.load (node:internal/modules/cjs/loader:1119:32)\n at Module._load (node:internal/modules/cjs/loader:960:12)\n at Module.require (node:internal/modules/cjs/loader:1143:19)\n at require (node:internal/modules/cjs/helpers:119:18)\n at Object.newrelic (/Users/ahmedbouhuolia/repos/bigcapital/packages/server/build/index.js:15954:18)","message":"New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!"}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":12076,"time":"2024-05-15T14:30:36.984Z","msg":"Unable to find configuration file. If a configuration file is desired (common for non-containerized environments), a base configuration file can be copied from /Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/newrelic.js and renamed to \"newrelic.js\" in the directory from which you will start your application. Attempting to start agent using environment variables."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":12076,"time":"2024-05-15T14:30:36.990Z","msg":"Using New Relic for Node.js. Agent version: 11.16.0; Node version: v18.18.2."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":12076,"time":"2024-05-15T14:30:37.126Z","msg":"Using AsyncLocalContextManager"}
|
||||||
|
{"v":0,"level":50,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":12076,"time":"2024-05-15T14:30:37.127Z","msg":"New Relic for Node.js was unable to bootstrap itself due to an error:","stack":"Error: New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!\n at createAgent (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:160:11)\n at initialize (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:105:15)\n at Object.<anonymous> (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:39:3)\n at Module._compile (node:internal/modules/cjs/loader:1256:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)\n at Module.load (node:internal/modules/cjs/loader:1119:32)\n at Module._load (node:internal/modules/cjs/loader:960:12)\n at Module.require (node:internal/modules/cjs/loader:1143:19)\n at require (node:internal/modules/cjs/helpers:119:18)\n at Object.newrelic (/Users/ahmedbouhuolia/repos/bigcapital/packages/server/build/index.js:15954:18)","message":"New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!"}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":29079,"time":"2024-05-17T10:24:22.393Z","msg":"Unable to find configuration file. If a configuration file is desired (common for non-containerized environments), a base configuration file can be copied from /Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/newrelic.js and renamed to \"newrelic.js\" in the directory from which you will start your application. Attempting to start agent using environment variables."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":29079,"time":"2024-05-17T10:24:22.405Z","msg":"Using New Relic for Node.js. Agent version: 11.16.0; Node version: v18.18.2."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":29079,"time":"2024-05-17T10:24:22.536Z","msg":"Using AsyncLocalContextManager"}
|
||||||
|
{"v":0,"level":50,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":29079,"time":"2024-05-17T10:24:22.537Z","msg":"New Relic for Node.js was unable to bootstrap itself due to an error:","stack":"Error: New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!\n at createAgent (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:160:11)\n at initialize (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:105:15)\n at Object.<anonymous> (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:39:3)\n at Module._compile (node:internal/modules/cjs/loader:1256:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)\n at Module.load (node:internal/modules/cjs/loader:1119:32)\n at Module._load (node:internal/modules/cjs/loader:960:12)\n at Module.require (node:internal/modules/cjs/loader:1143:19)\n at require (node:internal/modules/cjs/helpers:119:18)\n at Object.newrelic (/Users/ahmedbouhuolia/repos/bigcapital/packages/server/build/index.js:15954:18)","message":"New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!"}
|
||||||
17747
packages/server/package-lock.json
generated
17747
packages/server/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -20,8 +20,10 @@
|
|||||||
"bigcapital": "./bin/bigcapital.js"
|
"bigcapital": "./bin/bigcapital.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@aws-sdk/client-s3": "^3.576.0",
|
||||||
"@casl/ability": "^5.4.3",
|
"@casl/ability": "^5.4.3",
|
||||||
"@hapi/boom": "^7.4.3",
|
"@hapi/boom": "^7.4.3",
|
||||||
|
"@lemonsqueezy/lemonsqueezy.js": "^2.2.0",
|
||||||
"@types/i18n": "^0.8.7",
|
"@types/i18n": "^0.8.7",
|
||||||
"@types/knex": "^0.16.1",
|
"@types/knex": "^0.16.1",
|
||||||
"@types/mathjs": "^6.0.12",
|
"@types/mathjs": "^6.0.12",
|
||||||
@@ -81,6 +83,7 @@
|
|||||||
"mustache": "^3.0.3",
|
"mustache": "^3.0.3",
|
||||||
"mysql": "^2.17.1",
|
"mysql": "^2.17.1",
|
||||||
"mysql2": "^1.6.5",
|
"mysql2": "^1.6.5",
|
||||||
|
"newrelic": "^11.15.0",
|
||||||
"node-cache": "^4.2.1",
|
"node-cache": "^4.2.1",
|
||||||
"nodemailer": "^6.3.0",
|
"nodemailer": "^6.3.0",
|
||||||
"nodemon": "^1.19.1",
|
"nodemon": "^1.19.1",
|
||||||
@@ -89,17 +92,17 @@
|
|||||||
"objection-filter": "^4.0.1",
|
"objection-filter": "^4.0.1",
|
||||||
"objection-soft-delete": "^1.0.7",
|
"objection-soft-delete": "^1.0.7",
|
||||||
"objection-unique": "^1.2.2",
|
"objection-unique": "^1.2.2",
|
||||||
|
"plaid": "^10.3.0",
|
||||||
"pluralize": "^8.0.0",
|
"pluralize": "^8.0.0",
|
||||||
"pug": "^3.0.2",
|
"pug": "^3.0.2",
|
||||||
"puppeteer": "^10.2.0",
|
"puppeteer": "^10.2.0",
|
||||||
"plaid": "^10.3.0",
|
|
||||||
"qim": "0.0.52",
|
"qim": "0.0.52",
|
||||||
"ramda": "^0.27.1",
|
"ramda": "^0.27.1",
|
||||||
"rate-limiter-flexible": "^2.1.14",
|
"rate-limiter-flexible": "^2.1.14",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"rtl-detect": "^1.0.4",
|
"rtl-detect": "^1.0.4",
|
||||||
"source-map-loader": "^4.0.1",
|
|
||||||
"socket.io": "^4.7.4",
|
"socket.io": "^4.7.4",
|
||||||
|
"source-map-loader": "^4.0.1",
|
||||||
"tmp-promise": "^3.0.3",
|
"tmp-promise": "^3.0.3",
|
||||||
"ts-transformer-keys": "^0.4.2",
|
"ts-transformer-keys": "^0.4.2",
|
||||||
"tsyringe": "^4.3.0",
|
"tsyringe": "^4.3.0",
|
||||||
|
|||||||
@@ -244,6 +244,7 @@
|
|||||||
"account.field.active": "Active",
|
"account.field.active": "Active",
|
||||||
"account.field.currency": "Currency",
|
"account.field.currency": "Currency",
|
||||||
"account.field.balance": "Balance",
|
"account.field.balance": "Balance",
|
||||||
|
"account.field.bank_balance": "Bank Balance",
|
||||||
"account.field.parent_account": "Parent Account",
|
"account.field.parent_account": "Parent Account",
|
||||||
"account.field.created_at": "Created at",
|
"account.field.created_at": "Created at",
|
||||||
"item.field.type": "Item Type",
|
"item.field.type": "Item Type",
|
||||||
@@ -331,7 +332,7 @@
|
|||||||
"bill_payment.field.reference_no": "Reference No.",
|
"bill_payment.field.reference_no": "Reference No.",
|
||||||
"bill_payment.field.description": "Description",
|
"bill_payment.field.description": "Description",
|
||||||
"bill_payment.field.exchange_rate": "Exchange Rate",
|
"bill_payment.field.exchange_rate": "Exchange Rate",
|
||||||
"bill_payment.field.statement": "Statement",
|
"bill_payment.field.note": "Note",
|
||||||
"bill_payment.field.entries.bill": "Bill No.",
|
"bill_payment.field.entries.bill": "Bill No.",
|
||||||
"bill_payment.field.entries.payment_amount": "Payment Amount",
|
"bill_payment.field.entries.payment_amount": "Payment Amount",
|
||||||
"bill_payment.field.reference": "Reference No.",
|
"bill_payment.field.reference": "Reference No.",
|
||||||
@@ -431,6 +432,7 @@
|
|||||||
"vendor.field.created_at": "Created at",
|
"vendor.field.created_at": "Created at",
|
||||||
"vendor.field.balance": "Balance",
|
"vendor.field.balance": "Balance",
|
||||||
"vendor.field.status": "Status",
|
"vendor.field.status": "Status",
|
||||||
|
"vendor.field.note": "Note",
|
||||||
"vendor.field.currency": "Currency",
|
"vendor.field.currency": "Currency",
|
||||||
"vendor.field.status.active": "Active",
|
"vendor.field.status.active": "Active",
|
||||||
"vendor.field.status.inactive": "Inactive",
|
"vendor.field.status.inactive": "Inactive",
|
||||||
|
|||||||
35
packages/server/src/api/controllers/AttachmentsController.ts
Normal file
35
packages/server/src/api/controllers/AttachmentsController.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import { Service, Inject } from 'typedi';
|
||||||
|
import { Router, Response } from 'express';
|
||||||
|
import BaseController from '@/api/controllers/BaseController';
|
||||||
|
import { Request } from 'express-validator/src/base';
|
||||||
|
import { AttachmentsApplication } from '@/services/Attachments/AttachmentsApplication';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class AttachmentsController extends BaseController {
|
||||||
|
@Inject()
|
||||||
|
private attachmentsApplication: AttachmentsApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Router constructor.
|
||||||
|
*/
|
||||||
|
router() {
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.delete('/:id', this.deleteAttachment.bind(this));
|
||||||
|
router.post('/', this.uploadAttachment.bind(this));
|
||||||
|
|
||||||
|
return router;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async uploadAttachment(req: Request, res: Response, next: Function) {
|
||||||
|
try {
|
||||||
|
await this.attachmentsApplication.upload();
|
||||||
|
|
||||||
|
return res.status(200).send({});
|
||||||
|
} catch (error) {
|
||||||
|
next(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private deleteAttachment(req: Request, res: Response, next: Function) {}
|
||||||
|
}
|
||||||
@@ -9,6 +9,8 @@ import { DATATYPES_LENGTH } from '@/data/DataTypes';
|
|||||||
import LoginThrottlerMiddleware from '@/api/middleware/LoginThrottlerMiddleware';
|
import LoginThrottlerMiddleware from '@/api/middleware/LoginThrottlerMiddleware';
|
||||||
import AuthenticationApplication from '@/services/Authentication/AuthApplication';
|
import AuthenticationApplication from '@/services/Authentication/AuthApplication';
|
||||||
|
|
||||||
|
import JWTAuth from '@/api/middleware/jwtAuth';
|
||||||
|
import AttachCurrentTenantUser from '@/api/middleware/AttachCurrentTenantUser';
|
||||||
@Service()
|
@Service()
|
||||||
export default class AuthenticationController extends BaseController {
|
export default class AuthenticationController extends BaseController {
|
||||||
@Inject()
|
@Inject()
|
||||||
@@ -28,6 +30,20 @@ export default class AuthenticationController extends BaseController {
|
|||||||
asyncMiddleware(this.login.bind(this)),
|
asyncMiddleware(this.login.bind(this)),
|
||||||
this.handlerErrors
|
this.handlerErrors
|
||||||
);
|
);
|
||||||
|
router.use('/register/verify/resend', JWTAuth);
|
||||||
|
router.use('/register/verify/resend', AttachCurrentTenantUser);
|
||||||
|
router.post(
|
||||||
|
'/register/verify/resend',
|
||||||
|
asyncMiddleware(this.registerVerifyResendMail.bind(this)),
|
||||||
|
this.handlerErrors
|
||||||
|
);
|
||||||
|
router.post(
|
||||||
|
'/register/verify',
|
||||||
|
this.signupVerifySchema,
|
||||||
|
this.validationResult,
|
||||||
|
asyncMiddleware(this.registerVerify.bind(this)),
|
||||||
|
this.handlerErrors
|
||||||
|
);
|
||||||
router.post(
|
router.post(
|
||||||
'/register',
|
'/register',
|
||||||
this.registerSchema,
|
this.registerSchema,
|
||||||
@@ -99,6 +115,17 @@ export default class AuthenticationController extends BaseController {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private get signupVerifySchema(): ValidationChain[] {
|
||||||
|
return [
|
||||||
|
check('email')
|
||||||
|
.exists()
|
||||||
|
.isString()
|
||||||
|
.isEmail()
|
||||||
|
.isLength({ max: DATATYPES_LENGTH.STRING }),
|
||||||
|
check('token').exists().isString(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset password schema.
|
* Reset password schema.
|
||||||
* @returns {ValidationChain[]}
|
* @returns {ValidationChain[]}
|
||||||
@@ -166,6 +193,58 @@ export default class AuthenticationController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies the provider user's email after signin-up.
|
||||||
|
* @param {Request} req
|
||||||
|
* @param {Response}| res
|
||||||
|
* @param {Function} next
|
||||||
|
* @returns {Response|void}
|
||||||
|
*/
|
||||||
|
private async registerVerify(req: Request, res: Response, next: Function) {
|
||||||
|
const signUpVerifyDTO: { email: string; token: string } =
|
||||||
|
this.matchedBodyData(req);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const user = await this.authApplication.signUpConfirm(
|
||||||
|
signUpVerifyDTO.email,
|
||||||
|
signUpVerifyDTO.token
|
||||||
|
);
|
||||||
|
return res.status(200).send({
|
||||||
|
type: 'success',
|
||||||
|
message: 'The given user has verified successfully',
|
||||||
|
user,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
next(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resends the confirmation email to the user.
|
||||||
|
* @param {Request} req
|
||||||
|
* @param {Response}| res
|
||||||
|
* @param {Function} next
|
||||||
|
*/
|
||||||
|
private async registerVerifyResendMail(
|
||||||
|
req: Request,
|
||||||
|
res: Response,
|
||||||
|
next: Function
|
||||||
|
) {
|
||||||
|
const { user } = req;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await this.authApplication.signUpConfirmResend(user.id);
|
||||||
|
|
||||||
|
return res.status(200).send({
|
||||||
|
type: 'success',
|
||||||
|
message: 'The given user has verified successfully',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
next(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send reset password handler
|
* Send reset password handler
|
||||||
* @param {Request} req
|
* @param {Request} req
|
||||||
|
|||||||
@@ -144,10 +144,8 @@ export default class VendorsController extends ContactsController {
|
|||||||
try {
|
try {
|
||||||
const vendor = await this.vendorsApplication.createVendor(
|
const vendor = await this.vendorsApplication.createVendor(
|
||||||
tenantId,
|
tenantId,
|
||||||
contactDTO,
|
contactDTO
|
||||||
user
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return res.status(200).send({
|
return res.status(200).send({
|
||||||
id: vendor.id,
|
id: vendor.id,
|
||||||
message: 'The vendor has been created successfully.',
|
message: 'The vendor has been created successfully.',
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ export default class DashboardMetaController {
|
|||||||
dashboardService: DashboardService;
|
dashboardService: DashboardService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Constructor router.
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
router() {
|
public router() {
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
router.get('/boot', this.getDashboardBoot);
|
router.get('/boot', this.getDashboardBoot);
|
||||||
@@ -25,7 +25,7 @@ export default class DashboardMetaController {
|
|||||||
* @param {Response} res -
|
* @param {Response} res -
|
||||||
* @param {NextFunction} next -
|
* @param {NextFunction} next -
|
||||||
*/
|
*/
|
||||||
getDashboardBoot = async (
|
private getDashboardBoot = async (
|
||||||
req: Request,
|
req: Request,
|
||||||
res: Response,
|
res: Response,
|
||||||
next: NextFunction
|
next: NextFunction
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { Router, Request, Response, NextFunction } from 'express';
|
||||||
|
import { query } from 'express-validator';
|
||||||
|
import BaseController from '@/api/controllers/BaseController';
|
||||||
|
import { ServiceError } from '@/exceptions';
|
||||||
|
import { ExportApplication } from '@/services/Export/ExportApplication';
|
||||||
|
import { ACCEPT_TYPE } from '@/interfaces/Http';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class ExportController extends BaseController {
|
||||||
|
@Inject()
|
||||||
|
private exportResourceApp: ExportApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Router constructor method.
|
||||||
|
*/
|
||||||
|
router() {
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.get(
|
||||||
|
'/',
|
||||||
|
[
|
||||||
|
query('resource').exists(),
|
||||||
|
query('format').isIn(['csv', 'xlsx']).optional(),
|
||||||
|
],
|
||||||
|
this.validationResult,
|
||||||
|
this.export.bind(this),
|
||||||
|
this.catchServiceErrors
|
||||||
|
);
|
||||||
|
return router;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Imports xlsx/csv to the given resource type.
|
||||||
|
* @param {Request} req -
|
||||||
|
* @param {Response} res -
|
||||||
|
* @param {NextFunction} next -
|
||||||
|
*/
|
||||||
|
private async export(req: Request, res: Response, next: NextFunction) {
|
||||||
|
const { tenantId } = req;
|
||||||
|
const query = this.matchedQueryData(req);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const accept = this.accepts(req);
|
||||||
|
|
||||||
|
const acceptType = accept.types([
|
||||||
|
ACCEPT_TYPE.APPLICATION_XLSX,
|
||||||
|
ACCEPT_TYPE.APPLICATION_CSV,
|
||||||
|
ACCEPT_TYPE.APPLICATION_PDF,
|
||||||
|
]);
|
||||||
|
const data = await this.exportResourceApp.export(
|
||||||
|
tenantId,
|
||||||
|
query.resource,
|
||||||
|
acceptType === ACCEPT_TYPE.APPLICATION_XLSX ? 'xlsx' : 'csv'
|
||||||
|
);
|
||||||
|
if (ACCEPT_TYPE.APPLICATION_CSV === acceptType) {
|
||||||
|
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
|
||||||
|
res.setHeader('Content-Type', 'text/csv');
|
||||||
|
|
||||||
|
return res.send(data);
|
||||||
|
// Retrieves the xlsx format.
|
||||||
|
} else if (ACCEPT_TYPE.APPLICATION_XLSX === acceptType) {
|
||||||
|
res.setHeader(
|
||||||
|
'Content-Disposition',
|
||||||
|
'attachment; filename=output.xlsx'
|
||||||
|
);
|
||||||
|
res.setHeader(
|
||||||
|
'Content-Type',
|
||||||
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||||
|
);
|
||||||
|
return res.send(data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
next(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transforms service errors to response.
|
||||||
|
* @param {Error}
|
||||||
|
* @param {Request} req
|
||||||
|
* @param {Response} res
|
||||||
|
* @param {ServiceError} error
|
||||||
|
*/
|
||||||
|
private catchServiceErrors(
|
||||||
|
error,
|
||||||
|
req: Request,
|
||||||
|
res: Response,
|
||||||
|
next: NextFunction
|
||||||
|
) {
|
||||||
|
if (error instanceof ServiceError) {
|
||||||
|
return res.status(400).send({
|
||||||
|
errors: [{ type: error.errorType }],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
next(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import Multer from 'multer';
|
import Multer from 'multer';
|
||||||
import { ServiceError } from '@/exceptions';
|
import { ServiceError } from '@/exceptions';
|
||||||
|
import { getImportsStoragePath } from '@/services/Import/_utils';
|
||||||
|
|
||||||
export function allowSheetExtensions(req, file, cb) {
|
export function allowSheetExtensions(req, file, cb) {
|
||||||
if (
|
if (
|
||||||
@@ -16,7 +17,8 @@ export function allowSheetExtensions(req, file, cb) {
|
|||||||
|
|
||||||
const storage = Multer.diskStorage({
|
const storage = Multer.diskStorage({
|
||||||
destination: function (req, file, cb) {
|
destination: function (req, file, cb) {
|
||||||
cb(null, './public/imports');
|
const path = getImportsStoragePath();
|
||||||
|
cb(null, path);
|
||||||
},
|
},
|
||||||
filename: function (req, file, cb) {
|
filename: function (req, file, cb) {
|
||||||
// Add the creation timestamp to clean up temp files later.
|
// Add the creation timestamp to clean up temp files later.
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { check, ValidationChain } from 'express-validator';
|
|||||||
import asyncMiddleware from '@/api/middleware/asyncMiddleware';
|
import asyncMiddleware from '@/api/middleware/asyncMiddleware';
|
||||||
import JWTAuth from '@/api/middleware/jwtAuth';
|
import JWTAuth from '@/api/middleware/jwtAuth';
|
||||||
import TenancyMiddleware from '@/api/middleware/TenancyMiddleware';
|
import TenancyMiddleware from '@/api/middleware/TenancyMiddleware';
|
||||||
|
import SubscriptionMiddleware from '@/api/middleware/SubscriptionMiddleware';
|
||||||
import AttachCurrentTenantUser from '@/api/middleware/AttachCurrentTenantUser';
|
import AttachCurrentTenantUser from '@/api/middleware/AttachCurrentTenantUser';
|
||||||
import OrganizationService from '@/services/Organization/OrganizationService';
|
import OrganizationService from '@/services/Organization/OrganizationService';
|
||||||
import { MONTHS, ACCEPTED_LOCALES } from '@/services/Organization/constants';
|
import { MONTHS, ACCEPTED_LOCALES } from '@/services/Organization/constants';
|
||||||
@@ -17,7 +18,7 @@ import BaseController from '@/api/controllers/BaseController';
|
|||||||
@Service()
|
@Service()
|
||||||
export default class OrganizationController extends BaseController {
|
export default class OrganizationController extends BaseController {
|
||||||
@Inject()
|
@Inject()
|
||||||
private organizationService: OrganizationService;
|
organizationService: OrganizationService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Router constructor.
|
* Router constructor.
|
||||||
@@ -25,10 +26,13 @@ export default class OrganizationController extends BaseController {
|
|||||||
router() {
|
router() {
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
|
// Should before build tenant database the user be authorized and
|
||||||
|
// most important than that, should be subscribed to any plan.
|
||||||
router.use(JWTAuth);
|
router.use(JWTAuth);
|
||||||
router.use(AttachCurrentTenantUser);
|
router.use(AttachCurrentTenantUser);
|
||||||
router.use(TenancyMiddleware);
|
router.use(TenancyMiddleware);
|
||||||
|
|
||||||
|
router.use('/build', SubscriptionMiddleware('main'));
|
||||||
router.post(
|
router.post(
|
||||||
'/build',
|
'/build',
|
||||||
this.buildOrganizationValidationSchema,
|
this.buildOrganizationValidationSchema,
|
||||||
|
|||||||
@@ -297,8 +297,7 @@ export default class VendorCreditController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
const vendorCredit = await this.createVendorCreditService.newVendorCredit(
|
const vendorCredit = await this.createVendorCreditService.newVendorCredit(
|
||||||
tenantId,
|
tenantId,
|
||||||
vendorCreditCreateDTO,
|
vendorCreditCreateDTO
|
||||||
user
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return res.status(200).send({
|
return res.status(200).send({
|
||||||
|
|||||||
@@ -338,8 +338,7 @@ export default class PaymentReceivesController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
const creditNote = await this.createCreditNoteService.newCreditNote(
|
const creditNote = await this.createCreditNoteService.newCreditNote(
|
||||||
tenantId,
|
tenantId,
|
||||||
creditNoteDTO,
|
creditNoteDTO
|
||||||
user
|
|
||||||
);
|
);
|
||||||
return res.status(200).send({
|
return res.status(200).send({
|
||||||
id: creditNote.id,
|
id: creditNote.id,
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
import { Router, Request, Response, NextFunction } from 'express';
|
||||||
|
import { Service, Inject } from 'typedi';
|
||||||
|
import { body } from 'express-validator';
|
||||||
|
import JWTAuth from '@/api/middleware/jwtAuth';
|
||||||
|
import TenancyMiddleware from '@/api/middleware/TenancyMiddleware';
|
||||||
|
import AttachCurrentTenantUser from '@/api/middleware/AttachCurrentTenantUser';
|
||||||
|
import SubscriptionService from '@/services/Subscription/SubscriptionService';
|
||||||
|
import asyncMiddleware from '@/api/middleware/asyncMiddleware';
|
||||||
|
import BaseController from '../BaseController';
|
||||||
|
import { LemonSqueezyService } from '@/services/Subscription/LemonSqueezyService';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class SubscriptionController extends BaseController {
|
||||||
|
@Inject()
|
||||||
|
private subscriptionService: SubscriptionService;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private lemonSqueezyService: LemonSqueezyService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Router constructor.
|
||||||
|
*/
|
||||||
|
router() {
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.use(JWTAuth);
|
||||||
|
router.use(AttachCurrentTenantUser);
|
||||||
|
router.use(TenancyMiddleware);
|
||||||
|
|
||||||
|
router.post(
|
||||||
|
'/lemon/checkout_url',
|
||||||
|
[body('variantId').exists().trim()],
|
||||||
|
this.validationResult,
|
||||||
|
this.getCheckoutUrl.bind(this)
|
||||||
|
);
|
||||||
|
router.get('/', asyncMiddleware(this.getSubscriptions.bind(this)));
|
||||||
|
|
||||||
|
return router;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve all subscriptions of the authenticated user's tenant.
|
||||||
|
* @param {Request} req
|
||||||
|
* @param {Response} res
|
||||||
|
* @param {NextFunction} next
|
||||||
|
*/
|
||||||
|
private async getSubscriptions(
|
||||||
|
req: Request,
|
||||||
|
res: Response,
|
||||||
|
next: NextFunction
|
||||||
|
) {
|
||||||
|
const { tenantId } = req;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const subscriptions = await this.subscriptionService.getSubscriptions(
|
||||||
|
tenantId
|
||||||
|
);
|
||||||
|
return res.status(200).send({ subscriptions });
|
||||||
|
} catch (error) {
|
||||||
|
next(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the LemonSqueezy checkout url.
|
||||||
|
* @param {Request} req
|
||||||
|
* @param {Response} res
|
||||||
|
* @param {NextFunction} next
|
||||||
|
*/
|
||||||
|
private async getCheckoutUrl(
|
||||||
|
req: Request,
|
||||||
|
res: Response,
|
||||||
|
next: NextFunction
|
||||||
|
) {
|
||||||
|
const { variantId } = this.matchedBodyData(req);
|
||||||
|
const { user } = req;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const checkout = await this.lemonSqueezyService.getCheckout(
|
||||||
|
variantId,
|
||||||
|
user
|
||||||
|
);
|
||||||
|
return res.status(200).send(checkout);
|
||||||
|
} catch (error) {
|
||||||
|
next(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from './SubscriptionController';
|
||||||
@@ -3,6 +3,7 @@ import { PlaidApplication } from '@/services/Banking/Plaid/PlaidApplication';
|
|||||||
import { Request, Response } from 'express';
|
import { Request, Response } from 'express';
|
||||||
import { Inject, Service } from 'typedi';
|
import { Inject, Service } from 'typedi';
|
||||||
import BaseController from '../BaseController';
|
import BaseController from '../BaseController';
|
||||||
|
import { LemonSqueezyWebhooks } from '@/services/Subscription/LemonSqueezyWebhooks';
|
||||||
import { PlaidWebhookTenantBootMiddleware } from '@/services/Banking/Plaid/PlaidWebhookTenantBootMiddleware';
|
import { PlaidWebhookTenantBootMiddleware } from '@/services/Banking/Plaid/PlaidWebhookTenantBootMiddleware';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
@@ -10,18 +11,39 @@ export class Webhooks extends BaseController {
|
|||||||
@Inject()
|
@Inject()
|
||||||
private plaidApp: PlaidApplication;
|
private plaidApp: PlaidApplication;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private lemonWebhooksService: LemonSqueezyWebhooks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Router constructor.
|
* Router constructor.
|
||||||
*/
|
*/
|
||||||
router() {
|
router() {
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
router.use(PlaidWebhookTenantBootMiddleware);
|
router.use('/plaid', PlaidWebhookTenantBootMiddleware);
|
||||||
router.post('/plaid', this.plaidWebhooks.bind(this));
|
router.post('/plaid', this.plaidWebhooks.bind(this));
|
||||||
|
|
||||||
|
router.post('/lemon', this.lemonWebhooks.bind(this));
|
||||||
|
|
||||||
return router;
|
return router;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listens to Lemon Squeezy webhooks events.
|
||||||
|
* @param {Request} req
|
||||||
|
* @param {Response} res
|
||||||
|
* @returns {Response}
|
||||||
|
*/
|
||||||
|
public async lemonWebhooks(req: Request, res: Response) {
|
||||||
|
const data = req.body;
|
||||||
|
const signature = req.headers['x-signature'] ?? '';
|
||||||
|
const rawBody = req.rawBody;
|
||||||
|
|
||||||
|
await this.lemonWebhooksService.handlePostWebhook(rawBody, data, signature);
|
||||||
|
|
||||||
|
return res.status(200).send();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listens to Plaid webhooks.
|
* Listens to Plaid webhooks.
|
||||||
* @param {Request} req
|
* @param {Request} req
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { Container } from 'typedi';
|
|||||||
// Middlewares
|
// Middlewares
|
||||||
import JWTAuth from '@/api/middleware/jwtAuth';
|
import JWTAuth from '@/api/middleware/jwtAuth';
|
||||||
import AttachCurrentTenantUser from '@/api/middleware/AttachCurrentTenantUser';
|
import AttachCurrentTenantUser from '@/api/middleware/AttachCurrentTenantUser';
|
||||||
|
import SubscriptionMiddleware from '@/api/middleware/SubscriptionMiddleware';
|
||||||
import TenancyMiddleware from '@/api/middleware/TenancyMiddleware';
|
import TenancyMiddleware from '@/api/middleware/TenancyMiddleware';
|
||||||
import EnsureTenantIsInitialized from '@/api/middleware/EnsureTenantIsInitialized';
|
import EnsureTenantIsInitialized from '@/api/middleware/EnsureTenantIsInitialized';
|
||||||
import SettingsMiddleware from '@/api/middleware/SettingsMiddleware';
|
import SettingsMiddleware from '@/api/middleware/SettingsMiddleware';
|
||||||
@@ -36,6 +37,7 @@ import Resources from './controllers/Resources';
|
|||||||
import ExchangeRates from '@/api/controllers/ExchangeRates';
|
import ExchangeRates from '@/api/controllers/ExchangeRates';
|
||||||
import Media from '@/api/controllers/Media';
|
import Media from '@/api/controllers/Media';
|
||||||
import Ping from '@/api/controllers/Ping';
|
import Ping from '@/api/controllers/Ping';
|
||||||
|
import { SubscriptionController } from '@/api/controllers/Subscription';
|
||||||
import InventoryAdjustments from '@/api/controllers/Inventory/InventoryAdjustments';
|
import InventoryAdjustments from '@/api/controllers/Inventory/InventoryAdjustments';
|
||||||
import asyncRenderMiddleware from './middleware/AsyncRenderMiddleware';
|
import asyncRenderMiddleware from './middleware/AsyncRenderMiddleware';
|
||||||
import Jobs from './controllers/Jobs';
|
import Jobs from './controllers/Jobs';
|
||||||
@@ -59,6 +61,7 @@ import { TaxRatesController } from './controllers/TaxRates/TaxRates';
|
|||||||
import { ImportController } from './controllers/Import/ImportController';
|
import { ImportController } from './controllers/Import/ImportController';
|
||||||
import { BankingController } from './controllers/Banking/BankingController';
|
import { BankingController } from './controllers/Banking/BankingController';
|
||||||
import { Webhooks } from './controllers/Webhooks/Webhooks';
|
import { Webhooks } from './controllers/Webhooks/Webhooks';
|
||||||
|
import { ExportController } from './controllers/Export/ExportController';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const app = Router();
|
const app = Router();
|
||||||
@@ -70,6 +73,7 @@ export default () => {
|
|||||||
|
|
||||||
app.use('/auth', Container.get(Authentication).router());
|
app.use('/auth', Container.get(Authentication).router());
|
||||||
app.use('/invite', Container.get(InviteUsers).nonAuthRouter());
|
app.use('/invite', Container.get(InviteUsers).nonAuthRouter());
|
||||||
|
app.use('/subscription', Container.get(SubscriptionController).router());
|
||||||
app.use('/organization', Container.get(Organization).router());
|
app.use('/organization', Container.get(Organization).router());
|
||||||
app.use('/ping', Container.get(Ping).router());
|
app.use('/ping', Container.get(Ping).router());
|
||||||
app.use('/jobs', Container.get(Jobs).router());
|
app.use('/jobs', Container.get(Jobs).router());
|
||||||
@@ -83,6 +87,7 @@ export default () => {
|
|||||||
dashboard.use(JWTAuth);
|
dashboard.use(JWTAuth);
|
||||||
dashboard.use(AttachCurrentTenantUser);
|
dashboard.use(AttachCurrentTenantUser);
|
||||||
dashboard.use(TenancyMiddleware);
|
dashboard.use(TenancyMiddleware);
|
||||||
|
dashboard.use(SubscriptionMiddleware('main'));
|
||||||
dashboard.use(EnsureTenantIsInitialized);
|
dashboard.use(EnsureTenantIsInitialized);
|
||||||
dashboard.use(SettingsMiddleware);
|
dashboard.use(SettingsMiddleware);
|
||||||
dashboard.use(I18nAuthenticatedMiddlware);
|
dashboard.use(I18nAuthenticatedMiddlware);
|
||||||
@@ -136,12 +141,11 @@ export default () => {
|
|||||||
dashboard.use('/warehouses', Container.get(WarehousesController).router());
|
dashboard.use('/warehouses', Container.get(WarehousesController).router());
|
||||||
dashboard.use('/projects', Container.get(ProjectsController).router());
|
dashboard.use('/projects', Container.get(ProjectsController).router());
|
||||||
dashboard.use('/tax-rates', Container.get(TaxRatesController).router());
|
dashboard.use('/tax-rates', Container.get(TaxRatesController).router());
|
||||||
|
|
||||||
dashboard.use('/import', Container.get(ImportController).router());
|
dashboard.use('/import', Container.get(ImportController).router());
|
||||||
|
dashboard.use('/export', Container.get(ExportController).router())
|
||||||
|
|
||||||
dashboard.use('/', Container.get(ProjectTasksController).router());
|
dashboard.use('/', Container.get(ProjectTasksController).router());
|
||||||
dashboard.use('/', Container.get(ProjectTimesController).router());
|
dashboard.use('/', Container.get(ProjectTimesController).router());
|
||||||
|
|
||||||
dashboard.use('/', Container.get(WarehousesItemController).router());
|
dashboard.use('/', Container.get(WarehousesItemController).router());
|
||||||
|
|
||||||
dashboard.use('/dashboard', Container.get(DashboardController).router());
|
dashboard.use('/dashboard', Container.get(DashboardController).router());
|
||||||
|
|||||||
29
packages/server/src/api/middleware/SubscriptionMiddleware.ts
Normal file
29
packages/server/src/api/middleware/SubscriptionMiddleware.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { Container } from 'typedi';
|
||||||
|
import { Request, Response, NextFunction } from 'express';
|
||||||
|
|
||||||
|
export default (subscriptionSlug = 'main') =>
|
||||||
|
async (req: Request, res: Response, next: NextFunction) => {
|
||||||
|
const { tenant, tenantId } = req;
|
||||||
|
const { subscriptionRepository } = Container.get('repositories');
|
||||||
|
|
||||||
|
if (!tenant) {
|
||||||
|
throw new Error('Should load `TenancyMiddlware` before this middleware.');
|
||||||
|
}
|
||||||
|
const subscription = await subscriptionRepository.getBySlugInTenant(
|
||||||
|
subscriptionSlug,
|
||||||
|
tenantId
|
||||||
|
);
|
||||||
|
// Validate in case there is no any already subscription.
|
||||||
|
if (!subscription) {
|
||||||
|
return res.boom.badRequest('Tenant has no subscription.', {
|
||||||
|
errors: [{ type: 'TENANT.HAS.NO.SUBSCRIPTION' }],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// Validate in case the subscription is inactive.
|
||||||
|
else if (subscription.inactive()) {
|
||||||
|
return res.boom.badRequest(null, {
|
||||||
|
errors: [{ type: 'ORGANIZATION.SUBSCRIPTION.INACTIVE' }],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { toInteger } from 'lodash';
|
import { defaultTo, toInteger } from 'lodash';
|
||||||
import { castCommaListEnvVarToArray, parseBoolean } from '@/utils';
|
import { castCommaListEnvVarToArray, parseBoolean } from '@/utils';
|
||||||
|
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
@@ -55,7 +55,7 @@ module.exports = {
|
|||||||
mail: {
|
mail: {
|
||||||
host: process.env.MAIL_HOST,
|
host: process.env.MAIL_HOST,
|
||||||
port: process.env.MAIL_PORT,
|
port: process.env.MAIL_PORT,
|
||||||
secure: !!parseInt(process.env.MAIL_SECURE, 10),
|
secure: parseBoolean(defaultTo(process.env.MAIL_SECURE, false), false),
|
||||||
username: process.env.MAIL_USERNAME,
|
username: process.env.MAIL_USERNAME,
|
||||||
password: process.env.MAIL_PASSWORD,
|
password: process.env.MAIL_PASSWORD,
|
||||||
from: process.env.MAIL_FROM_ADDRESS,
|
from: process.env.MAIL_FROM_ADDRESS,
|
||||||
@@ -153,6 +153,13 @@ module.exports = {
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sign-up email confirmation
|
||||||
|
*/
|
||||||
|
signupConfirmation: {
|
||||||
|
enabled: parseBoolean<boolean>(process.env.SIGNUP_EMAIL_CONFIRMATION, false),
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Puppeteer remote browserless connection.
|
* Puppeteer remote browserless connection.
|
||||||
*/
|
*/
|
||||||
@@ -180,6 +187,14 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bank Synchronization.
|
||||||
|
*/
|
||||||
|
bankSync: {
|
||||||
|
enabled: parseBoolean(defaultTo(process.env.BANKING_CONNECT, false), false),
|
||||||
|
provider: 'plaid',
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plaid.
|
* Plaid.
|
||||||
*/
|
*/
|
||||||
@@ -190,6 +205,24 @@ module.exports = {
|
|||||||
secretSandbox: process.env.PLAID_SECRET_SANDBOX,
|
secretSandbox: process.env.PLAID_SECRET_SANDBOX,
|
||||||
redirectSandBox: process.env.PLAID_SANDBOX_REDIRECT_URI,
|
redirectSandBox: process.env.PLAID_SANDBOX_REDIRECT_URI,
|
||||||
redirectDevelopment: process.env.PLAID_DEVELOPMENT_REDIRECT_URI,
|
redirectDevelopment: process.env.PLAID_DEVELOPMENT_REDIRECT_URI,
|
||||||
linkWebhook: process.env.PLAID_LINK_WEBHOOK
|
linkWebhook: process.env.PLAID_LINK_WEBHOOK,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lemon Squeezy.
|
||||||
|
*/
|
||||||
|
lemonSqueezy: {
|
||||||
|
key: process.env.LEMONSQUEEZY_API_KEY,
|
||||||
|
storeId: process.env.LEMONSQUEEZY_STORE_ID,
|
||||||
|
webhookSecret: process.env.LEMONSQUEEZY_WEBHOOK_SECRET,
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bigcapital (Cloud).
|
||||||
|
* NOTE: DO NOT CHANGE THIS OPTION OR ADD THIS ENV VAR.
|
||||||
|
*/
|
||||||
|
hostedOnBigcapitalCloud: parseBoolean(
|
||||||
|
defaultTo(process.env.HOSTED_ON_BIGCAPITAL_CLOUD, false),
|
||||||
|
false
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
export default class NotAllowedChangeSubscriptionPlan {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.name = "NotAllowedChangeSubscriptionPlan";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import NotAllowedChangeSubscriptionPlan from './NotAllowedChangeSubscriptionPlan';
|
||||||
import ServiceError from './ServiceError';
|
import ServiceError from './ServiceError';
|
||||||
import ServiceErrors from './ServiceErrors';
|
import ServiceErrors from './ServiceErrors';
|
||||||
import TenantAlreadyInitialized from './TenantAlreadyInitialized';
|
import TenantAlreadyInitialized from './TenantAlreadyInitialized';
|
||||||
@@ -6,6 +7,7 @@ import TenantDBAlreadyExists from './TenantDBAlreadyExists';
|
|||||||
import TenantDatabaseNotBuilt from './TenantDatabaseNotBuilt';
|
import TenantDatabaseNotBuilt from './TenantDatabaseNotBuilt';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
NotAllowedChangeSubscriptionPlan,
|
||||||
ServiceError,
|
ServiceError,
|
||||||
ServiceErrors,
|
ServiceErrors,
|
||||||
TenantAlreadyInitialized,
|
TenantAlreadyInitialized,
|
||||||
|
|||||||
@@ -66,16 +66,27 @@ export interface IAuthResetedPasswordEventPayload {
|
|||||||
password: string;
|
password: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface IAuthSendingResetPassword {
|
export interface IAuthSendingResetPassword {
|
||||||
user: ISystemUser,
|
user: ISystemUser;
|
||||||
token: string;
|
token: string;
|
||||||
}
|
}
|
||||||
export interface IAuthSendedResetPassword {
|
export interface IAuthSendedResetPassword {
|
||||||
user: ISystemUser,
|
user: ISystemUser;
|
||||||
token: string;
|
token: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IAuthGetMetaPOJO {
|
export interface IAuthGetMetaPOJO {
|
||||||
signupDisabled: boolean;
|
signupDisabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IAuthSignUpVerifingEventPayload {
|
||||||
|
email: string;
|
||||||
|
verifyToken: string;
|
||||||
|
userId: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IAuthSignUpVerifiedEventPayload {
|
||||||
|
email: string;
|
||||||
|
verifyToken: string;
|
||||||
|
userId: number;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
export enum Features {
|
export enum Features {
|
||||||
WAREHOUSES = 'warehouses',
|
WAREHOUSES = 'warehouses',
|
||||||
BRANCHES = 'branches',
|
BRANCHES = 'branches',
|
||||||
|
BankSyncing = 'BankSyncing'
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IFeatureAllItem {
|
export interface IFeatureAllItem {
|
||||||
|
|||||||
@@ -126,13 +126,16 @@ export interface IModelMeta {
|
|||||||
defaultFilterField: string;
|
defaultFilterField: string;
|
||||||
defaultSort: IModelMetaDefaultSort;
|
defaultSort: IModelMetaDefaultSort;
|
||||||
|
|
||||||
importable?: boolean;
|
exportable?: boolean;
|
||||||
|
exportFlattenOn?: string;
|
||||||
|
|
||||||
|
importable?: boolean;
|
||||||
importAggregator?: string;
|
importAggregator?: string;
|
||||||
importAggregateOn?: string;
|
importAggregateOn?: string;
|
||||||
importAggregateBy?: string;
|
importAggregateBy?: string;
|
||||||
|
|
||||||
fields: { [key: string]: IModelMetaField };
|
fields: { [key: string]: IModelMetaField };
|
||||||
|
columns: { [key: string]: IModelMetaColumn };
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----
|
// ----
|
||||||
@@ -161,3 +164,22 @@ export type IModelMetaField2 = IModelMetaFieldCommon2 &
|
|||||||
| IModelMetaRelationField2
|
| IModelMetaRelationField2
|
||||||
| IModelMetaCollectionField
|
| IModelMetaCollectionField
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export interface ImodelMetaColumnMeta {
|
||||||
|
name: string;
|
||||||
|
accessor?: string;
|
||||||
|
exportable?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IModelMetaColumnText {
|
||||||
|
type: 'text;';
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IModelMetaColumnCollection {
|
||||||
|
type: 'collection';
|
||||||
|
collectionOf: 'object';
|
||||||
|
columns: { [key: string]: ImodelMetaColumnMeta & IModelMetaColumnText };
|
||||||
|
}
|
||||||
|
|
||||||
|
export type IModelMetaColumn = ImodelMetaColumnMeta &
|
||||||
|
(IModelMetaColumnText | IModelMetaColumnCollection);
|
||||||
|
|||||||
@@ -62,13 +62,13 @@ export default class MetableStore implements IMetableStore {
|
|||||||
* @param {String} key -
|
* @param {String} key -
|
||||||
* @param {Mixied} defaultValue -
|
* @param {Mixied} defaultValue -
|
||||||
*/
|
*/
|
||||||
get(query: string | IMetaQuery, defaultValue: any): any | false {
|
get(query: string | IMetaQuery, defaultValue: any): any | null {
|
||||||
const metadata = this.find(query);
|
const metadata = this.find(query);
|
||||||
return metadata
|
return metadata
|
||||||
? metadata.value
|
? metadata.value
|
||||||
: typeof defaultValue !== 'undefined'
|
: typeof defaultValue !== 'undefined'
|
||||||
? defaultValue
|
? defaultValue
|
||||||
: false;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -89,7 +89,10 @@ import { InvoiceChangeStatusOnMailSentSubscriber } from '@/services/Sales/Invoic
|
|||||||
import { SaleReceiptMarkClosedOnMailSentSubcriber } from '@/services/Sales/Receipts/subscribers/SaleReceiptMarkClosedOnMailSentSubcriber';
|
import { SaleReceiptMarkClosedOnMailSentSubcriber } from '@/services/Sales/Receipts/subscribers/SaleReceiptMarkClosedOnMailSentSubcriber';
|
||||||
import { SaleEstimateMarkApprovedOnMailSent } from '@/services/Sales/Estimates/subscribers/SaleEstimateMarkApprovedOnMailSent';
|
import { SaleEstimateMarkApprovedOnMailSent } from '@/services/Sales/Estimates/subscribers/SaleEstimateMarkApprovedOnMailSent';
|
||||||
import { DeleteCashflowTransactionOnUncategorize } from '@/services/Cashflow/subscribers/DeleteCashflowTransactionOnUncategorize';
|
import { DeleteCashflowTransactionOnUncategorize } from '@/services/Cashflow/subscribers/DeleteCashflowTransactionOnUncategorize';
|
||||||
import { PreventDeleteTransactionOnDelete } from '@/services/Cashflow/subscribers/PreventDeleteTransactionsOnDelete'; }
|
import { PreventDeleteTransactionOnDelete } from '@/services/Cashflow/subscribers/PreventDeleteTransactionsOnDelete';
|
||||||
|
import { SubscribeFreeOnSignupCommunity } from '@/services/Subscription/events/SubscribeFreeOnSignupCommunity';
|
||||||
|
import { SendVerfiyMailOnSignUp } from '@/services/Authentication/events/SendVerfiyMailOnSignUp';
|
||||||
|
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
return new EventPublisher();
|
return new EventPublisher();
|
||||||
@@ -218,6 +221,9 @@ export const susbcribers = () => {
|
|||||||
|
|
||||||
// Cashflow
|
// Cashflow
|
||||||
DeleteCashflowTransactionOnUncategorize,
|
DeleteCashflowTransactionOnUncategorize,
|
||||||
PreventDeleteTransactionOnDelete
|
PreventDeleteTransactionOnDelete,
|
||||||
|
|
||||||
|
SubscribeFreeOnSignupCommunity,
|
||||||
|
SendVerfiyMailOnSignUp
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -36,7 +36,13 @@ export default ({ app }) => {
|
|||||||
// Boom response objects.
|
// Boom response objects.
|
||||||
app.use(boom());
|
app.use(boom());
|
||||||
|
|
||||||
app.use(bodyParser.json());
|
app.use(
|
||||||
|
bodyParser.json({
|
||||||
|
verify: (req, res, buf) => {
|
||||||
|
req.rawBody = buf;
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
// Parses both json and urlencoded.
|
// Parses both json and urlencoded.
|
||||||
app.use(json());
|
app.use(json());
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { SaleReceiptMailNotificationJob } from '@/services/Sales/Receipts/SaleRe
|
|||||||
import { PaymentReceiveMailNotificationJob } from '@/services/Sales/PaymentReceives/PaymentReceiveMailNotificationJob';
|
import { PaymentReceiveMailNotificationJob } from '@/services/Sales/PaymentReceives/PaymentReceiveMailNotificationJob';
|
||||||
import { PlaidFetchTransactionsJob } from '@/services/Banking/Plaid/PlaidFetchTransactionsJob';
|
import { PlaidFetchTransactionsJob } from '@/services/Banking/Plaid/PlaidFetchTransactionsJob';
|
||||||
import { ImportDeleteExpiredFilesJobs } from '@/services/Import/jobs/ImportDeleteExpiredFilesJob';
|
import { ImportDeleteExpiredFilesJobs } from '@/services/Import/jobs/ImportDeleteExpiredFilesJob';
|
||||||
|
import { SendVerifyMailJob } from '@/services/Authentication/jobs/SendVerifyMailJob';
|
||||||
|
|
||||||
export default ({ agenda }: { agenda: Agenda }) => {
|
export default ({ agenda }: { agenda: Agenda }) => {
|
||||||
new ResetPasswordMailJob(agenda);
|
new ResetPasswordMailJob(agenda);
|
||||||
@@ -27,6 +28,7 @@ export default ({ agenda }: { agenda: Agenda }) => {
|
|||||||
new PaymentReceiveMailNotificationJob(agenda);
|
new PaymentReceiveMailNotificationJob(agenda);
|
||||||
new PlaidFetchTransactionsJob(agenda);
|
new PlaidFetchTransactionsJob(agenda);
|
||||||
new ImportDeleteExpiredFilesJobs(agenda);
|
new ImportDeleteExpiredFilesJobs(agenda);
|
||||||
|
new SendVerifyMailJob(agenda);
|
||||||
|
|
||||||
agenda.start().then(() => {
|
agenda.start().then(() => {
|
||||||
agenda.every('1 hours', 'delete-expired-imported-files', {});
|
agenda.every('1 hours', 'delete-expired-imported-files', {});
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import Container from 'typedi';
|
import Container from 'typedi';
|
||||||
import {
|
import {
|
||||||
SystemUserRepository,
|
SystemUserRepository,
|
||||||
|
SubscriptionRepository,
|
||||||
TenantRepository,
|
TenantRepository,
|
||||||
} from '@/system/repositories';
|
} from '@/system/repositories';
|
||||||
|
|
||||||
@@ -10,6 +11,7 @@ export default () => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
systemUserRepository: new SystemUserRepository(knex, cache),
|
systemUserRepository: new SystemUserRepository(knex, cache),
|
||||||
|
subscriptionRepository: new SubscriptionRepository(knex, cache),
|
||||||
tenantRepository: new TenantRepository(knex, cache),
|
tenantRepository: new TenantRepository(knex, cache),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ export default {
|
|||||||
sortField: 'name',
|
sortField: 'name',
|
||||||
},
|
},
|
||||||
importable: true,
|
importable: true,
|
||||||
|
exportable: true,
|
||||||
fields: {
|
fields: {
|
||||||
name: {
|
name: {
|
||||||
name: 'account.field.name',
|
name: 'account.field.name',
|
||||||
@@ -85,6 +86,55 @@ export default {
|
|||||||
fieldType: 'date',
|
fieldType: 'date',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
name: {
|
||||||
|
name: 'account.field.name',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
code: {
|
||||||
|
name: 'account.field.code',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
rootType: {
|
||||||
|
name: 'account.field.root_type',
|
||||||
|
type: 'text',
|
||||||
|
accessor: 'accountRootType',
|
||||||
|
},
|
||||||
|
accountType: {
|
||||||
|
name: 'account.field.type',
|
||||||
|
accessor: 'accountTypeLabel',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
accountNormal: {
|
||||||
|
name: 'account.field.normal',
|
||||||
|
accessor: 'accountNormalFormatted',
|
||||||
|
},
|
||||||
|
currencyCode: {
|
||||||
|
name: 'account.field.currency',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
bankBalance: {
|
||||||
|
name: 'account.field.bank_balance',
|
||||||
|
accessor: 'bankBalanceFormatted',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
balance: {
|
||||||
|
name: 'account.field.balance',
|
||||||
|
accessor: 'amount',
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
name: 'account.field.description',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
active: {
|
||||||
|
name: 'account.field.active',
|
||||||
|
type: 'boolean',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
name: 'account.field.created_at',
|
||||||
|
},
|
||||||
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
name: {
|
name: {
|
||||||
name: 'account.field.name',
|
name: 'account.field.name',
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ export default {
|
|||||||
sortField: 'bill_date',
|
sortField: 'bill_date',
|
||||||
},
|
},
|
||||||
importable: true,
|
importable: true,
|
||||||
|
exportFlattenOn: 'entries',
|
||||||
|
exportable: true,
|
||||||
importAggregator: 'group',
|
importAggregator: 'group',
|
||||||
importAggregateOn: 'entries',
|
importAggregateOn: 'entries',
|
||||||
importAggregateBy: 'billNumber',
|
importAggregateBy: 'billNumber',
|
||||||
@@ -80,6 +82,84 @@ export default {
|
|||||||
fieldType: 'date',
|
fieldType: 'date',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
billNumber: {
|
||||||
|
name: 'Bill No.',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
referenceNo: {
|
||||||
|
name: 'Reference No.',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
billDate: {
|
||||||
|
name: 'Date',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
dueDate: {
|
||||||
|
name: 'Due Date',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
vendorId: {
|
||||||
|
name: 'Vendor',
|
||||||
|
accessor: 'vendor.displayName',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'Amount',
|
||||||
|
accessor: 'formattedAmount',
|
||||||
|
},
|
||||||
|
exchangeRate: {
|
||||||
|
name: 'Exchange Rate',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
currencyCode: {
|
||||||
|
name: 'Currency Code',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
dueAmount: {
|
||||||
|
name: 'Due Amount',
|
||||||
|
accessor: 'formattedDueAmount',
|
||||||
|
},
|
||||||
|
paidAmount: {
|
||||||
|
name: 'Paid Amount',
|
||||||
|
accessor: 'formattedPaymentAmount',
|
||||||
|
},
|
||||||
|
note: {
|
||||||
|
name: 'Note',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
open: {
|
||||||
|
name: 'Open',
|
||||||
|
type: 'boolean',
|
||||||
|
},
|
||||||
|
entries: {
|
||||||
|
name: 'Entries',
|
||||||
|
accessor: 'entries',
|
||||||
|
type: 'collection',
|
||||||
|
collectionOf: 'object',
|
||||||
|
columns: {
|
||||||
|
itemName: {
|
||||||
|
name: 'Item Name',
|
||||||
|
accessor: 'item.name',
|
||||||
|
},
|
||||||
|
rate: {
|
||||||
|
name: 'Item Rate',
|
||||||
|
accessor: 'rateFormatted',
|
||||||
|
},
|
||||||
|
quantity: {
|
||||||
|
name: 'Item Quantity',
|
||||||
|
accessor: 'quantityFormatted',
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
name: 'Item Description',
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'Item Amount',
|
||||||
|
accessor: 'totalFormatted',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
billNumber: {
|
billNumber: {
|
||||||
name: 'Bill No.',
|
name: 'Bill No.',
|
||||||
@@ -132,7 +212,7 @@ export default {
|
|||||||
relationModel: 'Item',
|
relationModel: 'Item',
|
||||||
relationImportMatch: ['name', 'code'],
|
relationImportMatch: ['name', 'code'],
|
||||||
required: true,
|
required: true,
|
||||||
importHint: "Matches the item name or code."
|
importHint: 'Matches the item name or code.',
|
||||||
},
|
},
|
||||||
rate: {
|
rate: {
|
||||||
name: 'Rate',
|
name: 'Rate',
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ export default {
|
|||||||
sortOrder: 'DESC',
|
sortOrder: 'DESC',
|
||||||
sortField: 'bill_date',
|
sortField: 'bill_date',
|
||||||
},
|
},
|
||||||
|
exportable: true,
|
||||||
importable: true,
|
importable: true,
|
||||||
importAggregator: 'group',
|
importAggregator: 'group',
|
||||||
importAggregateOn: 'entries',
|
importAggregateOn: 'entries',
|
||||||
@@ -67,6 +68,46 @@ export default {
|
|||||||
fieldType: 'date',
|
fieldType: 'date',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
vendor: {
|
||||||
|
name: 'bill_payment.field.vendor',
|
||||||
|
type: 'relation',
|
||||||
|
accessor: 'vendor.displayName',
|
||||||
|
},
|
||||||
|
paymentDate: {
|
||||||
|
name: 'bill_payment.field.payment_date',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
paymentNumber: {
|
||||||
|
name: 'bill_payment.field.payment_number',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
paymentAccount: {
|
||||||
|
name: 'bill_payment.field.payment_account',
|
||||||
|
accessor: 'paymentAccount.name',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'Amount',
|
||||||
|
accessor: 'formattedAmount',
|
||||||
|
},
|
||||||
|
currencyCode: {
|
||||||
|
name: 'Currency Code',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
exchangeRate: {
|
||||||
|
name: 'bill_payment.field.exchange_rate',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
statement: {
|
||||||
|
name: 'bill_payment.field.note',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
reference: {
|
||||||
|
name: 'bill_payment.field.reference',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
vendorId: {
|
vendorId: {
|
||||||
name: 'bill_payment.field.vendor',
|
name: 'bill_payment.field.vendor',
|
||||||
@@ -84,7 +125,7 @@ export default {
|
|||||||
name: 'bill_payment.field.payment_number',
|
name: 'bill_payment.field.payment_number',
|
||||||
fieldType: 'text',
|
fieldType: 'text',
|
||||||
unique: true,
|
unique: true,
|
||||||
importHint: "The payment number should be unique."
|
importHint: 'The payment number should be unique.',
|
||||||
},
|
},
|
||||||
paymentAccountId: {
|
paymentAccountId: {
|
||||||
name: 'bill_payment.field.payment_account',
|
name: 'bill_payment.field.payment_account',
|
||||||
@@ -92,14 +133,14 @@ export default {
|
|||||||
relationModel: 'Account',
|
relationModel: 'Account',
|
||||||
relationImportMatch: ['name', 'code'],
|
relationImportMatch: ['name', 'code'],
|
||||||
required: true,
|
required: true,
|
||||||
importHint: "Matches the account name or code."
|
importHint: 'Matches the account name or code.',
|
||||||
},
|
},
|
||||||
exchangeRate: {
|
exchangeRate: {
|
||||||
name: 'bill_payment.field.exchange_rate',
|
name: 'bill_payment.field.exchange_rate',
|
||||||
fieldType: 'number',
|
fieldType: 'number',
|
||||||
},
|
},
|
||||||
statement: {
|
statement: {
|
||||||
name: 'bill_payment.field.statement',
|
name: 'bill_payment.field.note',
|
||||||
fieldType: 'text',
|
fieldType: 'text',
|
||||||
},
|
},
|
||||||
reference: {
|
reference: {
|
||||||
@@ -120,7 +161,7 @@ export default {
|
|||||||
relationModel: 'Bill',
|
relationModel: 'Bill',
|
||||||
relationImportMatch: 'billNumber',
|
relationImportMatch: 'billNumber',
|
||||||
required: true,
|
required: true,
|
||||||
importHint: "Matches the bill number."
|
importHint: 'Matches the bill number.',
|
||||||
},
|
},
|
||||||
paymentAmount: {
|
paymentAmount: {
|
||||||
name: 'bill_payment.field.entries.payment_amount',
|
name: 'bill_payment.field.entries.payment_amount',
|
||||||
|
|||||||
@@ -187,18 +187,4 @@ export default class Contact extends TenantModel {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static get fields() {
|
|
||||||
return {
|
|
||||||
contact_service: {
|
|
||||||
column: 'contact_service',
|
|
||||||
},
|
|
||||||
display_name: {
|
|
||||||
column: 'display_name',
|
|
||||||
},
|
|
||||||
created_at: {
|
|
||||||
column: 'created_at',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,14 @@ export default {
|
|||||||
sortOrder: 'DESC',
|
sortOrder: 'DESC',
|
||||||
sortField: 'name',
|
sortField: 'name',
|
||||||
},
|
},
|
||||||
|
exportable: true,
|
||||||
|
exportFlattenOn: 'entries',
|
||||||
|
|
||||||
importable: true,
|
importable: true,
|
||||||
importAggregator: 'group',
|
importAggregator: 'group',
|
||||||
importAggregateOn: 'entries',
|
importAggregateOn: 'entries',
|
||||||
importAggregateBy: 'creditNoteNumber',
|
importAggregateBy: 'creditNoteNumber',
|
||||||
|
|
||||||
fields: {
|
fields: {
|
||||||
customer: {
|
customer: {
|
||||||
name: 'credit_note.field.customer',
|
name: 'credit_note.field.customer',
|
||||||
@@ -81,6 +85,67 @@ export default {
|
|||||||
fieldType: 'date',
|
fieldType: 'date',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
customer: {
|
||||||
|
name: 'Customer',
|
||||||
|
type: 'relation',
|
||||||
|
accessor: 'customer.displayName',
|
||||||
|
},
|
||||||
|
exchangeRate: {
|
||||||
|
name: 'Exchange Rate',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
creditNoteDate: {
|
||||||
|
name: 'Credit Note Date',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
referenceNo: {
|
||||||
|
name: 'Reference No.',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
note: {
|
||||||
|
name: 'Note',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
termsConditions: {
|
||||||
|
name: 'Terms & Conditions',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
creditNoteNumber: {
|
||||||
|
name: 'Credit Note Number',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
open: {
|
||||||
|
name: 'Open',
|
||||||
|
type: 'boolean',
|
||||||
|
},
|
||||||
|
entries: {
|
||||||
|
name: 'Entries',
|
||||||
|
type: 'collection',
|
||||||
|
collectionOf: 'object',
|
||||||
|
columns: {
|
||||||
|
itemName: {
|
||||||
|
name: 'Item Name',
|
||||||
|
accessor: 'item.name',
|
||||||
|
},
|
||||||
|
rate: {
|
||||||
|
name: 'Item Rate',
|
||||||
|
accessor: 'rateFormatted',
|
||||||
|
},
|
||||||
|
quantity: {
|
||||||
|
name: 'Item Quantity',
|
||||||
|
accessor: 'quantityFormatted',
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
name: 'Item Description',
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'Item Amount',
|
||||||
|
accessor: 'totalFormatted',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
customerId: {
|
customerId: {
|
||||||
name: 'Customer',
|
name: 'Customer',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
importable: true,
|
importable: true,
|
||||||
|
exportable: true,
|
||||||
defaultFilterField: 'displayName',
|
defaultFilterField: 'displayName',
|
||||||
defaultSort: {
|
defaultSort: {
|
||||||
sortOrder: 'DESC',
|
sortOrder: 'DESC',
|
||||||
@@ -90,6 +91,138 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
firstName: {
|
||||||
|
name: 'vendor.field.first_name',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
lastName: {
|
||||||
|
name: 'vendor.field.last_name',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
displayName: {
|
||||||
|
name: 'vendor.field.display_name',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
email: {
|
||||||
|
name: 'vendor.field.email',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
workPhone: {
|
||||||
|
name: 'vendor.field.work_phone',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
personalPhone: {
|
||||||
|
name: 'vendor.field.personal_phone',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
companyName: {
|
||||||
|
name: 'vendor.field.company_name',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
website: {
|
||||||
|
name: 'vendor.field.website',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
balance: {
|
||||||
|
name: 'vendor.field.balance',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
openingBalance: {
|
||||||
|
name: 'vendor.field.opening_balance',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
openingBalanceAt: {
|
||||||
|
name: 'vendor.field.opening_balance_at',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
currencyCode: {
|
||||||
|
name: 'vendor.field.currency',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
status: {
|
||||||
|
name: 'vendor.field.status',
|
||||||
|
},
|
||||||
|
note: {
|
||||||
|
name: 'vendor.field.note',
|
||||||
|
},
|
||||||
|
// Billing Address
|
||||||
|
billingAddress1: {
|
||||||
|
name: 'Billing Address 1',
|
||||||
|
column: 'billing_address1',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
billingAddress2: {
|
||||||
|
name: 'Billing Address 2',
|
||||||
|
column: 'billing_address2',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
billingAddressCity: {
|
||||||
|
name: 'Billing Address City',
|
||||||
|
column: 'billing_address_city',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
billingAddressCountry: {
|
||||||
|
name: 'Billing Address Country',
|
||||||
|
column: 'billing_address_country',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
billingAddressPostcode: {
|
||||||
|
name: 'Billing Address Postcode',
|
||||||
|
column: 'billing_address_postcode',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
billingAddressState: {
|
||||||
|
name: 'Billing Address State',
|
||||||
|
column: 'billing_address_state',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
billingAddressPhone: {
|
||||||
|
name: 'Billing Address Phone',
|
||||||
|
column: 'billing_address_phone',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
// Shipping Address
|
||||||
|
shippingAddress1: {
|
||||||
|
name: 'Shipping Address 1',
|
||||||
|
column: 'shipping_address1',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
shippingAddress2: {
|
||||||
|
name: 'Shipping Address 2',
|
||||||
|
column: 'shipping_address2',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
shippingAddressCity: {
|
||||||
|
name: 'Shipping Address City',
|
||||||
|
column: 'shipping_address_city',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
shippingAddressCountry: {
|
||||||
|
name: 'Shipping Address Country',
|
||||||
|
column: 'shipping_address_country',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
shippingAddressPostcode: {
|
||||||
|
name: 'Shipping Address Postcode',
|
||||||
|
column: 'shipping_address_postcode',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
shippingAddressPhone: {
|
||||||
|
name: 'Shipping Address Phone',
|
||||||
|
column: 'shipping_address_phone',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
shippingAddressState: {
|
||||||
|
name: 'Shipping Address State',
|
||||||
|
column: 'shipping_address_state',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
name: 'vendor.field.created_at',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
customerType: {
|
customerType: {
|
||||||
name: 'Customer Type',
|
name: 'Customer Type',
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ export default {
|
|||||||
sortField: 'name',
|
sortField: 'name',
|
||||||
},
|
},
|
||||||
importable: true,
|
importable: true,
|
||||||
|
exportFlattenOn: 'categories',
|
||||||
|
exportable: true,
|
||||||
fields: {
|
fields: {
|
||||||
payment_date: {
|
payment_date: {
|
||||||
name: 'expense.field.payment_date',
|
name: 'expense.field.payment_date',
|
||||||
@@ -61,6 +63,56 @@ export default {
|
|||||||
fieldType: 'date',
|
fieldType: 'date',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
paymentReceive: {
|
||||||
|
name: 'expense.field.payment_account',
|
||||||
|
type: 'text',
|
||||||
|
accessor: 'paymentAccount.name'
|
||||||
|
},
|
||||||
|
referenceNo: {
|
||||||
|
name: 'expense.field.reference_no',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
paymentDate: {
|
||||||
|
name: 'expense.field.payment_date',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
currencyCode: {
|
||||||
|
name: 'expense.field.currency_code',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
exchangeRate: {
|
||||||
|
name: 'expense.field.exchange_rate',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
name: 'expense.field.description',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
categories: {
|
||||||
|
name: 'expense.field.categories',
|
||||||
|
type: 'collection',
|
||||||
|
collectionOf: 'object',
|
||||||
|
columns: {
|
||||||
|
expenseAccount: {
|
||||||
|
name: 'expense.field.expense_account',
|
||||||
|
accessor: 'expenseAccount.name',
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'expense.field.amount',
|
||||||
|
accessor: 'amountFormatted',
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
name: 'expense.field.line_description',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
publish: {
|
||||||
|
name: 'expense.field.publish',
|
||||||
|
type: 'boolean',
|
||||||
|
},
|
||||||
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
paymentAccountId: {
|
paymentAccountId: {
|
||||||
name: 'expense.field.payment_account',
|
name: 'expense.field.payment_account',
|
||||||
@@ -68,7 +120,7 @@ export default {
|
|||||||
relationModel: 'Account',
|
relationModel: 'Account',
|
||||||
relationImportMatch: ['name', 'code'],
|
relationImportMatch: ['name', 'code'],
|
||||||
required: true,
|
required: true,
|
||||||
importHint: "Matches the account name or code."
|
importHint: 'Matches the account name or code.',
|
||||||
},
|
},
|
||||||
referenceNo: {
|
referenceNo: {
|
||||||
name: 'expense.field.reference_no',
|
name: 'expense.field.reference_no',
|
||||||
@@ -102,7 +154,7 @@ export default {
|
|||||||
relationModel: 'Account',
|
relationModel: 'Account',
|
||||||
relationImportMatch: ['name', 'code'],
|
relationImportMatch: ['name', 'code'],
|
||||||
required: true,
|
required: true,
|
||||||
importHint: "Matches the account name or code."
|
importHint: 'Matches the account name or code.',
|
||||||
},
|
},
|
||||||
amount: {
|
amount: {
|
||||||
name: 'expense.field.amount',
|
name: 'expense.field.amount',
|
||||||
|
|||||||
@@ -4,6 +4,54 @@ export default {
|
|||||||
sortOrder: 'DESC',
|
sortOrder: 'DESC',
|
||||||
sortField: 'date',
|
sortField: 'date',
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
date: {
|
||||||
|
name: 'inventory_adjustment.field.date',
|
||||||
|
column: 'date',
|
||||||
|
fieldType: 'date',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
name: 'inventory_adjustment.field.type',
|
||||||
|
column: 'type',
|
||||||
|
fieldType: 'enumeration',
|
||||||
|
options: [
|
||||||
|
{ key: 'increment', name: 'inventory_adjustment.field.type.increment' },
|
||||||
|
{ key: 'decrement', name: 'inventory_adjustment.field.type.decrement' },
|
||||||
|
],
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
adjustmentAccount: {
|
||||||
|
name: 'inventory_adjustment.field.adjustment_account',
|
||||||
|
type: 'adjustment_account_id',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
reason: {
|
||||||
|
name: 'inventory_adjustment.field.reason',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
referenceNo: {
|
||||||
|
name: 'inventory_adjustment.field.reference_no',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
name: 'inventory_adjustment.field.description',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
publishedAt: {
|
||||||
|
name: 'inventory_adjustment.field.published_at',
|
||||||
|
type: 'date',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
name: 'inventory_adjustment.field.created_at',
|
||||||
|
type: 'date',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
fields: {
|
fields: {
|
||||||
date: {
|
date: {
|
||||||
name: 'inventory_adjustment.field.date',
|
name: 'inventory_adjustment.field.date',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
importable: true,
|
importable: true,
|
||||||
|
exportable: true,
|
||||||
defaultFilterField: 'name',
|
defaultFilterField: 'name',
|
||||||
defaultSort: {
|
defaultSort: {
|
||||||
sortField: 'name',
|
sortField: 'name',
|
||||||
@@ -121,6 +122,97 @@ export default {
|
|||||||
fieldType: 'date',
|
fieldType: 'date',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
type: {
|
||||||
|
name: 'item.field.type',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
name: 'item.field.name',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
code: {
|
||||||
|
name: 'item.field.code',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
sellable: {
|
||||||
|
name: 'item.field.sellable',
|
||||||
|
type: 'boolean',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
purchasable: {
|
||||||
|
name: 'item.field.purchasable',
|
||||||
|
type: 'boolean',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
sellPrice: {
|
||||||
|
name: 'item.field.cost_price',
|
||||||
|
type: 'number',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
costPrice: {
|
||||||
|
name: 'item.field.cost_account',
|
||||||
|
type: 'number',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
costAccount: {
|
||||||
|
name: 'item.field.sell_account',
|
||||||
|
type: 'text',
|
||||||
|
accessor: 'costAccount.name',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
sellAccount: {
|
||||||
|
name: 'item.field.sell_description',
|
||||||
|
type: 'text',
|
||||||
|
accessor: 'sellAccount.name',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
inventoryAccount: {
|
||||||
|
name: 'item.field.inventory_account',
|
||||||
|
type: 'text',
|
||||||
|
accessor: 'inventoryAccount.name',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
sellDescription: {
|
||||||
|
name: 'Sell description',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
purchaseDescription: {
|
||||||
|
name: 'Purchase description',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
quantityOnHand: {
|
||||||
|
name: 'item.field.quantity_on_hand',
|
||||||
|
type: 'number',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
note: {
|
||||||
|
name: 'item.field.note',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
category: {
|
||||||
|
name: 'item.field.category',
|
||||||
|
type: 'text',
|
||||||
|
accessor: 'category.name',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
active: {
|
||||||
|
name: 'item.field.active',
|
||||||
|
fieldType: 'boolean',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
name: 'item.field.created_at',
|
||||||
|
type: 'date',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
type: {
|
type: {
|
||||||
name: 'item.field.type',
|
name: 'item.field.type',
|
||||||
@@ -195,7 +287,7 @@ export default {
|
|||||||
fieldType: 'relation',
|
fieldType: 'relation',
|
||||||
relationModel: 'ItemCategory',
|
relationModel: 'ItemCategory',
|
||||||
relationImportMatch: ['name'],
|
relationImportMatch: ['name'],
|
||||||
importHint: "Matches the category name."
|
importHint: 'Matches the category name.',
|
||||||
},
|
},
|
||||||
active: {
|
active: {
|
||||||
name: 'item.field.active',
|
name: 'item.field.active',
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export default {
|
|||||||
sortOrder: 'DESC',
|
sortOrder: 'DESC',
|
||||||
},
|
},
|
||||||
importable: true,
|
importable: true,
|
||||||
|
exportable: true,
|
||||||
fields: {
|
fields: {
|
||||||
name: {
|
name: {
|
||||||
name: 'item_category.field.name',
|
name: 'item_category.field.name',
|
||||||
@@ -28,6 +29,24 @@ export default {
|
|||||||
columnType: 'date',
|
columnType: 'date',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
name: {
|
||||||
|
name: 'item_category.field.name',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
name: 'item_category.field.description',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
count: {
|
||||||
|
name: 'item_category.field.count',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
name: 'item_category.field.created_at',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
name: {
|
name: {
|
||||||
name: 'item_category.field.name',
|
name: 'item_category.field.name',
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ export default {
|
|||||||
sortField: 'name',
|
sortField: 'name',
|
||||||
},
|
},
|
||||||
importable: true,
|
importable: true,
|
||||||
|
exportFlattenOn: 'entries',
|
||||||
|
|
||||||
|
exportable: true,
|
||||||
importAggregator: 'group',
|
importAggregator: 'group',
|
||||||
importAggregateOn: 'entries',
|
importAggregateOn: 'entries',
|
||||||
importAggregateBy: 'journalNumber',
|
importAggregateBy: 'journalNumber',
|
||||||
@@ -56,6 +59,76 @@ export default {
|
|||||||
fieldType: 'date',
|
fieldType: 'date',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
date: {
|
||||||
|
name: 'manual_journal.field.date',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
journalNumber: {
|
||||||
|
name: 'manual_journal.field.journal_number',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
reference: {
|
||||||
|
name: 'manual_journal.field.reference',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
journalType: {
|
||||||
|
name: 'manual_journal.field.journal_type',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'Amount',
|
||||||
|
accessor: 'formattedAmount',
|
||||||
|
},
|
||||||
|
currencyCode: {
|
||||||
|
name: 'manual_journal.field.currency',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
exchangeRate: {
|
||||||
|
name: 'manual_journal.field.exchange_rate',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
name: 'manual_journal.field.description',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
entries: {
|
||||||
|
name: 'Entries',
|
||||||
|
type: 'collection',
|
||||||
|
collectionOf: 'object',
|
||||||
|
columns: {
|
||||||
|
credit: {
|
||||||
|
name: 'Credit',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
debit: {
|
||||||
|
name: 'Debit',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
account: {
|
||||||
|
name: 'Account',
|
||||||
|
accessor: 'account.name',
|
||||||
|
},
|
||||||
|
contact: {
|
||||||
|
name: 'Contact',
|
||||||
|
accessor: 'contact.displayName',
|
||||||
|
},
|
||||||
|
note: {
|
||||||
|
name: 'Note',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
publish: {
|
||||||
|
name: 'Publish',
|
||||||
|
type: 'boolean',
|
||||||
|
},
|
||||||
|
publishedAt: {
|
||||||
|
name: 'Published At',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
name: 'Created At',
|
||||||
|
},
|
||||||
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
date: {
|
date: {
|
||||||
name: 'manual_journal.field.date',
|
name: 'manual_journal.field.date',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
importable: true,
|
importable: true,
|
||||||
|
exportable: true,
|
||||||
importAggregator: 'group',
|
importAggregator: 'group',
|
||||||
importAggregateOn: 'entries',
|
importAggregateOn: 'entries',
|
||||||
importAggregateBy: 'paymentReceiveNo',
|
importAggregateBy: 'paymentReceiveNo',
|
||||||
@@ -57,6 +58,42 @@ export default {
|
|||||||
fieldDate: 'date',
|
fieldDate: 'date',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
customer: {
|
||||||
|
name: 'payment_receive.field.customer',
|
||||||
|
accessor: 'customer.displayName',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
paymentDate: {
|
||||||
|
name: 'payment_receive.field.payment_date',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'payment_receive.field.amount',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
referenceNo: {
|
||||||
|
name: 'payment_receive.field.reference_no',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
depositAccount: {
|
||||||
|
name: 'payment_receive.field.deposit_account',
|
||||||
|
accessor: 'depositAccount.name',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
paymentReceiveNo: {
|
||||||
|
name: 'payment_receive.field.payment_receive_no',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
statement: {
|
||||||
|
name: 'payment_receive.field.statement',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
created_at: {
|
||||||
|
name: 'payment_receive.field.created_at',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
customerId: {
|
customerId: {
|
||||||
name: 'payment_receive.field.customer',
|
name: 'payment_receive.field.customer',
|
||||||
@@ -84,12 +121,12 @@ export default {
|
|||||||
relationModel: 'Account',
|
relationModel: 'Account',
|
||||||
relationImportMatch: ['name', 'code'],
|
relationImportMatch: ['name', 'code'],
|
||||||
required: true,
|
required: true,
|
||||||
importHint: "Matches the account name or code."
|
importHint: 'Matches the account name or code.',
|
||||||
},
|
},
|
||||||
paymentReceiveNo: {
|
paymentReceiveNo: {
|
||||||
name: 'payment_receive.field.payment_receive_no',
|
name: 'payment_receive.field.payment_receive_no',
|
||||||
fieldType: 'text',
|
fieldType: 'text',
|
||||||
importHint: "The payment number should be unique."
|
importHint: 'The payment number should be unique.',
|
||||||
},
|
},
|
||||||
statement: {
|
statement: {
|
||||||
name: 'payment_receive.field.statement',
|
name: 'payment_receive.field.statement',
|
||||||
@@ -108,7 +145,7 @@ export default {
|
|||||||
relationModel: 'SaleInvoice',
|
relationModel: 'SaleInvoice',
|
||||||
relationImportMatch: 'invoiceNo',
|
relationImportMatch: 'invoiceNo',
|
||||||
required: true,
|
required: true,
|
||||||
importHint: "Matches the invoice number."
|
importHint: 'Matches the invoice number.',
|
||||||
},
|
},
|
||||||
paymentAmount: {
|
paymentAmount: {
|
||||||
name: 'payment_receive.field.entries.payment_amount',
|
name: 'payment_receive.field.entries.payment_amount',
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ export default {
|
|||||||
sortOrder: 'DESC',
|
sortOrder: 'DESC',
|
||||||
sortField: 'estimate_date',
|
sortField: 'estimate_date',
|
||||||
},
|
},
|
||||||
|
exportable: true,
|
||||||
|
exportFlattenOn: 'entries',
|
||||||
|
|
||||||
importable: true,
|
importable: true,
|
||||||
importAggregator: 'group',
|
importAggregator: 'group',
|
||||||
importAggregateOn: 'entries',
|
importAggregateOn: 'entries',
|
||||||
@@ -73,6 +76,91 @@ export default {
|
|||||||
columnType: 'date',
|
columnType: 'date',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
customer: {
|
||||||
|
name: 'Customer',
|
||||||
|
type: 'text',
|
||||||
|
accessor: 'customer.displayName',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
estimateDate: {
|
||||||
|
name: 'Estimate Date',
|
||||||
|
type: 'date',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
expirationDate: {
|
||||||
|
name: 'Expiration Date',
|
||||||
|
type: 'date',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
estimateNumber: {
|
||||||
|
name: 'Estimate No.',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
reference: {
|
||||||
|
name: 'Reference No.',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'Amount',
|
||||||
|
accessor: 'formattedAmount',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
exchangeRate: {
|
||||||
|
name: 'Exchange Rate',
|
||||||
|
type: 'number',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
currencyCode: {
|
||||||
|
name: 'Currency',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
note: {
|
||||||
|
name: 'Note',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
termsConditions: {
|
||||||
|
name: 'Terms & Conditions',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
delivered: {
|
||||||
|
name: 'Delivered',
|
||||||
|
type: 'boolean',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
entries: {
|
||||||
|
name: 'Entries',
|
||||||
|
accessor: 'entries',
|
||||||
|
type: 'collection',
|
||||||
|
collectionOf: 'object',
|
||||||
|
columns: {
|
||||||
|
itemName: {
|
||||||
|
name: 'Item Name',
|
||||||
|
accessor: 'item.name',
|
||||||
|
},
|
||||||
|
rate: {
|
||||||
|
name: 'Item Rate',
|
||||||
|
accessor: 'rateFormatted',
|
||||||
|
},
|
||||||
|
quantity: {
|
||||||
|
name: 'Item Quantity',
|
||||||
|
accessor: 'quantityFormatted',
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
name: 'Item Description',
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'Item Amount',
|
||||||
|
accessor: 'totalFormatted',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
customerId: {
|
customerId: {
|
||||||
name: 'Customer',
|
name: 'Customer',
|
||||||
@@ -132,7 +220,7 @@ export default {
|
|||||||
relationModel: 'Item',
|
relationModel: 'Item',
|
||||||
relationImportMatch: ['name', 'code'],
|
relationImportMatch: ['name', 'code'],
|
||||||
required: true,
|
required: true,
|
||||||
importHint: "Matches the item name or code."
|
importHint: 'Matches the item name or code.',
|
||||||
},
|
},
|
||||||
rate: {
|
rate: {
|
||||||
name: 'invoice.field.rate',
|
name: 'invoice.field.rate',
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ export default {
|
|||||||
sortOrder: 'DESC',
|
sortOrder: 'DESC',
|
||||||
sortField: 'created_at',
|
sortField: 'created_at',
|
||||||
},
|
},
|
||||||
|
exportable: true,
|
||||||
|
exportFlattenOn: 'entries',
|
||||||
|
|
||||||
importable: true,
|
importable: true,
|
||||||
importAggregator: 'group',
|
importAggregator: 'group',
|
||||||
importAggregateOn: 'entries',
|
importAggregateOn: 'entries',
|
||||||
@@ -87,6 +90,89 @@ export default {
|
|||||||
fieldType: 'date',
|
fieldType: 'date',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
invoiceDate: {
|
||||||
|
name: 'invoice.field.invoice_date',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
dueDate: {
|
||||||
|
name: 'invoice.field.due_date',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
referenceNo: {
|
||||||
|
name: 'invoice.field.reference_no',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
invoiceNo: {
|
||||||
|
name: 'invoice.field.invoice_no',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
customer: {
|
||||||
|
name: 'invoice.field.customer',
|
||||||
|
type: 'text',
|
||||||
|
accessor: 'customer.displayName',
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'invoice.field.amount',
|
||||||
|
type: 'text',
|
||||||
|
accessor: 'balanceAmountFormatted',
|
||||||
|
},
|
||||||
|
exchangeRate: {
|
||||||
|
name: 'invoice.field.exchange_rate',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
currencyCode: {
|
||||||
|
name: 'invoice.field.currency',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
paidAmount: {
|
||||||
|
name: 'Paid Amount',
|
||||||
|
accessor: 'paymentAmountFormatted',
|
||||||
|
},
|
||||||
|
dueAmount: {
|
||||||
|
name: 'Due Amount',
|
||||||
|
accessor: 'dueAmountFormatted',
|
||||||
|
},
|
||||||
|
invoiceMessage: {
|
||||||
|
name: 'invoice.field.invoice_message',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
termsConditions: {
|
||||||
|
name: 'invoice.field.terms_conditions',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
delivered: {
|
||||||
|
name: 'invoice.field.delivered',
|
||||||
|
type: 'boolean',
|
||||||
|
},
|
||||||
|
entries: {
|
||||||
|
name: 'Entries',
|
||||||
|
accessor: 'entries',
|
||||||
|
type: 'collection',
|
||||||
|
collectionOf: 'object',
|
||||||
|
columns: {
|
||||||
|
itemName: {
|
||||||
|
name: 'Item Name',
|
||||||
|
accessor: 'item.name',
|
||||||
|
},
|
||||||
|
rate: {
|
||||||
|
name: 'Item Rate',
|
||||||
|
accessor: 'rateFormatted',
|
||||||
|
},
|
||||||
|
quantity: {
|
||||||
|
name: 'Item Quantity',
|
||||||
|
accessor: 'quantityFormatted',
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
name: 'Item Description',
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'Item Amount',
|
||||||
|
accessor: 'totalFormatted',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
invoiceDate: {
|
invoiceDate: {
|
||||||
name: 'invoice.field.invoice_date',
|
name: 'invoice.field.invoice_date',
|
||||||
@@ -142,7 +228,7 @@ export default {
|
|||||||
relationModel: 'Item',
|
relationModel: 'Item',
|
||||||
relationImportMatch: ['name', 'code'],
|
relationImportMatch: ['name', 'code'],
|
||||||
required: true,
|
required: true,
|
||||||
importHint: "Matches the item name or code."
|
importHint: 'Matches the item name or code.',
|
||||||
},
|
},
|
||||||
rate: {
|
rate: {
|
||||||
name: 'invoice.field.rate',
|
name: 'invoice.field.rate',
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ export default {
|
|||||||
sortOrder: 'DESC',
|
sortOrder: 'DESC',
|
||||||
sortField: 'created_at',
|
sortField: 'created_at',
|
||||||
},
|
},
|
||||||
|
exportable: true,
|
||||||
|
exportFlattenOn: 'entries',
|
||||||
|
|
||||||
importable: true,
|
importable: true,
|
||||||
importAggregator: 'group',
|
importAggregator: 'group',
|
||||||
importAggregateOn: 'entries',
|
importAggregateOn: 'entries',
|
||||||
@@ -77,6 +80,86 @@ export default {
|
|||||||
sortCustomQuery: StatusFieldSortQuery,
|
sortCustomQuery: StatusFieldSortQuery,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
amount: {
|
||||||
|
name: 'receipt.field.amount',
|
||||||
|
column: 'amount',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
depositAccount: {
|
||||||
|
name: 'receipt.field.deposit_account',
|
||||||
|
type: 'text',
|
||||||
|
accessor: 'depositAccount.name',
|
||||||
|
},
|
||||||
|
customer: {
|
||||||
|
name: 'receipt.field.customer',
|
||||||
|
type: 'text',
|
||||||
|
accessor: 'customer.displayName',
|
||||||
|
},
|
||||||
|
receiptDate: {
|
||||||
|
name: 'receipt.field.receipt_date',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
receiptNumber: {
|
||||||
|
name: 'receipt.field.receipt_number',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
referenceNo: {
|
||||||
|
name: 'receipt.field.reference_no',
|
||||||
|
column: 'reference_no',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
receiptMessage: {
|
||||||
|
name: 'receipt.field.receipt_message',
|
||||||
|
column: 'receipt_message',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
statement: {
|
||||||
|
name: 'receipt.field.statement',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
status: {
|
||||||
|
name: 'receipt.field.status',
|
||||||
|
type: 'enumeration',
|
||||||
|
options: [
|
||||||
|
{ key: 'draft', label: 'receipt.field.status.draft' },
|
||||||
|
{ key: 'closed', label: 'receipt.field.status.closed' },
|
||||||
|
],
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
entries: {
|
||||||
|
name: 'Entries',
|
||||||
|
accessor: 'entries',
|
||||||
|
type: 'collection',
|
||||||
|
collectionOf: 'object',
|
||||||
|
columns: {
|
||||||
|
itemName: {
|
||||||
|
name: 'Item Name',
|
||||||
|
accessor: 'item.name',
|
||||||
|
},
|
||||||
|
rate: {
|
||||||
|
name: 'Item Rate',
|
||||||
|
accessor: 'rateFormatted',
|
||||||
|
},
|
||||||
|
quantity: {
|
||||||
|
name: 'Item Quantity',
|
||||||
|
accessor: 'quantityFormatted',
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
name: 'Item Description',
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'Item Amount',
|
||||||
|
accessor: 'totalFormatted',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
name: 'receipt.field.created_at',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
receiptDate: {
|
receiptDate: {
|
||||||
name: 'Receipt Date',
|
name: 'Receipt Date',
|
||||||
@@ -126,7 +209,7 @@ export default {
|
|||||||
relationModel: 'Item',
|
relationModel: 'Item',
|
||||||
relationImportMatch: ['name', 'code'],
|
relationImportMatch: ['name', 'code'],
|
||||||
required: true,
|
required: true,
|
||||||
importHint: "Matches the item name or code."
|
importHint: 'Matches the item name or code.',
|
||||||
},
|
},
|
||||||
rate: {
|
rate: {
|
||||||
name: 'invoice.field.rate',
|
name: 'invoice.field.rate',
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export default {
|
|||||||
sortField: 'created_at',
|
sortField: 'created_at',
|
||||||
},
|
},
|
||||||
importable: true,
|
importable: true,
|
||||||
|
exportable: true,
|
||||||
fields: {
|
fields: {
|
||||||
first_name: {
|
first_name: {
|
||||||
name: 'vendor.field.first_name',
|
name: 'vendor.field.first_name',
|
||||||
@@ -32,7 +33,7 @@ export default {
|
|||||||
fieldType: 'text',
|
fieldType: 'text',
|
||||||
},
|
},
|
||||||
personal_phone: {
|
personal_phone: {
|
||||||
name: 'vendor.field.personal_pone',
|
name: 'vendor.field.personal_phone',
|
||||||
column: 'personal_phone',
|
column: 'personal_phone',
|
||||||
fieldType: 'text',
|
fieldType: 'text',
|
||||||
},
|
},
|
||||||
@@ -90,6 +91,154 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
firstName: {
|
||||||
|
name: 'vendor.field.first_name',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
lastName: {
|
||||||
|
name: 'vendor.field.last_name',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
displayName: {
|
||||||
|
name: 'vendor.field.display_name',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
email: {
|
||||||
|
name: 'vendor.field.email',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
workPhone: {
|
||||||
|
name: 'vendor.field.work_phone',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
personalPhone: {
|
||||||
|
name: 'vendor.field.personal_phone',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
companyName: {
|
||||||
|
name: 'vendor.field.company_name',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
website: {
|
||||||
|
name: 'vendor.field.website',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
balance: {
|
||||||
|
name: 'vendor.field.balance',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
openingBalance: {
|
||||||
|
name: 'vendor.field.opening_balance',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
openingBalanceAt: {
|
||||||
|
name: 'vendor.field.opening_balance_at',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
currencyCode: {
|
||||||
|
name: 'vendor.field.currency',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
status: {
|
||||||
|
name: 'vendor.field.status',
|
||||||
|
},
|
||||||
|
note: {
|
||||||
|
name: 'vendor.field.note',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
// Billing Address
|
||||||
|
billingAddress1: {
|
||||||
|
name: 'Billing Address 1',
|
||||||
|
column: 'billing_address1',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
billingAddress2: {
|
||||||
|
name: 'Billing Address 2',
|
||||||
|
column: 'billing_address2',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
billingAddressCity: {
|
||||||
|
name: 'Billing Address City',
|
||||||
|
column: 'billing_address_city',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
billingAddressCountry: {
|
||||||
|
name: 'Billing Address Country',
|
||||||
|
column: 'billing_address_country',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
billingAddressPostcode: {
|
||||||
|
name: 'Billing Address Postcode',
|
||||||
|
column: 'billing_address_postcode',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
billingAddressState: {
|
||||||
|
name: 'Billing Address State',
|
||||||
|
column: 'billing_address_state',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
billingAddressPhone: {
|
||||||
|
name: 'Billing Address Phone',
|
||||||
|
column: 'billing_address_phone',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
// Shipping Address
|
||||||
|
shippingAddress1: {
|
||||||
|
name: 'Shipping Address 1',
|
||||||
|
column: 'shipping_address1',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
shippingAddress2: {
|
||||||
|
name: 'Shipping Address 2',
|
||||||
|
column: 'shipping_address2',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
shippingAddressCity: {
|
||||||
|
name: 'Shipping Address City',
|
||||||
|
column: 'shipping_address_city',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
shippingAddressCountry: {
|
||||||
|
name: 'Shipping Address Country',
|
||||||
|
column: 'shipping_address_country',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
shippingAddressPostcode: {
|
||||||
|
name: 'Shipping Address Postcode',
|
||||||
|
column: 'shipping_address_postcode',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
shippingAddressState: {
|
||||||
|
name: 'Shipping Address State',
|
||||||
|
column: 'shipping_address_state',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
shippingAddressPhone: {
|
||||||
|
name: 'Shipping Address Phone',
|
||||||
|
column: 'shipping_address_phone',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
name: 'vendor.field.created_at',
|
||||||
|
type: 'date',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
firstName: {
|
firstName: {
|
||||||
name: 'vendor.field.first_name',
|
name: 'vendor.field.first_name',
|
||||||
|
|||||||
@@ -12,10 +12,14 @@ export default {
|
|||||||
sortOrder: 'DESC',
|
sortOrder: 'DESC',
|
||||||
sortField: 'name',
|
sortField: 'name',
|
||||||
},
|
},
|
||||||
|
exportable: true,
|
||||||
|
exportFlattenOn: 'entries',
|
||||||
|
|
||||||
importable: true,
|
importable: true,
|
||||||
importAggregator: 'group',
|
importAggregator: 'group',
|
||||||
importAggregateOn: 'entries',
|
importAggregateOn: 'entries',
|
||||||
importAggregateBy: 'vendorCreditNumber',
|
importAggregateBy: 'vendorCreditNumber',
|
||||||
|
|
||||||
fields: {
|
fields: {
|
||||||
vendor: {
|
vendor: {
|
||||||
name: 'vendor_credit.field.vendor',
|
name: 'vendor_credit.field.vendor',
|
||||||
@@ -76,6 +80,79 @@ export default {
|
|||||||
fieldType: 'date',
|
fieldType: 'date',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
vendorId: {
|
||||||
|
name: 'Vendor',
|
||||||
|
type: 'relation',
|
||||||
|
accessor: 'vendor.displayName',
|
||||||
|
},
|
||||||
|
exchangeRate: {
|
||||||
|
name: 'Echange Rate',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
vendorCreditNumber: {
|
||||||
|
name: 'Vendor Credit No.',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
referenceNo: {
|
||||||
|
name: 'Refernece No.',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
vendorCreditDate: {
|
||||||
|
name: 'Vendor Credit Date',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'Amount',
|
||||||
|
accessor: 'formattedAmount',
|
||||||
|
},
|
||||||
|
creditRemaining: {
|
||||||
|
name: 'Credits Remaining',
|
||||||
|
accessor: 'formattedCreditsRemaining',
|
||||||
|
},
|
||||||
|
refundedAmount: {
|
||||||
|
name: 'Refunded Amount',
|
||||||
|
accessor: 'refundedAmount',
|
||||||
|
},
|
||||||
|
invoicedAmount: {
|
||||||
|
name: 'Invoiced Amount',
|
||||||
|
accessor: 'formattedInvoicedAmount',
|
||||||
|
},
|
||||||
|
note: {
|
||||||
|
name: 'Note',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
open: {
|
||||||
|
name: 'Open',
|
||||||
|
type: 'boolean',
|
||||||
|
},
|
||||||
|
entries: {
|
||||||
|
name: 'Entries',
|
||||||
|
type: 'collection',
|
||||||
|
collectionOf: 'object',
|
||||||
|
columns: {
|
||||||
|
itemName: {
|
||||||
|
name: 'Item Name',
|
||||||
|
accessor: 'item.name',
|
||||||
|
},
|
||||||
|
rate: {
|
||||||
|
name: 'Item Rate',
|
||||||
|
accessor: 'rateFormatted',
|
||||||
|
},
|
||||||
|
quantity: {
|
||||||
|
name: 'Item Quantity',
|
||||||
|
accessor: 'quantityFormatted',
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
name: 'Item Description',
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'Item Amount',
|
||||||
|
accessor: 'totalFormatted',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
vendorId: {
|
vendorId: {
|
||||||
name: 'Vendor',
|
name: 'Vendor',
|
||||||
@@ -122,7 +199,7 @@ export default {
|
|||||||
relationModel: 'Item',
|
relationModel: 'Item',
|
||||||
relationImportMatch: ['name', 'code'],
|
relationImportMatch: ['name', 'code'],
|
||||||
required: true,
|
required: true,
|
||||||
importHint: "Matches the item name or code."
|
importHint: 'Matches the item name or code.',
|
||||||
},
|
},
|
||||||
rate: {
|
rate: {
|
||||||
name: 'Rate',
|
name: 'Rate',
|
||||||
|
|||||||
@@ -8,6 +8,34 @@ export default {
|
|||||||
sortField: 'name',
|
sortField: 'name',
|
||||||
sortOrder: 'DESC',
|
sortOrder: 'DESC',
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
date: {
|
||||||
|
name: 'warehouse_transfer.field.date',
|
||||||
|
type: 'date',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
transaction_number: {
|
||||||
|
name: 'warehouse_transfer.field.transaction_number',
|
||||||
|
type: 'text',
|
||||||
|
exportable: true,
|
||||||
|
},
|
||||||
|
status: {
|
||||||
|
name: 'warehouse_transfer.field.status',
|
||||||
|
fieldType: 'enumeration',
|
||||||
|
options: [
|
||||||
|
{ key: 'draft', label: 'Draft' },
|
||||||
|
{ key: 'in-transit', label: 'In Transit' },
|
||||||
|
{ key: 'transferred', label: 'Transferred' },
|
||||||
|
],
|
||||||
|
sortable: false,
|
||||||
|
},
|
||||||
|
created_at: {
|
||||||
|
name: 'warehouse_transfer.field.created_at',
|
||||||
|
column: 'created_at',
|
||||||
|
columnType: 'date',
|
||||||
|
fieldType: 'date',
|
||||||
|
},
|
||||||
|
},
|
||||||
fields: {
|
fields: {
|
||||||
date: {
|
date: {
|
||||||
name: 'warehouse_transfer.field.date',
|
name: 'warehouse_transfer.field.date',
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'reflect-metadata'; // We need this in order to use @Decorators
|
import 'reflect-metadata'; // We need this in order to use @Decorators
|
||||||
|
import 'newrelic';
|
||||||
import './before';
|
import './before';
|
||||||
import '@/config';
|
import '@/config';
|
||||||
|
|
||||||
|
|||||||
31
packages/server/src/services/Accounts/AccountsExportable.ts
Normal file
31
packages/server/src/services/Accounts/AccountsExportable.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { AccountsApplication } from './AccountsApplication';
|
||||||
|
import { Exportable } from '../Export/Exportable';
|
||||||
|
import { IAccountsFilter, IAccountsStructureType } from '@/interfaces';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class AccountsExportable extends Exportable {
|
||||||
|
@Inject()
|
||||||
|
private accountsApplication: AccountsApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the accounts data to exportable sheet.
|
||||||
|
* @param {number} tenantId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
public exportable(tenantId: number, query: IAccountsFilter) {
|
||||||
|
const parsedQuery = {
|
||||||
|
sortOrder: 'desc',
|
||||||
|
columnSortBy: 'created_at',
|
||||||
|
inactiveMode: false,
|
||||||
|
...query,
|
||||||
|
structure: IAccountsStructureType.Flat,
|
||||||
|
pageSize: 12000,
|
||||||
|
page: 1,
|
||||||
|
} as IAccountsFilter;
|
||||||
|
|
||||||
|
return this.accountsApplication
|
||||||
|
.getAccounts(tenantId, parsedQuery)
|
||||||
|
.then((output) => output.accounts);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { Inject, Service } from "typedi";
|
||||||
|
import { UploadDocument } from "./UploadDocument";
|
||||||
|
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class AttachmentsApplication {
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private uploadDocumentService: UploadDocument;
|
||||||
|
|
||||||
|
upload(data: any) {
|
||||||
|
return this.uploadDocumentService.upload(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
delete(attachmentId: string) {}
|
||||||
|
|
||||||
|
get(attachmentId: string) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
22
packages/server/src/services/Attachments/UploadDocument.ts
Normal file
22
packages/server/src/services/Attachments/UploadDocument.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { Service } from 'typedi';
|
||||||
|
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class UploadDocument {
|
||||||
|
// setting up s3 client
|
||||||
|
public s3 = new S3Client({
|
||||||
|
region: process.env.AWS_REGION,
|
||||||
|
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
||||||
|
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
||||||
|
});
|
||||||
|
|
||||||
|
async upload(data) {
|
||||||
|
const putObjectCommand = new PutObjectCommand({
|
||||||
|
Bucket: process.env.AWS_BUCKET,
|
||||||
|
Key: data.filename,
|
||||||
|
Body: await data.toBuffer(),
|
||||||
|
ContentType: data.mimetype,
|
||||||
|
});
|
||||||
|
await this.s3.send(putObjectCommand);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Service, Inject, Container } from 'typedi';
|
import { Service, Inject } from 'typedi';
|
||||||
import {
|
import {
|
||||||
IRegisterDTO,
|
IRegisterDTO,
|
||||||
ISystemUser,
|
ISystemUser,
|
||||||
@@ -9,6 +9,9 @@ import { AuthSigninService } from './AuthSignin';
|
|||||||
import { AuthSignupService } from './AuthSignup';
|
import { AuthSignupService } from './AuthSignup';
|
||||||
import { AuthSendResetPassword } from './AuthSendResetPassword';
|
import { AuthSendResetPassword } from './AuthSendResetPassword';
|
||||||
import { GetAuthMeta } from './GetAuthMeta';
|
import { GetAuthMeta } from './GetAuthMeta';
|
||||||
|
import { AuthSignupConfirmService } from './AuthSignupConfirm';
|
||||||
|
import { SystemUser } from '@/system/models';
|
||||||
|
import { AuthSignupConfirmResend } from './AuthSignupResend';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export default class AuthenticationApplication {
|
export default class AuthenticationApplication {
|
||||||
@@ -18,6 +21,12 @@ export default class AuthenticationApplication {
|
|||||||
@Inject()
|
@Inject()
|
||||||
private authSignupService: AuthSignupService;
|
private authSignupService: AuthSignupService;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private authSignupConfirmService: AuthSignupConfirmService;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private authSignUpConfirmResendService: AuthSignupConfirmResend;
|
||||||
|
|
||||||
@Inject()
|
@Inject()
|
||||||
private authResetPasswordService: AuthSendResetPassword;
|
private authResetPasswordService: AuthSendResetPassword;
|
||||||
|
|
||||||
@@ -44,6 +53,28 @@ export default class AuthenticationApplication {
|
|||||||
return this.authSignupService.signUp(signupDTO);
|
return this.authSignupService.signUp(signupDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verfying the provided user's email after signin-up.
|
||||||
|
* @param {string} email
|
||||||
|
* @param {string} token
|
||||||
|
* @returns {Promise<SystemUser>}
|
||||||
|
*/
|
||||||
|
public async signUpConfirm(
|
||||||
|
email: string,
|
||||||
|
token: string
|
||||||
|
): Promise<SystemUser> {
|
||||||
|
return this.authSignupConfirmService.signUpConfirm(email, token);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resends the confirmation email of the given system user.
|
||||||
|
* @param {number} userId - System user id.
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
public async signUpConfirmResend(userId: number) {
|
||||||
|
return this.authSignUpConfirmResendService.signUpConfirmResend(userId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates and retrieve password reset token for the given user email.
|
* Generates and retrieve password reset token for the given user email.
|
||||||
* @param {string} email
|
* @param {string} email
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { isEmpty, omit } from 'lodash';
|
import { defaultTo, isEmpty, omit } from 'lodash';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
import crypto from 'crypto';
|
||||||
import { ServiceError } from '@/exceptions';
|
import { ServiceError } from '@/exceptions';
|
||||||
import {
|
import {
|
||||||
IAuthSignedUpEventPayload,
|
IAuthSignedUpEventPayload,
|
||||||
@@ -42,6 +43,13 @@ export class AuthSignupService {
|
|||||||
|
|
||||||
const hashedPassword = await hashPassword(signupDTO.password);
|
const hashedPassword = await hashPassword(signupDTO.password);
|
||||||
|
|
||||||
|
const verifyTokenCrypto = crypto.randomBytes(64).toString('hex');
|
||||||
|
const verifiedEnabed = defaultTo(config.signupConfirmation.enabled, false);
|
||||||
|
const verifyToken = verifiedEnabed ? verifyTokenCrypto : '';
|
||||||
|
const verified = !verifiedEnabed;
|
||||||
|
|
||||||
|
const inviteAcceptedAt = moment().format('YYYY-MM-DD');
|
||||||
|
|
||||||
// Triggers signin up event.
|
// Triggers signin up event.
|
||||||
await this.eventPublisher.emitAsync(events.auth.signingUp, {
|
await this.eventPublisher.emitAsync(events.auth.signingUp, {
|
||||||
signupDTO,
|
signupDTO,
|
||||||
@@ -50,10 +58,12 @@ export class AuthSignupService {
|
|||||||
const tenant = await this.tenantsManager.createTenant();
|
const tenant = await this.tenantsManager.createTenant();
|
||||||
const registeredUser = await systemUserRepository.create({
|
const registeredUser = await systemUserRepository.create({
|
||||||
...omit(signupDTO, 'country'),
|
...omit(signupDTO, 'country'),
|
||||||
|
verifyToken,
|
||||||
|
verified,
|
||||||
active: true,
|
active: true,
|
||||||
password: hashedPassword,
|
password: hashedPassword,
|
||||||
tenantId: tenant.id,
|
tenantId: tenant.id,
|
||||||
inviteAcceptedAt: moment().format('YYYY-MM-DD'),
|
inviteAcceptedAt,
|
||||||
});
|
});
|
||||||
// Triggers signed up event.
|
// Triggers signed up event.
|
||||||
await this.eventPublisher.emitAsync(events.auth.signUp, {
|
await this.eventPublisher.emitAsync(events.auth.signUp, {
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { ServiceError } from '@/exceptions';
|
||||||
|
import { SystemUser } from '@/system/models';
|
||||||
|
import { ERRORS } from './_constants';
|
||||||
|
import { EventPublisher } from '@/lib/EventPublisher/EventPublisher';
|
||||||
|
import events from '@/subscribers/events';
|
||||||
|
import {
|
||||||
|
IAuthSignUpVerifiedEventPayload,
|
||||||
|
IAuthSignUpVerifingEventPayload,
|
||||||
|
} from '@/interfaces';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class AuthSignupConfirmService {
|
||||||
|
@Inject()
|
||||||
|
private eventPublisher: EventPublisher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies the provided user's email after signing-up.
|
||||||
|
* @throws {ServiceErrors}
|
||||||
|
* @param {IRegisterDTO} signupDTO
|
||||||
|
* @returns {Promise<ISystemUser>}
|
||||||
|
*/
|
||||||
|
public async signUpConfirm(
|
||||||
|
email: string,
|
||||||
|
verifyToken: string
|
||||||
|
): Promise<SystemUser> {
|
||||||
|
const foundUser = await SystemUser.query().findOne({ email, verifyToken });
|
||||||
|
|
||||||
|
if (!foundUser) {
|
||||||
|
throw new ServiceError(ERRORS.SIGNUP_CONFIRM_TOKEN_INVALID);
|
||||||
|
}
|
||||||
|
const userId = foundUser.id;
|
||||||
|
|
||||||
|
// Triggers `signUpConfirming` event.
|
||||||
|
await this.eventPublisher.emitAsync(events.auth.signUpConfirming, {
|
||||||
|
email,
|
||||||
|
verifyToken,
|
||||||
|
userId,
|
||||||
|
} as IAuthSignUpVerifingEventPayload);
|
||||||
|
|
||||||
|
const updatedUser = await SystemUser.query().patchAndFetchById(
|
||||||
|
foundUser.id,
|
||||||
|
{
|
||||||
|
verified: true,
|
||||||
|
verifyToken: '',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
// Triggers `signUpConfirmed` event.
|
||||||
|
await this.eventPublisher.emitAsync(events.auth.signUpConfirmed, {
|
||||||
|
email,
|
||||||
|
verifyToken,
|
||||||
|
userId,
|
||||||
|
} as IAuthSignUpVerifiedEventPayload);
|
||||||
|
|
||||||
|
return updatedUser as SystemUser;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { ServiceError } from '@/exceptions';
|
||||||
|
import { SystemUser } from '@/system/models';
|
||||||
|
import { ERRORS } from './_constants';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class AuthSignupConfirmResend {
|
||||||
|
@Inject('agenda')
|
||||||
|
private agenda: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resends the email confirmation of the given user.
|
||||||
|
* @param {number} userId - User ID.
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
public async signUpConfirmResend(userId: number) {
|
||||||
|
const user = await SystemUser.query().findById(userId).throwIfNotFound();
|
||||||
|
|
||||||
|
// Throw error if the user is already verified.
|
||||||
|
if (user.verified) {
|
||||||
|
throw new ServiceError(ERRORS.USER_ALREADY_VERIFIED);
|
||||||
|
}
|
||||||
|
// Throw error if the verification token is not exist.
|
||||||
|
if (!user.verifyToken) {
|
||||||
|
throw new ServiceError(ERRORS.USER_ALREADY_VERIFIED);
|
||||||
|
}
|
||||||
|
const payload = {
|
||||||
|
email: user.email,
|
||||||
|
token: user.verifyToken,
|
||||||
|
fullName: user.firstName,
|
||||||
|
};
|
||||||
|
await this.agenda.now('send-signup-verify-mail', payload);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,4 +33,33 @@ export default class AuthenticationMailMesssages {
|
|||||||
})
|
})
|
||||||
.send();
|
.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends signup verification mail.
|
||||||
|
* @param {string} email - Email address
|
||||||
|
* @param {string} fullName - User name.
|
||||||
|
* @param {string} token - Verification token.
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
public async sendSignupVerificationMail(
|
||||||
|
email: string,
|
||||||
|
fullName: string,
|
||||||
|
token: string
|
||||||
|
) {
|
||||||
|
const verifyUrl = `${config.baseURL}/auth/email_confirmation?token=${token}&email=${email}`;
|
||||||
|
|
||||||
|
await new Mail()
|
||||||
|
.setSubject('Bigcapital - Verify your email')
|
||||||
|
.setView('mail/SignupVerifyEmail.html')
|
||||||
|
.setTo(email)
|
||||||
|
.setAttachments([
|
||||||
|
{
|
||||||
|
filename: 'bigcapital.png',
|
||||||
|
path: `${global.__views_dir}/images/bigcapital.png`,
|
||||||
|
cid: 'bigcapital_logo',
|
||||||
|
},
|
||||||
|
])
|
||||||
|
.setData({ verifyUrl, fullName })
|
||||||
|
.send();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,6 @@ export const ERRORS = {
|
|||||||
EMAIL_EXISTS: 'EMAIL_EXISTS',
|
EMAIL_EXISTS: 'EMAIL_EXISTS',
|
||||||
SIGNUP_RESTRICTED_NOT_ALLOWED: 'SIGNUP_RESTRICTED_NOT_ALLOWED',
|
SIGNUP_RESTRICTED_NOT_ALLOWED: 'SIGNUP_RESTRICTED_NOT_ALLOWED',
|
||||||
SIGNUP_RESTRICTED: 'SIGNUP_RESTRICTED',
|
SIGNUP_RESTRICTED: 'SIGNUP_RESTRICTED',
|
||||||
|
SIGNUP_CONFIRM_TOKEN_INVALID: 'SIGNUP_CONFIRM_TOKEN_INVALID',
|
||||||
|
USER_ALREADY_VERIFIED: 'USER_ALREADY_VERIFIED',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import { IAuthSignedUpEventPayload } from '@/interfaces';
|
||||||
|
import events from '@/subscribers/events';
|
||||||
|
import { Inject } from 'typedi';
|
||||||
|
|
||||||
|
export class SendVerfiyMailOnSignUp {
|
||||||
|
@Inject('agenda')
|
||||||
|
private agenda: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attaches events with handles.
|
||||||
|
*/
|
||||||
|
public attach(bus) {
|
||||||
|
bus.subscribe(events.auth.signUp, this.handleSendVerifyMailOnSignup);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {ITaxRateEditedPayload} payload -
|
||||||
|
*/
|
||||||
|
private handleSendVerifyMailOnSignup = async ({
|
||||||
|
user,
|
||||||
|
}: IAuthSignedUpEventPayload) => {
|
||||||
|
const payload = {
|
||||||
|
email: user.email,
|
||||||
|
token: user.verifyToken,
|
||||||
|
fullName: user.firstName,
|
||||||
|
};
|
||||||
|
await this.agenda.now('send-signup-verify-mail', payload);
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import { Container } from 'typedi';
|
||||||
|
import AuthenticationMailMesssages from '@/services/Authentication/AuthenticationMailMessages';
|
||||||
|
|
||||||
|
export class SendVerifyMailJob {
|
||||||
|
/**
|
||||||
|
* Constructor method.
|
||||||
|
* @param {Agenda} agenda
|
||||||
|
*/
|
||||||
|
constructor(agenda) {
|
||||||
|
agenda.define(
|
||||||
|
'send-signup-verify-mail',
|
||||||
|
{ priority: 'high' },
|
||||||
|
this.handler.bind(this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle send welcome mail job.
|
||||||
|
* @param {Job} job
|
||||||
|
* @param {Function} done
|
||||||
|
*/
|
||||||
|
public async handler(job, done: Function): Promise<void> {
|
||||||
|
const { data } = job.attrs;
|
||||||
|
const { email, fullName, token } = data;
|
||||||
|
const authService = Container.get(AuthenticationMailMesssages);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await authService.sendSignupVerificationMail(email, fullName, token);
|
||||||
|
done();
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
done(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,10 +50,7 @@ export class CustomersApplication {
|
|||||||
* @param {ISystemUser} authorizedUser
|
* @param {ISystemUser} authorizedUser
|
||||||
* @returns {Promise<ICustomer>}
|
* @returns {Promise<ICustomer>}
|
||||||
*/
|
*/
|
||||||
public createCustomer = (
|
public createCustomer = (tenantId: number, customerDTO: ICustomerNewDTO) => {
|
||||||
tenantId: number,
|
|
||||||
customerDTO: ICustomerNewDTO,
|
|
||||||
) => {
|
|
||||||
return this.createCustomerService.createCustomer(tenantId, customerDTO);
|
return this.createCustomerService.createCustomer(tenantId, customerDTO);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { IItemsFilter } from '@/interfaces';
|
||||||
|
import { CustomersApplication } from './CustomersApplication';
|
||||||
|
import { Exportable } from '@/services/Export/Exportable';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class CustomersExportable extends Exportable {
|
||||||
|
@Inject()
|
||||||
|
private customersApplication: CustomersApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the accounts data to exportable sheet.
|
||||||
|
* @param {number} tenantId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
public exportable(tenantId: number, query: IItemsFilter) {
|
||||||
|
const parsedQuery = {
|
||||||
|
sortOrder: 'DESC',
|
||||||
|
columnSortBy: 'created_at',
|
||||||
|
page: 1,
|
||||||
|
...query,
|
||||||
|
pageSize: 12,
|
||||||
|
} as IItemsFilter;
|
||||||
|
|
||||||
|
return this.customersApplication
|
||||||
|
.getCustomers(tenantId, parsedQuery)
|
||||||
|
.then((output) => output.customers);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Inject, Service } from 'typedi';
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { Knex } from 'knex';
|
||||||
import {
|
import {
|
||||||
ISystemUser,
|
ISystemUser,
|
||||||
IVendorEditDTO,
|
IVendorEditDTO,
|
||||||
@@ -42,13 +43,9 @@ export class VendorsApplication {
|
|||||||
public createVendor = (
|
public createVendor = (
|
||||||
tenantId: number,
|
tenantId: number,
|
||||||
vendorDTO: IVendorNewDTO,
|
vendorDTO: IVendorNewDTO,
|
||||||
authorizedUser: ISystemUser
|
trx?: Knex.Transaction
|
||||||
) => {
|
) => {
|
||||||
return this.createVendorService.createVendor(
|
return this.createVendorService.createVendor(tenantId, vendorDTO, trx);
|
||||||
tenantId,
|
|
||||||
vendorDTO,
|
|
||||||
authorizedUser
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { IItemsFilter } from '@/interfaces';
|
||||||
|
import { Exportable } from '@/services/Export/Exportable';
|
||||||
|
import { VendorsApplication } from './VendorsApplication';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class VendorsExportable extends Exportable {
|
||||||
|
@Inject()
|
||||||
|
private vendorsApplication: VendorsApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the accounts data to exportable sheet.
|
||||||
|
* @param {number} tenantId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
public exportable(tenantId: number, query: IItemsFilter) {
|
||||||
|
const parsedQuery = {
|
||||||
|
sortOrder: 'DESC',
|
||||||
|
columnSortBy: 'created_at',
|
||||||
|
page: 1,
|
||||||
|
...query,
|
||||||
|
pageSize: 12,
|
||||||
|
} as IItemsFilter;
|
||||||
|
|
||||||
|
return this.vendorsApplication
|
||||||
|
.getVendors(tenantId, parsedQuery)
|
||||||
|
.then((output) => output.vendors);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
ICreditNoteCreatedPayload,
|
ICreditNoteCreatedPayload,
|
||||||
ICreditNoteCreatingPayload,
|
ICreditNoteCreatingPayload,
|
||||||
ICreditNoteNewDTO,
|
ICreditNoteNewDTO,
|
||||||
ISystemUser,
|
|
||||||
} from '@/interfaces';
|
} from '@/interfaces';
|
||||||
import HasTenancyService from '@/services/Tenancy/TenancyService';
|
import HasTenancyService from '@/services/Tenancy/TenancyService';
|
||||||
import ItemsEntriesService from '@/services/Items/ItemsEntriesService';
|
import ItemsEntriesService from '@/services/Items/ItemsEntriesService';
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { ICreditNotesQueryDTO } from '@/interfaces';
|
||||||
|
import { Exportable } from '@/services/Export/Exportable';
|
||||||
|
import ListCreditNotes from './ListCreditNotes';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class CreditNotesExportable extends Exportable {
|
||||||
|
@Inject()
|
||||||
|
private getCreditNotes: ListCreditNotes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the accounts data to exportable sheet.
|
||||||
|
* @param {number} tenantId -
|
||||||
|
* @param {IVendorCreditsQueryDTO} query -
|
||||||
|
* @returns {}
|
||||||
|
*/
|
||||||
|
public exportable(tenantId: number, query: ICreditNotesQueryDTO) {
|
||||||
|
const parsedQuery = {
|
||||||
|
sortOrder: 'desc',
|
||||||
|
columnSortBy: 'created_at',
|
||||||
|
...query,
|
||||||
|
page: 1,
|
||||||
|
pageSize: 12000,
|
||||||
|
} as ICreditNotesQueryDTO;
|
||||||
|
|
||||||
|
return this.getCreditNotes
|
||||||
|
.getCreditNotesList(tenantId, parsedQuery)
|
||||||
|
.then((output) => output.creditNotes);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -45,7 +45,7 @@ export default class ListCreditNotes extends BaseCreditNotes {
|
|||||||
);
|
);
|
||||||
const { results, pagination } = await CreditNote.query()
|
const { results, pagination } = await CreditNote.query()
|
||||||
.onBuild((builder) => {
|
.onBuild((builder) => {
|
||||||
builder.withGraphFetched('entries');
|
builder.withGraphFetched('entries.item');
|
||||||
builder.withGraphFetched('customer');
|
builder.withGraphFetched('customer');
|
||||||
dynamicFilter.buildQuery()(builder);
|
dynamicFilter.buildQuery()(builder);
|
||||||
})
|
})
|
||||||
|
|||||||
29
packages/server/src/services/Expenses/ExpensesExportable.ts
Normal file
29
packages/server/src/services/Expenses/ExpensesExportable.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { Exportable } from '../Export/Exportable';
|
||||||
|
import { IExpensesFilter } from '@/interfaces';
|
||||||
|
import { ExpensesApplication } from './ExpensesApplication';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class ExpensesExportable extends Exportable {
|
||||||
|
@Inject()
|
||||||
|
private expensesApplication: ExpensesApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the accounts data to exportable sheet.
|
||||||
|
* @param {number} tenantId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
public exportable(tenantId: number, query: IExpensesFilter) {
|
||||||
|
const parsedQuery = {
|
||||||
|
sortOrder: 'desc',
|
||||||
|
columnSortBy: 'created_at',
|
||||||
|
...query,
|
||||||
|
page: 1,
|
||||||
|
pageSize: 12000,
|
||||||
|
} as IExpensesFilter;
|
||||||
|
|
||||||
|
return this.expensesApplication
|
||||||
|
.getExpenses(tenantId, parsedQuery)
|
||||||
|
.then((output) => output.expenses);
|
||||||
|
}
|
||||||
|
}
|
||||||
17
packages/server/src/services/Export/ExportApplication.ts
Normal file
17
packages/server/src/services/Export/ExportApplication.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { ExportResourceService } from './ExportService';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class ExportApplication {
|
||||||
|
@Inject()
|
||||||
|
private exportResource: ExportResourceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exports the given resource to csv, xlsx or pdf format.
|
||||||
|
* @param {string} reosurce
|
||||||
|
* @param {string} format
|
||||||
|
*/
|
||||||
|
public export(tenantId: number, resource: string, format: string) {
|
||||||
|
return this.exportResource.export(tenantId, resource, format);
|
||||||
|
}
|
||||||
|
}
|
||||||
49
packages/server/src/services/Export/ExportRegistery.ts
Normal file
49
packages/server/src/services/Export/ExportRegistery.ts
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import { camelCase, upperFirst } from 'lodash';
|
||||||
|
import { Exportable } from './Exportable';
|
||||||
|
|
||||||
|
export class ExportableRegistry {
|
||||||
|
private static instance: ExportableRegistry;
|
||||||
|
private exportables: Record<string, Exportable>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor method.
|
||||||
|
*/
|
||||||
|
constructor() {
|
||||||
|
this.exportables = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets singleton instance of registry.
|
||||||
|
* @returns {ExportableRegistry}
|
||||||
|
*/
|
||||||
|
public static getInstance(): ExportableRegistry {
|
||||||
|
if (!ExportableRegistry.instance) {
|
||||||
|
ExportableRegistry.instance = new ExportableRegistry();
|
||||||
|
}
|
||||||
|
return ExportableRegistry.instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the given importable service.
|
||||||
|
* @param {string} resource
|
||||||
|
* @param {Exportable} importable
|
||||||
|
*/
|
||||||
|
public registerExportable(resource: string, importable: Exportable): void {
|
||||||
|
const _resource = this.sanitizeResourceName(resource);
|
||||||
|
this.exportables[_resource] = importable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the importable service instance of the given resource name.
|
||||||
|
* @param {string} name
|
||||||
|
* @returns {Exportable}
|
||||||
|
*/
|
||||||
|
public getExportable(name: string): Exportable {
|
||||||
|
const _name = this.sanitizeResourceName(name);
|
||||||
|
return this.exportables[_name];
|
||||||
|
}
|
||||||
|
|
||||||
|
private sanitizeResourceName(resource: string) {
|
||||||
|
return upperFirst(camelCase(resource));
|
||||||
|
}
|
||||||
|
}
|
||||||
72
packages/server/src/services/Export/ExportResources.ts
Normal file
72
packages/server/src/services/Export/ExportResources.ts
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
import Container, { Service } from 'typedi';
|
||||||
|
import { AccountsExportable } from '../Accounts/AccountsExportable';
|
||||||
|
import { ExportableRegistry } from './ExportRegistery';
|
||||||
|
import { ItemsExportable } from '../Items/ItemsExportable';
|
||||||
|
import { CustomersExportable } from '../Contacts/Customers/CustomersExportable';
|
||||||
|
import { VendorsExportable } from '../Contacts/Vendors/VendorsExportable';
|
||||||
|
import { ExpensesExportable } from '../Expenses/ExpensesExportable';
|
||||||
|
import { SaleInvoicesExportable } from '../Sales/Invoices/SaleInvoicesExportable';
|
||||||
|
import { SaleEstimatesExportable } from '../Sales/Estimates/SaleEstimatesExportable';
|
||||||
|
import { SaleReceiptsExportable } from '../Sales/Receipts/SaleReceiptsExportable';
|
||||||
|
import { BillsExportable } from '../Purchases/Bills/BillsExportable';
|
||||||
|
import { PaymentsReceivedExportable } from '../Sales/PaymentReceives/PaymentsReceivedExportable';
|
||||||
|
import { BillPaymentExportable } from '../Purchases/BillPayments/BillPaymentExportable';
|
||||||
|
import { ManualJournalsExportable } from '../ManualJournals/ManualJournalExportable';
|
||||||
|
import { CreditNotesExportable } from '../CreditNotes/CreditNotesExportable';
|
||||||
|
import { VendorCreditsExportable } from '../Purchases/VendorCredits/VendorCreditsExportable';
|
||||||
|
import { ItemCategoriesExportable } from '../ItemCategories/ItemCategoriesExportable';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class ExportableResources {
|
||||||
|
private static registry: ExportableRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Consttuctor method.
|
||||||
|
*/
|
||||||
|
constructor() {
|
||||||
|
this.boot();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Importable instances.
|
||||||
|
*/
|
||||||
|
private importables = [
|
||||||
|
{ resource: 'Account', exportable: AccountsExportable },
|
||||||
|
{ resource: 'Item', exportable: ItemsExportable },
|
||||||
|
{ resource: 'ItemCategory', exportable: ItemCategoriesExportable },
|
||||||
|
{ resource: 'Customer', exportable: CustomersExportable },
|
||||||
|
{ resource: 'Vendor', exportable: VendorsExportable },
|
||||||
|
{ resource: 'Expense', exportable: ExpensesExportable },
|
||||||
|
{ resource: 'SaleInvoice', exportable: SaleInvoicesExportable },
|
||||||
|
{ resource: 'SaleEstimate', exportable: SaleEstimatesExportable },
|
||||||
|
{ resource: 'SaleReceipt', exportable: SaleReceiptsExportable },
|
||||||
|
{ resource: 'Bill', exportable: BillsExportable },
|
||||||
|
{ resource: 'PaymentReceive', exportable: PaymentsReceivedExportable },
|
||||||
|
{ resource: 'BillPayment', exportable: BillPaymentExportable },
|
||||||
|
{ resource: 'ManualJournal', exportable: ManualJournalsExportable },
|
||||||
|
{ resource: 'CreditNote', exportable: CreditNotesExportable },
|
||||||
|
{ resource: 'VendorCredit', exportable: VendorCreditsExportable },
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public get registry() {
|
||||||
|
return ExportableResources.registry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boots all the registered importables.
|
||||||
|
*/
|
||||||
|
public boot() {
|
||||||
|
if (!ExportableResources.registry) {
|
||||||
|
const instance = ExportableRegistry.getInstance();
|
||||||
|
|
||||||
|
this.importables.forEach((importable) => {
|
||||||
|
const importableInstance = Container.get(importable.exportable);
|
||||||
|
instance.registerExportable(importable.resource, importableInstance);
|
||||||
|
});
|
||||||
|
ExportableResources.registry = instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
161
packages/server/src/services/Export/ExportService.ts
Normal file
161
packages/server/src/services/Export/ExportService.ts
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
import { Inject, Service } from 'typedi';
|
||||||
|
import xlsx from 'xlsx';
|
||||||
|
import * as R from 'ramda';
|
||||||
|
import { get } from 'lodash';
|
||||||
|
import { sanitizeResourceName } from '../Import/_utils';
|
||||||
|
import ResourceService from '../Resource/ResourceService';
|
||||||
|
import { ExportableResources } from './ExportResources';
|
||||||
|
import { ServiceError } from '@/exceptions';
|
||||||
|
import { Errors } from './common';
|
||||||
|
import { IModelMeta, IModelMetaColumn } from '@/interfaces';
|
||||||
|
import { flatDataCollections, getDataAccessor } from './utils';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class ExportResourceService {
|
||||||
|
@Inject()
|
||||||
|
private resourceService: ResourceService;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private exportableResources: ExportableResources;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exports the given resource data through csv, xlsx or pdf.
|
||||||
|
* @param {number} tenantId - Tenant id.
|
||||||
|
* @param {string} resourceName - Resource name.
|
||||||
|
* @param {string} format - File format.
|
||||||
|
*/
|
||||||
|
public async export(tenantId: number, resourceName: string, format: string = 'csv') {
|
||||||
|
const resource = sanitizeResourceName(resourceName);
|
||||||
|
const resourceMeta = this.getResourceMeta(tenantId, resource);
|
||||||
|
|
||||||
|
this.validateResourceMeta(resourceMeta);
|
||||||
|
|
||||||
|
const data = await this.getExportableData(tenantId, resource);
|
||||||
|
const transformed = this.transformExportedData(tenantId, resource, data);
|
||||||
|
const exportableColumns = this.getExportableColumns(resourceMeta);
|
||||||
|
const workbook = this.createWorkbook(transformed, exportableColumns);
|
||||||
|
|
||||||
|
return this.exportWorkbook(workbook, format);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves metadata for a specific resource.
|
||||||
|
* @param {number} tenantId - The tenant identifier.
|
||||||
|
* @param {string} resource - The name of the resource.
|
||||||
|
* @returns The metadata of the resource.
|
||||||
|
*/
|
||||||
|
private getResourceMeta(tenantId: number, resource: string) {
|
||||||
|
return this.resourceService.getResourceMeta(tenantId, resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates if the resource metadata is exportable.
|
||||||
|
* @param {any} resourceMeta - The metadata of the resource.
|
||||||
|
* @throws {ServiceError} If the resource is not exportable or lacks columns.
|
||||||
|
*/
|
||||||
|
private validateResourceMeta(resourceMeta: any) {
|
||||||
|
if (!resourceMeta.exportable || !resourceMeta.columns) {
|
||||||
|
throw new ServiceError(Errors.RESOURCE_NOT_EXPORTABLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transforms the exported data based on the resource metadata.
|
||||||
|
* If the resource metadata specifies a flattening attribute (`exportFlattenOn`),
|
||||||
|
* the data will be flattened based on this attribute using the `flatDataCollections` utility function.
|
||||||
|
*
|
||||||
|
* @param {number} tenantId - The tenant identifier.
|
||||||
|
* @param {string} resource - The name of the resource.
|
||||||
|
* @param {Array<Record<string, any>>} data - The original data to be transformed.
|
||||||
|
* @returns {Array<Record<string, any>>} - The transformed data.
|
||||||
|
*/
|
||||||
|
private transformExportedData(
|
||||||
|
tenantId: number,
|
||||||
|
resource: string,
|
||||||
|
data: Array<Record<string, any>>
|
||||||
|
): Array<Record<string, any>> {
|
||||||
|
const resourceMeta = this.getResourceMeta(tenantId, resource);
|
||||||
|
|
||||||
|
return R.when<Array<Record<string, any>>, Array<Record<string, any>>>(
|
||||||
|
R.always(Boolean(resourceMeta.exportFlattenOn)),
|
||||||
|
(data) => flatDataCollections(data, resourceMeta.exportFlattenOn),
|
||||||
|
data
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Fetches exportable data for a given resource.
|
||||||
|
* @param {number} tenantId - The tenant identifier.
|
||||||
|
* @param {string} resource - The name of the resource.
|
||||||
|
* @returns A promise that resolves to the exportable data.
|
||||||
|
*/
|
||||||
|
private async getExportableData(tenantId: number, resource: string) {
|
||||||
|
const exportable =
|
||||||
|
this.exportableResources.registry.getExportable(resource);
|
||||||
|
return exportable.exportable(tenantId, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts columns that are marked as exportable from the resource metadata.
|
||||||
|
* @param {IModelMeta} resourceMeta - The metadata of the resource.
|
||||||
|
* @returns An array of exportable columns.
|
||||||
|
*/
|
||||||
|
private getExportableColumns(resourceMeta: IModelMeta) {
|
||||||
|
const processColumns = (
|
||||||
|
columns: { [key: string]: IModelMetaColumn },
|
||||||
|
parent = ''
|
||||||
|
) => {
|
||||||
|
return Object.entries(columns)
|
||||||
|
.filter(([_, value]) => value.exportable !== false)
|
||||||
|
.flatMap(([key, value]) => {
|
||||||
|
if (value.type === 'collection' && value.collectionOf === 'object') {
|
||||||
|
return processColumns(value.columns, key);
|
||||||
|
} else {
|
||||||
|
const group = parent;
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
name: value.name,
|
||||||
|
type: value.type || 'text',
|
||||||
|
accessor: value.accessor || key,
|
||||||
|
group,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return processColumns(resourceMeta.columns);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a workbook from the provided data and columns.
|
||||||
|
* @param {any[]} data - The data to be included in the workbook.
|
||||||
|
* @param {any[]} exportableColumns - The columns to be included in the workbook.
|
||||||
|
* @returns The created workbook.
|
||||||
|
*/
|
||||||
|
private createWorkbook(data: any[], exportableColumns: any[]) {
|
||||||
|
const workbook = xlsx.utils.book_new();
|
||||||
|
const worksheetData = data.map((item) =>
|
||||||
|
exportableColumns.map((col) => get(item, getDataAccessor(col)))
|
||||||
|
);
|
||||||
|
|
||||||
|
worksheetData.unshift(exportableColumns.map((col) => col.name));
|
||||||
|
|
||||||
|
const worksheet = xlsx.utils.aoa_to_sheet(worksheetData);
|
||||||
|
xlsx.utils.book_append_sheet(workbook, worksheet, 'Exported Data');
|
||||||
|
|
||||||
|
return workbook;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exports the workbook in the specified format.
|
||||||
|
* @param {any} workbook - The workbook to be exported.
|
||||||
|
* @param {string} format - The format to export the workbook in.
|
||||||
|
* @returns The exported workbook data.
|
||||||
|
*/
|
||||||
|
private exportWorkbook(workbook: any, format: string) {
|
||||||
|
if (format.toLowerCase() === 'csv') {
|
||||||
|
return xlsx.write(workbook, { type: 'buffer', bookType: 'csv' });
|
||||||
|
} else if (format.toLowerCase() === 'xlsx') {
|
||||||
|
return xlsx.write(workbook, { type: 'buffer', bookType: 'xlsx' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
packages/server/src/services/Export/Exportable.ts
Normal file
22
packages/server/src/services/Export/Exportable.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
export class Exportable {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param tenantId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
public async exportable(
|
||||||
|
tenantId: number,
|
||||||
|
query: Record<string, any>
|
||||||
|
): Promise<Array<Record<string, any>>> {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
public transform(data: Record<string, any>) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
3
packages/server/src/services/Export/common.ts
Normal file
3
packages/server/src/services/Export/common.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export enum Errors {
|
||||||
|
RESOURCE_NOT_EXPORTABLE = 'RESOURCE_NOT_EXPORTABLE',
|
||||||
|
}
|
||||||
27
packages/server/src/services/Export/utils.ts
Normal file
27
packages/server/src/services/Export/utils.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import { flatMap } from 'lodash';
|
||||||
|
/**
|
||||||
|
* Flattens the data based on a specified attribute.
|
||||||
|
* @param data - The data to be flattened.
|
||||||
|
* @param flattenAttr - The attribute to be flattened.
|
||||||
|
* @returns - The flattened data.
|
||||||
|
*/
|
||||||
|
export const flatDataCollections = (
|
||||||
|
data: Record<string, any>,
|
||||||
|
flattenAttr: string
|
||||||
|
): Record<string, any>[] => {
|
||||||
|
return flatMap(data, (item) =>
|
||||||
|
item[flattenAttr].map((entry) => ({
|
||||||
|
...item,
|
||||||
|
[flattenAttr]: entry,
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the data accessor for a given column.
|
||||||
|
* @param col - The column to get the data accessor for.
|
||||||
|
* @returns - The data accessor.
|
||||||
|
*/
|
||||||
|
export const getDataAccessor = (col: any) => {
|
||||||
|
return col.group ? `${col.group}.${col.accessor}` : col.accessor;
|
||||||
|
};
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
import { defaultTo } from 'lodash';
|
|
||||||
import { Inject, Service } from 'typedi';
|
import { Inject, Service } from 'typedi';
|
||||||
import { omit } from 'lodash';
|
|
||||||
import { FeaturesSettingsDriver } from './FeaturesSettingsDriver';
|
import { FeaturesSettingsDriver } from './FeaturesSettingsDriver';
|
||||||
import { FeaturesConfigureManager } from './FeaturesConfigureManager';
|
|
||||||
import { IFeatureAllItem } from '@/interfaces';
|
import { IFeatureAllItem } from '@/interfaces';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
@@ -10,9 +7,6 @@ export class FeaturesManager {
|
|||||||
@Inject()
|
@Inject()
|
||||||
private drive: FeaturesSettingsDriver;
|
private drive: FeaturesSettingsDriver;
|
||||||
|
|
||||||
@Inject()
|
|
||||||
private configure: FeaturesConfigureManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns-on the given feature name.
|
* Turns-on the given feature name.
|
||||||
* @param {number} tenantId
|
* @param {number} tenantId
|
||||||
@@ -40,35 +34,15 @@ export class FeaturesManager {
|
|||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
public async accessible(tenantId: number, feature: string) {
|
public async accessible(tenantId: number, feature: string) {
|
||||||
// Retrieves the feature default accessible value.
|
return this.drive.accessible(tenantId, feature);
|
||||||
const defaultValue = this.configure.getFeatureConfigure(
|
|
||||||
feature,
|
|
||||||
'defaultValue'
|
|
||||||
);
|
|
||||||
const isAccessible = await this.drive.accessible(tenantId, feature);
|
|
||||||
|
|
||||||
return defaultTo(isAccessible, defaultValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the all features and their accessible value and default value.
|
* Retrieves the all features and their accessible value and default value.
|
||||||
* @param {number} tenantId
|
* @param {number} tenantId
|
||||||
* @returns
|
* @returns {Promise<IFeatureAllItem[]>}
|
||||||
*/
|
*/
|
||||||
public async all(tenantId: number): Promise<IFeatureAllItem[]> {
|
public async all(tenantId: number): Promise<IFeatureAllItem[]> {
|
||||||
const all = await this.drive.all(tenantId);
|
return this.drive.all(tenantId);
|
||||||
|
|
||||||
return all.map((feature: IFeatureAllItem) => {
|
|
||||||
const defaultAccessible = this.configure.getFeatureConfigure(
|
|
||||||
feature.name,
|
|
||||||
'defaultValue'
|
|
||||||
);
|
|
||||||
const isAccessible = feature.isAccessible;
|
|
||||||
|
|
||||||
return {
|
|
||||||
...feature,
|
|
||||||
isAccessible: defaultTo(isAccessible, defaultAccessible),
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,15 @@ import { Service, Inject } from 'typedi';
|
|||||||
import HasTenancyService from '@/services/Tenancy/TenancyService';
|
import HasTenancyService from '@/services/Tenancy/TenancyService';
|
||||||
import { FeaturesConfigure } from './constants';
|
import { FeaturesConfigure } from './constants';
|
||||||
import { IFeatureAllItem } from '@/interfaces';
|
import { IFeatureAllItem } from '@/interfaces';
|
||||||
|
import { FeaturesConfigureManager } from './FeaturesConfigureManager';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export class FeaturesSettingsDriver {
|
export class FeaturesSettingsDriver {
|
||||||
@Inject()
|
@Inject()
|
||||||
tenancy: HasTenancyService;
|
private tenancy: HasTenancyService;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private configure: FeaturesConfigureManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns-on the given feature name.
|
* Turns-on the given feature name.
|
||||||
@@ -41,7 +45,15 @@ export class FeaturesSettingsDriver {
|
|||||||
async accessible(tenantId: number, feature: string) {
|
async accessible(tenantId: number, feature: string) {
|
||||||
const settings = this.tenancy.settings(tenantId);
|
const settings = this.tenancy.settings(tenantId);
|
||||||
|
|
||||||
return !!settings.get({ group: 'features', key: feature });
|
const defaultValue = this.configure.getFeatureConfigure(
|
||||||
|
feature,
|
||||||
|
'defaultValue'
|
||||||
|
);
|
||||||
|
const settingValue = settings.get(
|
||||||
|
{ group: 'features', key: feature },
|
||||||
|
defaultValue
|
||||||
|
);
|
||||||
|
return settingValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { Features, IFeatureConfiugration } from '@/interfaces';
|
import { Features, IFeatureConfiugration } from '@/interfaces';
|
||||||
|
import config from '@/config';
|
||||||
|
import { defaultTo } from 'lodash';
|
||||||
|
|
||||||
export const FeaturesConfigure: IFeatureConfiugration[] = [
|
export const FeaturesConfigure: IFeatureConfiugration[] = [
|
||||||
{
|
{
|
||||||
@@ -9,4 +11,8 @@ export const FeaturesConfigure: IFeatureConfiugration[] = [
|
|||||||
name: Features.WAREHOUSES,
|
name: Features.WAREHOUSES,
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: Features.BankSyncing,
|
||||||
|
defaultValue: defaultTo(config.bankSync.enabled, false),
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ export class ImportFileUploadService {
|
|||||||
filename: string,
|
filename: string,
|
||||||
params: Record<string, number | string>
|
params: Record<string, number | string>
|
||||||
): Promise<ImportFileUploadPOJO> {
|
): Promise<ImportFileUploadPOJO> {
|
||||||
console.log(filename, 'filename');
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return await this.importUnhandled(
|
return await this.importUnhandled(
|
||||||
tenantId,
|
tenantId,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import moment from 'moment';
|
|||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
import { Knex } from 'knex';
|
import { Knex } from 'knex';
|
||||||
import fs from 'fs/promises';
|
import fs from 'fs/promises';
|
||||||
|
import path from 'path';
|
||||||
import {
|
import {
|
||||||
defaultTo,
|
defaultTo,
|
||||||
upperFirst,
|
upperFirst,
|
||||||
@@ -353,7 +354,6 @@ export const parseKey = R.curry(
|
|||||||
_key = `${fieldKey}`;
|
_key = `${fieldKey}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(_key);
|
|
||||||
return _key;
|
return _key;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -432,13 +432,19 @@ export const sanitizeSheetData = (json) => {
|
|||||||
export const getMapToPath = (to: string, group = '') =>
|
export const getMapToPath = (to: string, group = '') =>
|
||||||
group ? `${group}.${to}` : to;
|
group ? `${group}.${to}` : to;
|
||||||
|
|
||||||
|
export const getImportsStoragePath = () => {
|
||||||
|
return path.join(global.__storage_dir, `/imports`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the imported file from the storage and database.
|
* Deletes the imported file from the storage and database.
|
||||||
* @param {string} filename
|
* @param {string} filename
|
||||||
*/
|
*/
|
||||||
export const deleteImportFile = async (filename: string) => {
|
export const deleteImportFile = async (filename: string) => {
|
||||||
|
const filePath = getImportsStoragePath();
|
||||||
|
|
||||||
// Deletes the imported file.
|
// Deletes the imported file.
|
||||||
await fs.unlink(`public/imports/${filename}`);
|
await fs.unlink(`${filePath}/${filename}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -447,5 +453,7 @@ export const deleteImportFile = async (filename: string) => {
|
|||||||
* @returns {Promise<Buffer>}
|
* @returns {Promise<Buffer>}
|
||||||
*/
|
*/
|
||||||
export const readImportFile = (filename: string) => {
|
export const readImportFile = (filename: string) => {
|
||||||
return fs.readFile(`public/imports/${filename}`);
|
const filePath = getImportsStoragePath();
|
||||||
|
|
||||||
|
return fs.readFile(`${filePath}/${filename}`);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { Exportable } from '../Export/Exportable';
|
||||||
|
import { IAccountsFilter, IAccountsStructureType } from '@/interfaces';
|
||||||
|
import ItemCategoriesService from './ItemCategoriesService';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class ItemCategoriesExportable extends Exportable {
|
||||||
|
@Inject()
|
||||||
|
private itemCategoriesApplication: ItemCategoriesService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the accounts data to exportable sheet.
|
||||||
|
* @param {number} tenantId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
public exportable(tenantId: number, query: IAccountsFilter) {
|
||||||
|
const parsedQuery = {
|
||||||
|
sortOrder: 'desc',
|
||||||
|
columnSortBy: 'created_at',
|
||||||
|
inactiveMode: false,
|
||||||
|
...query,
|
||||||
|
structure: IAccountsStructureType.Flat,
|
||||||
|
} as IAccountsFilter;
|
||||||
|
|
||||||
|
return this.itemCategoriesApplication
|
||||||
|
.getItemCategoriesList(tenantId, parsedQuery, {})
|
||||||
|
.then((output) => output.itemCategories);
|
||||||
|
}
|
||||||
|
}
|
||||||
29
packages/server/src/services/Items/ItemsExportable.ts
Normal file
29
packages/server/src/services/Items/ItemsExportable.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { Exportable } from '../Export/Exportable';
|
||||||
|
import { IItemsFilter } from '@/interfaces';
|
||||||
|
import { ItemsApplication } from './ItemsApplication';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class ItemsExportable extends Exportable {
|
||||||
|
@Inject()
|
||||||
|
private itemsApplication: ItemsApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the accounts data to exportable sheet.
|
||||||
|
* @param {number} tenantId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
public exportable(tenantId: number, query: IItemsFilter) {
|
||||||
|
const parsedQuery = {
|
||||||
|
sortOrder: 'DESC',
|
||||||
|
columnSortBy: 'created_at',
|
||||||
|
page: 1,
|
||||||
|
...query,
|
||||||
|
pageSize: 12,
|
||||||
|
} as IItemsFilter;
|
||||||
|
|
||||||
|
return this.itemsApplication
|
||||||
|
.getItems(tenantId, parsedQuery)
|
||||||
|
.then((output) => output.items);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,7 +39,7 @@ export class GetManualJournals {
|
|||||||
tenantId: number,
|
tenantId: number,
|
||||||
filterDTO: IManualJournalsFilter
|
filterDTO: IManualJournalsFilter
|
||||||
): Promise<{
|
): Promise<{
|
||||||
manualJournals: IManualJournal;
|
manualJournals: IManualJournal[];
|
||||||
pagination: IPaginationMeta;
|
pagination: IPaginationMeta;
|
||||||
filterMeta: IFilterMeta;
|
filterMeta: IFilterMeta;
|
||||||
}> => {
|
}> => {
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { IManualJournalsFilter } from '@/interfaces';
|
||||||
|
import { Exportable } from '../Export/Exportable';
|
||||||
|
import { ManualJournalsApplication } from './ManualJournalsApplication';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class ManualJournalsExportable extends Exportable {
|
||||||
|
@Inject()
|
||||||
|
private manualJournalsApplication: ManualJournalsApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the manual journals data to exportable sheet.
|
||||||
|
* @param {number} tenantId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
public exportable(tenantId: number, query: IManualJournalsFilter) {
|
||||||
|
const parsedQuery = {
|
||||||
|
sortOrder: 'desc',
|
||||||
|
columnSortBy: 'created_at',
|
||||||
|
...query,
|
||||||
|
page: 1,
|
||||||
|
pageSize: 12000,
|
||||||
|
} as IManualJournalsFilter;
|
||||||
|
|
||||||
|
return this.manualJournalsApplication
|
||||||
|
.getManualJournals(tenantId, parsedQuery)
|
||||||
|
.then((output) => output.manualJournals);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -144,6 +144,7 @@ export default class OrganizationService {
|
|||||||
public async currentOrganization(tenantId: number): Promise<ITenant> {
|
public async currentOrganization(tenantId: number): Promise<ITenant> {
|
||||||
const tenant = await Tenant.query()
|
const tenant = await Tenant.query()
|
||||||
.findById(tenantId)
|
.findById(tenantId)
|
||||||
|
.withGraphFetched('subscriptions')
|
||||||
.withGraphFetched('metadata');
|
.withGraphFetched('metadata');
|
||||||
|
|
||||||
this.throwIfTenantNotExists(tenant);
|
this.throwIfTenantNotExists(tenant);
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { Exportable } from '@/services/Export/Exportable';
|
||||||
|
import { BillPaymentsApplication } from './BillPaymentsApplication';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class BillPaymentExportable extends Exportable {
|
||||||
|
@Inject()
|
||||||
|
private billPaymentsApplication: BillPaymentsApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the accounts data to exportable sheet.
|
||||||
|
* @param {number} tenantId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
public exportable(tenantId: number, query: any) {
|
||||||
|
const parsedQuery = {
|
||||||
|
page: 1,
|
||||||
|
pageSize: 12,
|
||||||
|
...query,
|
||||||
|
sortOrder: 'desc',
|
||||||
|
columnSortBy: 'created_at',
|
||||||
|
} as any;
|
||||||
|
|
||||||
|
return this.billPaymentsApplication
|
||||||
|
.getBillPayments(tenantId, parsedQuery)
|
||||||
|
.then((output) => output.billPayments);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,7 +31,7 @@ export class GetBillPayments {
|
|||||||
tenantId: number,
|
tenantId: number,
|
||||||
filterDTO: IBillPaymentsFilter
|
filterDTO: IBillPaymentsFilter
|
||||||
): Promise<{
|
): Promise<{
|
||||||
billPayments: IBillPayment;
|
billPayments: IBillPayment[];
|
||||||
pagination: IPaginationMeta;
|
pagination: IPaginationMeta;
|
||||||
filterMeta: IFilterMeta;
|
filterMeta: IFilterMeta;
|
||||||
}> {
|
}> {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user