Skip to content

Commit 4ed9035

Browse files
committed
docs: sub category
Signed-off-by: Egor Berezovskiy <[email protected]>
1 parent 71a4853 commit 4ed9035

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: "Sub category"
3+
linkTitle: "Sub category"
4+
weight: 60
5+
description: "Describes the sub-category model and its relation to train schedules and paced trains."
6+
---
7+
8+
## Introduction
9+
10+
Sub categories are created via a dedicated API. Each sub category has a name and a unique code, as well as visual properties like **color**, **hovered_color**, and **background_color**.
11+
Each sub category is associated with a parent main category.
12+
Both **TrainSchedules** and **PacedTrains** can specify either a **main_category** or a user-defined **sub_category**.
13+
14+
### SubCategory model
15+
16+
```yml
17+
name: "RER"
18+
code: "RER"
19+
main_category: "COMMUTER_TRAIN"
20+
color: "#FF0000"
21+
hovered_color: "#FFA500"
22+
background_color: "#FFD700"
23+
```
24+
25+
### Train Schedule & Paced Train Category
26+
27+
The category field in train schedules and paced trains can take either:
28+
29+
```yml
30+
category:
31+
main_category: "COMMUTER_TRAIN"
32+
```
33+
34+
Or
35+
36+
```yml
37+
category:
38+
sub_category_code: "RER"
39+
```
40+
41+
Only one of the two can be defined at a time, or both can be absent.
42+
43+
If a referenced sub category is deleted, the affected train schedules or paced trains will automatically fall back to the sub category’s associated **main_category**.
44+
45+
## Sub categories Api
46+
47+
### Create sub categories
48+
49+
Creates one or more sub categories in batch.
50+
51+
```
52+
POST /api/sub_category
53+
```
54+
55+
Request body: array of sub category objects.
56+
57+
### Retrieve sub categories
58+
59+
Retrieves paginated sub categories.
60+
61+
```
62+
GET /api/sub_category?page=1&page_size=1000
63+
```
64+
65+
### Delete sub categories
66+
67+
Deletes a sub category using its code.
68+
69+
```
70+
DELETE /sub_category/:code
71+
```
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: "Sub category"
3+
linkTitle: "Sub category"
4+
weight: 60
5+
description: "Décrit le modèle de sous-catégorie et sa relation avec train schedules et paced trains."
6+
---
7+
8+
_Non traduit : veuillez sélectionner une autre langue._

0 commit comments

Comments
 (0)