-
Notifications
You must be signed in to change notification settings - Fork 13
docs: sub category #300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Wadjetz
wants to merge
3
commits into
master
Choose a base branch
from
ebe/docs/sub-categories
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
docs: sub category #300
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
content/docs/reference/design-docs/subcategory/index.en.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| --- | ||
| title: "Sub category" | ||
| linkTitle: "Sub category" | ||
| weight: 60 | ||
| description: "Sub categories help organize and visually distinguish train schedules and paced trains when displayed in OSRD and NGE." | ||
| --- | ||
|
|
||
| ## Introduction | ||
|
|
||
| Sub categories are created via a dedicated API. Each sub category includes: | ||
|
|
||
| - A name and a unique code, | ||
| - Visual properties like **color**, **hovered_color**, and **background_color**, | ||
| - A link to a parent main category. | ||
|
|
||
| ### SubCategory model | ||
|
|
||
| ```yml | ||
| name: "RER" | ||
| code: "RER" | ||
| main_category: "COMMUTER_TRAIN" | ||
| color: "#FF0000" | ||
| hovered_color: "#FFA500" | ||
| background_color: "#FFD700" | ||
| ``` | ||
|
|
||
| ## Main Train Category in Rolling Stocks | ||
|
|
||
| The main train category defines the general type or purpose of a train. | ||
| It is used to classify trains into broad groups such as: | ||
| - HighSpeedTrain – for long-distance high-speed services | ||
| - FreightTrain – for goods and cargo transportation | ||
| - ... | ||
|
|
||
| The RollingStock model includes a primary_category field to indicate which main category it belongs to: | ||
| ```yml | ||
| primary_category: "HIGH_SPEED_TRAIN" | ||
| ``` | ||
|
|
||
| This category helps ensure consistency between the train schedule and the rolling stock, and is also used for visual display and filtering in the UI. | ||
|
|
||
| ⚠️ If a train schedule or paced train specifies a main category, or a sub category whose parent category differs from the rolling stock’s primary category, a warning is displayed. | ||
|
|
||
| ### Train Schedule & Paced Train Category | ||
|
|
||
| The category field in train schedules and paced trains can take either: | ||
|
|
||
| ```yml | ||
| category: | ||
| main_category: "COMMUTER_TRAIN" | ||
| ``` | ||
|
|
||
| Or | ||
|
|
||
| ```yml | ||
| category: | ||
| sub_category_code: "RER" | ||
| ``` | ||
|
|
||
| Both **TrainSchedules** and **PacedTrains** can specify either a **main category** or a user-defined **sub category**. | ||
|
|
||
| When a subcategory is deleted, any train schedules and paced trains using it will automatically fall back to its associated parent category. | ||
|
|
||
|  | ||
|
|
||
| ## Sub categories Api | ||
|
|
||
| ### Create sub categories | ||
|
|
||
| Creates one or more sub categories in batch. | ||
|
|
||
| ``` | ||
| POST /api/sub_category | ||
| ``` | ||
|
|
||
| Request body: array of sub category objects. | ||
|
|
||
| ### Retrieve sub categories | ||
|
|
||
| Retrieves paginated sub categories. | ||
|
|
||
| ``` | ||
| GET /api/sub_category?page=1&page_size=1000 | ||
| ``` | ||
|
|
||
| ### Delete sub categories | ||
|
|
||
| Deletes a sub category using its code. | ||
|
|
||
| ``` | ||
| DELETE /sub_category/:code | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| title: "Sub category" | ||
| linkTitle: "Sub category" | ||
| weight: 60 | ||
| description: "Décrit le modèle de sous-catégorie et sa relation avec train schedules et paced trains." | ||
| --- | ||
|
|
||
| _Non traduit : veuillez sélectionner une autre langue._ |
3 changes: 3 additions & 0 deletions
3
content/docs/reference/design-docs/subcategory/sub_category.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.