mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-13 19:30:30 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9103b60653 | ||
|
|
7e5c6b6487 | ||
|
|
7abfa6a162 | ||
|
|
1372a1f0a8 | ||
|
|
571a332658 | ||
|
|
b44c318a5d | ||
|
|
bd9717f4dc | ||
|
|
f48aea8e5a | ||
|
|
0ac3a5dea9 |
@@ -25,6 +25,10 @@
|
||||
<img src="https://img.shields.io/twitter/follow/bigcapitalhq?style=social" alt="twitter" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://app.bigcapital.ly">Bigcapital Cloud</a>
|
||||
</p>
|
||||
</p>
|
||||
|
||||
# What's Bigcapital?
|
||||
|
||||
@@ -21,16 +21,12 @@ services:
|
||||
depends_on:
|
||||
- server
|
||||
- webapp
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: unless-stopped
|
||||
restart: on-failure
|
||||
|
||||
webapp:
|
||||
container_name: bigcapital-webapp
|
||||
image: ghcr.io/bigcapitalhq/webapp:latest
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: unless-stopped
|
||||
restart: on-failure
|
||||
|
||||
server:
|
||||
container_name: bigcapital-server
|
||||
@@ -45,9 +41,7 @@ services:
|
||||
- mysql
|
||||
- mongo
|
||||
- redis
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: unless-stopped
|
||||
restart: on-failure
|
||||
environment:
|
||||
# Mail
|
||||
- MAIL_HOST=${MAIL_HOST}
|
||||
@@ -92,6 +86,30 @@ services:
|
||||
- GOTENBERG_URL=${GOTENBERG_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:
|
||||
container_name: bigcapital-database-migration
|
||||
build:
|
||||
@@ -111,9 +129,7 @@ services:
|
||||
|
||||
mysql:
|
||||
container_name: bigcapital-mysql
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: unless-stopped
|
||||
restart: on-failure
|
||||
build:
|
||||
context: ./docker/mariadb
|
||||
environment:
|
||||
@@ -128,9 +144,7 @@ services:
|
||||
|
||||
mongo:
|
||||
container_name: bigcapital-mongo
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: unless-stopped
|
||||
restart: on-failure
|
||||
build: ./docker/mongo
|
||||
expose:
|
||||
- '27017'
|
||||
@@ -139,9 +153,7 @@ services:
|
||||
|
||||
redis:
|
||||
container_name: bigcapital-redis
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: unless-stopped
|
||||
restart: on-failure
|
||||
build:
|
||||
context: ./docker/redis
|
||||
expose:
|
||||
|
||||
@@ -78,6 +78,9 @@ ENV MAIL_HOST=$MAIL_HOST \
|
||||
SIGNUP_ALLOWED_DOMAINS=$SIGNUP_ALLOWED_DOMAINS \
|
||||
SIGNUP_ALLOWED_EMAILS=$SIGNUP_ALLOWED_EMAILS
|
||||
|
||||
# New Relic config file.
|
||||
ENV NEW_RELIC_NO_CONFIG_FILE=true
|
||||
|
||||
# Create app directory.
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
"mustache": "^3.0.3",
|
||||
"mysql": "^2.17.1",
|
||||
"mysql2": "^1.6.5",
|
||||
"newrelic": "^11.15.0",
|
||||
"node-cache": "^4.2.1",
|
||||
"nodemailer": "^6.3.0",
|
||||
"nodemon": "^1.19.1",
|
||||
|
||||
@@ -8,10 +8,10 @@ export default class DashboardMetaController {
|
||||
dashboardService: DashboardService;
|
||||
|
||||
/**
|
||||
*
|
||||
* Constructor router.
|
||||
* @returns
|
||||
*/
|
||||
router() {
|
||||
public router() {
|
||||
const router = Router();
|
||||
|
||||
router.get('/boot', this.getDashboardBoot);
|
||||
@@ -25,7 +25,7 @@ export default class DashboardMetaController {
|
||||
* @param {Response} res -
|
||||
* @param {NextFunction} next -
|
||||
*/
|
||||
getDashboardBoot = async (
|
||||
private getDashboardBoot = async (
|
||||
req: Request,
|
||||
res: Response,
|
||||
next: NextFunction
|
||||
|
||||
@@ -55,7 +55,7 @@ module.exports = {
|
||||
mail: {
|
||||
host: process.env.MAIL_HOST,
|
||||
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,
|
||||
password: process.env.MAIL_PASSWORD,
|
||||
from: process.env.MAIL_FROM_ADDRESS,
|
||||
@@ -180,6 +180,14 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Bank Synchronization.
|
||||
*/
|
||||
bankSync: {
|
||||
enabled: parseBoolean(defaultTo(process.env.BANKING_CONNECT, false), false),
|
||||
provider: 'plaid',
|
||||
},
|
||||
|
||||
/**
|
||||
* Plaid.
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export enum Features {
|
||||
WAREHOUSES = 'warehouses',
|
||||
BRANCHES = 'branches',
|
||||
BankSyncing = 'BankSyncing'
|
||||
}
|
||||
|
||||
export interface IFeatureAllItem {
|
||||
|
||||
@@ -62,13 +62,13 @@ export default class MetableStore implements IMetableStore {
|
||||
* @param {String} key -
|
||||
* @param {Mixied} defaultValue -
|
||||
*/
|
||||
get(query: string | IMetaQuery, defaultValue: any): any | false {
|
||||
get(query: string | IMetaQuery, defaultValue: any): any | null {
|
||||
const metadata = this.find(query);
|
||||
return metadata
|
||||
? metadata.value
|
||||
: typeof defaultValue !== 'undefined'
|
||||
? defaultValue
|
||||
: false;
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'reflect-metadata'; // We need this in order to use @Decorators
|
||||
import 'newrelic';
|
||||
import './before';
|
||||
import '@/config';
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { defaultTo } from 'lodash';
|
||||
import { Inject, Service } from 'typedi';
|
||||
import { omit } from 'lodash';
|
||||
import { FeaturesSettingsDriver } from './FeaturesSettingsDriver';
|
||||
import { FeaturesConfigureManager } from './FeaturesConfigureManager';
|
||||
import { IFeatureAllItem } from '@/interfaces';
|
||||
|
||||
@Service()
|
||||
@@ -10,9 +7,6 @@ export class FeaturesManager {
|
||||
@Inject()
|
||||
private drive: FeaturesSettingsDriver;
|
||||
|
||||
@Inject()
|
||||
private configure: FeaturesConfigureManager;
|
||||
|
||||
/**
|
||||
* Turns-on the given feature name.
|
||||
* @param {number} tenantId
|
||||
@@ -40,35 +34,15 @@ export class FeaturesManager {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
public async accessible(tenantId: number, feature: string) {
|
||||
// Retrieves the feature default accessible value.
|
||||
const defaultValue = this.configure.getFeatureConfigure(
|
||||
feature,
|
||||
'defaultValue'
|
||||
);
|
||||
const isAccessible = await this.drive.accessible(tenantId, feature);
|
||||
|
||||
return defaultTo(isAccessible, defaultValue);
|
||||
return this.drive.accessible(tenantId, feature);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the all features and their accessible value and default value.
|
||||
* @param {number} tenantId
|
||||
* @returns
|
||||
* @returns {Promise<IFeatureAllItem[]>}
|
||||
*/
|
||||
public async all(tenantId: number): Promise<IFeatureAllItem[]> {
|
||||
const all = await 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),
|
||||
};
|
||||
});
|
||||
return this.drive.all(tenantId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,15 @@ import { Service, Inject } from 'typedi';
|
||||
import HasTenancyService from '@/services/Tenancy/TenancyService';
|
||||
import { FeaturesConfigure } from './constants';
|
||||
import { IFeatureAllItem } from '@/interfaces';
|
||||
import { FeaturesConfigureManager } from './FeaturesConfigureManager';
|
||||
|
||||
@Service()
|
||||
export class FeaturesSettingsDriver {
|
||||
@Inject()
|
||||
tenancy: HasTenancyService;
|
||||
private tenancy: HasTenancyService;
|
||||
|
||||
@Inject()
|
||||
private configure: FeaturesConfigureManager;
|
||||
|
||||
/**
|
||||
* Turns-on the given feature name.
|
||||
@@ -41,7 +45,15 @@ export class FeaturesSettingsDriver {
|
||||
async accessible(tenantId: number, feature: string) {
|
||||
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 config from '@/config';
|
||||
import { defaultTo } from 'lodash';
|
||||
|
||||
export const FeaturesConfigure: IFeatureConfiugration[] = [
|
||||
{
|
||||
@@ -9,4 +11,8 @@ export const FeaturesConfigure: IFeatureConfiugration[] = [
|
||||
name: Features.WAREHOUSES,
|
||||
defaultValue: false,
|
||||
},
|
||||
{
|
||||
name: Features.BankSyncing,
|
||||
defaultValue: defaultTo(config.bankSync.enabled, false),
|
||||
}
|
||||
];
|
||||
|
||||
@@ -70,7 +70,7 @@ export class LemonSqueezyWebhooks {
|
||||
const variantId = attributes.variant_id as string;
|
||||
|
||||
// We assume that the Plan table is up to date.
|
||||
const plan = await Plan.query().findOne('slug', 'essentials-yearly');
|
||||
const plan = await Plan.query().findOne('slug', 'early-adaptor');
|
||||
|
||||
if (!plan) {
|
||||
throw new Error(`Plan with variantId ${variantId} not found.`);
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.seed.run({
|
||||
specific: 'seed_tenants_free_subscription.js',
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {};
|
||||
@@ -0,0 +1,26 @@
|
||||
exports.seed = (knex) => {
|
||||
// Deletes ALL existing entries
|
||||
return knex('subscription_plan_subscriptions')
|
||||
.then(async () => {
|
||||
const tenants = await knex('tenants');
|
||||
|
||||
for (const tenant of tenants) {
|
||||
const existingSubscription = await knex('subscription_plan_subscriptions')
|
||||
.where('tenantId', tenant.id)
|
||||
.first();
|
||||
|
||||
if (!existingSubscription) {
|
||||
const freePlan = await knex('subscription_plans').where('slug', 'free').first();
|
||||
|
||||
await knex('subscription_plan_subscriptions').insert({
|
||||
tenantId: tenant.id,
|
||||
planId: freePlan.id,
|
||||
slug: 'main',
|
||||
startsAt: knex.fn.now(),
|
||||
endsAt: null,
|
||||
createdAt: knex.fn.now(),
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
1
packages/server/storage/.gitignore
vendored
1
packages/server/storage/.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
*
|
||||
!pdf/
|
||||
!imports/
|
||||
!.gitignore
|
||||
2
packages/server/storage/imports/.gitignore
vendored
Normal file
2
packages/server/storage/imports/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -5,5 +5,6 @@ export const Features = {
|
||||
Warehouses: 'warehouses',
|
||||
Branches: 'branches',
|
||||
ManualJournal: 'manualJournal',
|
||||
Projects:'Projects'
|
||||
Projects:'Projects',
|
||||
BankSyncing: 'BankSyncing',
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
Can,
|
||||
Icon,
|
||||
FormattedMessage as T,
|
||||
FeatureCan,
|
||||
} from '@/components';
|
||||
import { useRefreshCashflowAccounts } from '@/hooks/query';
|
||||
import { CashflowAction, AbilitySubject } from '@/constants/abilityOption';
|
||||
@@ -21,7 +22,7 @@ import withCashflowAccountsTableActions from '../AccountTransactions/withCashflo
|
||||
|
||||
import { AccountDialogAction } from '@/containers/Dialogs/AccountDialog/utils';
|
||||
|
||||
import { ACCOUNT_TYPE } from '@/constants';
|
||||
import { ACCOUNT_TYPE, Features } from '@/constants';
|
||||
import { DialogsName } from '@/constants/dialogs';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
@@ -110,12 +111,14 @@ function CashFlowAccountsActionsBar({
|
||||
</NavbarGroup>
|
||||
|
||||
<NavbarGroup align={Alignment.RIGHT}>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
text={'Connect to Bank / Credit Card'}
|
||||
onClick={handleConnectToBank}
|
||||
/>
|
||||
<FeatureCan feature={Features.BankSyncing}>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
text={'Connect to Bank / Credit Card'}
|
||||
onClick={handleConnectToBank}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
</FeatureCan>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon="refresh-16" iconSize={14} />}
|
||||
|
||||
961
pnpm-lock.yaml
generated
961
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user