Giter VIP home page Giter VIP logo

invoices's People

Contributors

danielmoraes avatar reinert avatar

Stargazers

 avatar

Watchers

 avatar  avatar

invoices's Issues

Options for Entity fields

Below there are some options to think about adding in Entity's logic:

  • value
  • computed
  • required
  • enum

Support observers

Make Entity extends EventEmitter and support observing property changes.

Transactions (Financial)

User requirement:

Record all pending, due and done financial transactions, either revenues or expenses. The transaction should have description, billing month, due date, amount due and informations about payment/receipt.

Transaction is an Entity with the following properties: kind {REVENUE, EXPENSE} [NotNull], description [String] [NotNull], billingMonth [Date], dueDate [Date] [NotNull], dueAmount [Number] [NotNull], doneDate [Date] [NotNull], doneAdditions [Number], doneDiscounts [Number], doneAmount [Number] [NotNull], comments [String].

Valid values for kind are {'REVENUE', 'EXPENSE'}. Any other given value must be replied with an InvalidArgumentError.

Possible status:

  • Pending: transaction with dueDate in the future and doneDate null
  • Due: transaction with dueDate in the past and doneDate null
  • Done: transaction with doneDate not null

Create contract tests.

Use json-schema and supertest.
Define a structure to be followed in subsequent features.
Try to automate new future tests.

Expenses reporting

User requirements:

User can print expenses per week with the total amount and average day spending.

Remove config files from source

Config files should be stored somewhere in the file system and loaded to the app by env vars. Default config files should be provided in the source, in case there are no env vars available.

Expenses filtering

User requirements:

User can filter expenses.

It should be possible to query expenses by any string which will be compared against all its properties.

For example: querying for "transport 200" should return all expenses that either has a description containing this string, or a comment containing "transport" with an amount of "200".

The query string should be tokenized, and its tokens treated individually:

  • If a token has the format "##/##/####" or "####-##-##" it should be perceived as a datetime
  • If a token has only numbers, it should be perceived as an amount or part of any string field (description, comment)
  • Otherwise it should be perceived as part of any string field

ApiError

There must be only one error type in server, which is ApiError. Therefore, HeaderValidationError must be substituted by ApiError.

Expenses

User requirement:

When an expense record is entered, each one has: date, time, description, amount, comment.

Expense is an Entity with the following properties: type [String] [NotNull], datetime [Date] [NotNull], description [String] [NotNull], amount [Number] [NotNull], comment [String].

Expense can be either a SimpleExpense (type = 'SIMPLE') or DetailedExpense (type = 'DETAILED')

Valid values for type are {SIMPLE, DETAILED}. Any other give value must be returned an InvalidArgumentError.

A DetailedExpense MUST have an additional property called items of type Array. This array cannot be empty nor null.

ExpenseItem is an Entity with the following properties: description [String] and amount [Number].

The property amount of DetailedExpense must be a computed property, providing the sum of all its items' amount.

Add tests to Entity

Entity needs tests to super constructor, inherited constructors (both first and second level inheritance), super initialization, inherited initialization, instances properties, descriptors, public methods and protected methods.

Roles

Role is an Enum of: { User, Manager, Admin }.

A User MUST have a role, which is by default 'User'.

It should be possible to change the user role by just PATCHing or PUTting the resource.

If a value not present in the enum is given, an InvalidArgumentError should be returned.

Prototypes

Draw UI prototypes with Sketch (preferable) or Adobe XD.

Sign with invalid token in cache doesn't work

When a user tries to signin having a invalid token cached in the browser, express-jwt throws an UnauthourizedError before AuthHandler.sign is called. This error is caught by uncaughtErrorHandler.

Invoices

User requirement:

One should be able to register its invoices.

Invioce is an Entity with the following properties: type [{SIMPLE, DETAILED}], description [String], invoiceDate [Date] [NotNull], invoiceNumber [Number], amount [Number] [NotNull], providerName [String], providerRegistrationNumber [Number].

Invoice can be either a SimpleInvoice (type = 'SIMPLE') or DetailedInvoice (type = 'DETAILED')

Valid values for type are {'SIMPLE', 'DETAILED'}. Any other given value must be replied with an InvalidArgumentError.

A DetailedInvoice MUST have an additional property called items of type Array. This array cannot be empty nor null.

InvoiceItem is an Entity with the following properties: description [String], quantity [Number], unitPrice [Number] and amount [Number].

The property amount of InvoiceItem must be a computed property, providing the multiplication of its quantity with its unit price. Must not be persisted.

The property amount of DetailedInvoice must be a computed property, providing the sum of all its items' amount.

Support computed in descriptor

Add support for declaring computed properties in Entity.

Entity's descriptor should support an option 'computed' having a function as value. This function's arguments should match the name of the properties in which this computed property relies on.

For example:

    class Test extends Entity {}
    Test.$({
      'a': {},
      'b': {},
      'ab': { computed: (a, b) => a + b }
    })

In the example above, ab property is a computation of a property plus b property. Any check for invalid values must be done by the user defining the computed function.

Add ´items_qty´ to invoice

It represents the quantity of items from an invoice.

It should be updated whenever an item is inserted or deleted.

User modification

  • email is unique
  • there's no more username, email will play this role
  • add the properties firstName and lastName

Create unit tests for core

Define a structure to be followed in subsequent features using TDD.
Try to automate new future tests.

Create integration tests

Use supertest.
Define a structure to be followed in subsequent features.
Try to automate new future tests.

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.