invoices's People
invoices's Issues
The invoice's user property should be set from req.user
Make Entity extend EventEmitter
And support notify
boolean option in property descriptor.
Options for Entity fields
Below there are some options to think about adding in Entity's logic:
- value
- computed
- required
- enum
Adopt Polymer syntax
Instead of a $ initializer, use a static get properties inside the class definition. Later, support observers too.
Support observers
Make Entity extends EventEmitter and support observing property changes.
Restrict resource access based on the user that is logged in.
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
Integrate NodeInspector with the project
To enable debugging via Chrome
Change repo name to invoices
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
Refactor EntityHandler options
- Discuss each option name
- Extend express response prototype to provide useful functions to EntityHandler
Return invoice-amount header after creating/updating/deleting an invoice item
Extract Entity package as a separate project
Choose a name for the project and deploy it to npm.
Depends on #52
Decimal precision operations
Use decimal precision types to perform calculations. Decimal.js may be a good choice.
abstract instace in core
Hide EventEmitter properties from Entity enumerables
The EventEmitter prototype comes with the following properties: domain
, _events
, _eventsCount
and _maxListeners
. They should not appear as enumerable properties of the Entity prototype.
Create database script
Create and maintain a script for database schema creation.
Refactor Entity to proper use prototype
Entity is mixing prototypes with inherited classes. It must be fixed.
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 cors support.
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.
Implement server handler for sequelize constraint error
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.
Rename `isDefaultReadonly` to `isConstant`
Maybe create constant
option as an alias to default and readOnly
Validate before start transaction in SequelizeRepository
First chain method in Repository#find
Repository#find
should provide an optional first
method when user wants only the first result of the query.
Remove babel dependency
Add user authentication with JWT
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
andlastName
Check if `required`is being validated in construction
Create unit tests for core
Define a structure to be followed in subsequent features using TDD.
Try to automate new future tests.
Don't use transaction for single operations in SequelizeRepository
Persist token using cookies.
Create integration tests
Use supertest.
Define a structure to be followed in subsequent features.
Try to automate new future tests.
Organize and Finish Tests for Entity package
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.