Browse Source

Removed Swagger

Leonard Schulz (Arbeit) 2 năm trước cách đây
mục cha
commit
e366ae565c
1 tập tin đã thay đổi với 5 bổ sung và 65 xóa
  1. 5 65
      backend_nodejs/wbs_rechner_express.js

+ 5 - 65
backend_nodejs/wbs_rechner_express.js

@@ -1,79 +1,26 @@
 const express = require('express');
 const app = express();
-const expressSwagger = require('express-swagger-generator')(app);
 app.use(express.json()); //für das Parsing von JSON-Daten
 
-let options = {
-    swaggerDefinition: {
-        info: {
-            description: 'API Dokumentation',
-            title: 'WBS API',
-            version: '1.0.0',
-        },
-        host: 'localhost:3000',
-        basePath: '/',
-        produces: [
-            "application/json"
-        ],
-        schemes: ['http', 'https']
-    },
-    basedir: __dirname,
-    files: ['./**/*.js']
-};
-expressSwagger(options)
 
-/**
- * @typedef Income
- * @property {string} type.required
- * @property {number} amount.required
- * @property {string} frequency.required - monthly / quarterly / yearly
- * @property {number} advertisingCosts.required
- */
-
-/**
- * @typedef Person
- * @property {string} name.required
- * @property {Array.<Income>} incomes.required
- */
-
-/**
- * @typedef Frequency
- * @property {string} id.required
- * @property {string} description.required
- */
-
-
-/**
- * @route POST /calculate
- * @group Einkommen - Operationen für Einkommen
- * @param {Income.model} incomes.body.required - eine neue Person
- * @returns {object} 200 - Eine Person hinzufügen
- * @returns {Error}  default - Unerwarteter Fehler
- */
 app.post('/calculate', (req, res) => {
     let totalIncome = 0;
     const persons = req.body;
     for (const person of persons) {
         for (const income of person.incomes) {
-        let annualIncome = income.amount * income.frequency;
-        annualIncome -= income.advertisingCosts;
-        totalIncome += annualIncome;
-    }
+            let annualIncome = income.amount * income.frequency;
+            annualIncome -= income.advertisingCosts;
+            totalIncome += annualIncome;
+        }
     }
 
-    //Beispiel Berechnung nicht entsprechend der WBS Berechnung
+    //Beispiel Berechnung entspricht nicht der WBS Berechnung
     let maxIncome = persons.length * 12000;
     let wbsGranted = maxIncome <= totalIncome;
 
     res.send({ wbsGranted: wbsGranted });
 });
 
-/**
- * @route GET /frequencies
- * @group Einkommen - Operationen für Einkommen
- * @returns {Array.<Frequency>} 200 - Eine Liste der Frequenzen abrufen
- * @returns {Error}  default - Unerwarteter Fehler
- */
 app.get('/frequencies', (req, res) => {
     const frequencies = [
         { value: 365, description: 'täglich' },
@@ -85,13 +32,6 @@ app.get('/frequencies', (req, res) => {
     res.send(frequencies);
 });
 
-
-/**
- * @route GET /types
- * @group Einkommen - Operationen für Einkommen
- * @returns {Array.<IncomeType>} 200 - Eine Liste der Einkommensarten
- * @returns {Error}  default - Unerwarteter Fehler
- */
 app.get('/types', (req, res) => {
     const types = [
         { value: 'work', description: 'als Arbeitnehmer' },