Skip to content

🤡 The project of 2nd year of Higher Technical Certificate (BTS SN IR )

Notifications You must be signed in to change notification settings

AlbertLanne/ProductionMonitoringMysql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status


Mysql Production Monitoring

Logo

The repo of the project of 2nd year of Higher Technical Certificate (BTS SN IR )


· Report Bug · Request Feature

Table of Contents


About The Project

High school Paul Cornu BTS Systèmes Numériques Session 2020
9 Rue Paul Cornu, 14100 Lisieux Option A Informatique et Réseaux Session 2020

Professinal Partner Studens of the project Teatchers
Interfiltre compagnies -Mathieu Sanchez Sébastien Dossier
Rue de Livarot -Albert Lanne Laurent Blondel
14140 Farvaques -Alexis Dominguez-Condé
-Louis Evrard

  • The master branch have a classe "members" with all CUDR methods (GET,PUT,POST,DELETE).
  • The SingleFileCUDR branch have a single file for CUDR
  • The HTML branch use the classe "members" with front end vanilla JS.

To test the API i preconise to use postman for HTTP request.


Project setup

# Install dependecies
npm install
# serve with hot reload at localhost:8080
npm run start

Find the api map with Swaggers at localhost:8080/api/v1/api-docs/#/ and even test it from there. docker container SQL


Routes of the API

docker container SQL


Structure of SingleFileCUDR

  • This exemple show only for the specific ID
let MembersRouter = express.Router()
MembersRouter.route('/:id')
  • Get
   .get((req,res)=> {
            let index = getIndex(req.params.id);

            if (typeof(index) == 'string'){
                res.json(error(index))
            }else{
                res.json(success(members[index]))
            }
            res.json(success(members[(req.params.id)-1].name))
        })
  • Overwrite
        .put((req,res)=> {
            let index = getIndex(req.params.id);
            if (typeof(index) == 'string'){
                res.json(error(index))
            }else{
                let same = false;
                for (let i = 0; i < members.length; i++){
                    if (req.body.name == members[i].name && req.params.id != members[i].id){
                        same = true
                        break
                    }
                }
                if (same){
                    res.json(error('same name'))
                }else{
                    members[index].name = req.body.name
                    res.json(success(true))
                }

            }
        })
  • Delete
        .delete((req,res)=> {
            let index = getIndex(req.params.id);
            if (typeof(index) == 'string'){
                res.json(error(index))
            } else {
                members.splice(index, 1)
                res.json(success(members))
            }
        })

Members Classe

   let MembersRouter = express.Router()
   let Members = require('./assets/classes/members-class')(db, config)
    MembersRouter.route('/:id')
   let MembersRouter = express.Router()
   let Members = require('./assets/classes/members-class')(db, config)
  MembersRouter.route('/:id')

        // Récupère un membre avec son ID

        .get(async (req, res) => {
            let member = await Members.getById(req.params.id)
            res.json(checkAndchange(member))
        })

        // Modifie un membre avec ID
        .put(async(req, res) => {
            let updateMember = await Members.update(req.params.id, req.body.name)
            res.json(checkAndchange(updateMember))
        })

        // Supprime un membre avec ID
        .delete(async (req, res) => {
            let deleteMember = await Members.delete(req.params.id)
            res.json(checkAndchange(deleteMember))
        })

2 - ASYNC DATA

  • Understand async data
console.log('Début')
setTimeout(() => {
    console.log('Temps d\'attentes')
},1500)
console.log('Fin')
  • Callback
  • Promise
new Promise((resolve, reject) => {
setTimeout(()=> {
resolve('All good')
}, 1500)
})
.then(message => console.log(message))  // Dans le cas si c'est ok
.catch(err => console.log(err.message)) // Dans le cas d'une erreur
  • Async/Await

The project consists of experimenting with the implementation of computer tools, smartphone applications / Android tablets for operators for :

  • Helping the operators of the sheet metal part during cutting with the help of a documented and adapted OF.

Here's why:

  • Your time should be focused on creating something amazing. A project that solves a problem and helps others
  • You shouldn't be doing the same tasks over and over like creating a README from scratch
  • You should element DRY principles to the rest of your life 😄

Of course, no one template will serve all projects since your needs may be different. So I'll be adding more in the near future. You may also suggest changes by forking this repo and creating a pull request or opening an issue.

A list of commonly used resources that I find helpful are listed in the acknowledgements.

Built With

The project work with a web app made with nodejs/css. And a mobil applications for QR code.

Getting Started

Prerequisites

  • npm / node.js
  • webstorm
  • MySql server
npm install npm@latest -g

Installation

  1. Get a free API Key at https://example.com
  2. Clone the repo
git clone https://github.com/AlbertLanne/ProductionMonitoringMysql.git
  1. Install NPM packages
cd ProductionMonitoringMysql && npm install
  1. Copy example-config.js into config.js and add your data login. You can use URI link.
{
  "port": 8080,
  "URI":"????????????????????????????????????????????????????????????????????????????????????????????????",
}

or

  "db": {
    "host": "????????????????????????????????????????????????",
    "user": "????????????????????????",
    "password": "????????????????????????",
    "database": "????????????????????????"
  }
}
  1. You can find the databse structure at assets/sql/BBD.sql

Usage

Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.

For more examples, please refer to the Documentation

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

  1. Create a fork of this project
  2. Clone the project:
git clone https://github.com/<YOUR_GITHUB_USERNAME>/InterfiltreProductionMonitoring
  1. Create your Feature Branch (git checkout -b AmazingFeature)
  2. Commit your Changes (git commit -m 'Add some AmazingFeature')
  3. Push to the Branch (git push origin feature/AmazingFeature)
  4. Open a Pull Request

Contact

Student 2: https://github.com/AlbertLanne

Student 3: https://github.com/Aredi

Student 4: https://github.com/Evouiard

Useful link and ressources

About

🤡 The project of 2nd year of Higher Technical Certificate (BTS SN IR )

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published