Skip to content

Commit

Permalink
editoast: work-schedules: add endpoints for easier edition and viewing
Browse files Browse the repository at this point in the history
Signed-off-by: Eloi Charpentier <[email protected]>
  • Loading branch information
eckter committed Nov 19, 2024
1 parent 535d81d commit 7cb0332
Show file tree
Hide file tree
Showing 3 changed files with 310 additions and 21 deletions.
108 changes: 108 additions & 0 deletions editoast/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3059,6 +3059,89 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/WorkScheduleCreateResponse'
/work_schedules/group:
get:
tags:
- work_schedules
responses:
'201':
description: The existing work schedule group ids
content:
application/json:
schema:
type: array
items:
type: integer
format: int64
post:
tags:
- work_schedules
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/WorkScheduleGroupCreateForm'
required: true
responses:
'201':
description: The id of the created work schedule group
content:
application/json:
schema:
$ref: '#/components/schemas/WorkScheduleGroupCreateResponse'
/work_schedules/group/{id}:
get:
tags:
- work_schedules
parameters:
- name: id
in: path
description: A work schedule group ID
required: true
schema:
type: integer
format: int64
responses:
'200':
description: The work schedules in the group
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/WorkScheduleResponse'
'404':
description: Work schedule group not found
put:
tags:
- work_schedules
parameters:
- name: id
in: path
description: A work schedule group ID
required: true
schema:
type: integer
format: int64
requestBody:
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/WorkScheduleItemForm'
required: true
responses:
'201':
description: The work schedules have been created
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/WorkSchedule'
'404':
description: Work schedule group not found
/work_schedules/project_path:
post:
tags:
Expand Down Expand Up @@ -4280,6 +4363,7 @@ components:
- $ref: '#/components/schemas/EditoastTrainScheduleErrorInfraNotFound'
- $ref: '#/components/schemas/EditoastTrainScheduleErrorNotFound'
- $ref: '#/components/schemas/EditoastWorkScheduleErrorNameAlreadyUsed'
- $ref: '#/components/schemas/EditoastWorkScheduleErrorWorkScheduleGroupNotFound'
description: Generated error type for Editoast
discriminator:
propertyName: type
Expand Down Expand Up @@ -5698,6 +5782,30 @@ components:
type: string
enum:
- editoast:work_schedule:NameAlreadyUsed
EditoastWorkScheduleErrorWorkScheduleGroupNotFound:
type: object
required:
- type
- status
- message
properties:
context:
type: object
required:
- id
properties:
id:
type: integer
message:
type: string
status:
type: integer
enum:
- 404
type:
type: string
enum:
- editoast:work_schedule:WorkScheduleGroupNotFound
EffortCurve:
type: object
required:
Expand Down
2 changes: 1 addition & 1 deletion editoast/src/models/work_schedules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub enum WorkScheduleType {
Track,
}

#[derive(Debug, Default, Clone, Model)]
#[derive(Debug, Default, Clone, Model, Serialize, Deserialize, ToSchema)]
#[model(table = editoast_models::tables::work_schedule)]
#[model(gen(batch_ops = c, list))]
pub struct WorkSchedule {
Expand Down
Loading

0 comments on commit 7cb0332

Please sign in to comment.