mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
feat: wip Stripe connect integration
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @param { import("knex").Knex } knex
|
||||
* @returns { Promise<void> }
|
||||
*/
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.createTable('stripe_accounts', (table) => {
|
||||
table.increments('id').primary();
|
||||
table.string('stripe_account_id').notNullable();
|
||||
table.string('tenant_id').notNullable();
|
||||
table.timestamps(true, true); // Adds created_at and updated_at columns
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param { import("knex").Knex } knex
|
||||
* @returns { Promise<void> }
|
||||
*/
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.dropTableIfExists('stripe_accounts');
|
||||
};
|
||||
49
packages/server/src/system/models/StripeAccount.ts
Normal file
49
packages/server/src/system/models/StripeAccount.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { Model } from 'objection';
|
||||
|
||||
export class StripeAccount {
|
||||
/**
|
||||
* Table name
|
||||
*/
|
||||
static get tableName() {
|
||||
return 'stripe_accounts';
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamps columns.
|
||||
*/
|
||||
get timestamps() {
|
||||
return ['createdAt', 'updatedAt'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Virtual attributes.
|
||||
*/
|
||||
static get virtualAttributes() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Model modifiers.
|
||||
*/
|
||||
static get modifiers() {
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Relationship mapping.
|
||||
*/
|
||||
static get relationMappings() {
|
||||
const Tenant = require('./Tenant');
|
||||
|
||||
return {
|
||||
tenant: {
|
||||
relation: Model.BelongsToOneRelation,
|
||||
modelClass: Tenant.default,
|
||||
join: {
|
||||
from: 'stripe_accounts.tenant_id',
|
||||
to: 'tenants.id',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import PasswordReset from './PasswordReset';
|
||||
import Invite from './Invite';
|
||||
import SystemPlaidItem from './SystemPlaidItem';
|
||||
import { Import } from './Import';
|
||||
import { StripeAccount } from './StripeAccount';
|
||||
|
||||
export {
|
||||
Plan,
|
||||
@@ -18,4 +19,5 @@ export {
|
||||
Invite,
|
||||
SystemPlaidItem,
|
||||
Import,
|
||||
StripeAccount
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user