Compare commits

...

5 Commits

Author SHA1 Message Date
Ahmed Bouhuolia
1372a1f0a8 hotfix: fix the subscription plan when subscribe on cloud (#422) 2024-04-24 15:30:36 +02:00
Ahmed Bouhuolia
571a332658 Merge pull request #410 from bigcapitalhq/seed-free-subscription-to-tenants
feat: seed free subscription to tenants that have no subscription.
2024-04-19 09:36:35 +02:00
Ahmed Bouhuolia
b44c318a5d feat: seed free subscription to tenants that have no subscription. 2024-04-19 09:34:47 +02:00
Ahmed Bouhuolia
bd9717f4dc chore: Add Bigcapital Cloud link on README.md file 2024-04-17 19:51:05 +02:00
Ahmed Bouhuolia
f48aea8e5a feat: add the new env variables to docker compose 2024-04-17 19:21:35 +02:00
5 changed files with 50 additions and 19 deletions

View File

@@ -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?

View File

@@ -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,12 @@ services:
- GOTENBERG_URL=${GOTENBERG_URL}
- GOTENBERG_DOCS_URL=${GOTENBERG_DOCS_URL}
# 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}
database_migration:
container_name: bigcapital-database-migration
build:
@@ -111,9 +111,7 @@ services:
mysql:
container_name: bigcapital-mysql
deploy:
restart_policy:
condition: unless-stopped
restart: on-failure
build:
context: ./docker/mariadb
environment:
@@ -128,9 +126,7 @@ services:
mongo:
container_name: bigcapital-mongo
deploy:
restart_policy:
condition: unless-stopped
restart: on-failure
build: ./docker/mongo
expose:
- '27017'
@@ -139,9 +135,7 @@ services:
redis:
container_name: bigcapital-redis
deploy:
restart_policy:
condition: unless-stopped
restart: on-failure
build:
context: ./docker/redis
expose:

View File

@@ -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.`);

View File

@@ -0,0 +1,7 @@
exports.up = function (knex) {
return knex.seed.run({
specific: 'seed_tenants_free_subscription.js',
});
};
exports.down = function (knex) {};

View File

@@ -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(),
});
}
}
});
};