This repository has been archived by the owner on Jan 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(update) dockerfiles and products service
- Loading branch information
Showing
71 changed files
with
3,019 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
CREATE DATABASE accounting; | ||
CREATE DATABASE products; | ||
CREATE DATABASE ordering; | ||
CREATE DATABASE common; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,3 @@ RUN apk update | |
RUN apk add curl bash git | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
|
||
RUN npm install --production | ||
USER node |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// import { ex } from '~external/express'; | ||
// import { retrieveInvoiceController } from './bootstrap'; | ||
|
||
// ASSOC ROUTES | ||
// ex.route('invoices/:email').get(retrieveInvoiceController.handle); | ||
|
||
console.log('Express routes bootstrapped!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// import { nats } from '~external/nats'; | ||
// import { Client } from 'ts-nats'; | ||
// import { createInvoiceHandler, payInvoiceHandler } from './bootstrap'; | ||
|
||
// const bootstrapNats = async () => { | ||
// const client = (await nats) as Client; | ||
|
||
// ASSOC LISTENERS | ||
// client.subscribe(process.env.INVOICE_CREATE!, createInvoiceHandler.handle); | ||
// client.subscribe(process.env.INVOICE_PAY!, payInvoiceHandler.handle); | ||
// }; | ||
|
||
// bootstrapNats().then(() => console.log('Nats listeners bootstrapped!')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import './express'; | ||
import './queue'; |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
packages/accounting/db/connection.ts → packages/accounting/external/db/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import knex from 'knex'; | ||
import { options } from './knexfile'; | ||
|
||
export const connection = knex(options); | ||
export const database = knex(options); |
2 changes: 1 addition & 1 deletion
2
packages/accounting/db/knexfile.ts → packages/accounting/external/db/knexfile.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { database } from './index'; | ||
|
||
database.migrate | ||
.latest() | ||
.then(() => console.log('Migrated successfully')) | ||
.catch((err) => console.error('Error during migration', err)); |
5 changes: 2 additions & 3 deletions
5
...db/migrations/20200426145116_construct.js → ...db/migrations/20200426145116_construct.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
exports.up = async (db) => { | ||
await db.schema.createTable('accounts', (t) => { | ||
t.uuid('id').primary(); | ||
t.string('email'); | ||
t.string('email').primary(); | ||
t.string('password'); | ||
t.decimal('balance'); | ||
t.timestamp('created_at').defaultTo(db.fn.now()); | ||
}); | ||
}; | ||
|
||
exports.down = async (db) => db.schema.dropTable('accounts') | ||
exports.down = async (db) => db.schema.dropTable('accounts'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import express from 'express'; | ||
import morgan from 'morgan'; | ||
import compression from 'compression'; | ||
import bodyParser from 'body-parser'; | ||
import { Router } from 'express'; | ||
|
||
export const ex = Router(); | ||
|
||
const app = express(); | ||
|
||
app.use(bodyParser.json()); | ||
app.use(bodyParser.urlencoded({ extended: true })); | ||
app.use(compression()); | ||
app.use(morgan('combined')); | ||
|
||
// ROUTER | ||
app.use(ex); | ||
|
||
app.listen(3000, () => { | ||
console.log('Express server online!'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import got from 'got'; | ||
|
||
export class Fetcher { | ||
constructor() { | ||
Object.freeze(this); | ||
} | ||
|
||
static async get(url: string, searchParams?: { [key: string]: number | string }) { | ||
return got.get(url, { searchParams }); | ||
} | ||
static async post(url: string, body: { [key: string]: number | string } = {}) { | ||
return got.post(url, { body: JSON.stringify(body) }); | ||
} | ||
static async delete(url: string, searchParams?: { [key: string]: number | string }) { | ||
return got.delete(url, { searchParams }); | ||
} | ||
static async patch(url: string, body: { [key: string]: number | string } = {}) { | ||
return got.patch(url, { body: JSON.stringify(body) }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { connect, Payload } from 'ts-nats'; | ||
|
||
export const nats = connect({ | ||
payload: Payload.JSON, | ||
url: process.env.NATS_URL, | ||
}).then((client) => client); | ||
// .catch((err) => console.error('NATS connection error', err)); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,30 @@ | ||
{ | ||
"name": "accounts", | ||
"name": "accounting", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"main": "app/entrypoint.ts", | ||
"license": "MIT", | ||
"scripts": { | ||
"start": "ts-node-dev --files -r tsconfig-paths/register app/entrypoint.ts" | ||
}, | ||
"dependencies": { | ||
"ts-node-dev": "^1.0.0-pre.44" | ||
"@types/compression": "^1.7.0", | ||
"@types/express": "^4.17.6", | ||
"@types/morgan": "^1.9.0", | ||
"@types/node": "^13.13.2", | ||
"@types/uuid": "^7.0.3", | ||
"@types/validator": "^13.0.0", | ||
"body-parser": "^1.19.0", | ||
"compression": "^1.7.4", | ||
"express": "^4.17.1", | ||
"got": "^11.0.2", | ||
"knex": "^0.21.0", | ||
"morgan": "^1.10.0", | ||
"pg": "^8.0.3", | ||
"ts-nats": "^1.2.12", | ||
"ts-node": "^8.9.1", | ||
"ts-node-dev": "^1.0.0-pre.44", | ||
"tsconfig-paths": "^3.9.0", | ||
"uuid": "^7.0.3", | ||
"validator": "^13.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,3 @@ RUN apk update | |
RUN apk add curl bash git | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
|
||
RUN npm install --production | ||
USER node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,3 @@ RUN apk update | |
RUN apk add curl bash git | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
|
||
RUN npm install --production | ||
USER node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// import { ex } from '~external/express'; | ||
// import { retrieveInvoiceController } from './bootstrap'; | ||
|
||
// ASSOC ROUTES | ||
// ex.route('invoices/:email').get(retrieveInvoiceController.handle); | ||
|
||
console.log('Express routes bootstrapped!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// import { nats } from '~external/nats'; | ||
// import { Client } from 'ts-nats'; | ||
// import { createInvoiceHandler, payInvoiceHandler } from './bootstrap'; | ||
|
||
// const bootstrapNats = async () => { | ||
// const client = (await nats) as Client; | ||
|
||
// ASSOC LISTENERS | ||
// client.subscribe(process.env.INVOICE_CREATE!, createInvoiceHandler.handle); | ||
// client.subscribe(process.env.INVOICE_PAY!, payInvoiceHandler.handle); | ||
// }; | ||
|
||
// bootstrapNats().then(() => console.log('Nats listeners bootstrapped!')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import './express'; | ||
import './queue'; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.