Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 81 additions & 29 deletions swagger_code/oas3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ openapi: 3.0.0
info:
title: Ocio API
description: API for emergencies communication and users management.
version: 1.2.0
version: 1.2.1
servers:
- url: https://localhost:5000/api
description: Localhost
- url: https://ocio-backend.onrender.com/api
description: Main backend deployment
- url: https://ocio-frontend.onrender.com
description: Main frontend deployment

paths:
/login:
Expand Down Expand Up @@ -55,32 +57,7 @@ paths:
required: false
schema:
type: string
enum: [in_progress, ended]
- name: category
in: query
description: Filter for the category of the emergencies
required: false
schema:
type: string
enum: [frana, alluvione, ghiaccio, crollo_strutturale, incendio, neve, tempesta, caduta_albero]
- name: startDate
in: query
description: Filter based on the start date of the emergency (and forth)
required: false
schema:
type: string
format: date-time
example: "2024-10-25T00:00:00Z"
- name: keyword
in: query
description: Filter using one or more keywords
required: false
schema:
type: array
items:
type: string
explode: true
example: ["frana", "alluvione"]
enum: [In corso, Terminato]
responses:
'200':
description: (Filtered) list of the emergencies
Expand Down Expand Up @@ -192,6 +169,8 @@ paths:
/users:
get:
summary: Get a list of all the users
security:
- bearerAuth: []
responses:
'200':
description: List of the users
Expand Down Expand Up @@ -232,6 +211,8 @@ paths:
/users/{id}:
get:
summary: Gets a single user
security:
- bearerAuth: []
parameters:
- name: id
in: path
Expand Down Expand Up @@ -271,6 +252,42 @@ paths:
description: Error in user deletion
tags:
- Users

/users/{id}/password:
put:
summary: Updates the password of a user
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
oldPassword:
type: string
newPassword:
type: string
responses:
'200':
description: Password updated successfully
'404':
description: User not found
'400':
description: Incorrect old password
'403':
description: You cannot change another user's password
'500':
description: Server error
tags:
- Users

/reports:
get:
Expand Down Expand Up @@ -387,6 +404,25 @@ paths:
tags:
- Reports

/reports/myReports:
get:
summary: Retrieve all reports created by the user
security:
- bearerAuth: []
responses:
'200':
description: List of the reports
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Report'
'500':
description: Error in reports recovery
tags:
- Reports

components:
schemas:
User:
Expand Down Expand Up @@ -446,10 +482,21 @@ components:
type: string
description: Location of the emergency
example: "Via Sommarive 9"
coordinates:
type: object
properties:
lat:
type: number
description: Latitude of the emergency location
example: 46.066422
lon:
type: number
description: Longitude of the emergency location
example: 11.149765
state:
type: string
enum: [in_progress, ended]
default: "in_progress"
enum: [In corso, Terminato]
default: "In corso"
description:
type: string
description: Description of the emergency
Expand Down Expand Up @@ -496,6 +543,11 @@ components:
type: string
description: Description of the report
example: "A landslide has partially blocked the road, making it dangerous to drive."
createdBy:
type: string
format: uuid
description: "ID of the reporting user"
example: "65b23f18d4f1c3e58a9a7c12"

securitySchemes:
bearerAuth:
Expand Down