Skip to content

This is a teaching repository to integrate a classroom booking feature.

License

Notifications You must be signed in to change notification settings

monkeydroid/spartacus

Repository files navigation

PON 2020 - Spartacus

Prenotazione Aule Istituto

  • Node.js server
  • Desktop client
  • Android client (tbd)

The client is built with angularjs. The server runs over a Node.js instance node.js

Node.js

Per quanto riguarda il server su cui si appoggia il progetto è stato utilizzato node.js. Node.js è una piattaforma sever side costruita sull'engine javascript di google chrome è un runtime environment open source cross platform.

MongoDB

Il database è di tipo noSQL, non relazionale e document oriented. Lo schema di tale database è basato su docuemnti JSON. Come nei DB SQL i campi possono essere indicizzati con indici primari e secondari.

Postman

Postman è la prima piattaforma di sviluppo API. Tale piattoforma è stata utilizzata per delle simulazioni di chiamata al database.

Install

It requires:

The server will run on port 3500. You can test it in the (Chrome [https] or Firefox) browser at localhost:3500.

DB Diagram

alt text

Esempi chiamate

Di seguito verranno mostrati degli esempi di chiamate da parte del frontend e il relativo risultato backend in formato JSON

Aggiunta prenotazione

/api/addprenotation

  • Method:

    POST

  • URL Params

    • prenotation_day
    • xml
    • id_room
    • id_user
    • prenotation_time
    • event_name
    • tipology

    Required:

    • prenotation_day=[date]
    • id_room=[integer]
    • id_user=[string]
    • prenotation_time=[date]
    • event_name=[string]
    • tipology=[integer]

    Optional:

    null

  • Data Params

    Key Value
    prenotation_day 11-05-2019
    id_room 5
    id_user foo
    prenotation_time current_date
    event_name conferenza_informatica
    tipology 2
  • Success Response:

    {
      
    	"id": "5cadf6ff786dhfgy847rt",
      "prenotation_day": "2000-11-04T23:00:00.000Z",
      "id_room": "ds2uh4",
      "id_user": "v33f2w",
      "event_name": "conferenza_informatica",
      "tipology": "conferenza",
      "__v": 0,
      "prenotation_time": "2019-04-10T14:00:25.177Z"
    }
  • Error Response:

    {
     "status": 0,
     "message": "roomid not found"
    }

Ricerca di tutte le aule

/api/getallRoom

  • Method:

    GET

  • URL Params

    null

    Required:

    null

    Optional:

    null

  • Data Params

    null

  • Success Response:

    {
      "name": "auditorium",
     	"posti": 200,
     	"tipo": "conferenze",
     	"lim": false,
     	"proiettore": true,
     	"ncomputer": 20
    
    }
  • Error Response:

    {
     "status": 0,
     "message": "no room found"
    }

Ricerca di tutte le prenotazioni

/api/getallPrenotation

  • Method:

    GET

  • URL Params

    null

    Required:

    null

    Optional:

    null

  • Data Params

    null

  • Success Response:

    {
    	"id": "5cadf6ff786dhfgy847rt",
      "prenotation_day": "2000-11-04T23:00:00.000Z",
      "id_room": "ds2uh4",
      "id_user": "v33f2w",
      "event_name": "conferenza_informatica",
      "tipology": "conferenza",
      "__v": 0,
      "prenotation_time": "2019-04-10T14:00:25.177Z"
    
    }
  • Error Response:

    {
     "status": 0,
     "message": "no prenotation found"
    }

Ricerca di tutti gli utenti

/api/getallUser

  • Method:

    GET

  • URL Params

    null

    Required:

    null

    Optional:

    null

  • Data Params

    null

  • Success Response:

    {
    	"username": "GinoPaoli33",
      "password": "GPCiao23*",
      "name": "Gino",
      "surname": "Paoli",
    	"category": "normal",
      "access_lavel": "1"
    }
  • Error Response:

    {
     "status": 0,
     "message": "no users found"
    }

Aggiungi aula

/api/addAula

  • Method:

    `POST

  • URL Params

    • name
    • posti
    • tipo
    • lim
    • proiettore
    • ncomputer

    Required:

    • name=[string]
    • posti=[integer]
    • tipo=[string]

    Optional:

    • lim=[boolean]
    • proiettore=[boolean]
    • ncomputer=[integer]
  • Data Params

    Key Value
    name auditorium
    posti 200
    tipo 2
    lim false
    proiettore true
    ncomputer 20
  • Success Response:

    {
    	"id": "dhf492"
    	"name": "auditorium",
      "posti": 200,
      "tipo": 2,
      "lim": false,
    	"proiettore": true,
      "ncomputer": "20"
    }

Ricerca delle prenotazioni per data

/api/findRoombyDate

  • Method:

    GET

  • URL Params

    • date

    Required:

    • date

    Optional:

    null

  • Data Params

    Key Value
    date 2000-11-04T23:00:00.000Z
  • Success Response:

    {
      "id": "5cadf6ff786dhfgy847rt",
      "prenotation_day": "2000-11-04T23:00:00.000Z",
      "id_room": "ds2uh4",
      "id_user": "348v93yh",
      "event_name": "conferenza_informatica",
      "tipology": "conferenza",
      "__v": 0,
      "prenotation_time": "2019-04-10T14:00:25.177Z"
    
    }
  • Error Response:

    {
     "status": 0,
     "message": "no room found"
    }

Ricerca delle prenotazioni per utente

/api/findRoombyUser

  • Method:

    GET

  • URL Params

    • id_user

    Required:

    • id_user

    Optional:

    null

  • Data Params

    Key Value
    id_user 348v93yh
  • Success Response:

    {
      "id": "5cadf6ff786dhfgy847rt",
      "prenotation_day": "2000-11-04T23:00:00.000Z",
      "id_room": "ds2uh4",
      "id_user": "348v93yh",
      "event_name": "conferenza_informatica",
      "tipology": "conferenza",
      "__v": 0,
      "prenotation_time": "2019-04-10T14:00:25.177Z"
    
    }
  • Error Response:

    {
     "status": 0,
     "message": "no room found"
    }

About

This is a teaching repository to integrate a classroom booking feature.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •