Skip to content

Commit

Permalink
feat(subscription-service): add billing functionality to subscription…
Browse files Browse the repository at this point in the history
… service

add billing functionality to subscription service

BREAKING CHANGE:
yes

gh-34
  • Loading branch information
Tyagi-Sunny committed Aug 5, 2024
1 parent 4e6356a commit 004c267
Show file tree
Hide file tree
Showing 23 changed files with 1,123 additions and 134 deletions.
179 changes: 59 additions & 120 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
'use strict';

let dbm;
let type;
let seed;
let fs = require('fs');
let path = require('path');
let Promise;

/**
* We receive the dbmigrate dependency from dbmigrate initially.
* This enables us to not have to rely on NODE_PATH.
*/
exports.setup = function (options, seedLink) {
dbm = options.dbmigrate;
type = dbm.dataType;
seed = seedLink;
Promise = options.Promise;
};

exports.up = function (db) {
let filePath = path.join(
__dirname,
'sqls',
'20240209122448-add-customer-table-up.sql',
);
return new Promise(function (resolve, reject) {
fs.readFile(filePath, {encoding: 'utf-8'}, function (err, data) {
if (err) return reject(err);
console.log('received data: ' + data);

resolve(data);
});
}).then(function (data) {
return db.runSql(data);
});
};

exports.down = function (db) {
let filePath = path.join(
__dirname,
'sqls',
'20240209122448-add-customer-table-down.sql',
);
return new Promise(function (resolve, reject) {
fs.readFile(filePath, {encoding: 'utf-8'}, function (err, data) {
if (err) return reject(err);
console.log('received data: ' + data);

resolve(data);
});
}).then(function (data) {
return db.runSql(data);
});
};

exports._meta = {
version: 1,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
drop table main.billing_customer;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CREATE TABLE main.billing_customer (
id uuid DEFAULT (md5(((random())::text || (clock_timestamp())::text)))::uuid NOT NULL , tenant_id uuid NOT NULL ,
customer_id VARCHAR(255) NOT NULL,
payment_source_id VARCHAR(255),
invoice_id VARCHAR(255),
invoice_status BOOLEAN,
created_on timestamptz DEFAULT CURRENT_TIMESTAMP NOT NULL ,
modified_on timestamptz DEFAULT CURRENT_TIMESTAMP NOT NULL ,
deleted boolean DEFAULT false NOT NULL ,
deleted_on timestamptz ,
deleted_by uuid ,
created_by uuid NOT NULL ,
modified_by uuid ,
);
3 changes: 2 additions & 1 deletion services/subscription-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
"loopback4-authorization": "^7.0.2",
"swagger-stats": "^0.99.5",
"symlink-resolver": "0.2.1",
"tslib": "^2.6.2"
"tslib": "^2.6.2",
"local-billing":"file:/home/sunny.tyagi/Desktop/billing-package/packages/billing/local-billing-0.0.1.tgz"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2",
Expand Down
Loading

0 comments on commit 004c267

Please sign in to comment.