Skip to content

Commit 1c47f1e

Browse files
authored
docs: improved documentation
2 parents 244db35 + f7a9ec9 commit 1c47f1e

File tree

5 files changed

+67
-3
lines changed

5 files changed

+67
-3
lines changed

docs/CONFIGURATION.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Configuration
2+
3+
## Database
4+
| Variable name | Description | Default value |
5+
|---------------|-------------|---------------|
6+
| DATABASE_HOST | The host of the relational database. | localhost |
7+
| DATABASE_PORT | The port of the relational database. | 3306 |
8+
| DATABASE_USERNAME | The username which is used to authenticate against the database. | cern |
9+
| DATABASE_PASSWORD | The password which is used to authenticate against the database. | cern |
10+
| DATABASE_NAME | The name of the database | bookkeeping |

docs/CONTRIBUTING.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
```

docs/DEVELOPMENT.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ $ npm run sequelize -- seed:generate --name <MIGRATION NAME>
3232
$ npm run sequelize -- db:seed:all
3333
```
3434

35-
## Commit naming convention
36-
We use the [`Conventional Commits`](https://www.conventionalcommits.org/en/v1.0.0/) format, which is a specification for adding human and machine readable meaning to commit messages.
37-
3835
## Versioning
3936

4037
example: ```R.Arsenic.sp1.v0.0.1```

lib/config/database.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
// Default configuration
1515
let host = 'localhost';
16+
let port = 3306;
1617
let username = 'cern';
1718
let password = 'cern';
1819
let database = 'bookkeeping';
@@ -21,6 +22,10 @@ if (process.env.DATABASE_HOST) {
2122
host = process.env.DATABASE_HOST;
2223
}
2324

25+
if (process.env.DATABASE_PORT) {
26+
port = process.env.DATABASE_PORT;
27+
}
28+
2429
if (process.env.DATABASE_USERNAME) {
2530
username = process.env.DATABASE_USERNAME;
2631
}
@@ -40,6 +45,7 @@ if (process.env.NODE_ENV === 'test') {
4045
module.exports = {
4146
dialect: 'mariadb',
4247
host,
48+
port,
4349
username,
4450
password,
4551
database,

lib/database/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class SequelizeDatabase extends IDatabase {
3636

3737
this.sequelize = new Sequelize(Config.database, Config.username, Config.password, {
3838
host: Config.host,
39+
port: Config.port,
3940
dialect: Config.dialect,
4041
dialectOptions: {
4142
charset: 'utf8mb4',

0 commit comments

Comments
 (0)