nobt-io / api Goto Github PK
View Code? Open in Web Editor NEWMain-Backend of nobt.io.
License: GNU General Public License v3.0
Main-Backend of nobt.io.
License: GNU General Public License v3.0
Currently, we return bills and debts to the frontend. However, in addition to the debts, the frontend also shows the balances of each participant. This information is not present in the API response and hence, the frontend needs to calculate it by itself.
This is:
In addition, we recently introduced property-based tests into the backend to have more thorough tests and better guarantees that our optimization algorithms actually behave correctly.
For these tests, we already calculate the balances of each participant because no matter how we optimize the debts, the balances always need to stay the same: they are the perfect metric to check on whether an optimization algorithm is correct.
However, at the moment, all this logic is part of the test suite and not the production code.
If we return balances in the API we can:
Currently, there is no way too request configuration options from the API. It would be good to have an endpoint that returns stuff like:
Note that this is different from an actual healthcheck endpoint that would return information about the connected database. A healthcheck endpoint is out-of-scope of this issue.
Initially, we thought "expenses" and "transactions" are good terms. But they are not :D
We should add new endpoints to the API that use our newly adopted terminology so that the frontend doesn't have to do that much mapping in its presentation code.
Terminology to be changed:
Currently, we have self-made classes for handling amount and currencies. We should replace that with JodaMoney (http://www.joda.org/joda-money/) or JavaMoney (https://github.com/JavaMoney/jsr354-ri)
Currently, the documentation states the following about the currencyInformation
object:
An object defining the conversion information to the currency of the associated nobt. If this object is present, the amounts of this expense are to be interpreted in the given currency. If this object is not present, it is assumed that the currency of this expense is equal to the currency of the nobt, hence the conversion rate is 1.
This is not correct.
The amounts listed in the shares are always in the currency of the nobt. The conversion information object represents the rate and the original currency. Clients can utilize this object to store information about the amounts that were entered by the user:
The API is started from a different working dir than locally (outside bin).
Therefore the call to staticFileLocation
does not work.
Useful link: travis-ci/travis-ci#6132
The timestamps for createdOn should actually be Instant and not ZonedDateTime.
From the documentation of Instant:
This class models a single instantaneous point on the time-line. This might be used to record event time-stamps in the application.
The API should allow to delete bills from a nobt, however, they should not be actually deleted from the DB but instead "marked" deleted with a flag or something like that. During the debt-calculation, these bills have to be filtered out.
Also, the API should advertise to the client that bills can be deleted. I would suggest adding a link to each bill's resource payload like this:
{
"id": 3,
"name": "Beer",
// other properties
"_links": {
"delete": {
"href": "..."
}
}
}
For now, this link is always present. Later on, we can change whether or not bills can be deleted by excluding the links under certain conditions (e.g. time-limit etc)
Starting with nobt-io/frontend#301, we use netlify and have deploy previews for each branch.
It would be good to have a dev version of the API sitting at dev-api.nobt.io which only uses an in-memory database.
This API could then be used to test deploy previews without polluting the production database too much.
Currently, the client knows the endpoints for creating expenses and payments. We should add links to the response of a Nobt that points clients to these endpoints.
{
"id": "g943hNß57gha",
...
"_links": {
"create-expense": {
"href": "..."
},
"create-payment": {
"href": "..."
}
}
}
Implementation hints can be taken from the "delete" link of expenses. See #8.
We could expose metrics about our nobts in the database in prometheus format.
This is a bit of a hack but it gives us some reasonably easy analytics without setting anything else up.
The newly added property-based test for the optimizer seems to fail rarely.
Should investigate that :)
This incident is a combination of several problems, with one of them being a trailing space in the name "Blair".
Avoid errors as soon as possible.
Sanitize the input from the frontend better, especially all "name" fields. We should remove any whitespace character from the front and back of all names.
There seems to be an issue related to persistence of deleted bills.
https://sentry.io/share/issue/f57b492f905b475f9cb7526431b3fb91/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.