|
| 1 | +# Contributing to AliceO2 Bookkeeping |
| 2 | +We would love for you to contribute to *AliceO2 Bookkeeping* and help make it even better than it is today! As a contributor, here are the guidelines we would like you to follow: |
| 3 | +- [Coding conventions](#coding-conventions) |
| 4 | +- [Endpoint conventions](#endpoint-conventions) |
| 5 | +- [Commit Message Guidelines](#commit-message-guidelines) |
| 6 | + |
| 7 | +## Coding conventions |
| 8 | +To ensure consistency throughout the source code, keep these rules in mind as you are working: |
| 9 | +- All features or bug fixes must be tested by one or more specs (unit-tests). |
| 10 | +- All endpoints must be tested by one or more specs (e2e-tests). |
| 11 | +- All code must be formatted. An automated formatter is available (`npm run lint:fix`). |
| 12 | + |
| 13 | +## Endpoint conventions |
| 14 | +A **resource can be a singleton or a collection**. For example, "`customers`" is a collection resource and "`customer`" is a singleton resource (in a banking domain). We can identify "`customers`" collection resource using the URI "`customers`". We can identify a single "`customer`" resource using the URI "`/customers/{customerId}`". |
| 15 | + |
| 16 | +A **resource may contain sub-collection resources** also. For example, sub-collection resource "`accounts`" of a particular "`customer`" can be identified using the URI "`/customers/{customerId}/accounts`" (in a banking domain). Similarly, a singleton resource "`account`" inside the sub-collection resource "`accounts"` can be identified as follows: "`/customers/{customerId}/accounts/{accountId}`". |
| 17 | + |
| 18 | +### Example |
| 19 | +``` |
| 20 | +GET /orders <---> orders |
| 21 | +POST /orders <---> orders.push(data) |
| 22 | +GET /orders/1 <---> orders[1] |
| 23 | +PUT /orders/1 <---> orders[1] = data |
| 24 | +PATCH /orders/1 <---> orders[1] = { ...orders[1], ...data } |
| 25 | +GET /orders/1/lines <---> orders[1].lines |
| 26 | +POST /orders/1/lines <---> orders[1].lines.push(data) |
| 27 | +``` |
| 28 | + |
| 29 | +## Commit Message Guidelines |
| 30 | +We have very precise rules over how our git commit messages can be formatted. This leads to **more readable messages** that are easy to follow when looking through the **project history**. But also, we use the git commit messages to **generate the change log**. |
| 31 | + |
| 32 | +### Format |
| 33 | +Each commit message consists of a **header**, a **body** and a **footer**. The header has a special format that includes a type, a scope and a subject: |
| 34 | +``` |
| 35 | +<type>[(optional scope)]: <description> |
| 36 | +
|
| 37 | +[optional body] |
| 38 | +
|
| 39 | +[optional footer(s)] |
| 40 | +``` |
| 41 | + |
| 42 | +### Examples |
| 43 | +``` |
| 44 | +docs(changelog): update changelog to beta.5 |
| 45 | +``` |
| 46 | +``` |
| 47 | +fix(release): need to depend on latest rxjs and zone.js |
| 48 | +
|
| 49 | +The version in our package.json gets copied to the one we publish, and users need the latest of these. |
| 50 | +``` |
0 commit comments