Index: src/mapservice/openapi.yaml
===================================================================
--- src/mapservice/openapi.yaml	(revision 5446f28097bbe65a5d892c249e26485349ebe015)
+++ src/mapservice/openapi.yaml	(revision ec8d5d05863dc72303b3ccd9bcf16d306f0fcccb)
@@ -23,5 +23,5 @@
         default: v1
 paths:
-  '/user':
+  /user:
     get:
       description: Returns information of current/authorized user
@@ -82,5 +82,5 @@
           content:
             application/json: {}
-  '/user/apikey_create':
+  /user/apikey_create:
     get:
       description: Generates and returns a new API key for current user
@@ -157,5 +157,5 @@
                 type: string
               description: 'URL to the website, showing the result of the activation'
-  '/waters':
+  /waters:
     get:
       description: Returns all waters
@@ -375,4 +375,102 @@
         '400':
           $ref: '#/components/responses/BadRequest'
+        '404':
+          $ref: '#/components/responses/NotFound'
+  '/devices':
+    get:
+      description: Returns all devices of user
+      tags:
+        - devices
+      summary: Find devices by id
+      operationId: devicesGet
+      security:
+        - basicAuth: []
+        - apiKeyAuth: []
+      parameters:
+        - name: name
+          in: query
+          schema:
+            $ref: '#/components/schemas/itemName'
+          example: Love
+        - $ref: '#/components/parameters/orderBy'
+        - $ref: '#/components/parameters/offset'
+        - $ref: '#/components/parameters/limit'
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/devices'
+              examples:
+                Devices:
+                  $ref: '#/components/examples/devices'
+        '404':
+          $ref: '#/components/responses/NotFound'
+    post:
+      description: Adds a new device to the database
+      tags:
+        - devices
+      summary: Add a new device
+      operationId: devicesCreate
+      security:
+        - basicAuth: []
+        - apiKeyAuth: []
+      parameters:
+        - name: user_id
+          in: path
+          description: User ID
+          required: true
+          schema:
+            $ref: '#/components/schemas/itemId'
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/DeviceCreation'
+            example:
+              name: "Lovely Boat"
+              sensorDepth: 2
+      responses:
+        '201':
+          description: Device created
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Device'
+              examples:
+                Device:
+                  $ref: '#/components/examples/Device'
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '401':
+          $ref: '#/components/responses/Unauthorized'
+  '/devices/{id}':
+    get:
+      description: Returns the device identified by id
+      tags:
+        - devices
+      summary: Represents a device
+      operationId: devicesGetById
+      security:
+        - basicAuth: []
+        - apiKeyAuth: []
+      parameters:
+        - name: id
+          in: path
+          description: Item ID
+          required: true
+          schema:
+            $ref: '#/components/schemas/itemId'
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Device'
+              examples:
+                Water:
+                  $ref: '#/components/examples/Device'
         '404':
           $ref: '#/components/responses/NotFound'
@@ -455,4 +553,8 @@
         coordinates:
           $ref: '#/components/schemas/point'
+    sensorDepth:
+      type: number
+      title: 'Depth of sensor beneath water level in cm (positive means below water)'
+      minimum: 0
     User:
       title: User
@@ -511,5 +613,5 @@
         - name
     WaterCreation:
-      title: Water
+      title: Water for Creation
       type: object
       properties:
@@ -591,4 +693,38 @@
       items:
         $ref: '#/components/schemas/GaugeGeoJson'
+    Device:
+      title: Device
+      type: object
+      properties:
+        deviceId:
+          $ref: '#/components/schemas/itemId'
+        name:
+          $ref: '#/components/schemas/itemName'
+        sensorDepth:
+          $ref: '#/components/schemas/sensorDepth'
+        comment:
+              $ref: '#/components/schemas/comment'
+      required:
+        - deviceId
+        - name
+        - sensorDepth
+    DeviceCreation:
+      title: Device for Creation
+      type: object
+      properties:
+        name:
+          $ref: '#/components/schemas/itemName'
+        sensorDepth:
+          $ref: '#/components/schemas/sensorDepth'
+        comment:
+              $ref: '#/components/schemas/comment'
+      required:
+        - name
+        - sensorDepth
+    devices:
+      title: Devices
+      type: array
+      items:
+        $ref: '#/components/schemas/Device'
     HttpError:
       title: HTTP Error Response Object
@@ -704,5 +840,5 @@
           coordinates:
             - 90.136111
-            - 29.934722 
+            - 29.934722
           properties:
             name: New Orleans
@@ -716,5 +852,5 @@
             coordinates:
               - 90.136111
-              - 29.934722 
+              - 29.934722
             properties:
               name: New Orleans
@@ -722,4 +858,17 @@
               comment: Gauge for Mississippi in New Orleans
       summary: A sample list of gauges in GeoJson format
+    Device:
+      value:
+        deviceId: 1
+        name: Lovely Boat
+        sensorDepth: 0.2
+        comment: Really a pleasure to measure
+      summary: A sample device
+    devices:
+      value:
+        - deviceId: 1
+          name: Lovely Boat
+          sensorDepth: 0.2
+          comment: Really a pleasure to measure
     HttpError:
       value:
@@ -761,2 +910,4 @@
   - name: users
     description: All actions used to manage users and api keys
+  - name: devices
+    description: All actions used to manage devices of an user
Index: src/mapservice/src/server_impl/controllers/DevicesController.py
===================================================================
--- src/mapservice/src/server_impl/controllers/DevicesController.py	(revision ec8d5d05863dc72303b3ccd9bcf16d306f0fcccb)
+++ src/mapservice/src/server_impl/controllers/DevicesController.py	(revision ec8d5d05863dc72303b3ccd9bcf16d306f0fcccb)
@@ -0,0 +1,72 @@
+'''
+    Copyright (C) 2019 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+'''
+import connexion
+
+from ..database.Model import User, Device, db
+from ..HttpErrors import BadRequest, Unauthorized, NotFound
+
+def devices_get(name=None, order_by=None, offset=None, limit=None):
+	query = None
+	
+	user = User.loggedin_user()
+	if user is None:
+		return Unauthorized
+
+	query = Device.query.filter_by(owner = user)
+	if name is not None:
+		query = query.filter(Device.name.like('%{}%'.format(name)))
+
+	result = []
+	for device in query.offset(offset).limit(limit):
+		result.append(device.to_dict())
+	return result
+
+def devices_get_by_id(id):
+	user = User.loggedin_user()
+	if user is None:
+		return Unauthorized
+	
+	device = Device.query.filter_by(owner = user).filter_by(id=id).all()
+	if len(device) != 1:
+		return NotFound
+	return device[0].to_dict()
+
+def devices_create(device_creation):
+	user = User.loggedin_user()
+	if user is None:
+		return Unauthorized
+	
+	device = Device(name=device_creation.name, owner=user, sensor_depth=device_creation.sensor_depth, comment=device_creation.comment)
+	db.session.add(device)
+	db.session.commit()
+	return device.to_dict()
+
+def devices_device_delete(id):
+	user = User.loggedin_user()
+	if user is None:
+		return Unauthorized
+	
+	print(id)
+	if not Device.query.filter_by(owner = user).filter_by(id=id).delete():
+		return BadRequest
+	db.session.commit()
+	
+	query = Device.query.filter_by(owner = user)
+	result = []
+	for device in query:
+		result.append(device.to_dict())
+	return result
Index: src/mapservice/src/server_impl/database/Model.py
===================================================================
--- src/mapservice/src/server_impl/database/Model.py	(revision 5446f28097bbe65a5d892c249e26485349ebe015)
+++ src/mapservice/src/server_impl/database/Model.py	(revision ec8d5d05863dc72303b3ccd9bcf16d306f0fcccb)
@@ -79,4 +79,6 @@
 	@staticmethod
 	def loggedin_username():
+		if not 'user' in connexion.context:
+			return None
 		return connexion.context['user']
 
@@ -84,4 +86,6 @@
 	def loggedin_user():
 		username = User.loggedin_username()
+		if username is None:
+			return None
 		user = User.query.filter_by(username=username).all()
 		if len(user) != 1:
@@ -168,4 +172,21 @@
 		point = to_shape(wkbelement)
 		return {'longitude': point.x, 'latitude': point.y}
+	
+class Device(db.Model):
+	__tablename__ = "devices"
+	
+	id = db.Column(db.Integer, primary_key=True, autoincrement=True)
+	name = db.Column(db.String(255), nullable=False)
+	owner_id = db.Column(db.Integer, db.ForeignKey('users.id'))
+	sensor_depth = db.Column(db.Float, nullable=False)
+	comment = db.Column(db.String(255))
+	
+	owner = db.relationship("User", backref=db.backref("devices"), lazy=True)
+	
+	def to_dict(obj):
+		result = { 'deviceId': obj.id, 'name': obj.name, 'sensorDepth': obj.sensor_depth }
+		if obj.comment:
+			result['comment'] = obj.comment
+		return result
 
 def db_setup():
@@ -227,4 +248,9 @@
 			new_orleans = Gauge(name='New Orleans', manager=test_user_jane, water=mississippi, location='SRID=4326;POINT(-90.136111 29.934722)')
 			db.session.add(new_orleans)
+			
+		
+		if len(Device.query.filter_by(name='GnuBoat 1').all()) < 1:
+			gnuboat_one = Device(name='GnuBoat 1', owner=test_user_jane, sensor_depth=0.2, comment='SUP attachment')
+			db.session.add(gnuboat_one)
 		db.session.commit()
 
