Skip to content

Commit 1e0829e

Browse files
committed
docs: added Endpoint conventions
1 parent 2251ae0 commit 1e0829e

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

docs/CONTRIBUTING.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Contributing to AliceO2 Bookkeeping
22
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:
33
- [Coding conventions](#coding-conventions)
4+
- [Endpoint conventions](#endpoint-conventions)
45
- [Commit Message Guidelines](#commit-message-guidelines)
56

67
## Coding conventions
@@ -9,6 +10,22 @@ To ensure consistency throughout the source code, keep these rules in mind as yo
910
- All endpoints must be tested by one or more specs (e2e-tests).
1011
- All code must be formatted. An automated formatter is available (`npm run lint:fix`).
1112

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+
1229
## Commit Message Guidelines
1330
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**.
1431

0 commit comments

Comments
 (0)