GithubHelp home page GithubHelp logo

accounter-fullstack's Introduction

Node ES Modules with TypeScript

Latest Typescript and Node - as bare-bone as possible example app

I wanted to start a simple Node project where I can install the latest things I want and using as little compilation from Typescript as possible.

I remembered Node announced Node 13 support ESModules without experimental flags, checked out the official documentation but couldn't find a simple bare bone example, so maybe that would help someone.

I've committed the dist folder as well to see how the output from Typescript.

Would love suggestions on how to make it better or to point to a better example!

What I've done (so you can tell me what I should have done...)

Node

TypeScript

  • "module": "esnext": Make Typescript output ES Modules
  • "target": "es2020": Highest target (from 3.8.0-beta)

Run app

  1. Install latest Node (Notice that I've placed the engines field on package.json so try to make sure you have the exact version or simply delete it from package.json
  2. Install dependencies - yarn
  3. Compile with tsc -w and run Node with nodemon - yarn dev
  4. You can also use yarn compile and yarn start separately

Want to import from a commonjs package?

Here is a branch of the example with including a commonjs pacakge (pg):

https://github.com/Urigo/typescript-node-es-modules-example/commit/98304173e964713955be3a92b4e355a857376dca

The renovate.json file has nothing to do with the project itself. It's a file to activate RenovateBot to automatically PR this repository when a new version of any dependency of that project has been published

accounter-fullstack's People

Contributors

gilgardosh avatar urigo avatar renovate[bot] avatar tuvalsimha avatar dimamachina avatar dotansimha avatar renovate-bot avatar

Stargazers

 avatar Yassin Eldeeb avatar Daniel Starns avatar Jovi De Croock avatar Michael Staib avatar  avatar TheGuildBot avatar

Watchers

Liron Achdut avatar  avatar  avatar  avatar

accounter-fullstack's Issues

Add uuid to financial_accounts

currently the unique key is account_number (which is bank account number / credit card last 4 digits) - which is not unique as DB will scale, and theoretically can be changed.
we should add id column, to match other table conventions and avoid duplications

string to Date issue

not sure about the dates, I think new Date(09/10/2020) might have month-date mix.
need to double check that

Documents Table throw error (Prod DB)

{json: {…}} json: data: {documents: Array(1632)} errors: Array(1) 0: locations: Array(2) 0: column: 5 line: 107 [[Prototype]]: Object 1: column: 5 line: 128 [[Prototype]]: Object length: 2 [[Prototype]]: Array(0) message: "Unexpected error." path: Array(4) 0: "documents" 1: 1092 2: "amount" 3: "raw" length: 4 [[Prototype]]: Array(0) [[Prototype]]: Object length: 1 [[Prototype]]: Array(0) [[Prototype]]: Object [[Prototype]]: Object

Implement user system basics into DB

TABLE users {
  id   guid
  email  text
  auth0_user_id text
}

TABLE permissions {
  user_id references users.id
  resource_type "business" | "bank_account"
  resource_id text
  role "owner" | "writer" | "reader"
}

TABLE bank_accounts {
  id guid
  parent_business_id references business.id | null
}

TABLE business {
  id guid
}

migrate to Documents table

  • create documents table in the DB
  • add triggers to maintain data until migration completion
  • update new server logic to use new table
  • add logic to use email_invoice table as seed to documents

Create new UpdateButton, ConfirmButton

the current one uses the temp-server and doesn't match new schema conventions.

after creation, add here (./client/src/components/allCharges/cells/):

  • Entity
  • Description
  • Category
  • Vat
  • ShareWith

Enhance DB beneficiaries implementation

Rethink and implement better DB structure.

later-
update server resolvers:

  • Charge.beneficiaries
  • Mutations.updateCharge.beneficiaries

update client:

  • edit charge modal
  • all-charges view

Uri's view rejections

Issues:

  • selection requires touch (add null option, make default) #124

  • insert ledger failing #123

  • Charge tag suggestions not working on new design #125

  • vat is updating (from null to null), should be removed before mutation sent #126

  • cannot generate creditcard ledger automatically

  • add vat back, add amount to charge, use all_transactions currency for amount, vat, withholdingTax (edited only on amount) #128

  • temporary add account number & type to charge #121

  • No label for tags #125

  • insert/generate buttons are not available if no data #127

  • show insert ledger as card under the charge (so you can see charge details) #130

  • UI that shows charge data aside for update/insert forms #130

  • add credit/debit counterparties to documents table (and to UI insert/update) #131

  • unlink document from charge #129

  • link documents to charge flow+UI (can use test-server logic) #133

  • update email listener (on test-server) to use documents table

  • add trigger to update (and link) documents on insert to email_invoices

  • deb7012a-fcc5-4dff-9080-cb088996bdf2 move to crisp charge

  • slooooooowwww. paginate

  • local currency should default to ILS #142

  • insert ledger still not working #141

use the context of GraphQL

Basically:

  1. Define the interface for the GraphQL context type -> it should include anything related to data that you might need in your resolver. Don't put helper function and things like that. Only loaders, DB connection and everything you might need to mock one day as part of testing.
  2. Add that to the typescript-resolvers codegen plugin config, it's called contextType.
  3. Make sure to build the context object as part of GraphQL Yoga server creation (either by using useExtendContext plugin, or by using the context option of the Yoga server.
  4. Replace all direct imports to data sources / loaders and use context.something

use Account ID in DB

replace all_transactions.account_number with account_id (based on financial_accounts.id)
meaning - use the ID of account as identifier instead of account number - this to prevent future duplications.
also, update the functions feeding the table.

update suggestedTransaction function

logic should match new schema.
maybe logic should move to server?

after update, add here (./client/src/components/allCharges/cells/):

  • Entity
  • Description
  • Category
  • Vat
  • ShareWith

schema updates:

docs:

  • add uploading_financial_entity attribute
  • think about how to represent multiple relevant financial entities for each doc

Documents matcher rejections

Tasks:

  • create reversed matcher: on all-charges add match-document function that shows top 3 picks and full list ordered by date #149
  • delete document button #161
  • show document extended info inputs according to type selection #143
  • merge documents table and matcher

misc

  • on Israeli transactions, debit date is missing. If no value => (If creditcard + ILS use event_date). solve it on DB/PubSub later #153

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.