Skip to content

Team-Diagram/riot-back

Repository files navigation

RioT

RioT is an end-of-year project by students at HETIC. The aim of this project is to provide a data capture, storage and analysis solution to make our environment, here in Building A at our school, less energy-intensive and more comfortable.

🛠️ Tech Stack

Front Back

Prerequisites

  • Docker
  • Php 8.1.2
  • Composer
  • Symfony 5
  • Make

🛠️ Run docker run

make init
make migrate
make insert-data

Before starting you need JWT keys

make bash
php bin/console lexik:jwt:generate-keypair

If there are authorization problems, use these commands to give right to var/www in container

chown -R www-data:www-data /var/www
chmod -R 775 /var/www

🛠️ Env

cp .env .env.local

In .env.local change the variable 'API_MQTT' to

  • For Mac chip M1, and other: http://host.docker.internal:8585/sensor
  • For Mac chip Intel : http://localhost:8585/sensor

🛠️ Environment Variables

API_MQTT APP_ENV APP_SECRET DATABASE_URL

➤ API Reference

Methods GET

User

Get all users

GET /api/user/all
Parameter Type Description
token string Required. Your auth token

Get user by id

GET /api/users/:userId
Parameter Type Description
token string Required. Your auth token
userId string Required. User target id

Get user by params

GET /api/user/by?key=value
Parameter Type Description
token string Required. Your auth token
key string Required. A key
value string Required. A value

DATA

Get states of the whole building

GET /states 

Get state of place by Id

GET /states /:placeId

Necessary

Parameter Type Description
placeId string Required. Place Id taget

Get voltage of the whole building

GET /voltage

Get voltage of place by Id

GET /voltage/:placeId

Necessary

Parameter Type Description
placeId string Required. Place Id taget

Get notification

GET /notification

Get sensor

GET /sensor

Methods POST

USER

Login

POST /api/login_check
Body Type Description
email string Required. Your email
password string Required. Your password

Create user

POST /api/user

Necessary :

ROLE_ADMIN

Parameter Type Description
Bearer token string Required. Your auth token

Content :

Body Type Description
first_name string Required. First Name
last_Name string Required. Last Name
email string Required. Email
password string Required. Password
admin bool Required. True or False

Switch

Edit value state vent, heater, ac

POST /api/switch/vent
POST /api/switch/heater
POST /api/switch/climatisation

Necessary :

ROLE_ADMIN

Parameter Type Description
Bearer token string Required. Your auth token

Content :

Body Type Description
place_id string Required. Place Id
value int Required. Value we want to set

Edit state light

POST /switch/light

Necessary :

ROLE_ADMIN

Parameter Type Description
Bearer token string Required. Your auth token

Content :

Body Type Description
place_id string Required. Place Id

ShutDown all device or TurnOn all device

POST /api/switchAll/:action

Necessary :

ROLE_ADMIN

Parameter Type Description
Bearer token string Required. Your auth token

Content :

Body Type Description
action string Required. For shutdown all : shutdown; For TurOn all : turnOn

Methods PUT

USER

Update User

PUT /api/user/update/:userId

Necessary :

ROLE_ADMIN

Parameter Type Description
Bearer token string Required. Your auth token
userId string Required.User target id

Content :

Body Type Description
first_name string Optionnal. First Name
last_Name string Optionnal. Last Name
email string Optionnal. Email
password string Optionnal. Password

Methods DELETE

Delete User

DELETE /api/user/delete/:userId

Necessary :

ROLE_ADMIN

Parameter Type Description
Bearer token string Required. Your auth token
userId string Required. User target id

🙇 Authors

Dimitri CHAUVEL

Romain LHUILLIER

Pauline Miranda

Herby NÉRILUS

Adrien QUIMBRE

Anthony RINGRESSI