commit 0fcb708f3eec9a99bb4d6610105394abb368b1c1
Author: Matej Zeman <zeman339@gmail.com>
Date:   Sun May 15 15:53:00 2022 +0200

    re #9846 Changed keyman devices, body devices views. Added Head devices view. Changed filtering of logs, ldlogs, body devices, head devices and keyman devices. Changed HTML tables style and few labels.

diff --git a/server/doc/sql_app/api/auth.html b/server/doc/sql_app/api/auth.html
new file mode 100644
index 0000000..38a4bf7
--- /dev/null
+++ b/server/doc/sql_app/api/auth.html
@@ -0,0 +1,633 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
+<meta name="generator" content="pdoc 0.10.0" />
+<title>sql_app.api.auth API documentation</title>
+<meta name="description" content="" />
+<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
+<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
+<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
+<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
+<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
+<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
+<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
+<script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
+</head>
+<body>
+<main>
+<article id="content">
+<header>
+<h1 class="title">Module <code>sql_app.api.auth</code></h1>
+</header>
+<section id="section-intro">
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">from fastapi import Depends, APIRouter, Form
+from fastapi import Request
+from fastapi.responses import HTMLResponse, RedirectResponse
+from fastapi.templating import Jinja2Templates
+from fastapi_jwt_auth import AuthJWT
+from sqlalchemy.orm import Session
+from sql_app import crud
+from passlib.context import CryptContext
+from pydantic import BaseModel
+from ..database import SessionLocal, engine
+
+# Path to html templates used in this file
+templates = Jinja2Templates(directory=&#34;../templates/auth&#34;)
+
+pwd_context = CryptContext(schemes=[&#34;bcrypt&#34;], deprecated=&#34;auto&#34;)
+
+# prefix used for all endpoints in this file
+auth = APIRouter(prefix=&#34;&#34;)
+
+
+# Dependency
+def get_db():
+    db = SessionLocal()
+    try:
+        yield db
+    finally:
+        db.close()
+
+
+class Settings(BaseModel):
+    authjwt_secret_key: str = &#34;secret&#34;
+    # Configure application to store and get JWT from cookies
+    authjwt_token_location: set = {&#34;cookies&#34;}
+    # Disable CSRF Protection for this example. default is True
+    authjwt_cookie_csrf_protect: bool = False
+
+
+@AuthJWT.load_config
+def get_config():
+    return Settings()
+
+
+# admin username and password
+fake_users_db = {
+    &#34;admin&#34;: {
+        &#34;username&#34;: &#34;admin&#34;,
+        &#34;password&#34;: &#34;admin&#34;
+    }
+}
+
+
+def verify_password(plain_password, hashed_password):
+    &#34;&#34;&#34;
+    Verifies plain text password with hashed password
+    &#34;&#34;&#34;
+    return pwd_context.verify(plain_password, hashed_password)
+
+
+def get_hash_password(password):
+    &#34;&#34;&#34;
+    Returns hashed password
+    &#34;&#34;&#34;
+    return pwd_context.hash(password)
+
+
+def auth_user(db, username: str, password: str):
+    &#34;&#34;&#34;
+    Determines if given password belongs to user with given username
+    &#34;&#34;&#34;
+    user = crud.find_user(db, username)
+    if not user:
+        return None
+    if not verify_password(password, user.password):
+        return None
+    return user
+
+
+@auth.get(&#34;/signup&#34;, response_class=HTMLResponse)
+async def signup_get(request: Request):
+    &#34;&#34;&#34;
+    return html template for signup
+    &#34;&#34;&#34;
+    return templates.TemplateResponse(&#34;signup.html&#34;, {&#34;request&#34;: request})
+
+
+@auth.post(&#34;/signup&#34;, response_class=HTMLResponse)
+async def signup(username: str = Form(...), password: str = Form(...), db: Session = Depends(get_db)):
+    &#34;&#34;&#34;
+    Endpoint called form signup template. Creates new user with role guest that can be changed by admin user
+    &#34;&#34;&#34;
+    users = crud.get_users(db, 0, 100)
+    users_names = []
+    for u in users:
+        users_names.append(u.username)
+    if username not in users_names:
+        new_user = crud.create_user(db, username, get_hash_password(password), &#34;guest&#34;)
+        if new_user is None:
+            print(&#34;something went wrong&#34;)
+        return &#34;&#34;&#34;
+            &lt;html&gt;
+                &lt;head&gt;
+                    &lt;title&gt;Signup&lt;/title&gt;
+                &lt;/head&gt;
+                &lt;body&gt;
+                    &lt;h1&gt;New user created. You can go back to previous page.&lt;/h1&gt;
+                    &lt;form action=&#34;/logs-web&#34; method=&#34;get&#34;&gt;
+                        &lt;input type=&#34;submit&#34; value=&#34;Home Page&#34; /&gt;
+                    &lt;/form&gt;
+                &lt;/body&gt;
+            &lt;/html&gt;
+            &#34;&#34;&#34;
+    else:
+        return &#34;&#34;&#34;
+                    &lt;html&gt;
+                        &lt;head&gt;
+                            &lt;title&gt;Signup&lt;/title&gt;
+                        &lt;/head&gt;
+                        &lt;body&gt;
+                            &lt;h1&gt;Username taken. Try to choose different username.&lt;/h1&gt;
+                            &lt;form action=&#34;/logs-web&#34; method=&#34;get&#34;&gt;
+                                &lt;input type=&#34;submit&#34; value=&#34;Home Page&#34; /&gt;
+                            &lt;/form&gt;
+                        &lt;/body&gt;
+                    &lt;/html&gt;
+                    &#34;&#34;&#34;
+
+@auth.get(&#34;/login&#34;, response_class=HTMLResponse)
+async def login_get(request: Request):
+    &#34;&#34;&#34;
+    return html template for login
+    &#34;&#34;&#34;
+    return templates.TemplateResponse(&#34;login.html&#34;, {&#34;request&#34;: request})
+
+
+@auth.post(&#34;/login&#34;, response_class=HTMLResponse)
+async def login(username: str = Form(...), password: str = Form(...), db: Session = Depends(get_db),
+                Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from login template. Checks if given username and password aligns with admin
+    username and password and returns token for browser according to given username and password
+    &#34;&#34;&#34;
+    user = auth_user(db, username, password)
+    if user != None:
+        if user.role == &#34;admin&#34;:
+            access_token = Authorize.create_access_token(subject=&#34;admin&#34;, expires_time=False)
+            refresh_token = Authorize.create_refresh_token(subject=&#34;admin&#34;, expires_time=False)
+        else:
+            access_token = Authorize.create_access_token(subject=&#34;guest&#34;, expires_time=False)
+            refresh_token = Authorize.create_refresh_token(subject=&#34;guest&#34;, expires_time=False)
+    else:
+        usr = fake_users_db.get(username)
+        if usr != None:
+            if usr[&#34;username&#34;] == username and usr[&#34;password&#34;] == password:
+                access_token = Authorize.create_access_token(subject=&#34;admin&#34;, expires_time=False)
+                refresh_token = Authorize.create_refresh_token(subject=&#34;admin&#34;, expires_time=False)
+        else:
+            return &#34;&#34;&#34;
+                &lt;html&gt;
+                    &lt;head&gt;
+                        &lt;title&gt;Login&lt;/title&gt;
+                    &lt;/head&gt;
+                    &lt;body&gt;
+                        &lt;h1&gt;Wrong Username or Password&lt;/h1&gt;
+                        &lt;form action=&#34;/login&#34; method=&#34;get&#34;&gt;
+                            &lt;input type=&#34;submit&#34; value=&#34;Log again&#34; /&gt;
+                        &lt;/form&gt;
+                        &lt;form action=&#34;/login&#34; method=&#34;get&#34;&gt;
+                            &lt;input type=&#34;submit&#34; value=&#34;Home Page&#34; /&gt;
+                        &lt;/form&gt;
+                    &lt;/body&gt;
+                &lt;/html&gt;
+                &#34;&#34;&#34;
+
+    # Set the JWT cookies in the response
+    Authorize.set_access_cookies(access_token)
+    Authorize.set_refresh_cookies(refresh_token)
+    return &#34;&#34;&#34;
+    &lt;html&gt;
+        &lt;head&gt;
+            &lt;title&gt;Login&lt;/title&gt;
+        &lt;/head&gt;
+        &lt;body&gt;
+            &lt;h1&gt;Now you are logged in, you can continue to previous page.&lt;/h1&gt;
+            &lt;form action=&#34;/logs-web&#34; method=&#34;get&#34;&gt;
+                &lt;input type=&#34;submit&#34; value=&#34;Home Page&#34; /&gt;
+            &lt;/form&gt;
+        &lt;/body&gt;
+    &lt;/html&gt;
+    &#34;&#34;&#34;
+
+
+@auth.post(&#39;/refresh&#39;)
+def refresh(Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    endpoint for refreshing browser token. Not used at the moment since lifetime of given tokens are
+    unlimited.
+    &#34;&#34;&#34;
+    Authorize.jwt_refresh_token_required()
+    current_user = Authorize.get_jwt_subject()
+    new_access_token = Authorize.create_access_token(subject=current_user)
+    # Set the JWT cookies in the response
+    Authorize.set_access_cookies(new_access_token)
+    return {&#34;msg&#34;: &#34;The token has been refresh&#34;}
+
+
+@auth.get(&#39;/logout&#39;, response_class=HTMLResponse)
+def logout(Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint for deleting cookie token with acces role.
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+
+    Authorize.unset_jwt_cookies()
+    return &#34;&#34;&#34;
+        &lt;html&gt;
+            &lt;head&gt;
+                &lt;title&gt;Logout&lt;/title&gt;
+            &lt;/head&gt;
+            &lt;body&gt;
+                &lt;h1&gt;Logged Out&lt;/h1&gt;
+                &lt;form action=&#34;/logs-web&#34; method=&#34;get&#34;&gt;
+                    &lt;input type=&#34;submit&#34; value=&#34;Back&#34; /&gt;
+                &lt;/form&gt;
+            &lt;/body&gt;
+        &lt;/html&gt;
+        &#34;&#34;&#34;</code></pre>
+</details>
+</section>
+<section>
+</section>
+<section>
+</section>
+<section>
+<h2 class="section-title" id="header-functions">Functions</h2>
+<dl>
+<dt id="sql_app.api.auth.auth_user"><code class="name flex">
+<span>def <span class="ident">auth_user</span></span>(<span>db, username: str, password: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Determines if given password belongs to user with given username</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def auth_user(db, username: str, password: str):
+    &#34;&#34;&#34;
+    Determines if given password belongs to user with given username
+    &#34;&#34;&#34;
+    user = crud.find_user(db, username)
+    if not user:
+        return None
+    if not verify_password(password, user.password):
+        return None
+    return user</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.auth.get_db"><code class="name flex">
+<span>def <span class="ident">get_db</span></span>(<span>)</span>
+</code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_db():
+    db = SessionLocal()
+    try:
+        yield db
+    finally:
+        db.close()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.auth.get_hash_password"><code class="name flex">
+<span>def <span class="ident">get_hash_password</span></span>(<span>password)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Returns hashed password</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_hash_password(password):
+    &#34;&#34;&#34;
+    Returns hashed password
+    &#34;&#34;&#34;
+    return pwd_context.hash(password)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.auth.login"><code class="name flex">
+<span>async def <span class="ident">login</span></span>(<span>username: str = Form(Ellipsis), password: str = Form(Ellipsis), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Endpoint called from login template. Checks if given username and password aligns with admin
+username and password and returns token for browser according to given username and password</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@auth.post(&#34;/login&#34;, response_class=HTMLResponse)
+async def login(username: str = Form(...), password: str = Form(...), db: Session = Depends(get_db),
+                Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from login template. Checks if given username and password aligns with admin
+    username and password and returns token for browser according to given username and password
+    &#34;&#34;&#34;
+    user = auth_user(db, username, password)
+    if user != None:
+        if user.role == &#34;admin&#34;:
+            access_token = Authorize.create_access_token(subject=&#34;admin&#34;, expires_time=False)
+            refresh_token = Authorize.create_refresh_token(subject=&#34;admin&#34;, expires_time=False)
+        else:
+            access_token = Authorize.create_access_token(subject=&#34;guest&#34;, expires_time=False)
+            refresh_token = Authorize.create_refresh_token(subject=&#34;guest&#34;, expires_time=False)
+    else:
+        usr = fake_users_db.get(username)
+        if usr != None:
+            if usr[&#34;username&#34;] == username and usr[&#34;password&#34;] == password:
+                access_token = Authorize.create_access_token(subject=&#34;admin&#34;, expires_time=False)
+                refresh_token = Authorize.create_refresh_token(subject=&#34;admin&#34;, expires_time=False)
+        else:
+            return &#34;&#34;&#34;
+                &lt;html&gt;
+                    &lt;head&gt;
+                        &lt;title&gt;Login&lt;/title&gt;
+                    &lt;/head&gt;
+                    &lt;body&gt;
+                        &lt;h1&gt;Wrong Username or Password&lt;/h1&gt;
+                        &lt;form action=&#34;/login&#34; method=&#34;get&#34;&gt;
+                            &lt;input type=&#34;submit&#34; value=&#34;Log again&#34; /&gt;
+                        &lt;/form&gt;
+                        &lt;form action=&#34;/login&#34; method=&#34;get&#34;&gt;
+                            &lt;input type=&#34;submit&#34; value=&#34;Home Page&#34; /&gt;
+                        &lt;/form&gt;
+                    &lt;/body&gt;
+                &lt;/html&gt;
+                &#34;&#34;&#34;
+
+    # Set the JWT cookies in the response
+    Authorize.set_access_cookies(access_token)
+    Authorize.set_refresh_cookies(refresh_token)
+    return &#34;&#34;&#34;
+    &lt;html&gt;
+        &lt;head&gt;
+            &lt;title&gt;Login&lt;/title&gt;
+        &lt;/head&gt;
+        &lt;body&gt;
+            &lt;h1&gt;Now you are logged in, you can continue to previous page.&lt;/h1&gt;
+            &lt;form action=&#34;/logs-web&#34; method=&#34;get&#34;&gt;
+                &lt;input type=&#34;submit&#34; value=&#34;Home Page&#34; /&gt;
+            &lt;/form&gt;
+        &lt;/body&gt;
+    &lt;/html&gt;
+    &#34;&#34;&#34;</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.auth.login_get"><code class="name flex">
+<span>async def <span class="ident">login_get</span></span>(<span>request: starlette.requests.Request)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>return html template for login</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@auth.get(&#34;/login&#34;, response_class=HTMLResponse)
+async def login_get(request: Request):
+    &#34;&#34;&#34;
+    return html template for login
+    &#34;&#34;&#34;
+    return templates.TemplateResponse(&#34;login.html&#34;, {&#34;request&#34;: request})</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.auth.logout"><code class="name flex">
+<span>def <span class="ident">logout</span></span>(<span>Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Endpoint for deleting cookie token with acces role.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@auth.get(&#39;/logout&#39;, response_class=HTMLResponse)
+def logout(Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint for deleting cookie token with acces role.
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+
+    Authorize.unset_jwt_cookies()
+    return &#34;&#34;&#34;
+        &lt;html&gt;
+            &lt;head&gt;
+                &lt;title&gt;Logout&lt;/title&gt;
+            &lt;/head&gt;
+            &lt;body&gt;
+                &lt;h1&gt;Logged Out&lt;/h1&gt;
+                &lt;form action=&#34;/logs-web&#34; method=&#34;get&#34;&gt;
+                    &lt;input type=&#34;submit&#34; value=&#34;Back&#34; /&gt;
+                &lt;/form&gt;
+            &lt;/body&gt;
+        &lt;/html&gt;
+        &#34;&#34;&#34;</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.auth.refresh"><code class="name flex">
+<span>def <span class="ident">refresh</span></span>(<span>Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>endpoint for refreshing browser token. Not used at the moment since lifetime of given tokens are
+unlimited.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@auth.post(&#39;/refresh&#39;)
+def refresh(Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    endpoint for refreshing browser token. Not used at the moment since lifetime of given tokens are
+    unlimited.
+    &#34;&#34;&#34;
+    Authorize.jwt_refresh_token_required()
+    current_user = Authorize.get_jwt_subject()
+    new_access_token = Authorize.create_access_token(subject=current_user)
+    # Set the JWT cookies in the response
+    Authorize.set_access_cookies(new_access_token)
+    return {&#34;msg&#34;: &#34;The token has been refresh&#34;}</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.auth.signup"><code class="name flex">
+<span>async def <span class="ident">signup</span></span>(<span>username: str = Form(Ellipsis), password: str = Form(Ellipsis), db: sqlalchemy.orm.session.Session = Depends(get_db))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Endpoint called form signup template. Creates new user with role guest that can be changed by admin user</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@auth.post(&#34;/signup&#34;, response_class=HTMLResponse)
+async def signup(username: str = Form(...), password: str = Form(...), db: Session = Depends(get_db)):
+    &#34;&#34;&#34;
+    Endpoint called form signup template. Creates new user with role guest that can be changed by admin user
+    &#34;&#34;&#34;
+    users = crud.get_users(db, 0, 100)
+    users_names = []
+    for u in users:
+        users_names.append(u.username)
+    if username not in users_names:
+        new_user = crud.create_user(db, username, get_hash_password(password), &#34;guest&#34;)
+        if new_user is None:
+            print(&#34;something went wrong&#34;)
+        return &#34;&#34;&#34;
+            &lt;html&gt;
+                &lt;head&gt;
+                    &lt;title&gt;Signup&lt;/title&gt;
+                &lt;/head&gt;
+                &lt;body&gt;
+                    &lt;h1&gt;New user created. You can go back to previous page.&lt;/h1&gt;
+                    &lt;form action=&#34;/logs-web&#34; method=&#34;get&#34;&gt;
+                        &lt;input type=&#34;submit&#34; value=&#34;Home Page&#34; /&gt;
+                    &lt;/form&gt;
+                &lt;/body&gt;
+            &lt;/html&gt;
+            &#34;&#34;&#34;
+    else:
+        return &#34;&#34;&#34;
+                    &lt;html&gt;
+                        &lt;head&gt;
+                            &lt;title&gt;Signup&lt;/title&gt;
+                        &lt;/head&gt;
+                        &lt;body&gt;
+                            &lt;h1&gt;Username taken. Try to choose different username.&lt;/h1&gt;
+                            &lt;form action=&#34;/logs-web&#34; method=&#34;get&#34;&gt;
+                                &lt;input type=&#34;submit&#34; value=&#34;Home Page&#34; /&gt;
+                            &lt;/form&gt;
+                        &lt;/body&gt;
+                    &lt;/html&gt;
+                    &#34;&#34;&#34;</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.auth.signup_get"><code class="name flex">
+<span>async def <span class="ident">signup_get</span></span>(<span>request: starlette.requests.Request)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>return html template for signup</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@auth.get(&#34;/signup&#34;, response_class=HTMLResponse)
+async def signup_get(request: Request):
+    &#34;&#34;&#34;
+    return html template for signup
+    &#34;&#34;&#34;
+    return templates.TemplateResponse(&#34;signup.html&#34;, {&#34;request&#34;: request})</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.auth.verify_password"><code class="name flex">
+<span>def <span class="ident">verify_password</span></span>(<span>plain_password, hashed_password)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Verifies plain text password with hashed password</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def verify_password(plain_password, hashed_password):
+    &#34;&#34;&#34;
+    Verifies plain text password with hashed password
+    &#34;&#34;&#34;
+    return pwd_context.verify(plain_password, hashed_password)</code></pre>
+</details>
+</dd>
+</dl>
+</section>
+<section>
+<h2 class="section-title" id="header-classes">Classes</h2>
+<dl>
+<dt id="sql_app.api.auth.Settings"><code class="flex name class">
+<span>class <span class="ident">Settings</span></span>
+<span>(</span><span>**data: Any)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Create a new model by parsing and validating input data from keyword arguments.</p>
+<p>Raises ValidationError if the input data cannot be parsed to form a valid model.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">class Settings(BaseModel):
+    authjwt_secret_key: str = &#34;secret&#34;
+    # Configure application to store and get JWT from cookies
+    authjwt_token_location: set = {&#34;cookies&#34;}
+    # Disable CSRF Protection for this example. default is True
+    authjwt_cookie_csrf_protect: bool = False</code></pre>
+</details>
+<h3>Ancestors</h3>
+<ul class="hlist">
+<li>pydantic.main.BaseModel</li>
+<li>pydantic.utils.Representation</li>
+</ul>
+<h3>Class variables</h3>
+<dl>
+<dt id="sql_app.api.auth.Settings.authjwt_cookie_csrf_protect"><code class="name">var <span class="ident">authjwt_cookie_csrf_protect</span> : bool</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt id="sql_app.api.auth.Settings.authjwt_secret_key"><code class="name">var <span class="ident">authjwt_secret_key</span> : str</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt id="sql_app.api.auth.Settings.authjwt_token_location"><code class="name">var <span class="ident">authjwt_token_location</span> : set</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+</dl>
+</dd>
+</dl>
+</section>
+</article>
+<nav id="sidebar">
+<h1>Index</h1>
+<div class="toc">
+<ul></ul>
+</div>
+<ul id="index">
+<li><h3>Super-module</h3>
+<ul>
+<li><code><a title="sql_app.api" href="index.html">sql_app.api</a></code></li>
+</ul>
+</li>
+<li><h3><a href="#header-functions">Functions</a></h3>
+<ul class="two-column">
+<li><code><a title="sql_app.api.auth.auth_user" href="#sql_app.api.auth.auth_user">auth_user</a></code></li>
+<li><code><a title="sql_app.api.auth.get_db" href="#sql_app.api.auth.get_db">get_db</a></code></li>
+<li><code><a title="sql_app.api.auth.get_hash_password" href="#sql_app.api.auth.get_hash_password">get_hash_password</a></code></li>
+<li><code><a title="sql_app.api.auth.login" href="#sql_app.api.auth.login">login</a></code></li>
+<li><code><a title="sql_app.api.auth.login_get" href="#sql_app.api.auth.login_get">login_get</a></code></li>
+<li><code><a title="sql_app.api.auth.logout" href="#sql_app.api.auth.logout">logout</a></code></li>
+<li><code><a title="sql_app.api.auth.refresh" href="#sql_app.api.auth.refresh">refresh</a></code></li>
+<li><code><a title="sql_app.api.auth.signup" href="#sql_app.api.auth.signup">signup</a></code></li>
+<li><code><a title="sql_app.api.auth.signup_get" href="#sql_app.api.auth.signup_get">signup_get</a></code></li>
+<li><code><a title="sql_app.api.auth.verify_password" href="#sql_app.api.auth.verify_password">verify_password</a></code></li>
+</ul>
+</li>
+<li><h3><a href="#header-classes">Classes</a></h3>
+<ul>
+<li>
+<h4><code><a title="sql_app.api.auth.Settings" href="#sql_app.api.auth.Settings">Settings</a></code></h4>
+<ul class="">
+<li><code><a title="sql_app.api.auth.Settings.authjwt_cookie_csrf_protect" href="#sql_app.api.auth.Settings.authjwt_cookie_csrf_protect">authjwt_cookie_csrf_protect</a></code></li>
+<li><code><a title="sql_app.api.auth.Settings.authjwt_secret_key" href="#sql_app.api.auth.Settings.authjwt_secret_key">authjwt_secret_key</a></code></li>
+<li><code><a title="sql_app.api.auth.Settings.authjwt_token_location" href="#sql_app.api.auth.Settings.authjwt_token_location">authjwt_token_location</a></code></li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</nav>
+</main>
+<footer id="footer">
+<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
+</footer>
+</body>
+</html>
\ No newline at end of file
diff --git a/server/doc/sql_app/api/bodydevices_web.html b/server/doc/sql_app/api/bodydevices_web.html
new file mode 100644
index 0000000..958001a
--- /dev/null
+++ b/server/doc/sql_app/api/bodydevices_web.html
@@ -0,0 +1,446 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
+<meta name="generator" content="pdoc 0.10.0" />
+<title>sql_app.api.bodydevices_web API documentation</title>
+<meta name="description" content="" />
+<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
+<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
+<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
+<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
+<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
+<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
+<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
+<script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
+</head>
+<body>
+<main>
+<article id="content">
+<header>
+<h1 class="title">Module <code>sql_app.api.bodydevices_web</code></h1>
+</header>
+<section id="section-intro">
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">from datetime import datetime
+
+from fastapi import Depends, APIRouter, Form
+from fastapi import Request
+from fastapi.responses import HTMLResponse, RedirectResponse
+from fastapi.templating import Jinja2Templates
+from fastapi_jwt_auth import AuthJWT
+from pydantic import BaseModel
+from sqlalchemy.orm import Session
+from sql_app.api.auth import fake_users_db
+from sql_app import crud, models
+from ..database import SessionLocal, engine
+
+models.Base.metadata.create_all(bind=engine)
+
+# Path to html templates used in this file
+templates = Jinja2Templates(directory=&#34;../templates/body-devices&#34;)
+
+# prefix used for all endpoints in this file
+body_device_web = APIRouter(prefix=&#34;&#34;)
+
+
+# Dependency
+def get_db():
+    db = SessionLocal()
+    try:
+        yield db
+    finally:
+        db.close()
+
+
+@body_device_web.get(&#34;/body-devices-web&#34;, response_class=HTMLResponse)
+async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Returns template with all body devices and necessary attributes
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+
+    device_dict = []
+    devices = crud.get_body_devices(db, skip=skip, limit=limit)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    for dev in devices:
+        lic = crud.get_license(db, dev.license_id)
+        device_dict.append({&#34;device&#34;: dev, &#34;license&#34;: lic, &#34;log&#34;: dev.b_logs[len(dev.b_logs) - 1]})
+    licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;body_devices.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                &#34;devs&#34;: devices, &#34;teams&#34;: teams, &#34;licenses&#34;: licenses,
+                                                                &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;body_devices_normal.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                &#34;devs&#34;: devices, &#34;teams&#34;: teams, &#34;licenses&#34;: licenses,
+                                                                &#34;user&#34;: current_user})
+
+
+@body_device_web.post(&#34;/body-devices-web&#34;, response_class=HTMLResponse)
+async def filter_devices(request: Request, skip: int = 0, limit: int = 100,
+                         body_id: str = Form(&#34;all&#34;), lic_id: str = Form(&#34;all&#34;), team: str = Form(&#34;all&#34;),
+                         db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint used for filtering body devices by user given inputs. returns html template with only
+    body devices that has attributes defined by user input
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    device_dict = []
+    devices_f = crud.get_filtered_bodydevices(db, body_id, lic_id, team)
+    ids = []
+    for d in devices_f:
+        ids.append(d[0])
+    devices = crud.get_bodydevices_with_ids(db, ids)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    for dev in devices:
+        lic = crud.get_license(db, dev.license_id)
+        device_dict.append({&#34;device&#34;: dev, &#34;license&#34;: lic, &#34;log&#34;: dev.b_logs[len(dev.b_logs) - 1]})
+    licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;body_devices.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                &#34;devs&#34;: devices, &#34;teams&#34;: teams, &#34;licenses&#34;: licenses,
+                                                                &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;body_devices_normal.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                       &#34;devs&#34;: devices, &#34;teams&#34;: teams,
+                                                                       &#34;licenses&#34;: licenses,
+                                                                       &#34;user&#34;: current_user})
+
+
+@body_device_web.get(&#34;/body-device-license/{device_id}&#34;, response_class=HTMLResponse)
+async def connect_dev_lic(request: Request, device_id: int, db: Session = Depends(get_db),
+                          Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Returns template with one body device and all available licenses that can be assigned to it. Plus available teams
+    that can be assigned to device, inventory number and comment text input for this device.
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    device = crud.get_body_device(db, device_id)
+    licenses = crud.get_licenses(db, 0, 100)
+    lic_left = []
+    for lic in licenses:
+        if lic != device.license:
+            lic_left.append(lic)
+    teams = crud.get_teams(db, 0, 100)
+    return templates.TemplateResponse(&#34;body_device_license.html&#34;,
+                                      {&#34;request&#34;: request, &#34;device&#34;: device, &#34;licenses&#34;: lic_left, &#34;teams&#34;: teams})
+
+
+@body_device_web.post(&#34;/body-devices-web-lic/{device_id}&#34;)
+async def connect_post(device_id: int, lic: str = Form(...), db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from template from body_device_license.html template. Connects body device with license
+    and redirects to body-devices-web endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_bodydevice_license(db, device_id, int(lic))
+    return RedirectResponse(url=f&#34;/body-devices-web&#34;, status_code=303)
+
+
+@body_device_web.post(&#34;/body-devices-web-team/{device_id}&#34;)
+async def delete_post(device_id: int, team_con: str = Form(...), db: Session = Depends(get_db),
+                      Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from template from body_device_license.html template, connects device with new team
+    and redirects to body-devices-web endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_bodydevice_team(db, device_id, int(team_con))
+    return RedirectResponse(url=f&#34;/body-devices-web&#34;, status_code=303)
+
+
+@body_device_web.post(&#34;/body-devices-inv/{device_id}&#34;)
+async def device_inv(device_id: int, dev_inv: str = Form(...), db: Session = Depends(get_db),
+                     Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from template from body_device_license.html template, updates devices inventory number
+    and redirects to body-devices-web endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_bodydevice_inv(db, device_id, dev_inv)
+    return RedirectResponse(url=f&#34;/body-devices-web&#34;, status_code=303)
+
+
+@body_device_web.post(&#34;/body-devices-comm/{device_id}&#34;)
+async def device_inv(device_id: int, dev_com: str = Form(...), db: Session = Depends(get_db),
+                     Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from template from body_device_license.html template, updates devices comment
+    and redirects to body-devices-web endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_bodydevice_comm(db, device_id, dev_com)
+    return RedirectResponse(url=f&#34;/body-devices-web&#34;, status_code=303)</code></pre>
+</details>
+</section>
+<section>
+</section>
+<section>
+</section>
+<section>
+<h2 class="section-title" id="header-functions">Functions</h2>
+<dl>
+<dt id="sql_app.api.bodydevices_web.connect_dev_lic"><code class="name flex">
+<span>async def <span class="ident">connect_dev_lic</span></span>(<span>request: starlette.requests.Request, device_id: int, db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Returns template with one body device and all available licenses that can be assigned to it. Plus available teams
+that can be assigned to device, inventory number and comment text input for this device.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@body_device_web.get(&#34;/body-device-license/{device_id}&#34;, response_class=HTMLResponse)
+async def connect_dev_lic(request: Request, device_id: int, db: Session = Depends(get_db),
+                          Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Returns template with one body device and all available licenses that can be assigned to it. Plus available teams
+    that can be assigned to device, inventory number and comment text input for this device.
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    device = crud.get_body_device(db, device_id)
+    licenses = crud.get_licenses(db, 0, 100)
+    lic_left = []
+    for lic in licenses:
+        if lic != device.license:
+            lic_left.append(lic)
+    teams = crud.get_teams(db, 0, 100)
+    return templates.TemplateResponse(&#34;body_device_license.html&#34;,
+                                      {&#34;request&#34;: request, &#34;device&#34;: device, &#34;licenses&#34;: lic_left, &#34;teams&#34;: teams})</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.bodydevices_web.connect_post"><code class="name flex">
+<span>async def <span class="ident">connect_post</span></span>(<span>device_id: int, lic: str = Form(Ellipsis), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Endpoint called from template from body_device_license.html template. Connects body device with license
+and redirects to body-devices-web endpoint</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@body_device_web.post(&#34;/body-devices-web-lic/{device_id}&#34;)
+async def connect_post(device_id: int, lic: str = Form(...), db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from template from body_device_license.html template. Connects body device with license
+    and redirects to body-devices-web endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_bodydevice_license(db, device_id, int(lic))
+    return RedirectResponse(url=f&#34;/body-devices-web&#34;, status_code=303)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.bodydevices_web.delete_post"><code class="name flex">
+<span>async def <span class="ident">delete_post</span></span>(<span>device_id: int, team_con: str = Form(Ellipsis), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Endpoint called from template from body_device_license.html template, connects device with new team
+and redirects to body-devices-web endpoint</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@body_device_web.post(&#34;/body-devices-web-team/{device_id}&#34;)
+async def delete_post(device_id: int, team_con: str = Form(...), db: Session = Depends(get_db),
+                      Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from template from body_device_license.html template, connects device with new team
+    and redirects to body-devices-web endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_bodydevice_team(db, device_id, int(team_con))
+    return RedirectResponse(url=f&#34;/body-devices-web&#34;, status_code=303)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.bodydevices_web.device_inv"><code class="name flex">
+<span>async def <span class="ident">device_inv</span></span>(<span>device_id: int, dev_com: str = Form(Ellipsis), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Endpoint called from template from body_device_license.html template, updates devices comment
+and redirects to body-devices-web endpoint</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@body_device_web.post(&#34;/body-devices-comm/{device_id}&#34;)
+async def device_inv(device_id: int, dev_com: str = Form(...), db: Session = Depends(get_db),
+                     Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from template from body_device_license.html template, updates devices comment
+    and redirects to body-devices-web endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_bodydevice_comm(db, device_id, dev_com)
+    return RedirectResponse(url=f&#34;/body-devices-web&#34;, status_code=303)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.bodydevices_web.filter_devices"><code class="name flex">
+<span>async def <span class="ident">filter_devices</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, body_id: str = Form(all), lic_id: str = Form(all), team: str = Form(all), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Endpoint used for filtering body devices by user given inputs. returns html template with only
+body devices that has attributes defined by user input</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@body_device_web.post(&#34;/body-devices-web&#34;, response_class=HTMLResponse)
+async def filter_devices(request: Request, skip: int = 0, limit: int = 100,
+                         body_id: str = Form(&#34;all&#34;), lic_id: str = Form(&#34;all&#34;), team: str = Form(&#34;all&#34;),
+                         db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint used for filtering body devices by user given inputs. returns html template with only
+    body devices that has attributes defined by user input
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    device_dict = []
+    devices_f = crud.get_filtered_bodydevices(db, body_id, lic_id, team)
+    ids = []
+    for d in devices_f:
+        ids.append(d[0])
+    devices = crud.get_bodydevices_with_ids(db, ids)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    for dev in devices:
+        lic = crud.get_license(db, dev.license_id)
+        device_dict.append({&#34;device&#34;: dev, &#34;license&#34;: lic, &#34;log&#34;: dev.b_logs[len(dev.b_logs) - 1]})
+    licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;body_devices.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                &#34;devs&#34;: devices, &#34;teams&#34;: teams, &#34;licenses&#34;: licenses,
+                                                                &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;body_devices_normal.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                       &#34;devs&#34;: devices, &#34;teams&#34;: teams,
+                                                                       &#34;licenses&#34;: licenses,
+                                                                       &#34;user&#34;: current_user})</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.bodydevices_web.get_db"><code class="name flex">
+<span>def <span class="ident">get_db</span></span>(<span>)</span>
+</code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_db():
+    db = SessionLocal()
+    try:
+        yield db
+    finally:
+        db.close()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.bodydevices_web.read_devices"><code class="name flex">
+<span>async def <span class="ident">read_devices</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Returns template with all body devices and necessary attributes</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@body_device_web.get(&#34;/body-devices-web&#34;, response_class=HTMLResponse)
+async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Returns template with all body devices and necessary attributes
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+
+    device_dict = []
+    devices = crud.get_body_devices(db, skip=skip, limit=limit)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    for dev in devices:
+        lic = crud.get_license(db, dev.license_id)
+        device_dict.append({&#34;device&#34;: dev, &#34;license&#34;: lic, &#34;log&#34;: dev.b_logs[len(dev.b_logs) - 1]})
+    licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;body_devices.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                &#34;devs&#34;: devices, &#34;teams&#34;: teams, &#34;licenses&#34;: licenses,
+                                                                &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;body_devices_normal.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                &#34;devs&#34;: devices, &#34;teams&#34;: teams, &#34;licenses&#34;: licenses,
+                                                                &#34;user&#34;: current_user})</code></pre>
+</details>
+</dd>
+</dl>
+</section>
+<section>
+</section>
+</article>
+<nav id="sidebar">
+<h1>Index</h1>
+<div class="toc">
+<ul></ul>
+</div>
+<ul id="index">
+<li><h3>Super-module</h3>
+<ul>
+<li><code><a title="sql_app.api" href="index.html">sql_app.api</a></code></li>
+</ul>
+</li>
+<li><h3><a href="#header-functions">Functions</a></h3>
+<ul class="two-column">
+<li><code><a title="sql_app.api.bodydevices_web.connect_dev_lic" href="#sql_app.api.bodydevices_web.connect_dev_lic">connect_dev_lic</a></code></li>
+<li><code><a title="sql_app.api.bodydevices_web.connect_post" href="#sql_app.api.bodydevices_web.connect_post">connect_post</a></code></li>
+<li><code><a title="sql_app.api.bodydevices_web.delete_post" href="#sql_app.api.bodydevices_web.delete_post">delete_post</a></code></li>
+<li><code><a title="sql_app.api.bodydevices_web.device_inv" href="#sql_app.api.bodydevices_web.device_inv">device_inv</a></code></li>
+<li><code><a title="sql_app.api.bodydevices_web.filter_devices" href="#sql_app.api.bodydevices_web.filter_devices">filter_devices</a></code></li>
+<li><code><a title="sql_app.api.bodydevices_web.get_db" href="#sql_app.api.bodydevices_web.get_db">get_db</a></code></li>
+<li><code><a title="sql_app.api.bodydevices_web.read_devices" href="#sql_app.api.bodydevices_web.read_devices">read_devices</a></code></li>
+</ul>
+</li>
+</ul>
+</nav>
+</main>
+<footer id="footer">
+<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
+</footer>
+</body>
+</html>
\ No newline at end of file
diff --git a/server/doc/sql_app/api/devices.html b/server/doc/sql_app/api/devices.html
index 44cffd7..0f933d7 100644
--- a/server/doc/sql_app/api/devices.html
+++ b/server/doc/sql_app/api/devices.html
@@ -49,7 +49,7 @@ def get_db():
 
 
 @device.post(&#34;/device&#34;, response_model=schemas.Device)
-def create_device(device: schemas.DeviceCreate, db: Session = Depends(get_db)):
+def create_device(device: schemas.DeviceTemp, db: Session = Depends(get_db)):
     &#34;&#34;&#34;
     Endpoint used for creating new device
     &#34;&#34;&#34;
@@ -84,7 +84,7 @@ def read_device(device_id: int, db: Session = Depends(get_db)):
 <h2 class="section-title" id="header-functions">Functions</h2>
 <dl>
 <dt id="sql_app.api.devices.create_device"><code class="name flex">
-<span>def <span class="ident">create_device</span></span>(<span>device: <a title="sql_app.schemas.DeviceCreate" href="../schemas.html#sql_app.schemas.DeviceCreate">DeviceCreate</a>, db: sqlalchemy.orm.session.Session = Depends(get_db))</span>
+<span>def <span class="ident">create_device</span></span>(<span>device: <a title="sql_app.schemas.DeviceTemp" href="../schemas.html#sql_app.schemas.DeviceTemp">DeviceTemp</a>, db: sqlalchemy.orm.session.Session = Depends(get_db))</span>
 </code></dt>
 <dd>
 <div class="desc"><p>Endpoint used for creating new device</p></div>
@@ -93,7 +93,7 @@ def read_device(device_id: int, db: Session = Depends(get_db)):
 <span>Expand source code</span>
 </summary>
 <pre><code class="python">@device.post(&#34;/device&#34;, response_model=schemas.Device)
-def create_device(device: schemas.DeviceCreate, db: Session = Depends(get_db)):
+def create_device(device: schemas.DeviceTemp, db: Session = Depends(get_db)):
     &#34;&#34;&#34;
     Endpoint used for creating new device
     &#34;&#34;&#34;
diff --git a/server/doc/sql_app/api/devices_web.html b/server/doc/sql_app/api/devices_web.html
index b4028ad..4c54ff9 100644
--- a/server/doc/sql_app/api/devices_web.html
+++ b/server/doc/sql_app/api/devices_web.html
@@ -26,17 +26,18 @@
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">from typing import List
+<pre><code class="python">from datetime import datetime
 
-from fastapi import Depends, FastAPI, HTTPException, APIRouter, Form
+from fastapi import Depends, APIRouter, Form
+from fastapi import Request
+from fastapi.responses import HTMLResponse, RedirectResponse
+from fastapi.templating import Jinja2Templates
+from fastapi_jwt_auth import AuthJWT
+from pydantic import BaseModel
 from sqlalchemy.orm import Session
+from sql_app.api.auth import fake_users_db
 from sql_app import crud, models, schemas
-from datetime import datetime
 from ..database import SessionLocal, engine
-from fastapi import FastAPI, Request
-from fastapi.responses import HTMLResponse
-from fastapi.staticfiles import StaticFiles
-from fastapi.templating import Jinja2Templates
 
 models.Base.metadata.create_all(bind=engine)
 
@@ -44,7 +45,7 @@ models.Base.metadata.create_all(bind=engine)
 templates = Jinja2Templates(directory=&#34;../templates/devices&#34;)
 
 # prefix used for all endpoints in this file
-device_web = APIRouter(prefix=&#34;/api/v1&#34;)
+device_web = APIRouter(prefix=&#34;&#34;)
 
 
 # Dependency
@@ -57,71 +58,173 @@ def get_db():
 
 
 @device_web.get(&#34;/devices-web&#34;, response_class=HTMLResponse)
-async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
+async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
-    Returns template with all devices and its current states
+    Returns template with all devices and its necessary attributes
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+
+    device_dict = []
     devices = crud.get_devices(db, skip=skip, limit=limit)
-    statuses = []
-    # adding state for each device in list
-    for i in range(0, len(devices)):
-        statuses.append(devices[i].logs[len(devices[i].logs)-1].status)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    # adding dictionary entry with all inforamtions needed in template
+    for dev in devices:
+        if len(dev.licenses) &gt; 0:
+            for lic in dev.licenses:
+                device_dict.append({&#34;device&#34;: dev, &#34;license&#34;: lic.licenses, &#34;log&#34;: dev.logs[len(dev.logs) - 1]})
+        else:
+            device_dict.append({&#34;device&#34;: dev, &#34;license&#34;: dev.licenses, &#34;log&#34;: dev.logs[len(dev.logs) - 1]})
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;devices.html&#34;, {&#34;request&#34;: request, &#34;devs&#34;: len(devices), &#34;devices&#34;: devices,
-                                                       &#34;statuses&#34;: statuses, &#34;licenses&#34;: licenses})
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;devices.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                           &#34;licenses&#34;: licenses, &#34;devs&#34;: devices,
+                                                           &#34;teams&#34;: teams, &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;devices_normal.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                  &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})
 
 
 @device_web.post(&#34;/devices-web&#34;, response_class=HTMLResponse)
-async def filter_devices(request: Request, skip: int = 0, limit: int = 100, lic: str = Form(&#34;all&#34;),
-                         db: Session = Depends(get_db)):
+async def filter_devices(request: Request, skip: int = 0, limit: int = 100,
+                         keyman_id: str = Form(&#34;all&#34;), lic_name: str = Form(&#34;all&#34;),
+                         lic_id: str = Form(&#34;all&#34;), team: str = Form(&#34;all&#34;),
+                         db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
-    Endpoint used for filtering devices by license. returns html template with only
+    Endpoint used for filtering devices by user given inputs. returns html template with only
     devices that has assigned license defined by user input
     &#34;&#34;&#34;
-    devices = crud.get_devices(db, skip=skip, limit=limit)
-    def_devices = []
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    device_dict = []
+    devices_f = crud.get_filtered_devices(db, keyman_id, lic_name, lic_id, team)
+    ids = []
+    for d in devices_f:
+        ids.append(d[0])
+    devices = crud.get_devices_with_ids(db, ids)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    # adding dictionary entry with all inforamtions needed in template
     for dev in devices:
-        for l in dev.licenses:
-            if dev not in def_devices and l.licenses.name == lic:
-                def_devices.append(dev)
-    # if input was default all
-    if lic == &#34;all&#34;:
-        def_devices = devices
-    statuses = []
-    for i in range(0, len(def_devices)):
-        statuses.append(def_devices[i].logs[len(def_devices[i].logs) - 1].status)
+        if len(dev.licenses) &gt; 0:
+            for lic in dev.licenses:
+                device_dict.append({&#34;device&#34;: dev, &#34;license&#34;: lic.licenses, &#34;log&#34;: dev.logs[len(dev.logs) - 1]})
+        else:
+            device_dict.append({&#34;device&#34;: dev, &#34;license&#34;: dev.licenses, &#34;log&#34;: dev.logs[len(dev.logs) - 1]})
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;devices.html&#34;, {&#34;request&#34;: request, &#34;devs&#34;: len(def_devices), &#34;devices&#34;: def_devices,
-                                                       &#34;statuses&#34;: statuses, &#34;licenses&#34;: licenses})
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;devices.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                           &#34;licenses&#34;: licenses, &#34;devs&#34;: devices,
+                                                           &#34;teams&#34;: teams, &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;devices_normal.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                  &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})
 
 
 @device_web.get(&#34;/device-license/{device_id}&#34;, response_class=HTMLResponse)
-async def connect_dev_lic(request: Request, device_id: int, db: Session = Depends(get_db)):
+async def connect_dev_lic(request: Request, device_id: int, db: Session = Depends(get_db),
+                          Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
-    Returns template with one device and all available licenses that can be assigned to it.
+    Returns template with one device and all available licenses that can be assigned to it. Plus all teams that can
+    be assigned to device, inventory number text input and comment text input
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
     device = crud.get_device(db, device_id)
+    dev_licenses = crud.get_device_licenses(db, device_id)
+    lic_ids = []
+    dev_lics = []
+    for dev_lic in dev_licenses:
+        dev_lics.append(dev_lic.licenses)
+    for dev_lic in dev_licenses:
+        lic_ids.append(dev_lic.licenses.license_id)
     licenses = crud.get_licenses(db, 0, 100)
+    lic_left = []
+    for lic in licenses:
+        if lic.license_id not in lic_ids and lic not in lic_left:
+            lic_left.append(lic)
+    teams = crud.get_teams(db, 0, 100)
     return templates.TemplateResponse(&#34;devicelicense.html&#34;,
-                                      {&#34;request&#34;: request, &#34;device&#34;: device, &#34;licenses&#34;: licenses})
+                                      {&#34;request&#34;: request, &#34;device&#34;: device, &#34;licenses&#34;: lic_left, &#34;dev_lic&#34;: dev_lics,
+                                       &#34;teams&#34;: teams})
 
 
-@device_web.post(&#34;/devices-web/{device_id}&#34;, response_class=HTMLResponse)
-async def connect_post(request: Request, device_id: int, lic: str = Form(...), skip: int = 0, limit: int = 100,
-                       db: Session = Depends(get_db)):
+@device_web.post(&#34;/devices-web/{device_id}&#34;)
+async def connect_post(device_id: int, lic: str = Form(...), db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
-    Endpoint called from template for connecting device with license. Adds entry to devices_licenses
-    table and returns template with all devices in database
+    Endpoint called from devicelicense.html template. Adds entry to devices_licenses
+    table and redirects to devices-web endpoint
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
     crud.create_device_license(db, device_id, int(lic), datetime.now())
-    devices = crud.get_devices(db, skip=skip, limit=limit)
-    statuses = []
-    # adding state for each device in list
-    for i in range(0, len(devices)):
-        statuses.append(devices[i].logs[len(devices[i].logs) - 1].status)
-    licenses = crud.get_licenses(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;devices.html&#34;, {&#34;request&#34;: request, &#34;devs&#34;: len(devices), &#34;devices&#34;: devices,
-                                                       &#34;statuses&#34;: statuses, &#34;licenses&#34;: licenses})</code></pre>
+    return RedirectResponse(url=f&#34;/devices-web&#34;, status_code=303)
+
+
+@device_web.post(&#34;/devices-web-del/{device_id}&#34;)
+async def delete_post(device_id: int, lic_del: str = Form(...), db: Session = Depends(get_db),
+                      Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from devicelicense.html template for deleting device-license connection. Deletes entry in
+    bodydevices_licenses table and redirects to devices-web endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.delete_device_license(db, device_id, int(lic_del))
+    return RedirectResponse(url=f&#34;/devices-web&#34;, status_code=303)
+
+
+@device_web.post(&#34;/devices-web-team/{device_id}&#34;)
+async def dev_team_con(device_id: int, team_con: str = Form(...), db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from devicelicense.html template, connects device with team and redirects to devices-web endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_device(db, device_id, team_con)
+    return RedirectResponse(url=f&#34;/devices-web&#34;, status_code=303)
+
+
+@device_web.post(&#34;/devices-web-inv/{device_id}&#34;)
+async def dev_inv_new(device_id: int, dev_inv: str = Form(...), db: Session = Depends(get_db),
+                      Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from template devicelicense.html, updates inventory number of device and redirects to devices-web
+    endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_device_inv(db, device_id, dev_inv)
+    return RedirectResponse(url=f&#34;/devices-web&#34;, status_code=303)
+
+
+@device_web.post(&#34;/devices-web-comment/{device_id}&#34;)
+async def dev_comm_new(device_id: int, dev_com: str = Form(...), db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from template devicelicense.html, updates comment of device and redirects to devices-web
+    endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_device_com(db, device_id, dev_com)
+    return RedirectResponse(url=f&#34;/devices-web&#34;, status_code=303)</code></pre>
 </details>
 </section>
 <section>
@@ -132,85 +235,212 @@ async def connect_post(request: Request, device_id: int, lic: str = Form(...), s
 <h2 class="section-title" id="header-functions">Functions</h2>
 <dl>
 <dt id="sql_app.api.devices_web.connect_dev_lic"><code class="name flex">
-<span>async def <span class="ident">connect_dev_lic</span></span>(<span>request: starlette.requests.Request, device_id: int, db: sqlalchemy.orm.session.Session = Depends(get_db))</span>
+<span>async def <span class="ident">connect_dev_lic</span></span>(<span>request: starlette.requests.Request, device_id: int, db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
 </code></dt>
 <dd>
-<div class="desc"><p>Returns template with one device and all available licenses that can be assigned to it.</p></div>
+<div class="desc"><p>Returns template with one device and all available licenses that can be assigned to it. Plus all teams that can
+be assigned to device, inventory number text input and comment text input</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
 <pre><code class="python">@device_web.get(&#34;/device-license/{device_id}&#34;, response_class=HTMLResponse)
-async def connect_dev_lic(request: Request, device_id: int, db: Session = Depends(get_db)):
+async def connect_dev_lic(request: Request, device_id: int, db: Session = Depends(get_db),
+                          Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
-    Returns template with one device and all available licenses that can be assigned to it.
+    Returns template with one device and all available licenses that can be assigned to it. Plus all teams that can
+    be assigned to device, inventory number text input and comment text input
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
     device = crud.get_device(db, device_id)
+    dev_licenses = crud.get_device_licenses(db, device_id)
+    lic_ids = []
+    dev_lics = []
+    for dev_lic in dev_licenses:
+        dev_lics.append(dev_lic.licenses)
+    for dev_lic in dev_licenses:
+        lic_ids.append(dev_lic.licenses.license_id)
     licenses = crud.get_licenses(db, 0, 100)
+    lic_left = []
+    for lic in licenses:
+        if lic.license_id not in lic_ids and lic not in lic_left:
+            lic_left.append(lic)
+    teams = crud.get_teams(db, 0, 100)
     return templates.TemplateResponse(&#34;devicelicense.html&#34;,
-                                      {&#34;request&#34;: request, &#34;device&#34;: device, &#34;licenses&#34;: licenses})</code></pre>
+                                      {&#34;request&#34;: request, &#34;device&#34;: device, &#34;licenses&#34;: lic_left, &#34;dev_lic&#34;: dev_lics,
+                                       &#34;teams&#34;: teams})</code></pre>
 </details>
 </dd>
 <dt id="sql_app.api.devices_web.connect_post"><code class="name flex">
-<span>async def <span class="ident">connect_post</span></span>(<span>request: starlette.requests.Request, device_id: int, lic: str = Form(Ellipsis), skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db))</span>
+<span>async def <span class="ident">connect_post</span></span>(<span>device_id: int, lic: str = Form(Ellipsis), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
 </code></dt>
 <dd>
-<div class="desc"><p>Endpoint called from template for connecting device with license. Adds entry to devices_licenses
-table and returns template with all devices in database</p></div>
+<div class="desc"><p>Endpoint called from devicelicense.html template. Adds entry to devices_licenses
+table and redirects to devices-web endpoint</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">@device_web.post(&#34;/devices-web/{device_id}&#34;, response_class=HTMLResponse)
-async def connect_post(request: Request, device_id: int, lic: str = Form(...), skip: int = 0, limit: int = 100,
-                       db: Session = Depends(get_db)):
+<pre><code class="python">@device_web.post(&#34;/devices-web/{device_id}&#34;)
+async def connect_post(device_id: int, lic: str = Form(...), db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
-    Endpoint called from template for connecting device with license. Adds entry to devices_licenses
-    table and returns template with all devices in database
+    Endpoint called from devicelicense.html template. Adds entry to devices_licenses
+    table and redirects to devices-web endpoint
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
     crud.create_device_license(db, device_id, int(lic), datetime.now())
-    devices = crud.get_devices(db, skip=skip, limit=limit)
-    statuses = []
-    # adding state for each device in list
-    for i in range(0, len(devices)):
-        statuses.append(devices[i].logs[len(devices[i].logs) - 1].status)
-    licenses = crud.get_licenses(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;devices.html&#34;, {&#34;request&#34;: request, &#34;devs&#34;: len(devices), &#34;devices&#34;: devices,
-                                                       &#34;statuses&#34;: statuses, &#34;licenses&#34;: licenses})</code></pre>
+    return RedirectResponse(url=f&#34;/devices-web&#34;, status_code=303)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.devices_web.delete_post"><code class="name flex">
+<span>async def <span class="ident">delete_post</span></span>(<span>device_id: int, lic_del: str = Form(Ellipsis), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Endpoint called from devicelicense.html template for deleting device-license connection. Deletes entry in
+bodydevices_licenses table and redirects to devices-web endpoint</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@device_web.post(&#34;/devices-web-del/{device_id}&#34;)
+async def delete_post(device_id: int, lic_del: str = Form(...), db: Session = Depends(get_db),
+                      Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from devicelicense.html template for deleting device-license connection. Deletes entry in
+    bodydevices_licenses table and redirects to devices-web endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.delete_device_license(db, device_id, int(lic_del))
+    return RedirectResponse(url=f&#34;/devices-web&#34;, status_code=303)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.devices_web.dev_comm_new"><code class="name flex">
+<span>async def <span class="ident">dev_comm_new</span></span>(<span>device_id: int, dev_com: str = Form(Ellipsis), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Endpoint called from template devicelicense.html, updates comment of device and redirects to devices-web
+endpoint</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@device_web.post(&#34;/devices-web-comment/{device_id}&#34;)
+async def dev_comm_new(device_id: int, dev_com: str = Form(...), db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from template devicelicense.html, updates comment of device and redirects to devices-web
+    endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_device_com(db, device_id, dev_com)
+    return RedirectResponse(url=f&#34;/devices-web&#34;, status_code=303)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.devices_web.dev_inv_new"><code class="name flex">
+<span>async def <span class="ident">dev_inv_new</span></span>(<span>device_id: int, dev_inv: str = Form(Ellipsis), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Endpoint called from template devicelicense.html, updates inventory number of device and redirects to devices-web
+endpoint</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@device_web.post(&#34;/devices-web-inv/{device_id}&#34;)
+async def dev_inv_new(device_id: int, dev_inv: str = Form(...), db: Session = Depends(get_db),
+                      Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from template devicelicense.html, updates inventory number of device and redirects to devices-web
+    endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_device_inv(db, device_id, dev_inv)
+    return RedirectResponse(url=f&#34;/devices-web&#34;, status_code=303)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.devices_web.dev_team_con"><code class="name flex">
+<span>async def <span class="ident">dev_team_con</span></span>(<span>device_id: int, team_con: str = Form(Ellipsis), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Endpoint called from devicelicense.html template, connects device with team and redirects to devices-web endpoint</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@device_web.post(&#34;/devices-web-team/{device_id}&#34;)
+async def dev_team_con(device_id: int, team_con: str = Form(...), db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from devicelicense.html template, connects device with team and redirects to devices-web endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_device(db, device_id, team_con)
+    return RedirectResponse(url=f&#34;/devices-web&#34;, status_code=303)</code></pre>
 </details>
 </dd>
 <dt id="sql_app.api.devices_web.filter_devices"><code class="name flex">
-<span>async def <span class="ident">filter_devices</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, lic: str = Form(all), db: sqlalchemy.orm.session.Session = Depends(get_db))</span>
+<span>async def <span class="ident">filter_devices</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, keyman_id: str = Form(all), lic_name: str = Form(all), lic_id: str = Form(all), team: str = Form(all), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
 </code></dt>
 <dd>
-<div class="desc"><p>Endpoint used for filtering devices by license. returns html template with only
+<div class="desc"><p>Endpoint used for filtering devices by user given inputs. returns html template with only
 devices that has assigned license defined by user input</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
 <pre><code class="python">@device_web.post(&#34;/devices-web&#34;, response_class=HTMLResponse)
-async def filter_devices(request: Request, skip: int = 0, limit: int = 100, lic: str = Form(&#34;all&#34;),
-                         db: Session = Depends(get_db)):
+async def filter_devices(request: Request, skip: int = 0, limit: int = 100,
+                         keyman_id: str = Form(&#34;all&#34;), lic_name: str = Form(&#34;all&#34;),
+                         lic_id: str = Form(&#34;all&#34;), team: str = Form(&#34;all&#34;),
+                         db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
-    Endpoint used for filtering devices by license. returns html template with only
+    Endpoint used for filtering devices by user given inputs. returns html template with only
     devices that has assigned license defined by user input
     &#34;&#34;&#34;
-    devices = crud.get_devices(db, skip=skip, limit=limit)
-    def_devices = []
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    device_dict = []
+    devices_f = crud.get_filtered_devices(db, keyman_id, lic_name, lic_id, team)
+    ids = []
+    for d in devices_f:
+        ids.append(d[0])
+    devices = crud.get_devices_with_ids(db, ids)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    # adding dictionary entry with all inforamtions needed in template
     for dev in devices:
-        for l in dev.licenses:
-            if dev not in def_devices and l.licenses.name == lic:
-                def_devices.append(dev)
-    # if input was default all
-    if lic == &#34;all&#34;:
-        def_devices = devices
-    statuses = []
-    for i in range(0, len(def_devices)):
-        statuses.append(def_devices[i].logs[len(def_devices[i].logs) - 1].status)
+        if len(dev.licenses) &gt; 0:
+            for lic in dev.licenses:
+                device_dict.append({&#34;device&#34;: dev, &#34;license&#34;: lic.licenses, &#34;log&#34;: dev.logs[len(dev.logs) - 1]})
+        else:
+            device_dict.append({&#34;device&#34;: dev, &#34;license&#34;: dev.licenses, &#34;log&#34;: dev.logs[len(dev.logs) - 1]})
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;devices.html&#34;, {&#34;request&#34;: request, &#34;devs&#34;: len(def_devices), &#34;devices&#34;: def_devices,
-                                                       &#34;statuses&#34;: statuses, &#34;licenses&#34;: licenses})</code></pre>
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;devices.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                           &#34;licenses&#34;: licenses, &#34;devs&#34;: devices,
+                                                           &#34;teams&#34;: teams, &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;devices_normal.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                  &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})</code></pre>
 </details>
 </dd>
 <dt id="sql_app.api.devices_web.get_db"><code class="name flex">
@@ -231,27 +461,42 @@ async def filter_devices(request: Request, skip: int = 0, limit: int = 100, lic:
 </details>
 </dd>
 <dt id="sql_app.api.devices_web.read_devices"><code class="name flex">
-<span>async def <span class="ident">read_devices</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db))</span>
+<span>async def <span class="ident">read_devices</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
 </code></dt>
 <dd>
-<div class="desc"><p>Returns template with all devices and its current states</p></div>
+<div class="desc"><p>Returns template with all devices and its necessary attributes</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
 <pre><code class="python">@device_web.get(&#34;/devices-web&#34;, response_class=HTMLResponse)
-async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
+async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
-    Returns template with all devices and its current states
+    Returns template with all devices and its necessary attributes
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+
+    device_dict = []
     devices = crud.get_devices(db, skip=skip, limit=limit)
-    statuses = []
-    # adding state for each device in list
-    for i in range(0, len(devices)):
-        statuses.append(devices[i].logs[len(devices[i].logs)-1].status)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    # adding dictionary entry with all inforamtions needed in template
+    for dev in devices:
+        if len(dev.licenses) &gt; 0:
+            for lic in dev.licenses:
+                device_dict.append({&#34;device&#34;: dev, &#34;license&#34;: lic.licenses, &#34;log&#34;: dev.logs[len(dev.logs) - 1]})
+        else:
+            device_dict.append({&#34;device&#34;: dev, &#34;license&#34;: dev.licenses, &#34;log&#34;: dev.logs[len(dev.logs) - 1]})
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;devices.html&#34;, {&#34;request&#34;: request, &#34;devs&#34;: len(devices), &#34;devices&#34;: devices,
-                                                       &#34;statuses&#34;: statuses, &#34;licenses&#34;: licenses})</code></pre>
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;devices.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                           &#34;licenses&#34;: licenses, &#34;devs&#34;: devices,
+                                                           &#34;teams&#34;: teams, &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;devices_normal.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                  &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})</code></pre>
 </details>
 </dd>
 </dl>
@@ -271,9 +516,13 @@ async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Se
 </ul>
 </li>
 <li><h3><a href="#header-functions">Functions</a></h3>
-<ul class="">
+<ul class="two-column">
 <li><code><a title="sql_app.api.devices_web.connect_dev_lic" href="#sql_app.api.devices_web.connect_dev_lic">connect_dev_lic</a></code></li>
 <li><code><a title="sql_app.api.devices_web.connect_post" href="#sql_app.api.devices_web.connect_post">connect_post</a></code></li>
+<li><code><a title="sql_app.api.devices_web.delete_post" href="#sql_app.api.devices_web.delete_post">delete_post</a></code></li>
+<li><code><a title="sql_app.api.devices_web.dev_comm_new" href="#sql_app.api.devices_web.dev_comm_new">dev_comm_new</a></code></li>
+<li><code><a title="sql_app.api.devices_web.dev_inv_new" href="#sql_app.api.devices_web.dev_inv_new">dev_inv_new</a></code></li>
+<li><code><a title="sql_app.api.devices_web.dev_team_con" href="#sql_app.api.devices_web.dev_team_con">dev_team_con</a></code></li>
 <li><code><a title="sql_app.api.devices_web.filter_devices" href="#sql_app.api.devices_web.filter_devices">filter_devices</a></code></li>
 <li><code><a title="sql_app.api.devices_web.get_db" href="#sql_app.api.devices_web.get_db">get_db</a></code></li>
 <li><code><a title="sql_app.api.devices_web.read_devices" href="#sql_app.api.devices_web.read_devices">read_devices</a></code></li>
diff --git a/server/doc/sql_app/api/headdevices_web.html b/server/doc/sql_app/api/headdevices_web.html
new file mode 100644
index 0000000..9d1ba03
--- /dev/null
+++ b/server/doc/sql_app/api/headdevices_web.html
@@ -0,0 +1,440 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
+<meta name="generator" content="pdoc 0.10.0" />
+<title>sql_app.api.headdevices_web API documentation</title>
+<meta name="description" content="" />
+<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
+<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
+<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
+<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
+<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
+<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
+<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
+<script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
+</head>
+<body>
+<main>
+<article id="content">
+<header>
+<h1 class="title">Module <code>sql_app.api.headdevices_web</code></h1>
+</header>
+<section id="section-intro">
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">from datetime import datetime
+
+from fastapi import Depends, APIRouter, Form
+from fastapi import Request
+from fastapi.responses import HTMLResponse, RedirectResponse
+from fastapi.templating import Jinja2Templates
+from fastapi_jwt_auth import AuthJWT
+from pydantic import BaseModel
+from sqlalchemy.orm import Session
+from sql_app.api.auth import fake_users_db
+from sql_app import crud, models
+from ..database import SessionLocal, engine
+
+models.Base.metadata.create_all(bind=engine)
+
+# Path to html templates used in this file
+templates = Jinja2Templates(directory=&#34;../templates/head_devices&#34;)
+
+# prefix used for all endpoints in this file
+head_device_web = APIRouter(prefix=&#34;&#34;)
+
+
+# Dependency
+def get_db():
+    db = SessionLocal()
+    try:
+        yield db
+    finally:
+        db.close()
+
+
+@head_device_web.get(&#34;/head-devices-web&#34;, response_class=HTMLResponse)
+async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Returns template with all head devices and necessary attributes
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+
+    device_dict = []
+    devices = crud.get_head_devices(db, skip=skip, limit=limit)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    for dev in devices:
+        lic = crud.get_license(db, dev.license_id)
+        device_dict.append({&#34;device&#34;: dev, &#34;license&#34;: lic, &#34;log&#34;: dev.h_logs[len(dev.h_logs) - 1]})
+    licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;head_devices.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                &#34;devs&#34;: devices, &#34;teams&#34;: teams, &#34;licenses&#34;: licenses,
+                                                                &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;head_devices_normal.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                &#34;devs&#34;: devices, &#34;teams&#34;: teams, &#34;licenses&#34;: licenses,
+                                                                &#34;user&#34;: current_user})
+
+
+@head_device_web.post(&#34;/head-devices-web&#34;, response_class=HTMLResponse)
+async def filter_devices(request: Request, skip: int = 0, limit: int = 100,
+                         body_id: str = Form(&#34;all&#34;), lic_id: str = Form(&#34;all&#34;), team: str = Form(&#34;all&#34;),
+                         db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint used for filtering head devices by user given inputs. returns html template with only
+    head devices that has attributes defined by user input
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    device_dict = []
+    devices_f = crud.get_filtered_headdevices(db, body_id, lic_id, team)
+    ids = []
+    for d in devices_f:
+        ids.append(d[0])
+    devices = crud.get_headdevices_with_ids(db, ids)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    for dev in devices:
+        lic = crud.get_license(db, dev.license_id)
+        device_dict.append({&#34;device&#34;: dev, &#34;license&#34;: lic, &#34;log&#34;: dev.h_logs[len(dev.h_logs) - 1]})
+    licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;head_devices.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                &#34;devs&#34;: devices, &#34;teams&#34;: teams, &#34;licenses&#34;: licenses,
+                                                                &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;head_devices_normal.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                       &#34;devs&#34;: devices, &#34;teams&#34;: teams,
+                                                                       &#34;licenses&#34;: licenses,
+                                                                       &#34;user&#34;: current_user})
+
+
+@head_device_web.get(&#34;/head-device-license/{device_id}&#34;, response_class=HTMLResponse)
+async def connect_dev_lic(request: Request, device_id: int, db: Session = Depends(get_db),
+                          Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Returns template with one head device and all available licenses that can be assigned to it, plus team and comment
+    and inventory number inputs.
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    device = crud.get_head_device(db, device_id)
+    licenses = crud.get_licenses(db, 0, 100)
+    lic_left = []
+    for lic in licenses:
+        if lic != device.license:
+            lic_left.append(lic)
+    teams = crud.get_teams(db, 0, 100)
+    return templates.TemplateResponse(&#34;headlicense.html&#34;,
+                                      {&#34;request&#34;: request, &#34;device&#34;: device, &#34;licenses&#34;: lic_left, &#34;teams&#34;: teams})
+
+
+@head_device_web.post(&#34;/head-devices-web-lic/{device_id}&#34;)
+async def connect_post(device_id: int, lic: str = Form(...), db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from template for connecting head device with license and redirects to head-devices-web endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_headdevice_license(db, device_id, int(lic))
+    return RedirectResponse(url=f&#34;/head-devices-web&#34;, status_code=303)
+
+
+@head_device_web.post(&#34;/head-devices-web-team/{device_id}&#34;)
+async def delete_post(device_id: int, team_con: str = Form(...), db: Session = Depends(get_db),
+                      Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from template for connecting head device with team and redirects to body-devices-web endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_headdevice_team(db, device_id, int(team_con))
+    return RedirectResponse(url=f&#34;/head-devices-web&#34;, status_code=303)
+
+
+@head_device_web.post(&#34;/head-devices-inv/{device_id}&#34;)
+async def device_inv(device_id: int, dev_inv: str = Form(...), db: Session = Depends(get_db),
+                     Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from within from headlicense.html template. Changes head devices inventory number with new one
+    given from user
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_headdevice_inv(db, device_id, dev_inv)
+    return RedirectResponse(url=f&#34;/head-devices-web&#34;, status_code=303)
+
+
+@head_device_web.post(&#34;/head-devices-comm/{device_id}&#34;)
+async def device_inv(device_id: int, dev_com: str = Form(...), db: Session = Depends(get_db),
+                     Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from within from headlicense.html template. Changes head devices comment with new one
+    given from user
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_headdevice_comm(db, device_id, dev_com)
+    return RedirectResponse(url=f&#34;/head-devices-web&#34;, status_code=303)</code></pre>
+</details>
+</section>
+<section>
+</section>
+<section>
+</section>
+<section>
+<h2 class="section-title" id="header-functions">Functions</h2>
+<dl>
+<dt id="sql_app.api.headdevices_web.connect_dev_lic"><code class="name flex">
+<span>async def <span class="ident">connect_dev_lic</span></span>(<span>request: starlette.requests.Request, device_id: int, db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Returns template with one head device and all available licenses that can be assigned to it, plus team and comment
+and inventory number inputs.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@head_device_web.get(&#34;/head-device-license/{device_id}&#34;, response_class=HTMLResponse)
+async def connect_dev_lic(request: Request, device_id: int, db: Session = Depends(get_db),
+                          Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Returns template with one head device and all available licenses that can be assigned to it, plus team and comment
+    and inventory number inputs.
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    device = crud.get_head_device(db, device_id)
+    licenses = crud.get_licenses(db, 0, 100)
+    lic_left = []
+    for lic in licenses:
+        if lic != device.license:
+            lic_left.append(lic)
+    teams = crud.get_teams(db, 0, 100)
+    return templates.TemplateResponse(&#34;headlicense.html&#34;,
+                                      {&#34;request&#34;: request, &#34;device&#34;: device, &#34;licenses&#34;: lic_left, &#34;teams&#34;: teams})</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.headdevices_web.connect_post"><code class="name flex">
+<span>async def <span class="ident">connect_post</span></span>(<span>device_id: int, lic: str = Form(Ellipsis), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Endpoint called from template for connecting head device with license and redirects to head-devices-web endpoint</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@head_device_web.post(&#34;/head-devices-web-lic/{device_id}&#34;)
+async def connect_post(device_id: int, lic: str = Form(...), db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from template for connecting head device with license and redirects to head-devices-web endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_headdevice_license(db, device_id, int(lic))
+    return RedirectResponse(url=f&#34;/head-devices-web&#34;, status_code=303)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.headdevices_web.delete_post"><code class="name flex">
+<span>async def <span class="ident">delete_post</span></span>(<span>device_id: int, team_con: str = Form(Ellipsis), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Endpoint called from template for connecting head device with team and redirects to body-devices-web endpoint</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@head_device_web.post(&#34;/head-devices-web-team/{device_id}&#34;)
+async def delete_post(device_id: int, team_con: str = Form(...), db: Session = Depends(get_db),
+                      Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from template for connecting head device with team and redirects to body-devices-web endpoint
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_headdevice_team(db, device_id, int(team_con))
+    return RedirectResponse(url=f&#34;/head-devices-web&#34;, status_code=303)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.headdevices_web.device_inv"><code class="name flex">
+<span>async def <span class="ident">device_inv</span></span>(<span>device_id: int, dev_com: str = Form(Ellipsis), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Endpoint called from within from headlicense.html template. Changes head devices comment with new one
+given from user</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@head_device_web.post(&#34;/head-devices-comm/{device_id}&#34;)
+async def device_inv(device_id: int, dev_com: str = Form(...), db: Session = Depends(get_db),
+                     Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint called from within from headlicense.html template. Changes head devices comment with new one
+    given from user
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    crud.update_headdevice_comm(db, device_id, dev_com)
+    return RedirectResponse(url=f&#34;/head-devices-web&#34;, status_code=303)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.headdevices_web.filter_devices"><code class="name flex">
+<span>async def <span class="ident">filter_devices</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, body_id: str = Form(all), lic_id: str = Form(all), team: str = Form(all), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Endpoint used for filtering head devices by user given inputs. returns html template with only
+head devices that has attributes defined by user input</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@head_device_web.post(&#34;/head-devices-web&#34;, response_class=HTMLResponse)
+async def filter_devices(request: Request, skip: int = 0, limit: int = 100,
+                         body_id: str = Form(&#34;all&#34;), lic_id: str = Form(&#34;all&#34;), team: str = Form(&#34;all&#34;),
+                         db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint used for filtering head devices by user given inputs. returns html template with only
+    head devices that has attributes defined by user input
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    device_dict = []
+    devices_f = crud.get_filtered_headdevices(db, body_id, lic_id, team)
+    ids = []
+    for d in devices_f:
+        ids.append(d[0])
+    devices = crud.get_headdevices_with_ids(db, ids)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    for dev in devices:
+        lic = crud.get_license(db, dev.license_id)
+        device_dict.append({&#34;device&#34;: dev, &#34;license&#34;: lic, &#34;log&#34;: dev.h_logs[len(dev.h_logs) - 1]})
+    licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;head_devices.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                &#34;devs&#34;: devices, &#34;teams&#34;: teams, &#34;licenses&#34;: licenses,
+                                                                &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;head_devices_normal.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                       &#34;devs&#34;: devices, &#34;teams&#34;: teams,
+                                                                       &#34;licenses&#34;: licenses,
+                                                                       &#34;user&#34;: current_user})</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.headdevices_web.get_db"><code class="name flex">
+<span>def <span class="ident">get_db</span></span>(<span>)</span>
+</code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_db():
+    db = SessionLocal()
+    try:
+        yield db
+    finally:
+        db.close()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.headdevices_web.read_devices"><code class="name flex">
+<span>async def <span class="ident">read_devices</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Returns template with all head devices and necessary attributes</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@head_device_web.get(&#34;/head-devices-web&#34;, response_class=HTMLResponse)
+async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Returns template with all head devices and necessary attributes
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+
+    device_dict = []
+    devices = crud.get_head_devices(db, skip=skip, limit=limit)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    for dev in devices:
+        lic = crud.get_license(db, dev.license_id)
+        device_dict.append({&#34;device&#34;: dev, &#34;license&#34;: lic, &#34;log&#34;: dev.h_logs[len(dev.h_logs) - 1]})
+    licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;head_devices.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                &#34;devs&#34;: devices, &#34;teams&#34;: teams, &#34;licenses&#34;: licenses,
+                                                                &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;head_devices_normal.html&#34;, {&#34;request&#34;: request, &#34;devices&#34;: device_dict,
+                                                                &#34;devs&#34;: devices, &#34;teams&#34;: teams, &#34;licenses&#34;: licenses,
+                                                                &#34;user&#34;: current_user})</code></pre>
+</details>
+</dd>
+</dl>
+</section>
+<section>
+</section>
+</article>
+<nav id="sidebar">
+<h1>Index</h1>
+<div class="toc">
+<ul></ul>
+</div>
+<ul id="index">
+<li><h3>Super-module</h3>
+<ul>
+<li><code><a title="sql_app.api" href="index.html">sql_app.api</a></code></li>
+</ul>
+</li>
+<li><h3><a href="#header-functions">Functions</a></h3>
+<ul class="two-column">
+<li><code><a title="sql_app.api.headdevices_web.connect_dev_lic" href="#sql_app.api.headdevices_web.connect_dev_lic">connect_dev_lic</a></code></li>
+<li><code><a title="sql_app.api.headdevices_web.connect_post" href="#sql_app.api.headdevices_web.connect_post">connect_post</a></code></li>
+<li><code><a title="sql_app.api.headdevices_web.delete_post" href="#sql_app.api.headdevices_web.delete_post">delete_post</a></code></li>
+<li><code><a title="sql_app.api.headdevices_web.device_inv" href="#sql_app.api.headdevices_web.device_inv">device_inv</a></code></li>
+<li><code><a title="sql_app.api.headdevices_web.filter_devices" href="#sql_app.api.headdevices_web.filter_devices">filter_devices</a></code></li>
+<li><code><a title="sql_app.api.headdevices_web.get_db" href="#sql_app.api.headdevices_web.get_db">get_db</a></code></li>
+<li><code><a title="sql_app.api.headdevices_web.read_devices" href="#sql_app.api.headdevices_web.read_devices">read_devices</a></code></li>
+</ul>
+</li>
+</ul>
+</nav>
+</main>
+<footer id="footer">
+<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
+</footer>
+</body>
+</html>
\ No newline at end of file
diff --git a/server/doc/sql_app/api/index.html b/server/doc/sql_app/api/index.html
index edd8582..6459f2e 100644
--- a/server/doc/sql_app/api/index.html
+++ b/server/doc/sql_app/api/index.html
@@ -26,6 +26,14 @@
 <section>
 <h2 class="section-title" id="header-submodules">Sub-modules</h2>
 <dl>
+<dt><code class="name"><a title="sql_app.api.auth" href="auth.html">sql_app.api.auth</a></code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt><code class="name"><a title="sql_app.api.bodydevices_web" href="bodydevices_web.html">sql_app.api.bodydevices_web</a></code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
 <dt><code class="name"><a title="sql_app.api.devices" href="devices.html">sql_app.api.devices</a></code></dt>
 <dd>
 <div class="desc"></div>
@@ -34,6 +42,14 @@
 <dd>
 <div class="desc"></div>
 </dd>
+<dt><code class="name"><a title="sql_app.api.headdevices_web" href="headdevices_web.html">sql_app.api.headdevices_web</a></code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt><code class="name"><a title="sql_app.api.ld_logs_web" href="ld_logs_web.html">sql_app.api.ld_logs_web</a></code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
 <dt><code class="name"><a title="sql_app.api.licenses" href="licenses.html">sql_app.api.licenses</a></code></dt>
 <dd>
 <div class="desc"></div>
@@ -66,6 +82,10 @@
 <dd>
 <div class="desc"></div>
 </dd>
+<dt><code class="name"><a title="sql_app.api.users_web" href="users_web.html">sql_app.api.users_web</a></code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
 </dl>
 </section>
 <section>
@@ -88,8 +108,12 @@
 </li>
 <li><h3><a href="#header-submodules">Sub-modules</a></h3>
 <ul>
+<li><code><a title="sql_app.api.auth" href="auth.html">sql_app.api.auth</a></code></li>
+<li><code><a title="sql_app.api.bodydevices_web" href="bodydevices_web.html">sql_app.api.bodydevices_web</a></code></li>
 <li><code><a title="sql_app.api.devices" href="devices.html">sql_app.api.devices</a></code></li>
 <li><code><a title="sql_app.api.devices_web" href="devices_web.html">sql_app.api.devices_web</a></code></li>
+<li><code><a title="sql_app.api.headdevices_web" href="headdevices_web.html">sql_app.api.headdevices_web</a></code></li>
+<li><code><a title="sql_app.api.ld_logs_web" href="ld_logs_web.html">sql_app.api.ld_logs_web</a></code></li>
 <li><code><a title="sql_app.api.licenses" href="licenses.html">sql_app.api.licenses</a></code></li>
 <li><code><a title="sql_app.api.licenses_web" href="licenses_web.html">sql_app.api.licenses_web</a></code></li>
 <li><code><a title="sql_app.api.pcs" href="pcs.html">sql_app.api.pcs</a></code></li>
@@ -98,6 +122,7 @@
 <li><code><a title="sql_app.api.teams_web" href="teams_web.html">sql_app.api.teams_web</a></code></li>
 <li><code><a title="sql_app.api.usb_logs" href="usb_logs.html">sql_app.api.usb_logs</a></code></li>
 <li><code><a title="sql_app.api.usb_logs_web" href="usb_logs_web.html">sql_app.api.usb_logs_web</a></code></li>
+<li><code><a title="sql_app.api.users_web" href="users_web.html">sql_app.api.users_web</a></code></li>
 </ul>
 </li>
 </ul>
diff --git a/server/doc/sql_app/api/ld_logs_web.html b/server/doc/sql_app/api/ld_logs_web.html
new file mode 100644
index 0000000..5336ec6
--- /dev/null
+++ b/server/doc/sql_app/api/ld_logs_web.html
@@ -0,0 +1,237 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
+<meta name="generator" content="pdoc 0.10.0" />
+<title>sql_app.api.ld_logs_web API documentation</title>
+<meta name="description" content="" />
+<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
+<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
+<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
+<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
+<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
+<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
+<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
+<script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
+</head>
+<body>
+<main>
+<article id="content">
+<header>
+<h1 class="title">Module <code>sql_app.api.ld_logs_web</code></h1>
+</header>
+<section id="section-intro">
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">from typing import List
+from fastapi import Depends, FastAPI, HTTPException, APIRouter, Form
+from datetime import datetime
+from sqlalchemy.orm import Session
+from sql_app import crud, models, schemas
+from ..database import SessionLocal, engine
+from fastapi import FastAPI, Request
+from fastapi.responses import HTMLResponse
+from fastapi_jwt_auth import AuthJWT
+from fastapi.staticfiles import StaticFiles
+from fastapi.templating import Jinja2Templates
+
+models.Base.metadata.create_all(bind=engine)
+
+# Path to html templates used in this file
+templates = Jinja2Templates(directory=&#34;../templates/ld-logs&#34;)
+
+# prefix used for all endpoints in this file
+ldlogs_web = APIRouter(prefix=&#34;&#34;)
+
+
+# Dependency
+def get_db():
+    db = SessionLocal()
+    try:
+        yield db
+    finally:
+        db.close()
+
+
+@ldlogs_web.get(&#34;/ldlogs-web&#34;, response_class=HTMLResponse)
+async def read_logs(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                    Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Returns template with all usb logs currently saved in database with its pcs, teams and licenses.
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    logs = crud.get_ld_logs(db, skip=skip, limit=limit)
+    pcs = []
+    for log in logs:
+        if log.pc_id not in pcs:
+            pcs.append(log.pc_id)
+    pc_obj = crud.find_pcs(db, pcs)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;ldlogs.html&#34;, {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
+                                                          &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;ldlogs_normal.html&#34;,
+                                          {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
+                                           &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})
+
+
+@ldlogs_web.post(&#34;/ldlogs-web&#34;, response_class=HTMLResponse)
+async def filter_logs(request: Request, pc: str = Form(&#34;all&#34;), team: str = Form(&#34;all&#34;), lic: str = Form(&#34;all&#34;),
+                      skip: int = 0, limit: int = 100,
+                      db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint used for filtering ld logs by user given form inputs.
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    log = crud.get_filtered_ldlogs(db, pc, team, lic)
+    logs_ids = []
+    for l in log:
+        logs_ids.append(l[0])
+    logs = crud.find_filtered_ldlogs(db, logs_ids)
+    pc_obj = crud.get_pcs(db, skip=skip, limit=limit)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;ldlogs.html&#34;, {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
+                                                          &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;ldlogs_normal.html&#34;,
+                                          {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
+                                           &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})</code></pre>
+</details>
+</section>
+<section>
+</section>
+<section>
+</section>
+<section>
+<h2 class="section-title" id="header-functions">Functions</h2>
+<dl>
+<dt id="sql_app.api.ld_logs_web.filter_logs"><code class="name flex">
+<span>async def <span class="ident">filter_logs</span></span>(<span>request: starlette.requests.Request, pc: str = Form(all), team: str = Form(all), lic: str = Form(all), skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Endpoint used for filtering ld logs by user given form inputs.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@ldlogs_web.post(&#34;/ldlogs-web&#34;, response_class=HTMLResponse)
+async def filter_logs(request: Request, pc: str = Form(&#34;all&#34;), team: str = Form(&#34;all&#34;), lic: str = Form(&#34;all&#34;),
+                      skip: int = 0, limit: int = 100,
+                      db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Endpoint used for filtering ld logs by user given form inputs.
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    log = crud.get_filtered_ldlogs(db, pc, team, lic)
+    logs_ids = []
+    for l in log:
+        logs_ids.append(l[0])
+    logs = crud.find_filtered_ldlogs(db, logs_ids)
+    pc_obj = crud.get_pcs(db, skip=skip, limit=limit)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;ldlogs.html&#34;, {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
+                                                          &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;ldlogs_normal.html&#34;,
+                                          {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
+                                           &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.ld_logs_web.get_db"><code class="name flex">
+<span>def <span class="ident">get_db</span></span>(<span>)</span>
+</code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_db():
+    db = SessionLocal()
+    try:
+        yield db
+    finally:
+        db.close()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.ld_logs_web.read_logs"><code class="name flex">
+<span>async def <span class="ident">read_logs</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Returns template with all usb logs currently saved in database with its pcs, teams and licenses.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@ldlogs_web.get(&#34;/ldlogs-web&#34;, response_class=HTMLResponse)
+async def read_logs(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                    Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Returns template with all usb logs currently saved in database with its pcs, teams and licenses.
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    logs = crud.get_ld_logs(db, skip=skip, limit=limit)
+    pcs = []
+    for log in logs:
+        if log.pc_id not in pcs:
+            pcs.append(log.pc_id)
+    pc_obj = crud.find_pcs(db, pcs)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;ldlogs.html&#34;, {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
+                                                          &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;ldlogs_normal.html&#34;,
+                                          {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
+                                           &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})</code></pre>
+</details>
+</dd>
+</dl>
+</section>
+<section>
+</section>
+</article>
+<nav id="sidebar">
+<h1>Index</h1>
+<div class="toc">
+<ul></ul>
+</div>
+<ul id="index">
+<li><h3>Super-module</h3>
+<ul>
+<li><code><a title="sql_app.api" href="index.html">sql_app.api</a></code></li>
+</ul>
+</li>
+<li><h3><a href="#header-functions">Functions</a></h3>
+<ul class="">
+<li><code><a title="sql_app.api.ld_logs_web.filter_logs" href="#sql_app.api.ld_logs_web.filter_logs">filter_logs</a></code></li>
+<li><code><a title="sql_app.api.ld_logs_web.get_db" href="#sql_app.api.ld_logs_web.get_db">get_db</a></code></li>
+<li><code><a title="sql_app.api.ld_logs_web.read_logs" href="#sql_app.api.ld_logs_web.read_logs">read_logs</a></code></li>
+</ul>
+</li>
+</ul>
+</nav>
+</main>
+<footer id="footer">
+<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
+</footer>
+</body>
+</html>
\ No newline at end of file
diff --git a/server/doc/sql_app/api/licenses_web.html b/server/doc/sql_app/api/licenses_web.html
index fb9ff21..0ac98d8 100644
--- a/server/doc/sql_app/api/licenses_web.html
+++ b/server/doc/sql_app/api/licenses_web.html
@@ -27,14 +27,15 @@
 <span>Expand source code</span>
 </summary>
 <pre><code class="python">from typing import List
-
+from typing import Optional
 from fastapi import Depends, FastAPI, HTTPException, APIRouter, Form
 from sqlalchemy.orm import Session
 from datetime import date
 from sql_app import crud, models, schemas
 from ..database import SessionLocal, engine
 from fastapi import FastAPI, Request
-from fastapi.responses import HTMLResponse
+from fastapi.responses import HTMLResponse, RedirectResponse
+from fastapi_jwt_auth import AuthJWT
 from fastapi.staticfiles import StaticFiles
 from fastapi.templating import Jinja2Templates
 
@@ -45,7 +46,7 @@ templates = Jinja2Templates(directory=&#34;../templates/licenses&#34;)
 device_templates = Jinja2Templates(directory=&#34;../templates/devices&#34;)
 
 # prefix used for all endpoints in this file
-licenses_web = APIRouter(prefix=&#34;/api/v1&#34;)
+licenses_web = APIRouter(prefix=&#34;&#34;)
 
 
 # Dependency
@@ -58,38 +59,53 @@ def get_db():
 
 
 @licenses_web.get(&#34;/license-create&#34;, response_class=HTMLResponse)
-async def licenses_create_web(request: Request):
+async def licenses_create_web(request: Request, Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
     Returns template with Form for creating new license.
     &#34;&#34;&#34;
-    return templates.TemplateResponse(&#34;license_create.html&#34;, {&#34;request&#34;: request})
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    return templates.TemplateResponse(&#34;license_create.html&#34;, {&#34;request&#34;: request, &#34;minimum_date&#34;: date.today()})
 
 
 @licenses_web.get(&#34;/licenses-web&#34;, response_class=HTMLResponse)
-async def read_licenses_web(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
+async def read_licenses_web(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                            Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
     Returns template with all licenses currently saved in database
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;licenses.html&#34;, {&#34;request&#34;: request, &#34;licenses&#34;: licenses})
-
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;licenses.html&#34;, {&#34;request&#34;: request, &#34;licenses&#34;: licenses,
+                                                            &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;licenses_normal.html&#34;, {&#34;request&#34;: request, &#34;licenses&#34;: licenses,
+                                                            &#34;user&#34;: current_user})
 
-@licenses_web.post(&#34;/licenses-web&#34;, response_class=HTMLResponse)
-def create_license(request: Request, name: str = Form(...), expdate: date = Form(...), skip: int = 0, limit: int = 100,
-                   db: Session = Depends(get_db)):
+@licenses_web.post(&#34;/licenses-web&#34;)
+def create_license(name: Optional[str] = Form(&#34;&#34;), lic_id: str = Form(...), expdate: Optional[date] = Form(None),
+                   db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
-    Endpoint called from create license form. Creates new license and returns template with all licenses in database
+    Endpoint called from create license form. Creates new license and redirects to devices-web endpoint
     &#34;&#34;&#34;
-    db_license = crud.create_license(db, name, expdate)
-    if db_license is None:
-        print(&#34;something went wrong&#34;)
-    devices = crud.get_devices(db, skip=skip, limit=limit)
-    statuses = []
-    for i in range(0, len(devices)):
-        statuses.append(devices[i].logs[len(devices[i].logs) - 1].status)
-    licenses = crud.get_licenses(db, skip=skip, limit=limit)
-    return device_templates.TemplateResponse(&#34;devices.html&#34;, {&#34;request&#34;: request, &#34;devs&#34;: len(devices), &#34;devices&#34;: devices,
-                                                       &#34;statuses&#34;: statuses, &#34;licenses&#34;: licenses})</code></pre>
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    licenses = crud.get_licenses(db, 0, 100)
+    licenses_ids = []
+    for l in licenses:
+        licenses_ids.append(l.license_id)
+    if lic_id not in licenses_ids:
+        db_license = crud.create_license(db, name, lic_id, expdate)
+        if db_license is None:
+            print(&#34;something went wrong&#34;)
+    return RedirectResponse(url=f&#34;/licenses-web&#34;, status_code=303)</code></pre>
 </details>
 </section>
 <section>
@@ -100,30 +116,33 @@ def create_license(request: Request, name: str = Form(...), expdate: date = Form
 <h2 class="section-title" id="header-functions">Functions</h2>
 <dl>
 <dt id="sql_app.api.licenses_web.create_license"><code class="name flex">
-<span>def <span class="ident">create_license</span></span>(<span>request: starlette.requests.Request, name: str = Form(Ellipsis), expdate: datetime.date = Form(Ellipsis), skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db))</span>
+<span>def <span class="ident">create_license</span></span>(<span>name: Optional[str] = Form(), lic_id: str = Form(Ellipsis), expdate: Optional[datetime.date] = Form(None), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
 </code></dt>
 <dd>
-<div class="desc"><p>Endpoint called from create license form. Creates new license and returns template with all licenses in database</p></div>
+<div class="desc"><p>Endpoint called from create license form. Creates new license and redirects to devices-web endpoint</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">@licenses_web.post(&#34;/licenses-web&#34;, response_class=HTMLResponse)
-def create_license(request: Request, name: str = Form(...), expdate: date = Form(...), skip: int = 0, limit: int = 100,
-                   db: Session = Depends(get_db)):
+<pre><code class="python">@licenses_web.post(&#34;/licenses-web&#34;)
+def create_license(name: Optional[str] = Form(&#34;&#34;), lic_id: str = Form(...), expdate: Optional[date] = Form(None),
+                   db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
-    Endpoint called from create license form. Creates new license and returns template with all licenses in database
+    Endpoint called from create license form. Creates new license and redirects to devices-web endpoint
     &#34;&#34;&#34;
-    db_license = crud.create_license(db, name, expdate)
-    if db_license is None:
-        print(&#34;something went wrong&#34;)
-    devices = crud.get_devices(db, skip=skip, limit=limit)
-    statuses = []
-    for i in range(0, len(devices)):
-        statuses.append(devices[i].logs[len(devices[i].logs) - 1].status)
-    licenses = crud.get_licenses(db, skip=skip, limit=limit)
-    return device_templates.TemplateResponse(&#34;devices.html&#34;, {&#34;request&#34;: request, &#34;devs&#34;: len(devices), &#34;devices&#34;: devices,
-                                                       &#34;statuses&#34;: statuses, &#34;licenses&#34;: licenses})</code></pre>
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    licenses = crud.get_licenses(db, 0, 100)
+    licenses_ids = []
+    for l in licenses:
+        licenses_ids.append(l.license_id)
+    if lic_id not in licenses_ids:
+        db_license = crud.create_license(db, name, lic_id, expdate)
+        if db_license is None:
+            print(&#34;something went wrong&#34;)
+    return RedirectResponse(url=f&#34;/licenses-web&#34;, status_code=303)</code></pre>
 </details>
 </dd>
 <dt id="sql_app.api.licenses_web.get_db"><code class="name flex">
@@ -144,7 +163,7 @@ def create_license(request: Request, name: str = Form(...), expdate: date = Form
 </details>
 </dd>
 <dt id="sql_app.api.licenses_web.licenses_create_web"><code class="name flex">
-<span>async def <span class="ident">licenses_create_web</span></span>(<span>request: starlette.requests.Request)</span>
+<span>async def <span class="ident">licenses_create_web</span></span>(<span>request: starlette.requests.Request, Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
 </code></dt>
 <dd>
 <div class="desc"><p>Returns template with Form for creating new license.</p></div>
@@ -153,15 +172,19 @@ def create_license(request: Request, name: str = Form(...), expdate: date = Form
 <span>Expand source code</span>
 </summary>
 <pre><code class="python">@licenses_web.get(&#34;/license-create&#34;, response_class=HTMLResponse)
-async def licenses_create_web(request: Request):
+async def licenses_create_web(request: Request, Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
     Returns template with Form for creating new license.
     &#34;&#34;&#34;
-    return templates.TemplateResponse(&#34;license_create.html&#34;, {&#34;request&#34;: request})</code></pre>
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    return templates.TemplateResponse(&#34;license_create.html&#34;, {&#34;request&#34;: request, &#34;minimum_date&#34;: date.today()})</code></pre>
 </details>
 </dd>
 <dt id="sql_app.api.licenses_web.read_licenses_web"><code class="name flex">
-<span>async def <span class="ident">read_licenses_web</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db))</span>
+<span>async def <span class="ident">read_licenses_web</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
 </code></dt>
 <dd>
 <div class="desc"><p>Returns template with all licenses currently saved in database</p></div>
@@ -170,12 +193,21 @@ async def licenses_create_web(request: Request):
 <span>Expand source code</span>
 </summary>
 <pre><code class="python">@licenses_web.get(&#34;/licenses-web&#34;, response_class=HTMLResponse)
-async def read_licenses_web(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
+async def read_licenses_web(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                            Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
     Returns template with all licenses currently saved in database
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;licenses.html&#34;, {&#34;request&#34;: request, &#34;licenses&#34;: licenses})</code></pre>
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;licenses.html&#34;, {&#34;request&#34;: request, &#34;licenses&#34;: licenses,
+                                                            &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;licenses_normal.html&#34;, {&#34;request&#34;: request, &#34;licenses&#34;: licenses,
+                                                            &#34;user&#34;: current_user})</code></pre>
 </details>
 </dd>
 </dl>
diff --git a/server/doc/sql_app/api/pcs_web.html b/server/doc/sql_app/api/pcs_web.html
index 5f11982..3b208a9 100644
--- a/server/doc/sql_app/api/pcs_web.html
+++ b/server/doc/sql_app/api/pcs_web.html
@@ -32,7 +32,8 @@ from sqlalchemy.orm import Session
 from sql_app import crud, models, schemas
 from ..database import SessionLocal, engine
 from fastapi import FastAPI, Request
-from fastapi.responses import HTMLResponse
+from fastapi.responses import HTMLResponse, RedirectResponse
+from fastapi_jwt_auth import AuthJWT
 from fastapi.staticfiles import StaticFiles
 from fastapi.templating import Jinja2Templates
 
@@ -42,7 +43,7 @@ models.Base.metadata.create_all(bind=engine)
 templates = Jinja2Templates(directory=&#34;../templates/pcs&#34;)
 
 # prefix used for all endpoints in this file
-pcs_web = APIRouter(prefix=&#34;/api/v1&#34;)
+pcs_web = APIRouter(prefix=&#34;&#34;)
 
 
 # Dependency
@@ -55,34 +56,19 @@ def get_db():
 
 
 @pcs_web.get(&#34;/pcs-web&#34;, response_class=HTMLResponse)
-async def read_pcs(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
+async def read_pcs(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                   Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
     Returns template with all pcs currently saved in database
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
     pcs = crud.get_pcs(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;pcs.html&#34;, {&#34;request&#34;: request, &#34;pcs&#34;: pcs})
-
-
-@pcs_web.get(&#34;/pc-team/{pc_id}&#34;, response_class=HTMLResponse)
-async def connect_pc_team(request: Request, pc_id: int, db: Session = Depends(get_db)):
-    &#34;&#34;&#34;
-    Returns template with Form for connecting pc with team
-    &#34;&#34;&#34;
-    pc = crud.get_pc(db, pc_id)
-    teams = crud.get_teams(db, 0, 100)
-    return templates.TemplateResponse(&#34;pcteam.html&#34;,
-                                      {&#34;request&#34;: request, &#34;pc&#34;: pc, &#34;teams&#34;: teams})
-
-
-@pcs_web.post(&#34;/pcs-web/{pc_id}&#34;, response_class=HTMLResponse)
-async def connect_post(request: Request, pc_id: int, team: str = Form(...), skip: int = 0, limit: int = 100,
-                       db: Session = Depends(get_db)):
-    &#34;&#34;&#34;
-    Endpoint called from within form for connecting pc with team. Updates certain pc with new team.
-    &#34;&#34;&#34;
-    old_pc = crud.update_pc(db, pc_id, team)
-    pcs = crud.get_pcs(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;pcs.html&#34;, {&#34;request&#34;: request, &#34;pcs&#34;: pcs})</code></pre>
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;pcs.html&#34;, {&#34;request&#34;: request, &#34;pcs&#34;: pcs, &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;pcs_normal.html&#34;, {&#34;request&#34;: request, &#34;pcs&#34;: pcs, &#34;user&#34;: current_user})</code></pre>
 </details>
 </section>
 <section>
@@ -92,46 +78,6 @@ async def connect_post(request: Request, pc_id: int, team: str = Form(...), skip
 <section>
 <h2 class="section-title" id="header-functions">Functions</h2>
 <dl>
-<dt id="sql_app.api.pcs_web.connect_pc_team"><code class="name flex">
-<span>async def <span class="ident">connect_pc_team</span></span>(<span>request: starlette.requests.Request, pc_id: int, db: sqlalchemy.orm.session.Session = Depends(get_db))</span>
-</code></dt>
-<dd>
-<div class="desc"><p>Returns template with Form for connecting pc with team</p></div>
-<details class="source">
-<summary>
-<span>Expand source code</span>
-</summary>
-<pre><code class="python">@pcs_web.get(&#34;/pc-team/{pc_id}&#34;, response_class=HTMLResponse)
-async def connect_pc_team(request: Request, pc_id: int, db: Session = Depends(get_db)):
-    &#34;&#34;&#34;
-    Returns template with Form for connecting pc with team
-    &#34;&#34;&#34;
-    pc = crud.get_pc(db, pc_id)
-    teams = crud.get_teams(db, 0, 100)
-    return templates.TemplateResponse(&#34;pcteam.html&#34;,
-                                      {&#34;request&#34;: request, &#34;pc&#34;: pc, &#34;teams&#34;: teams})</code></pre>
-</details>
-</dd>
-<dt id="sql_app.api.pcs_web.connect_post"><code class="name flex">
-<span>async def <span class="ident">connect_post</span></span>(<span>request: starlette.requests.Request, pc_id: int, team: str = Form(Ellipsis), skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db))</span>
-</code></dt>
-<dd>
-<div class="desc"><p>Endpoint called from within form for connecting pc with team. Updates certain pc with new team.</p></div>
-<details class="source">
-<summary>
-<span>Expand source code</span>
-</summary>
-<pre><code class="python">@pcs_web.post(&#34;/pcs-web/{pc_id}&#34;, response_class=HTMLResponse)
-async def connect_post(request: Request, pc_id: int, team: str = Form(...), skip: int = 0, limit: int = 100,
-                       db: Session = Depends(get_db)):
-    &#34;&#34;&#34;
-    Endpoint called from within form for connecting pc with team. Updates certain pc with new team.
-    &#34;&#34;&#34;
-    old_pc = crud.update_pc(db, pc_id, team)
-    pcs = crud.get_pcs(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;pcs.html&#34;, {&#34;request&#34;: request, &#34;pcs&#34;: pcs})</code></pre>
-</details>
-</dd>
 <dt id="sql_app.api.pcs_web.get_db"><code class="name flex">
 <span>def <span class="ident">get_db</span></span>(<span>)</span>
 </code></dt>
@@ -150,7 +96,7 @@ async def connect_post(request: Request, pc_id: int, team: str = Form(...), skip
 </details>
 </dd>
 <dt id="sql_app.api.pcs_web.read_pcs"><code class="name flex">
-<span>async def <span class="ident">read_pcs</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db))</span>
+<span>async def <span class="ident">read_pcs</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
 </code></dt>
 <dd>
 <div class="desc"><p>Returns template with all pcs currently saved in database</p></div>
@@ -159,12 +105,19 @@ async def connect_post(request: Request, pc_id: int, team: str = Form(...), skip
 <span>Expand source code</span>
 </summary>
 <pre><code class="python">@pcs_web.get(&#34;/pcs-web&#34;, response_class=HTMLResponse)
-async def read_pcs(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
+async def read_pcs(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                   Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
     Returns template with all pcs currently saved in database
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
     pcs = crud.get_pcs(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;pcs.html&#34;, {&#34;request&#34;: request, &#34;pcs&#34;: pcs})</code></pre>
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;pcs.html&#34;, {&#34;request&#34;: request, &#34;pcs&#34;: pcs, &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;pcs_normal.html&#34;, {&#34;request&#34;: request, &#34;pcs&#34;: pcs, &#34;user&#34;: current_user})</code></pre>
 </details>
 </dd>
 </dl>
@@ -185,8 +138,6 @@ async def read_pcs(request: Request, skip: int = 0, limit: int = 100, db: Sessio
 </li>
 <li><h3><a href="#header-functions">Functions</a></h3>
 <ul class="">
-<li><code><a title="sql_app.api.pcs_web.connect_pc_team" href="#sql_app.api.pcs_web.connect_pc_team">connect_pc_team</a></code></li>
-<li><code><a title="sql_app.api.pcs_web.connect_post" href="#sql_app.api.pcs_web.connect_post">connect_post</a></code></li>
 <li><code><a title="sql_app.api.pcs_web.get_db" href="#sql_app.api.pcs_web.get_db">get_db</a></code></li>
 <li><code><a title="sql_app.api.pcs_web.read_pcs" href="#sql_app.api.pcs_web.read_pcs">read_pcs</a></code></li>
 </ul>
diff --git a/server/doc/sql_app/api/teams_web.html b/server/doc/sql_app/api/teams_web.html
index bee1c5d..d80c794 100644
--- a/server/doc/sql_app/api/teams_web.html
+++ b/server/doc/sql_app/api/teams_web.html
@@ -33,7 +33,8 @@ from sqlalchemy.orm import Session
 from sql_app import crud, models, schemas
 from ..database import SessionLocal, engine
 from fastapi import FastAPI, Request
-from fastapi.responses import HTMLResponse
+from fastapi.responses import HTMLResponse, RedirectResponse
+from fastapi_jwt_auth import AuthJWT
 from fastapi.staticfiles import StaticFiles
 from fastapi.templating import Jinja2Templates
 
@@ -43,7 +44,7 @@ models.Base.metadata.create_all(bind=engine)
 templates = Jinja2Templates(directory=&#34;../templates/teams&#34;)
 
 # prefix used for all endpoints in this file
-teams_web = APIRouter(prefix=&#34;/api/v1&#34;)
+teams_web = APIRouter(prefix=&#34;&#34;)
 
 
 # Dependency
@@ -56,33 +57,78 @@ def get_db():
 
 
 @teams_web.get(&#34;/teams-web&#34;, response_class=HTMLResponse)
-async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
+async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
     Returns template with all teams currently saved in database
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
     teams = crud.get_teams(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;teams.html&#34;, {&#34;request&#34;: request, &#34;teams&#34;: teams})
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;teams.html&#34;, {&#34;request&#34;: request, &#34;teams&#34;: teams, &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;teams_normal.html&#34;, {&#34;request&#34;: request, &#34;teams&#34;: teams, &#34;user&#34;: current_user})
 
 
 @teams_web.get(&#34;/team-create&#34;, response_class=HTMLResponse)
-async def team_create_web(request: Request):
+async def team_create_web(request: Request, Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
     Returns template with form for creating new team
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
     return templates.TemplateResponse(&#34;team_create.html&#34;, {&#34;request&#34;: request})
 
 
-@teams_web.post(&#34;/teams-web&#34;, response_class=HTMLResponse)
-def create_team(request: Request, name: str = Form(...), skip: int = 0, limit: int = 100,
-                   db: Session = Depends(get_db)):
+@teams_web.post(&#34;/teams-web-con&#34;)
+def create_team(name: str = Form(...), db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
-    Endpoint called from within form for creating new team. Creates new team and returns all teams in database
+    Endpoint called from within form for creating new team. Creates new team and redirects to view with all teams
     &#34;&#34;&#34;
-    team = crud.create_team(db, name)
-    if team is None:
-        print(&#34;something went wrong&#34;)
-    teams = crud.get_teams(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;teams.html&#34;, {&#34;request&#34;: request, &#34;teams&#34;: teams})</code></pre>
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    teams = crud.get_teams(db, 0, 100)
+    teams_names = []
+    for t in teams:
+        teams_names.append(t.name)
+    if name not in teams_names:
+        team = crud.create_team(db, name)
+        if team is None:
+            print(&#34;something went wrong&#34;)
+    return RedirectResponse(url=f&#34;/teams-web&#34;, status_code=303)
+
+
+@teams_web.get(&#34;/team-change/{team_id}&#34;, response_class=HTMLResponse)
+async def team_change_web(request: Request, team_id: int, db: Session = Depends(get_db),
+                          Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Returns template with form for changing teams name
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    team = crud.get_team(db, team_id)
+    return templates.TemplateResponse(&#34;team_change.html&#34;, {&#34;request&#34;: request, &#34;team&#34;: team})
+
+@teams_web.post(&#34;/teams-change-process/{team_id}&#34;)
+async def team_change_process(team_id: int, db:Session = Depends(get_db), name: str = Form(...),
+                              Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Changes teams name to a new one given by user
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    team = crud.change_team(db, team_id, name)
+    return RedirectResponse(url=f&#34;/teams-web&#34;, status_code=303)</code></pre>
 </details>
 </section>
 <section>
@@ -93,25 +139,32 @@ def create_team(request: Request, name: str = Form(...), skip: int = 0, limit: i
 <h2 class="section-title" id="header-functions">Functions</h2>
 <dl>
 <dt id="sql_app.api.teams_web.create_team"><code class="name flex">
-<span>def <span class="ident">create_team</span></span>(<span>request: starlette.requests.Request, name: str = Form(Ellipsis), skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db))</span>
+<span>def <span class="ident">create_team</span></span>(<span>name: str = Form(Ellipsis), db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
 </code></dt>
 <dd>
-<div class="desc"><p>Endpoint called from within form for creating new team. Creates new team and returns all teams in database</p></div>
+<div class="desc"><p>Endpoint called from within form for creating new team. Creates new team and redirects to view with all teams</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">@teams_web.post(&#34;/teams-web&#34;, response_class=HTMLResponse)
-def create_team(request: Request, name: str = Form(...), skip: int = 0, limit: int = 100,
-                   db: Session = Depends(get_db)):
+<pre><code class="python">@teams_web.post(&#34;/teams-web-con&#34;)
+def create_team(name: str = Form(...), db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
-    Endpoint called from within form for creating new team. Creates new team and returns all teams in database
+    Endpoint called from within form for creating new team. Creates new team and redirects to view with all teams
     &#34;&#34;&#34;
-    team = crud.create_team(db, name)
-    if team is None:
-        print(&#34;something went wrong&#34;)
-    teams = crud.get_teams(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;teams.html&#34;, {&#34;request&#34;: request, &#34;teams&#34;: teams})</code></pre>
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    teams = crud.get_teams(db, 0, 100)
+    teams_names = []
+    for t in teams:
+        teams_names.append(t.name)
+    if name not in teams_names:
+        team = crud.create_team(db, name)
+        if team is None:
+            print(&#34;something went wrong&#34;)
+    return RedirectResponse(url=f&#34;/teams-web&#34;, status_code=303)</code></pre>
 </details>
 </dd>
 <dt id="sql_app.api.teams_web.get_db"><code class="name flex">
@@ -132,7 +185,7 @@ def create_team(request: Request, name: str = Form(...), skip: int = 0, limit: i
 </details>
 </dd>
 <dt id="sql_app.api.teams_web.read_devices"><code class="name flex">
-<span>async def <span class="ident">read_devices</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db))</span>
+<span>async def <span class="ident">read_devices</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
 </code></dt>
 <dd>
 <div class="desc"><p>Returns template with all teams currently saved in database</p></div>
@@ -141,16 +194,69 @@ def create_team(request: Request, name: str = Form(...), skip: int = 0, limit: i
 <span>Expand source code</span>
 </summary>
 <pre><code class="python">@teams_web.get(&#34;/teams-web&#34;, response_class=HTMLResponse)
-async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
+async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
     Returns template with all teams currently saved in database
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
     teams = crud.get_teams(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;teams.html&#34;, {&#34;request&#34;: request, &#34;teams&#34;: teams})</code></pre>
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;teams.html&#34;, {&#34;request&#34;: request, &#34;teams&#34;: teams, &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;teams_normal.html&#34;, {&#34;request&#34;: request, &#34;teams&#34;: teams, &#34;user&#34;: current_user})</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.teams_web.team_change_process"><code class="name flex">
+<span>async def <span class="ident">team_change_process</span></span>(<span>team_id: int, db: sqlalchemy.orm.session.Session = Depends(get_db), name: str = Form(Ellipsis), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Changes teams name to a new one given by user</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@teams_web.post(&#34;/teams-change-process/{team_id}&#34;)
+async def team_change_process(team_id: int, db:Session = Depends(get_db), name: str = Form(...),
+                              Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Changes teams name to a new one given by user
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    team = crud.change_team(db, team_id, name)
+    return RedirectResponse(url=f&#34;/teams-web&#34;, status_code=303)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.teams_web.team_change_web"><code class="name flex">
+<span>async def <span class="ident">team_change_web</span></span>(<span>request: starlette.requests.Request, team_id: int, db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Returns template with form for changing teams name</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@teams_web.get(&#34;/team-change/{team_id}&#34;, response_class=HTMLResponse)
+async def team_change_web(request: Request, team_id: int, db: Session = Depends(get_db),
+                          Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Returns template with form for changing teams name
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    team = crud.get_team(db, team_id)
+    return templates.TemplateResponse(&#34;team_change.html&#34;, {&#34;request&#34;: request, &#34;team&#34;: team})</code></pre>
 </details>
 </dd>
 <dt id="sql_app.api.teams_web.team_create_web"><code class="name flex">
-<span>async def <span class="ident">team_create_web</span></span>(<span>request: starlette.requests.Request)</span>
+<span>async def <span class="ident">team_create_web</span></span>(<span>request: starlette.requests.Request, Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
 </code></dt>
 <dd>
 <div class="desc"><p>Returns template with form for creating new team</p></div>
@@ -159,10 +265,14 @@ async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Se
 <span>Expand source code</span>
 </summary>
 <pre><code class="python">@teams_web.get(&#34;/team-create&#34;, response_class=HTMLResponse)
-async def team_create_web(request: Request):
+async def team_create_web(request: Request, Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
     Returns template with form for creating new team
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
     return templates.TemplateResponse(&#34;team_create.html&#34;, {&#34;request&#34;: request})</code></pre>
 </details>
 </dd>
@@ -183,10 +293,12 @@ async def team_create_web(request: Request):
 </ul>
 </li>
 <li><h3><a href="#header-functions">Functions</a></h3>
-<ul class="">
+<ul class="two-column">
 <li><code><a title="sql_app.api.teams_web.create_team" href="#sql_app.api.teams_web.create_team">create_team</a></code></li>
 <li><code><a title="sql_app.api.teams_web.get_db" href="#sql_app.api.teams_web.get_db">get_db</a></code></li>
 <li><code><a title="sql_app.api.teams_web.read_devices" href="#sql_app.api.teams_web.read_devices">read_devices</a></code></li>
+<li><code><a title="sql_app.api.teams_web.team_change_process" href="#sql_app.api.teams_web.team_change_process">team_change_process</a></code></li>
+<li><code><a title="sql_app.api.teams_web.team_change_web" href="#sql_app.api.teams_web.team_change_web">team_change_web</a></code></li>
 <li><code><a title="sql_app.api.teams_web.team_create_web" href="#sql_app.api.teams_web.team_create_web">team_create_web</a></code></li>
 </ul>
 </li>
diff --git a/server/doc/sql_app/api/usb_logs.html b/server/doc/sql_app/api/usb_logs.html
index 499c94e..68e28ae 100644
--- a/server/doc/sql_app/api/usb_logs.html
+++ b/server/doc/sql_app/api/usb_logs.html
@@ -76,9 +76,9 @@ def create_ld_logs(log: schemas.LDTempBase, db: Session = Depends(get_db)):
     head_dev = crud.find_head_device(db, log.head_device)
     body_dev = crud.find_body_device(db, log.body_device)
     if head_dev is None:
-        crud.create_head_device(db, log.head_device)
+        head_dev = crud.create_head_device(db, log.head_device)
     if body_dev is None:
-        crud.create_body_device(db, log.body_device)
+        body_dev = crud.create_body_device(db, log.body_device)
 
     pc = crud.find_pc(db, log.username, log.hostname)
     if pc is None:
@@ -164,9 +164,9 @@ def create_ld_logs(log: schemas.LDTempBase, db: Session = Depends(get_db)):
     head_dev = crud.find_head_device(db, log.head_device)
     body_dev = crud.find_body_device(db, log.body_device)
     if head_dev is None:
-        crud.create_head_device(db, log.head_device)
+        head_dev = crud.create_head_device(db, log.head_device)
     if body_dev is None:
-        crud.create_body_device(db, log.body_device)
+        body_dev = crud.create_body_device(db, log.body_device)
 
     pc = crud.find_pc(db, log.username, log.hostname)
     if pc is None:
diff --git a/server/doc/sql_app/api/usb_logs_web.html b/server/doc/sql_app/api/usb_logs_web.html
index fb54ab6..5c2b0ca 100644
--- a/server/doc/sql_app/api/usb_logs_web.html
+++ b/server/doc/sql_app/api/usb_logs_web.html
@@ -34,6 +34,7 @@ from sql_app import crud, models, schemas
 from ..database import SessionLocal, engine
 from fastapi import FastAPI, Request
 from fastapi.responses import HTMLResponse
+from fastapi_jwt_auth import AuthJWT
 from fastapi.staticfiles import StaticFiles
 from fastapi.templating import Jinja2Templates
 
@@ -43,7 +44,7 @@ models.Base.metadata.create_all(bind=engine)
 templates = Jinja2Templates(directory=&#34;../templates/usb-logs&#34;)
 
 # prefix used for all endpoints in this file
-usblogs_web = APIRouter(prefix=&#34;/api/v1&#34;)
+usblogs_web = APIRouter(prefix=&#34;&#34;)
 
 
 # Dependency
@@ -56,10 +57,13 @@ def get_db():
 
 
 @usblogs_web.get(&#34;/logs-web&#34;, response_class=HTMLResponse)
-async def read_logs(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
+async def read_logs(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                    Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
     Returns template with all usb logs currently saved in database with its pcs, teams and licenses.
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
     logs = crud.get_logs(db, skip=skip, limit=limit)
     pcs = []
     for log in logs:
@@ -68,17 +72,24 @@ async def read_logs(request: Request, skip: int = 0, limit: int = 100, db: Sessi
     pc_obj = crud.find_pcs(db, pcs)
     teams = crud.get_teams(db, skip=skip, limit=limit)
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;logs.html&#34;, {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
-                                                    &#34;licenses&#34;: licenses})
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;logs.html&#34;, {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
+                                                        &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;logs_normal.html&#34;, {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
+                                                        &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})
 
 
 @usblogs_web.post(&#34;/logs-web&#34;, response_class=HTMLResponse)
 async def filter_logs(request: Request, pc: str = Form(&#34;all&#34;), team: str = Form(&#34;all&#34;), lic: str = Form(&#34;all&#34;),
                       skip: int = 0, limit: int = 100,
-                      db: Session = Depends(get_db)):
+                      db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
     Endpoint used for filtering usb logs by user given form inputs.
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
     log = crud.get_filtered_logs(db, pc, team, lic)
     logs_ids = []
     for l in log:
@@ -87,8 +98,18 @@ async def filter_logs(request: Request, pc: str = Form(&#34;all&#34;), team: str
     pc_obj = crud.get_pcs(db, skip=skip, limit=limit)
     teams = crud.get_teams(db, skip=skip, limit=limit)
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;logs.html&#34;, {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
-                                                    &#34;licenses&#34;: licenses})</code></pre>
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;logs.html&#34;, {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
+                                                        &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;logs_normal.html&#34;, {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
+                                                        &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})
+
+
+@usblogs_web.get(&#34;/&#34;, response_class=HTMLResponse)
+async def crossroad(request: Request):
+    return templates.TemplateResponse(&#34;crossroad.html&#34;, {&#34;request&#34;: request})</code></pre>
 </details>
 </section>
 <section>
@@ -98,8 +119,22 @@ async def filter_logs(request: Request, pc: str = Form(&#34;all&#34;), team: str
 <section>
 <h2 class="section-title" id="header-functions">Functions</h2>
 <dl>
+<dt id="sql_app.api.usb_logs_web.crossroad"><code class="name flex">
+<span>async def <span class="ident">crossroad</span></span>(<span>request: starlette.requests.Request)</span>
+</code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@usblogs_web.get(&#34;/&#34;, response_class=HTMLResponse)
+async def crossroad(request: Request):
+    return templates.TemplateResponse(&#34;crossroad.html&#34;, {&#34;request&#34;: request})</code></pre>
+</details>
+</dd>
 <dt id="sql_app.api.usb_logs_web.filter_logs"><code class="name flex">
-<span>async def <span class="ident">filter_logs</span></span>(<span>request: starlette.requests.Request, pc: str = Form(all), team: str = Form(all), lic: str = Form(all), skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db))</span>
+<span>async def <span class="ident">filter_logs</span></span>(<span>request: starlette.requests.Request, pc: str = Form(all), team: str = Form(all), lic: str = Form(all), skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
 </code></dt>
 <dd>
 <div class="desc"><p>Endpoint used for filtering usb logs by user given form inputs.</p></div>
@@ -110,10 +145,12 @@ async def filter_logs(request: Request, pc: str = Form(&#34;all&#34;), team: str
 <pre><code class="python">@usblogs_web.post(&#34;/logs-web&#34;, response_class=HTMLResponse)
 async def filter_logs(request: Request, pc: str = Form(&#34;all&#34;), team: str = Form(&#34;all&#34;), lic: str = Form(&#34;all&#34;),
                       skip: int = 0, limit: int = 100,
-                      db: Session = Depends(get_db)):
+                      db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
     Endpoint used for filtering usb logs by user given form inputs.
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
     log = crud.get_filtered_logs(db, pc, team, lic)
     logs_ids = []
     for l in log:
@@ -122,8 +159,13 @@ async def filter_logs(request: Request, pc: str = Form(&#34;all&#34;), team: str
     pc_obj = crud.get_pcs(db, skip=skip, limit=limit)
     teams = crud.get_teams(db, skip=skip, limit=limit)
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;logs.html&#34;, {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
-                                                    &#34;licenses&#34;: licenses})</code></pre>
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;logs.html&#34;, {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
+                                                        &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;logs_normal.html&#34;, {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
+                                                        &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})</code></pre>
 </details>
 </dd>
 <dt id="sql_app.api.usb_logs_web.get_db"><code class="name flex">
@@ -144,7 +186,7 @@ async def filter_logs(request: Request, pc: str = Form(&#34;all&#34;), team: str
 </details>
 </dd>
 <dt id="sql_app.api.usb_logs_web.read_logs"><code class="name flex">
-<span>async def <span class="ident">read_logs</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db))</span>
+<span>async def <span class="ident">read_logs</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
 </code></dt>
 <dd>
 <div class="desc"><p>Returns template with all usb logs currently saved in database with its pcs, teams and licenses.</p></div>
@@ -153,10 +195,13 @@ async def filter_logs(request: Request, pc: str = Form(&#34;all&#34;), team: str
 <span>Expand source code</span>
 </summary>
 <pre><code class="python">@usblogs_web.get(&#34;/logs-web&#34;, response_class=HTMLResponse)
-async def read_logs(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
+async def read_logs(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                    Authorize: AuthJWT = Depends()):
     &#34;&#34;&#34;
     Returns template with all usb logs currently saved in database with its pcs, teams and licenses.
     &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
     logs = crud.get_logs(db, skip=skip, limit=limit)
     pcs = []
     for log in logs:
@@ -165,8 +210,13 @@ async def read_logs(request: Request, skip: int = 0, limit: int = 100, db: Sessi
     pc_obj = crud.find_pcs(db, pcs)
     teams = crud.get_teams(db, skip=skip, limit=limit)
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
-    return templates.TemplateResponse(&#34;logs.html&#34;, {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
-                                                    &#34;licenses&#34;: licenses})</code></pre>
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;logs.html&#34;, {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
+                                                        &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})
+    else:
+        current_user = &#34;guest&#34;
+        return templates.TemplateResponse(&#34;logs_normal.html&#34;, {&#34;request&#34;: request, &#34;logs&#34;: logs, &#34;pcs&#34;: pc_obj, &#34;teams&#34;: teams,
+                                                        &#34;licenses&#34;: licenses, &#34;user&#34;: current_user})</code></pre>
 </details>
 </dd>
 </dl>
@@ -187,6 +237,7 @@ async def read_logs(request: Request, skip: int = 0, limit: int = 100, db: Sessi
 </li>
 <li><h3><a href="#header-functions">Functions</a></h3>
 <ul class="">
+<li><code><a title="sql_app.api.usb_logs_web.crossroad" href="#sql_app.api.usb_logs_web.crossroad">crossroad</a></code></li>
 <li><code><a title="sql_app.api.usb_logs_web.filter_logs" href="#sql_app.api.usb_logs_web.filter_logs">filter_logs</a></code></li>
 <li><code><a title="sql_app.api.usb_logs_web.get_db" href="#sql_app.api.usb_logs_web.get_db">get_db</a></code></li>
 <li><code><a title="sql_app.api.usb_logs_web.read_logs" href="#sql_app.api.usb_logs_web.read_logs">read_logs</a></code></li>
diff --git a/server/doc/sql_app/api/users_web.html b/server/doc/sql_app/api/users_web.html
new file mode 100644
index 0000000..ac9a9d6
--- /dev/null
+++ b/server/doc/sql_app/api/users_web.html
@@ -0,0 +1,194 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
+<meta name="generator" content="pdoc 0.10.0" />
+<title>sql_app.api.users_web API documentation</title>
+<meta name="description" content="" />
+<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
+<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
+<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
+<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
+<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
+<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
+<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
+<script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
+</head>
+<body>
+<main>
+<article id="content">
+<header>
+<h1 class="title">Module <code>sql_app.api.users_web</code></h1>
+</header>
+<section id="section-intro">
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">from typing import List
+from fastapi import Depends, FastAPI, HTTPException, APIRouter, Form
+from sqlalchemy.orm import Session
+from sql_app import crud, models, schemas
+from ..database import SessionLocal, engine
+from fastapi import FastAPI, Request
+from fastapi.responses import HTMLResponse, RedirectResponse
+from fastapi_jwt_auth import AuthJWT
+from fastapi.staticfiles import StaticFiles
+from fastapi.templating import Jinja2Templates
+
+models.Base.metadata.create_all(bind=engine)
+
+# Path to html templates used in this file
+templates = Jinja2Templates(directory=&#34;../templates/users&#34;)
+
+# prefix used for all endpoints in this file
+users = APIRouter(prefix=&#34;&#34;)
+
+
+# Dependency
+def get_db():
+    db = SessionLocal()
+    try:
+        yield db
+    finally:
+        db.close()
+
+
+@users.get(&#34;/users-web&#34;, response_class=HTMLResponse)
+async def read_usrs(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                   Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Returns template with all users currently saved in database
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    users = crud.get_users(db, skip, limit)
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;users.html&#34;, {&#34;request&#34;: request, &#34;users&#34;: users})
+    else:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+
+
+@users.get(&#34;/user-role/{usr_id}&#34;, response_class=HTMLResponse)
+async def connect_pc_team(usr_id: int, db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Changes role of user to either guest or admin depending on old role.
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    user = crud.find_user_byid(db, usr_id)
+    if user.role == &#34;admin&#34;:
+        crud.change_role(db, usr_id, &#34;guest&#34;)
+    else:
+        crud.change_role(db, usr_id, &#34;admin&#34;)
+    return RedirectResponse(url=f&#34;/users-web&#34;, status_code=303)</code></pre>
+</details>
+</section>
+<section>
+</section>
+<section>
+</section>
+<section>
+<h2 class="section-title" id="header-functions">Functions</h2>
+<dl>
+<dt id="sql_app.api.users_web.connect_pc_team"><code class="name flex">
+<span>async def <span class="ident">connect_pc_team</span></span>(<span>usr_id: int, db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Changes role of user to either guest or admin depending on old role.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@users.get(&#34;/user-role/{usr_id}&#34;, response_class=HTMLResponse)
+async def connect_pc_team(usr_id: int, db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Changes role of user to either guest or admin depending on old role.
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != &#34;admin&#34;:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)
+    user = crud.find_user_byid(db, usr_id)
+    if user.role == &#34;admin&#34;:
+        crud.change_role(db, usr_id, &#34;guest&#34;)
+    else:
+        crud.change_role(db, usr_id, &#34;admin&#34;)
+    return RedirectResponse(url=f&#34;/users-web&#34;, status_code=303)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.users_web.get_db"><code class="name flex">
+<span>def <span class="ident">get_db</span></span>(<span>)</span>
+</code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_db():
+    db = SessionLocal()
+    try:
+        yield db
+    finally:
+        db.close()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.api.users_web.read_usrs"><code class="name flex">
+<span>async def <span class="ident">read_usrs</span></span>(<span>request: starlette.requests.Request, skip: int = 0, limit: int = 100, db: sqlalchemy.orm.session.Session = Depends(get_db), Authorize: fastapi_jwt_auth.auth_jwt.AuthJWT = Depends(NoneType))</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Returns template with all users currently saved in database</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">@users.get(&#34;/users-web&#34;, response_class=HTMLResponse)
+async def read_usrs(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                   Authorize: AuthJWT = Depends()):
+    &#34;&#34;&#34;
+    Returns template with all users currently saved in database
+    &#34;&#34;&#34;
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    users = crud.get_users(db, skip, limit)
+    if current_user == &#34;admin&#34;:
+        return templates.TemplateResponse(&#34;users.html&#34;, {&#34;request&#34;: request, &#34;users&#34;: users})
+    else:
+        return RedirectResponse(url=f&#34;/logs-web&#34;, status_code=303)</code></pre>
+</details>
+</dd>
+</dl>
+</section>
+<section>
+</section>
+</article>
+<nav id="sidebar">
+<h1>Index</h1>
+<div class="toc">
+<ul></ul>
+</div>
+<ul id="index">
+<li><h3>Super-module</h3>
+<ul>
+<li><code><a title="sql_app.api" href="index.html">sql_app.api</a></code></li>
+</ul>
+</li>
+<li><h3><a href="#header-functions">Functions</a></h3>
+<ul class="">
+<li><code><a title="sql_app.api.users_web.connect_pc_team" href="#sql_app.api.users_web.connect_pc_team">connect_pc_team</a></code></li>
+<li><code><a title="sql_app.api.users_web.get_db" href="#sql_app.api.users_web.get_db">get_db</a></code></li>
+<li><code><a title="sql_app.api.users_web.read_usrs" href="#sql_app.api.users_web.read_usrs">read_usrs</a></code></li>
+</ul>
+</li>
+</ul>
+</nav>
+</main>
+<footer id="footer">
+<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
+</footer>
+</body>
+</html>
\ No newline at end of file
diff --git a/server/doc/sql_app/crud.html b/server/doc/sql_app/crud.html
index b6620d0..3130d1d 100644
--- a/server/doc/sql_app/crud.html
+++ b/server/doc/sql_app/crud.html
@@ -47,21 +47,82 @@ def get_devices(db: Session, skip: int = 0, limit: int = 100):
     return db.query(models.Device).offset(skip).limit(limit).all()
 
 
-def find_device(db: Session, device: schemas.DeviceBase):
+def find_device(db: Session, device: schemas.DeviceTemp):
     &#34;&#34;&#34;
-    finds one device with product_id, vendor_id and serial_number same as in given DeviceBase object
+    finds one device with  serial_number same as in given DeviceBase object
     &#34;&#34;&#34;
-    return db.query(models.Device).filter(and_(models.Device.product_id == device.product_id,
-                                               models.Device.vendor_id == device.vendor_id,
-                                               models.Device.serial_number == device.serial_number)).first()
+    return db.query(models.Device).filter(and_(models.Device.serial_number == device.serial_number)).first()
 
 
-def create_device(db: Session, device: schemas.DeviceBase):
+def find_device_by_serial(db: Session, ser: str):
+    &#34;&#34;&#34;
+    finds one device with serial_number same as in given DeviceBase object
+    &#34;&#34;&#34;
+    return db.query(models.Device).filter(and_(models.Device.serial_number == ser)).first()
+
+
+def get_devices_with_ids(db: Session, ids: []):
+    &#34;&#34;&#34;
+    returns all devices with given ids
+    &#34;&#34;&#34;
+    return db.query(models.Device).filter(models.Device.id.in_(ids)).all()
+
+
+def get_bodydevices_with_ids(db: Session, ids: []):
+    &#34;&#34;&#34;
+    returns all bodydevices with given ids
+    &#34;&#34;&#34;
+    return db.query(models.BodyDevice).filter(models.BodyDevice.id.in_(ids)).all()
+
+
+def get_headdevices_with_ids(db: Session, ids: []):
+    &#34;&#34;&#34;
+    returns all headdevices with given ids
+    &#34;&#34;&#34;
+    return db.query(models.HeadDevice).filter(models.HeadDevice.id.in_(ids)).all()
+
+
+def find_headdevices_by_team(db: Session, team_id: int):
+    &#34;&#34;&#34;
+    Returns all head devices in specific team
+    &#34;&#34;&#34;
+    return db.query(models.HeadDevice).filter(models.HeadDevice.team_id == team_id).all()
+
+
+def find_bodydevices_by_team(db: Session, team_id: int):
+    &#34;&#34;&#34;
+    Returns all body devices in specific team
+    &#34;&#34;&#34;
+    return db.query(models.BodyDevice).filter(models.BodyDevice.team_id == team_id).all()
+
+
+def find_headdevices_by_license(db: Session, lic_id: int):
+    &#34;&#34;&#34;
+    Returns all head devices with specific license
+    &#34;&#34;&#34;
+    return db.query(models.HeadDevice).filter(models.HeadDevice.license_id == lic_id).all()
+
+
+def find_bodydevices_by_license(db: Session, lic_id: int):
+    &#34;&#34;&#34;
+    Returns all body devices with specific license
+    &#34;&#34;&#34;
+    return db.query(models.BodyDevice).filter(models.BodyDevice.license_id == lic_id).all()
+
+
+def get_devices_by_team(db: Session, team: int):
+    &#34;&#34;&#34;
+    returns all devices with same team
+    &#34;&#34;&#34;
+    return db.query(models.Device).filter(models.Device.team_id == team).all()
+
+
+def create_device(db: Session, device: schemas.DeviceTemp):
     &#34;&#34;&#34;
     creates new device with data from given DeviceBase object
     &#34;&#34;&#34;
     db_device = models.Device(vendor_id=device.vendor_id, product_id=device.product_id,
-                              serial_number=device.serial_number, assigned=False)
+                              serial_number=device.serial_number, inventory_number=&#34;&#34;, comment=&#34;&#34;)
     db.add(db_device)
     db.commit()
     db.refresh(db_device)
@@ -86,14 +147,18 @@ def find_license(db: Session, name: str):
     &#34;&#34;&#34;
     finds one license by given string name
     &#34;&#34;&#34;
-    return db.query(models.License).filter(models.License.name == name).first()
+    return db.query(models.License).filter(models.License.license_id == name).first()
 
 
-def create_license(db: Session, name: str, expdate: date):
+def get_licenses_by_name(db: Session, name: str):
+    return db.query(models.License).filter(models.License.name == name).all()
+
+
+def create_license(db: Session, name: str, lic_id: str, expdate: date):
     &#34;&#34;&#34;
     creates new license with given name and expiration date
     &#34;&#34;&#34;
-    db_license = models.License(name=name, expiration_date=expdate)
+    db_license = models.License(name=name, license_id=lic_id, expiration_date=expdate)
     db.add(db_license)
     db.commit()
     db.refresh(db_license)
@@ -102,11 +167,33 @@ def create_license(db: Session, name: str, expdate: date):
 
 def get_license_devices(db: Session, license_id: int):
     &#34;&#34;&#34;
-    returns all entries in devices_licenses table
+    returns all entries in devices_licenses table with given license_id
     &#34;&#34;&#34;
     return db.query(models.DeviceLicense).filter(models.DeviceLicense.license_id == license_id).all()
 
 
+def find_devicelicenses_by_licid_array(db: Session, lcs: []):
+    &#34;&#34;&#34;
+    Finds all device_licenses with license_id in given id array
+    &#34;&#34;&#34;
+    return db.query(models.DeviceLicense).filter(models.DeviceLicense.license_id.in_(lcs)).all()
+
+
+def get_device_licenses(db: Session, device_id: int):
+    &#34;&#34;&#34;
+    returns all entries in devices_licenses table with given device_id
+    &#34;&#34;&#34;
+    return db.query(models.DeviceLicense).filter(models.DeviceLicense.device_id == device_id).all()
+
+
+def get_devicelicense_by_devicelicense(db: Session, device_id: int, license_id: int):
+    &#34;&#34;&#34;
+    returns entry in devices_licenses table with given device id and license id
+    &#34;&#34;&#34;
+    return db.query(models.DeviceLicense).filter(and_(models.DeviceLicense.device_id == device_id,
+                                                      models.DeviceLicense.license_id == license_id)).first()
+
+
 def create_device_license(db: Session, device: int, license: int, time: datetime):
     &#34;&#34;&#34;
     creates new entry in devices_licenses table with device id, license id and time.
@@ -119,6 +206,16 @@ def create_device_license(db: Session, device: int, license: int, time: datetime
     return db_device_license
 
 
+def delete_device_license(db: Session, device: int, license: int):
+    &#34;&#34;&#34;
+    deletes entry in devices_licenses table with device id, license id and time.
+    &#34;&#34;&#34;
+    db_device_license = get_devicelicense_by_devicelicense(db, device, license)
+    db_lic = db.delete(db_device_license)
+    db.commit()
+    return db_lic
+
+
 def find_pc_by_username(db: Session, name: str):
     &#34;&#34;&#34;
     Finds one pc by given username
@@ -133,19 +230,73 @@ def get_pc(db: Session, pc_id: int):
     return db.query(models.PC).filter(models.PC.id == pc_id).first()
 
 
-def update_pc(db: Session, pc_id: int, team: str):
+def update_device(db: Session, device_id: int, team: str):
     &#34;&#34;&#34;
-    Function updates team of one specific pc
+    Updates team of one specific pc
     &#34;&#34;&#34;
-    old_pc = get_pc(db, pc_id)
+    old_dev = get_device(db, device_id)
     team = get_team(db, int(team))
-    new = {&#39;id&#39;: old_pc.id, &#39;username&#39;: old_pc.username, &#39;hostname&#39;: old_pc.hostname, &#39;assigned&#39;: True,
-           &#39;team_id&#39;: team.id}
+    new = {&#39;id&#39;: old_dev.id, &#39;vendor_id&#39;: old_dev.vendor_id, &#39;product_id&#39;: old_dev.product_id,
+           &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: old_dev.inventory_number,
+           &#39;comment&#39;: old_dev.comment, &#39;team_id&#39;: team.id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_device_inv(db: Session, device_id: int, inv: str):
+    &#34;&#34;&#34;
+    Updates inventory number of one specific pc
+    &#34;&#34;&#34;
+    old_dev = get_device(db, device_id)
+    if old_dev.team_id != None:
+        team = get_team(db, int(old_dev.team_id))
+        teamid = team.id
+    else:
+        teamid = None
+    new = {&#39;id&#39;: old_dev.id, &#39;vendor_id&#39;: old_dev.vendor_id, &#39;product_id&#39;: old_dev.product_id,
+           &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: inv,
+           &#39;comment&#39;: old_dev.comment, &#39;team_id&#39;: teamid}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_device_com(db: Session, device_id: int, comm: str):
+    &#34;&#34;&#34;
+    Updates team of one specific pc
+    &#34;&#34;&#34;
+    old_dev = get_device(db, device_id)
+    if old_dev.team_id != None:
+        team = get_team(db, int(old_dev.team_id))
+        teamid = team.id
+    else:
+        teamid = None
+    new = {&#39;id&#39;: old_dev.id, &#39;vendor_id&#39;: old_dev.vendor_id, &#39;product_id&#39;: old_dev.product_id,
+           &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: old_dev.inventory_number,
+           &#39;comment&#39;: comm, &#39;team_id&#39;: teamid}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def change_role(db: Session, usr_id: int, role: str):
+    &#34;&#34;&#34;
+    Updates team of one specific pc
+    &#34;&#34;&#34;
+    old_usr = find_user_byid(db, usr_id)
+    new = {&#39;id&#39;: old_usr.id, &#39;username&#39;: old_usr.username, &#39;password&#39;: old_usr.password, &#39;role&#39;: role}
     for key, value in new.items():
-        setattr(old_pc, key, value)
+        setattr(old_usr, key, value)
     db.commit()
-    db.refresh(old_pc)
-    return old_pc
+    db.refresh(old_usr)
+    return old_usr
 
 
 def get_pcs(db: Session, skip: int = 0, limit: int = 100):
@@ -184,18 +335,11 @@ def find_pcs(db: Session, pcs: []):
     return db.query(models.PC).filter(models.PC.id.in_(pcs)).all()
 
 
-def get_pcs_by_team(db: Session, team_id: int):
-    &#34;&#34;&#34;
-    returns all pcs in given team by team id
-    &#34;&#34;&#34;
-    return db.query(models.PC).filter(models.PC.team_id == team_id).all()
-
-
 def create_pc(db: Session, user: str, host: str):
     &#34;&#34;&#34;
     creates new pc with given username and hostname
     &#34;&#34;&#34;
-    db_pc = models.PC(username=user, hostname=host, assigned=False)
+    db_pc = models.PC(username=user, hostname=host)
     db.add(db_pc)
     db.commit()
     db.refresh(db_pc)
@@ -234,6 +378,19 @@ def create_team(db: Session, name: str):
     return db_team
 
 
+def change_team(db: Session, team_id: int, name: str):
+    &#34;&#34;&#34;
+    Updates name of one specific team
+    &#34;&#34;&#34;
+    old_team = get_team(db, team_id)
+    new = {&#39;id&#39;: old_team.id, &#39;name&#39;: name}
+    for key, value in new.items():
+        setattr(old_team, key, value)
+    db.commit()
+    db.refresh(old_team)
+    return old_team
+
+
 def get_head_device(db: Session, head_id: int):
     &#34;&#34;&#34;
     Returns one specific head device by given id
@@ -248,14 +405,14 @@ def get_head_devices(db: Session, skip: int = 0, limit: int = 100):
     return db.query(models.HeadDevice).offset(skip).limit(limit).all()
 
 
-def find_head_device(db: Session, serial: schemas.HeadDeviceBase):
+def find_head_device(db: Session, serial: schemas.HeadDeviceTemp):
     &#34;&#34;&#34;
     Finds one head device by its serial number
     &#34;&#34;&#34;
     return db.query(models.HeadDevice).filter(models.HeadDevice.serial_number == serial.serial_number).first()
 
 
-def create_head_device(db: Session, log: schemas.HeadDeviceBase):
+def create_head_device(db: Session, log: schemas.HeadDeviceTemp):
     &#34;&#34;&#34;
     Creates new head device
     &#34;&#34;&#34;
@@ -280,29 +437,159 @@ def get_body_devices(db: Session, skip: int = 0, limit: int = 100):
     return db.query(models.BodyDevice).offset(skip).limit(limit).all()
 
 
-def find_body_device(db: Session, serial: schemas.BodyDeviceBase):
+def find_body_device(db: Session, serial: schemas.BodyDeviceTemp):
     &#34;&#34;&#34;
     Finds one body device by its serial number
     &#34;&#34;&#34;
     return db.query(models.BodyDevice).filter(models.BodyDevice.serial_number == serial.serial_number).first()
 
 
-def create_body_device(db: Session, log: schemas.BodyDeviceBase):
+def find_bodydevice_by_serial(db: Session, serial: str):
+    &#34;&#34;&#34;
+    Finds one specific body device by given serial number
+    &#34;&#34;&#34;
+    return db.query(models.BodyDevice).filter(models.BodyDevice.serial_number == serial).first()
+
+
+def find_headdevice_by_serial(db: Session, serial: str):
+    &#34;&#34;&#34;
+    Finds one specific head device by given serial number
+    &#34;&#34;&#34;
+    return db.query(models.HeadDevice).filter(models.HeadDevice.serial_number == serial).first()
+
+
+def create_body_device(db: Session, log: schemas.BodyDeviceTemp):
     &#34;&#34;&#34;
     Creates new Body device
     &#34;&#34;&#34;
-    db_body = models.BodyDevice(serial_number=log.serial_number)
+    db_body = models.BodyDevice(serial_number=log.serial_number, inventory_number=&#34;&#34;, comment=&#34;&#34;)
     db.add(db_body)
     db.commit()
     db.refresh(db_body)
     return db_body
 
 
+def update_bodydevice_license(db: Session, device_id: int, lic_id: int):
+    &#34;&#34;&#34;
+    Updates body devices license with one given by user
+    &#34;&#34;&#34;
+    old_dev = get_body_device(db, device_id)
+    lic = get_license(db, lic_id)
+    new = {&#39;id&#39;: old_dev.id, &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: old_dev.inventory_number,
+           &#39;comment&#39;: old_dev.comment, &#39;team_id&#39;: old_dev.team_id, &#39;license_id&#39;: lic.id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_bodydevice_team(db: Session, device_id: int, team_id: int):
+    &#34;&#34;&#34;
+    Updates body devices team with one given by user
+    &#34;&#34;&#34;
+    old_dev = get_body_device(db, device_id)
+    team = get_team(db, team_id)
+    new = {&#39;id&#39;: old_dev.id, &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: old_dev.inventory_number,
+           &#39;comment&#39;: old_dev.comment, &#39;team_id&#39;: team.id, &#39;license_id&#39;: old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_bodydevice_inv(db: Session, device_id: int, dev_inv: str):
+    &#34;&#34;&#34;
+    Updates body devices inventory number with new one given by user
+    &#34;&#34;&#34;
+    old_dev = get_body_device(db, device_id)
+    new = {&#39;id&#39;: old_dev.id, &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: dev_inv,
+           &#39;comment&#39;: old_dev.comment, &#39;team_id&#39;: old_dev.team_id, &#39;license_id&#39;: old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_bodydevice_comm(db: Session, device_id: int, comm: str):
+    &#34;&#34;&#34;
+    Updates body devices comment with new one given by user
+    &#34;&#34;&#34;
+    old_dev = get_body_device(db, device_id)
+    new = {&#39;id&#39;: old_dev.id, &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: old_dev.inventory_number,
+           &#39;comment&#39;: comm, &#39;team_id&#39;: old_dev.team_id, &#39;license_id&#39;: old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_headdevice_license(db: Session, device_id: int, lic_id: int):
+    &#34;&#34;&#34;
+    Updates head devices license with one given by user
+    &#34;&#34;&#34;
+    old_dev = get_head_device(db, device_id)
+    lic = get_license(db, lic_id)
+    new = {&#39;id&#39;: old_dev.id, &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: old_dev.inventory_number,
+           &#39;comment&#39;: old_dev.comment, &#39;team_id&#39;: old_dev.team_id, &#39;license_id&#39;: lic.id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_headdevice_team(db: Session, device_id: int, team_id: int):
+    &#34;&#34;&#34;
+    Updates head devices team with one given by user
+    &#34;&#34;&#34;
+    old_dev = get_head_device(db, device_id)
+    team = get_team(db, team_id)
+    new = {&#39;id&#39;: old_dev.id, &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: old_dev.inventory_number,
+           &#39;comment&#39;: old_dev.comment, &#39;team_id&#39;: team.id, &#39;license_id&#39;: old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_headdevice_inv(db: Session, device_id: int, dev_inv: str):
+    &#34;&#34;&#34;
+    Updates head devices inventory number with new one given by user
+    &#34;&#34;&#34;
+    old_dev = get_head_device(db, device_id)
+    new = {&#39;id&#39;: old_dev.id, &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: dev_inv,
+           &#39;comment&#39;: old_dev.comment, &#39;team_id&#39;: old_dev.team_id, &#39;license_id&#39;: old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_headdevice_comm(db: Session, device_id: int, comm: str):
+    &#34;&#34;&#34;
+    Updates head devices comment with new one given by user
+    &#34;&#34;&#34;
+    old_dev = get_head_device(db, device_id)
+    new = {&#39;id&#39;: old_dev.id, &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: old_dev.inventory_number,
+           &#39;comment&#39;: comm, &#39;team_id&#39;: old_dev.team_id, &#39;license_id&#39;: old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
 def get_ld_logs(db: Session, skip: int = 0, limit: int = 100):
     &#34;&#34;&#34;
     Returns all ld debugger logs in database
     &#34;&#34;&#34;
-    return db.query(models.LDLog).offset(skip).limit(limit).all()
+    return db.query(models.LDLog).order_by(desc(models.LDLog.timestamp)).offset(skip).limit(limit).all()
 
 
 def create_ld_logs(db: Session, item: schemas.LDTempBase, head_id: int, body_id: int, pc_id: int, date: datetime):
@@ -337,43 +624,330 @@ def find_filtered_logs(db: Session, logs: []):
     return db.query(models.USBLog).filter(models.USBLog.id.in_(logs)).order_by(desc(models.USBLog.timestamp)).all()
 
 
+def find_filtered_ldlogs(db: Session, logs: []):
+    &#34;&#34;&#34;
+    Returns all ld logs with ids in given id array.
+    &#34;&#34;&#34;
+    return db.query(models.LDLog).filter(models.LDLog.id.in_(logs)).order_by(desc(models.LDLog.timestamp)).all()
+
+
+def get_filtered_ldlogs(db: Session, pc: str, tema: str, lic: str):
+    &#34;&#34;&#34;
+    Function creates query string used for filtering by pc username, team name and license name.
+    Depending on selected filters assembles query string for database
+    &#34;&#34;&#34;
+    execute_string = &#34;SELECT * FROM ld_logs AS logs WHERE&#34;
+    before_me = False
+    all_all = True
+    if pc != &#34;all&#34;:
+        all_all = False
+        pc = find_pc_by_username(db, pc)
+        if pc != None:
+            if before_me:
+                execute_string += &#34; AND logs.pc_id = &#34; + str(pc.id)
+            else:
+                before_me = True
+                execute_string += &#34; logs.pc_id = &#34; + str(pc.id)
+    if tema != &#34;all&#34;:
+        all_all = False
+        team = find_team(db, tema)
+        if team != None:
+            head_devices = find_headdevices_by_team(db, team.id)
+            body_devices = find_bodydevices_by_team(db, team.id)
+            if len(head_devices) &gt; 0 and len(body_devices) &gt; 0:
+                h_ids = &#34;(&#34;
+                for h in head_devices:
+                    h_ids += str(h.id) + &#34;, &#34;
+                def_h_ids = h_ids[:-2] + &#34;)&#34;
+                b_ids = &#34;(&#34;
+                for b in body_devices:
+                    b_ids += str(b.id) + &#34;, &#34;
+                def_b_ids = b_ids[:-2] + &#34;)&#34;
+                if before_me:
+                    execute_string += &#34; AND (logs.head_id IN &#34; + def_h_ids + &#34; OR logs.body_id IN &#34; + def_b_ids + &#34;)&#34;
+                else:
+                    before_me = True
+                    execute_string += &#34; (logs.head_id IN &#34; + def_h_ids + &#34; OR logs.body_id IN &#34; + def_b_ids + &#34;)&#34;
+            elif len(head_devices) == 0 and len(body_devices) &gt; 0:
+                b_ids = &#34;(&#34;
+                for b in body_devices:
+                    b_ids += str(b.id) + &#34;, &#34;
+                def_b_ids = b_ids[:-2] + &#34;)&#34;
+                if before_me:
+                    execute_string += &#34; AND logs.body_id IN &#34; + def_b_ids
+                else:
+                    before_me = True
+                    execute_string += &#34; logs.body_id IN &#34; + def_b_ids
+            elif len(head_devices) &gt; 0 and len(body_devices) == 0:
+                h_ids = &#34;(&#34;
+                for h in head_devices:
+                    h_ids += str(h.id) + &#34;, &#34;
+                def_h_ids = h_ids[:-2] + &#34;)&#34;
+                if before_me:
+                    execute_string += &#34; AND logs.head_id IN &#34; + def_h_ids
+                else:
+                    before_me = True
+                    execute_string += &#34; logs.head_id IN &#34; + def_h_ids
+            else:
+                if before_me:
+                    execute_string += &#34; AND (logs.head_id = -1 OR logs.body_id = -1)&#34;
+                else:
+                    before_me = True
+                    execute_string += &#34; (logs.head_id = -1 OR logs.body_id = -1)&#34;
+    if lic != &#34;all&#34;:
+        all_all = False
+        license = find_license(db, lic)
+        if license != None:
+            head_devices = find_headdevices_by_license(db, license.id)
+            body_devices = find_bodydevices_by_license(db, license.id)
+            if len(head_devices) &gt; 0 and len(body_devices) &gt; 0:
+                h_ids = &#34;(&#34;
+                for h in head_devices:
+                    h_ids += str(h.id) + &#34;, &#34;
+                def_h_ids = h_ids[:-2] + &#34;)&#34;
+                b_ids = &#34;(&#34;
+                for b in body_devices:
+                    b_ids += str(b.id) + &#34;, &#34;
+                def_b_ids = b_ids[:-2] + &#34;)&#34;
+                if before_me:
+                    execute_string += &#34; AND (logs.head_id IN &#34; + def_h_ids + &#34; OR logs.body_id IN &#34; + def_b_ids + &#34;)&#34;
+                else:
+                    before_me = True
+                    execute_string += &#34; (logs.head_id IN &#34; + def_h_ids + &#34; OR logs.body_id IN &#34; + def_b_ids + &#34;)&#34;
+            elif len(head_devices) == 0 and len(body_devices) &gt; 0:
+                b_ids = &#34;(&#34;
+                for b in body_devices:
+                    b_ids += str(b.id) + &#34;, &#34;
+                def_b_ids = b_ids[:-2] + &#34;)&#34;
+                if before_me:
+                    execute_string += &#34; AND logs.body_id IN &#34; + def_b_ids
+                else:
+                    before_me = True
+                    execute_string += &#34; logs.body_id IN &#34; + def_b_ids
+            elif len(head_devices) &gt; 0 and len(body_devices) == 0:
+                h_ids = &#34;(&#34;
+                for h in head_devices:
+                    h_ids += str(h.id) + &#34;, &#34;
+                def_h_ids = h_ids[:-2] + &#34;)&#34;
+                if before_me:
+                    execute_string += &#34; AND logs.head_id IN &#34; + def_h_ids
+                else:
+                    before_me = True
+                    execute_string += &#34; logs.head_id IN &#34; + def_h_ids
+            else:
+                if before_me:
+                    execute_string += &#34; AND (logs.head_id = -1 OR logs.body_id = -1)&#34;
+                else:
+                    before_me = True
+                    execute_string += &#34; (logs.head_id = -1 OR logs.body_id = -1)&#34;
+    if all_all:
+        before_me = True
+        execute_string = &#34;SELECT * FROM ld_logs AS logs&#34;
+
+    if not before_me:
+        execute_string = &#34;SELECT * FROM ld_logs AS logs WHERE logs.id = -1&#34;
+    result = db.execute(execute_string)
+    return result
+
+
 def get_filtered_logs(db: Session, pc: str, tema: str, lic: str):
     &#34;&#34;&#34;
     Function creates query string used for filtering by pc username, team name and license name.
     Depending on selected filters assembles query string for database
     &#34;&#34;&#34;
     execute_string = &#34;SELECT * FROM usb_logs AS logs&#34;
+    pcs = find_pc_by_username(db, pc)
     if pc != &#34;all&#34;:
-        pcs = find_pc_by_username(db, pc)
-        execute_string += &#34;  WHERE logs.pc_id = &#34; + str(pcs.id)
+        if pcs is not None:
+            execute_string += &#34;  WHERE logs.pc_id = &#34; + str(pcs.id)
     if tema != &#34;all&#34;:
         team = find_team(db, tema)
-        pcs = get_pcs_by_team(db, team.id)
-        pc_ids = &#34;(&#34;
-        for p in pcs:
-            pc_ids += str(p.id) + &#34;, &#34;
-        def_pc_ids = pc_ids[:-2] + &#34;)&#34;
-        if pc != &#34;all&#34;:
-            execute_string += &#34; AND logs.pc_id IN &#34; + def_pc_ids
-        else:
-            execute_string += &#34; WHERE logs.pc_id IN &#34; + def_pc_ids
+        if team is not None:
+            devs = get_devices_by_team(db, team.id)
+            d_ids = &#34;(&#34;
+            for p in devs:
+                d_ids += str(p.id) + &#34;, &#34;
+            def_d_ids = d_ids[:-2] + &#34;)&#34;
+            if pc != &#34;all&#34; and pcs is not None:
+                if len(def_d_ids) &gt; 1:
+                    execute_string += &#34; AND logs.device_id IN &#34; + def_d_ids
+            else:
+                if len(def_d_ids) &gt; 1:
+                    execute_string += &#34; WHERE logs.device_id IN &#34; + def_d_ids
     if lic != &#34;all&#34;:
-        license = find_license(db, lic)
-        device_licenses = get_license_devices(db, license.id)
-        dev_ids = &#34;(&#34;
-        for dev in device_licenses:
-            dev_ids += str(dev.device_id) + &#34;, &#34;
-        defin_ids = dev_ids[:-2] + &#34;)&#34;
-        if pc != &#34;all&#34; or tema != &#34;all&#34;:
-            execute_string += &#34; AND logs.device_id IN &#34; + defin_ids
-        else:
-            execute_string += &#34; WHERE logs.device_id IN &#34; + defin_ids
+        license = get_licenses_by_name(db, lic)
+        if license is not None:
+            device_licenses = get_license_devices(db, license.id)
+            dev_ids = &#34;(&#34;
+            for dev in device_licenses:
+                dev_ids += str(dev.device_id) + &#34;, &#34;
+            defin_ids = dev_ids[:-2] + &#34;)&#34;
+            if pc != &#34;all&#34; or tema != &#34;all&#34;:
+                if len(defin_ids) &gt; 1:
+                    execute_string += &#34; AND logs.device_id IN &#34; + defin_ids
+            else:
+                if len(defin_ids) &gt; 1:
+                    execute_string += &#34; WHERE logs.device_id IN &#34; + defin_ids
 
     # executing assembled query string
     result = db.execute(execute_string)
     return result
 
 
+def get_filtered_bodydevices(db: Session, body_id: str, license_id: str, team: str):
+    &#34;&#34;&#34;
+    returns filtered body devices based on given attributes
+    &#34;&#34;&#34;
+    execute_string = &#34;SELECT * FROM body_devices AS device WHERE&#34;
+    before_me = False
+    all_all = True
+    if body_id != &#34;all&#34;:
+        all_all = False
+        body_dev = find_bodydevice_by_serial(db, body_id)
+        if body_dev != None:
+            if before_me:
+                execute_string += &#34; AND device.id = &#34; + str(body_dev.id)
+            else:
+                before_me = True
+                execute_string += &#34; device.id = &#34; + str(body_dev.id)
+    if license_id != &#34;all&#34;:
+        all_all = False
+        license = find_license(db, license_id)
+        if license != None:
+            if before_me:
+                execute_string += &#34; AND device.license_id = &#34; + str(license.id)
+            else:
+                before_me = True
+                execute_string += &#34; device.license_id = &#34; + str(license.id)
+    if team != &#34;all&#34;:
+        all_all = False
+        tem = find_team(db, team)
+        if tem != None:
+            if before_me:
+                execute_string += &#34; AND device.team_id = &#34; + str(tem.id)
+            else:
+                before_me = True
+                execute_string += &#34; device.team_id = &#34; + str(tem.id)
+    if all_all:
+        before_me = True
+        execute_string = &#34;SELECT * FROM body_devices AS devices&#34;
+
+    if not before_me:
+        execute_string = &#34;SELECT * FROM body_devices AS devices WHERE devices.id = -1&#34;
+    result = db.execute(execute_string)
+    return result
+
+
+def get_filtered_headdevices(db: Session, body_id: str, license_id: str, team: str):
+    &#34;&#34;&#34;
+    returns filtered head devices based on given attributes
+    &#34;&#34;&#34;
+    execute_string = &#34;SELECT * FROM head_devices AS device WHERE&#34;
+    before_me = False
+    all_all = True
+    if body_id != &#34;all&#34;:
+        all_all = False
+        head_dev = find_headdevice_by_serial(db, body_id)
+        if head_dev != None:
+            if before_me:
+                execute_string += &#34; AND device.id = &#34; + str(head_dev.id)
+            else:
+                before_me = True
+                execute_string += &#34; device.id = &#34; + str(head_dev.id)
+    if license_id != &#34;all&#34;:
+        all_all = False
+        license = find_license(db, license_id)
+        if license != None:
+            if before_me:
+                execute_string += &#34; AND device.license_id = &#34; + str(license.id)
+            else:
+                before_me = True
+                execute_string += &#34; device.license_id = &#34; + str(license.id)
+    if team != &#34;all&#34;:
+        all_all = False
+        tem = find_team(db, team)
+        if tem != None:
+            if before_me:
+                execute_string += &#34; AND device.team_id = &#34; + str(tem.id)
+            else:
+                before_me = True
+                execute_string += &#34; device.team_id = &#34; + str(tem.id)
+    if all_all:
+        before_me = True
+        execute_string = &#34;SELECT * FROM body_devices AS devices&#34;
+
+    if not before_me:
+        execute_string = &#34;SELECT * FROM body_devices AS devices WHERE devices.id = -1&#34;
+    result = db.execute(execute_string)
+    return result
+
+
+def get_filtered_devices(db: Session, keyman_id: str, license_name: str, license_id: str, team: str):
+    &#34;&#34;&#34;
+    returns filtered keyman devices based on given attributes
+    &#34;&#34;&#34;
+    execute_string = &#34;SELECT * FROM devices AS device WHERE&#34;
+    before_me = False
+    all_all = True
+    if keyman_id != &#34;all&#34;:
+        all_all = False
+        keyman_dev = find_device_by_serial(db, keyman_id)
+        if keyman_dev != None:
+            if before_me:
+                execute_string += &#34; AND device.id = &#34; + str(keyman_dev.id)
+            else:
+                before_me = True
+                execute_string += &#34; device.id = &#34; + str(keyman_dev.id)
+    if license_name != &#34;all&#34;:
+        all_all = False
+        license = get_licenses_by_name(db, license_name)
+        if len(license) &gt; 0:
+            lic_ids = []
+            for l in license:
+                lic_ids.append(l.id)
+            dev_lics = find_devicelicenses_by_licid_array(db, lic_ids)
+            lic_ids = &#34;(&#34;
+            for l in dev_lics:
+                lic_ids += str(l.device_id) + &#34;, &#34;
+            def_lic_ids = lic_ids[:-2] + &#34;)&#34;
+            if before_me:
+                execute_string += &#34; AND device.id IN &#34; + def_lic_ids
+            else:
+                before_me = True
+                execute_string += &#34; device.id IN &#34; + def_lic_ids
+    if license_id != &#34;all&#34;:
+        all_all = False
+        license = find_license(db, license_id)
+        licen_devs = get_license_devices(db, license.id)
+        ids = &#34;(&#34;
+        for lic in licen_devs:
+            ids += str(lic.device_id) + &#34;, &#34;
+        def_ids = ids[:-2] + &#34;)&#34;
+        if license != None:
+            if before_me:
+                execute_string += &#34; AND device.id IN &#34; + def_ids
+            else:
+                before_me = True
+                execute_string += &#34; device.id IN &#34; + def_ids
+    if team != &#34;all&#34;:
+        all_all = False
+        tem = find_team(db, team)
+        if tem != None:
+            if before_me:
+                execute_string += &#34; AND device.team_id = &#34; + str(tem.id)
+            else:
+                before_me = True
+                execute_string += &#34; device.team_id = &#34; + str(tem.id)
+    if all_all:
+        before_me = True
+        execute_string = &#34;SELECT * FROM devices AS devices&#34;
+
+    if not before_me:
+        execute_string = &#34;SELECT * FROM devices AS devices WHERE devices.id = -1&#34;
+    result = db.execute(execute_string)
+    return result
+
+
 def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_id: int, date: datetime):
     &#34;&#34;&#34;
     Creates new USB log for usb_logs database table
@@ -382,7 +956,39 @@ def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_i
     db.add(db_log)
     db.commit()
     db.refresh(db_log)
-    return db_log</code></pre>
+    return db_log
+
+
+def get_users(db: Session, skip: int = 0, limit: int = 100):
+    &#34;&#34;&#34;
+    Returns all users saved in database
+    &#34;&#34;&#34;
+    return db.query(models.User).offset(skip).limit(limit).all()
+
+
+def find_user(db: Session, name: str):
+    &#34;&#34;&#34;
+    Finds one user by given username
+    &#34;&#34;&#34;
+    return db.query(models.User).filter(models.User.username == name).first()
+
+
+def find_user_byid(db: Session, id: int):
+    &#34;&#34;&#34;
+    Finds one user by given id
+    &#34;&#34;&#34;
+    return db.query(models.User).filter(models.User.id == id).first()
+
+
+def create_user(db: Session, name: str, passw: str, rol: str):
+    &#34;&#34;&#34;
+    Creates new user
+    &#34;&#34;&#34;
+    db_user = models.User(username=name, password=passw, role=rol)
+    db.add(db_user)
+    db.commit()
+    db.refresh(db_user)
+    return db_user</code></pre>
 </details>
 </section>
 <section>
@@ -392,8 +998,52 @@ def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_i
 <section>
 <h2 class="section-title" id="header-functions">Functions</h2>
 <dl>
+<dt id="sql_app.crud.change_role"><code class="name flex">
+<span>def <span class="ident">change_role</span></span>(<span>db: sqlalchemy.orm.session.Session, usr_id: int, role: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Updates team of one specific pc</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def change_role(db: Session, usr_id: int, role: str):
+    &#34;&#34;&#34;
+    Updates team of one specific pc
+    &#34;&#34;&#34;
+    old_usr = find_user_byid(db, usr_id)
+    new = {&#39;id&#39;: old_usr.id, &#39;username&#39;: old_usr.username, &#39;password&#39;: old_usr.password, &#39;role&#39;: role}
+    for key, value in new.items():
+        setattr(old_usr, key, value)
+    db.commit()
+    db.refresh(old_usr)
+    return old_usr</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.change_team"><code class="name flex">
+<span>def <span class="ident">change_team</span></span>(<span>db: sqlalchemy.orm.session.Session, team_id: int, name: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Updates name of one specific team</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def change_team(db: Session, team_id: int, name: str):
+    &#34;&#34;&#34;
+    Updates name of one specific team
+    &#34;&#34;&#34;
+    old_team = get_team(db, team_id)
+    new = {&#39;id&#39;: old_team.id, &#39;name&#39;: name}
+    for key, value in new.items():
+        setattr(old_team, key, value)
+    db.commit()
+    db.refresh(old_team)
+    return old_team</code></pre>
+</details>
+</dd>
 <dt id="sql_app.crud.create_body_device"><code class="name flex">
-<span>def <span class="ident">create_body_device</span></span>(<span>db: sqlalchemy.orm.session.Session, log: <a title="sql_app.schemas.BodyDeviceBase" href="schemas.html#sql_app.schemas.BodyDeviceBase">BodyDeviceBase</a>)</span>
+<span>def <span class="ident">create_body_device</span></span>(<span>db: sqlalchemy.orm.session.Session, log: <a title="sql_app.schemas.BodyDeviceTemp" href="schemas.html#sql_app.schemas.BodyDeviceTemp">BodyDeviceTemp</a>)</span>
 </code></dt>
 <dd>
 <div class="desc"><p>Creates new Body device</p></div>
@@ -401,11 +1051,11 @@ def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_i
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">def create_body_device(db: Session, log: schemas.BodyDeviceBase):
+<pre><code class="python">def create_body_device(db: Session, log: schemas.BodyDeviceTemp):
     &#34;&#34;&#34;
     Creates new Body device
     &#34;&#34;&#34;
-    db_body = models.BodyDevice(serial_number=log.serial_number)
+    db_body = models.BodyDevice(serial_number=log.serial_number, inventory_number=&#34;&#34;, comment=&#34;&#34;)
     db.add(db_body)
     db.commit()
     db.refresh(db_body)
@@ -413,7 +1063,7 @@ def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_i
 </details>
 </dd>
 <dt id="sql_app.crud.create_device"><code class="name flex">
-<span>def <span class="ident">create_device</span></span>(<span>db: sqlalchemy.orm.session.Session, device: <a title="sql_app.schemas.DeviceBase" href="schemas.html#sql_app.schemas.DeviceBase">DeviceBase</a>)</span>
+<span>def <span class="ident">create_device</span></span>(<span>db: sqlalchemy.orm.session.Session, device: <a title="sql_app.schemas.DeviceTemp" href="schemas.html#sql_app.schemas.DeviceTemp">DeviceTemp</a>)</span>
 </code></dt>
 <dd>
 <div class="desc"><p>creates new device with data from given DeviceBase object</p></div>
@@ -421,12 +1071,12 @@ def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_i
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">def create_device(db: Session, device: schemas.DeviceBase):
+<pre><code class="python">def create_device(db: Session, device: schemas.DeviceTemp):
     &#34;&#34;&#34;
     creates new device with data from given DeviceBase object
     &#34;&#34;&#34;
     db_device = models.Device(vendor_id=device.vendor_id, product_id=device.product_id,
-                              serial_number=device.serial_number, assigned=False)
+                              serial_number=device.serial_number, inventory_number=&#34;&#34;, comment=&#34;&#34;)
     db.add(db_device)
     db.commit()
     db.refresh(db_device)
@@ -475,7 +1125,7 @@ def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_i
 </details>
 </dd>
 <dt id="sql_app.crud.create_head_device"><code class="name flex">
-<span>def <span class="ident">create_head_device</span></span>(<span>db: sqlalchemy.orm.session.Session, log: <a title="sql_app.schemas.HeadDeviceBase" href="schemas.html#sql_app.schemas.HeadDeviceBase">HeadDeviceBase</a>)</span>
+<span>def <span class="ident">create_head_device</span></span>(<span>db: sqlalchemy.orm.session.Session, log: <a title="sql_app.schemas.HeadDeviceTemp" href="schemas.html#sql_app.schemas.HeadDeviceTemp">HeadDeviceTemp</a>)</span>
 </code></dt>
 <dd>
 <div class="desc"><p>Creates new head device</p></div>
@@ -483,7 +1133,7 @@ def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_i
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">def create_head_device(db: Session, log: schemas.HeadDeviceBase):
+<pre><code class="python">def create_head_device(db: Session, log: schemas.HeadDeviceTemp):
     &#34;&#34;&#34;
     Creates new head device
     &#34;&#34;&#34;
@@ -515,7 +1165,7 @@ def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_i
 </details>
 </dd>
 <dt id="sql_app.crud.create_license"><code class="name flex">
-<span>def <span class="ident">create_license</span></span>(<span>db: sqlalchemy.orm.session.Session, name: str, expdate: datetime.date)</span>
+<span>def <span class="ident">create_license</span></span>(<span>db: sqlalchemy.orm.session.Session, name: str, lic_id: str, expdate: datetime.date)</span>
 </code></dt>
 <dd>
 <div class="desc"><p>creates new license with given name and expiration date</p></div>
@@ -523,11 +1173,11 @@ def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_i
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">def create_license(db: Session, name: str, expdate: date):
+<pre><code class="python">def create_license(db: Session, name: str, lic_id: str, expdate: date):
     &#34;&#34;&#34;
     creates new license with given name and expiration date
     &#34;&#34;&#34;
-    db_license = models.License(name=name, expiration_date=expdate)
+    db_license = models.License(name=name, license_id=lic_id, expiration_date=expdate)
     db.add(db_license)
     db.commit()
     db.refresh(db_license)
@@ -547,7 +1197,7 @@ def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_i
     &#34;&#34;&#34;
     creates new pc with given username and hostname
     &#34;&#34;&#34;
-    db_pc = models.PC(username=user, hostname=host, assigned=False)
+    db_pc = models.PC(username=user, hostname=host)
     db.add(db_pc)
     db.commit()
     db.refresh(db_pc)
@@ -574,133 +1224,315 @@ def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_i
     return db_team</code></pre>
 </details>
 </dd>
-<dt id="sql_app.crud.find_body_device"><code class="name flex">
-<span>def <span class="ident">find_body_device</span></span>(<span>db: sqlalchemy.orm.session.Session, serial: <a title="sql_app.schemas.BodyDeviceBase" href="schemas.html#sql_app.schemas.BodyDeviceBase">BodyDeviceBase</a>)</span>
+<dt id="sql_app.crud.create_user"><code class="name flex">
+<span>def <span class="ident">create_user</span></span>(<span>db: sqlalchemy.orm.session.Session, name: str, passw: str, rol: str)</span>
 </code></dt>
 <dd>
-<div class="desc"><p>Finds one body device by its serial number</p></div>
+<div class="desc"><p>Creates new user</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">def find_body_device(db: Session, serial: schemas.BodyDeviceBase):
+<pre><code class="python">def create_user(db: Session, name: str, passw: str, rol: str):
     &#34;&#34;&#34;
-    Finds one body device by its serial number
+    Creates new user
     &#34;&#34;&#34;
-    return db.query(models.BodyDevice).filter(models.BodyDevice.serial_number == serial.serial_number).first()</code></pre>
+    db_user = models.User(username=name, password=passw, role=rol)
+    db.add(db_user)
+    db.commit()
+    db.refresh(db_user)
+    return db_user</code></pre>
 </details>
 </dd>
-<dt id="sql_app.crud.find_device"><code class="name flex">
-<span>def <span class="ident">find_device</span></span>(<span>db: sqlalchemy.orm.session.Session, device: <a title="sql_app.schemas.DeviceBase" href="schemas.html#sql_app.schemas.DeviceBase">DeviceBase</a>)</span>
+<dt id="sql_app.crud.delete_device_license"><code class="name flex">
+<span>def <span class="ident">delete_device_license</span></span>(<span>db: sqlalchemy.orm.session.Session, device: int, license: int)</span>
 </code></dt>
 <dd>
-<div class="desc"><p>finds one device with product_id, vendor_id and serial_number same as in given DeviceBase object</p></div>
+<div class="desc"><p>deletes entry in devices_licenses table with device id, license id and time.</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">def find_device(db: Session, device: schemas.DeviceBase):
+<pre><code class="python">def delete_device_license(db: Session, device: int, license: int):
     &#34;&#34;&#34;
-    finds one device with product_id, vendor_id and serial_number same as in given DeviceBase object
+    deletes entry in devices_licenses table with device id, license id and time.
     &#34;&#34;&#34;
-    return db.query(models.Device).filter(and_(models.Device.product_id == device.product_id,
-                                               models.Device.vendor_id == device.vendor_id,
-                                               models.Device.serial_number == device.serial_number)).first()</code></pre>
+    db_device_license = get_devicelicense_by_devicelicense(db, device, license)
+    db_lic = db.delete(db_device_license)
+    db.commit()
+    return db_lic</code></pre>
 </details>
 </dd>
-<dt id="sql_app.crud.find_filtered_logs"><code class="name flex">
-<span>def <span class="ident">find_filtered_logs</span></span>(<span>db: sqlalchemy.orm.session.Session, logs: [])</span>
+<dt id="sql_app.crud.find_body_device"><code class="name flex">
+<span>def <span class="ident">find_body_device</span></span>(<span>db: sqlalchemy.orm.session.Session, serial: <a title="sql_app.schemas.BodyDeviceTemp" href="schemas.html#sql_app.schemas.BodyDeviceTemp">BodyDeviceTemp</a>)</span>
 </code></dt>
 <dd>
-<div class="desc"><p>Returns all usb logs with ids in given id array.</p></div>
+<div class="desc"><p>Finds one body device by its serial number</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">def find_filtered_logs(db: Session, logs: []):
+<pre><code class="python">def find_body_device(db: Session, serial: schemas.BodyDeviceTemp):
     &#34;&#34;&#34;
-    Returns all usb logs with ids in given id array.
+    Finds one body device by its serial number
     &#34;&#34;&#34;
-    return db.query(models.USBLog).filter(models.USBLog.id.in_(logs)).order_by(desc(models.USBLog.timestamp)).all()</code></pre>
+    return db.query(models.BodyDevice).filter(models.BodyDevice.serial_number == serial.serial_number).first()</code></pre>
 </details>
 </dd>
-<dt id="sql_app.crud.find_head_device"><code class="name flex">
-<span>def <span class="ident">find_head_device</span></span>(<span>db: sqlalchemy.orm.session.Session, serial: <a title="sql_app.schemas.HeadDeviceBase" href="schemas.html#sql_app.schemas.HeadDeviceBase">HeadDeviceBase</a>)</span>
+<dt id="sql_app.crud.find_bodydevice_by_serial"><code class="name flex">
+<span>def <span class="ident">find_bodydevice_by_serial</span></span>(<span>db: sqlalchemy.orm.session.Session, serial: str)</span>
 </code></dt>
 <dd>
-<div class="desc"><p>Finds one head device by its serial number</p></div>
+<div class="desc"><p>Finds one specific body device by given serial number</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">def find_head_device(db: Session, serial: schemas.HeadDeviceBase):
+<pre><code class="python">def find_bodydevice_by_serial(db: Session, serial: str):
     &#34;&#34;&#34;
-    Finds one head device by its serial number
+    Finds one specific body device by given serial number
     &#34;&#34;&#34;
-    return db.query(models.HeadDevice).filter(models.HeadDevice.serial_number == serial.serial_number).first()</code></pre>
+    return db.query(models.BodyDevice).filter(models.BodyDevice.serial_number == serial).first()</code></pre>
 </details>
 </dd>
-<dt id="sql_app.crud.find_license"><code class="name flex">
-<span>def <span class="ident">find_license</span></span>(<span>db: sqlalchemy.orm.session.Session, name: str)</span>
+<dt id="sql_app.crud.find_bodydevices_by_license"><code class="name flex">
+<span>def <span class="ident">find_bodydevices_by_license</span></span>(<span>db: sqlalchemy.orm.session.Session, lic_id: int)</span>
 </code></dt>
 <dd>
-<div class="desc"><p>finds one license by given string name</p></div>
+<div class="desc"><p>Returns all body devices with specific license</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">def find_license(db: Session, name: str):
+<pre><code class="python">def find_bodydevices_by_license(db: Session, lic_id: int):
     &#34;&#34;&#34;
-    finds one license by given string name
+    Returns all body devices with specific license
     &#34;&#34;&#34;
-    return db.query(models.License).filter(models.License.name == name).first()</code></pre>
+    return db.query(models.BodyDevice).filter(models.BodyDevice.license_id == lic_id).all()</code></pre>
 </details>
 </dd>
-<dt id="sql_app.crud.find_pc"><code class="name flex">
-<span>def <span class="ident">find_pc</span></span>(<span>db: sqlalchemy.orm.session.Session, username: str, hostname: str)</span>
+<dt id="sql_app.crud.find_bodydevices_by_team"><code class="name flex">
+<span>def <span class="ident">find_bodydevices_by_team</span></span>(<span>db: sqlalchemy.orm.session.Session, team_id: int)</span>
 </code></dt>
 <dd>
-<div class="desc"><p>Finds one pc with given username and hostname</p></div>
+<div class="desc"><p>Returns all body devices in specific team</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">def find_pc(db: Session, username: str, hostname: str):
+<pre><code class="python">def find_bodydevices_by_team(db: Session, team_id: int):
     &#34;&#34;&#34;
-    Finds one pc with given username and hostname
+    Returns all body devices in specific team
     &#34;&#34;&#34;
-    return db.query(models.PC).filter(and_(models.PC.username == username,
-                                           models.PC.hostname == hostname)).first()</code></pre>
+    return db.query(models.BodyDevice).filter(models.BodyDevice.team_id == team_id).all()</code></pre>
 </details>
 </dd>
-<dt id="sql_app.crud.find_pc_by_name"><code class="name flex">
-<span>def <span class="ident">find_pc_by_name</span></span>(<span>db: sqlalchemy.orm.session.Session, username: str)</span>
+<dt id="sql_app.crud.find_device"><code class="name flex">
+<span>def <span class="ident">find_device</span></span>(<span>db: sqlalchemy.orm.session.Session, device: <a title="sql_app.schemas.DeviceTemp" href="schemas.html#sql_app.schemas.DeviceTemp">DeviceTemp</a>)</span>
 </code></dt>
 <dd>
-<div class="desc"><p>Finds one pc by its username</p></div>
+<div class="desc"><p>finds one device with
+serial_number same as in given DeviceBase object</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">def find_pc_by_name(db: Session, username: str):
+<pre><code class="python">def find_device(db: Session, device: schemas.DeviceTemp):
     &#34;&#34;&#34;
-    Finds one pc by its username
+    finds one device with  serial_number same as in given DeviceBase object
     &#34;&#34;&#34;
-    return db.query(models.PC).filter(models.PC.username == username).first()</code></pre>
+    return db.query(models.Device).filter(and_(models.Device.serial_number == device.serial_number)).first()</code></pre>
 </details>
 </dd>
-<dt id="sql_app.crud.find_pc_by_name_all"><code class="name flex">
-<span>def <span class="ident">find_pc_by_name_all</span></span>(<span>db: sqlalchemy.orm.session.Session, username: str)</span>
+<dt id="sql_app.crud.find_device_by_serial"><code class="name flex">
+<span>def <span class="ident">find_device_by_serial</span></span>(<span>db: sqlalchemy.orm.session.Session, ser: str)</span>
 </code></dt>
 <dd>
-<div class="desc"><p>Finds all pcs with same username</p></div>
+<div class="desc"><p>finds one device with serial_number same as in given DeviceBase object</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">def find_pc_by_name_all(db: Session, username: str):
+<pre><code class="python">def find_device_by_serial(db: Session, ser: str):
     &#34;&#34;&#34;
-    Finds all pcs with same username
+    finds one device with serial_number same as in given DeviceBase object
+    &#34;&#34;&#34;
+    return db.query(models.Device).filter(and_(models.Device.serial_number == ser)).first()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.find_devicelicenses_by_licid_array"><code class="name flex">
+<span>def <span class="ident">find_devicelicenses_by_licid_array</span></span>(<span>db: sqlalchemy.orm.session.Session, lcs: [])</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Finds all device_licenses with license_id in given id array</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def find_devicelicenses_by_licid_array(db: Session, lcs: []):
+    &#34;&#34;&#34;
+    Finds all device_licenses with license_id in given id array
+    &#34;&#34;&#34;
+    return db.query(models.DeviceLicense).filter(models.DeviceLicense.license_id.in_(lcs)).all()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.find_filtered_ldlogs"><code class="name flex">
+<span>def <span class="ident">find_filtered_ldlogs</span></span>(<span>db: sqlalchemy.orm.session.Session, logs: [])</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Returns all ld logs with ids in given id array.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def find_filtered_ldlogs(db: Session, logs: []):
+    &#34;&#34;&#34;
+    Returns all ld logs with ids in given id array.
+    &#34;&#34;&#34;
+    return db.query(models.LDLog).filter(models.LDLog.id.in_(logs)).order_by(desc(models.LDLog.timestamp)).all()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.find_filtered_logs"><code class="name flex">
+<span>def <span class="ident">find_filtered_logs</span></span>(<span>db: sqlalchemy.orm.session.Session, logs: [])</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Returns all usb logs with ids in given id array.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def find_filtered_logs(db: Session, logs: []):
+    &#34;&#34;&#34;
+    Returns all usb logs with ids in given id array.
+    &#34;&#34;&#34;
+    return db.query(models.USBLog).filter(models.USBLog.id.in_(logs)).order_by(desc(models.USBLog.timestamp)).all()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.find_head_device"><code class="name flex">
+<span>def <span class="ident">find_head_device</span></span>(<span>db: sqlalchemy.orm.session.Session, serial: <a title="sql_app.schemas.HeadDeviceTemp" href="schemas.html#sql_app.schemas.HeadDeviceTemp">HeadDeviceTemp</a>)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Finds one head device by its serial number</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def find_head_device(db: Session, serial: schemas.HeadDeviceTemp):
+    &#34;&#34;&#34;
+    Finds one head device by its serial number
+    &#34;&#34;&#34;
+    return db.query(models.HeadDevice).filter(models.HeadDevice.serial_number == serial.serial_number).first()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.find_headdevice_by_serial"><code class="name flex">
+<span>def <span class="ident">find_headdevice_by_serial</span></span>(<span>db: sqlalchemy.orm.session.Session, serial: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Finds one specific head device by given serial number</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def find_headdevice_by_serial(db: Session, serial: str):
+    &#34;&#34;&#34;
+    Finds one specific head device by given serial number
+    &#34;&#34;&#34;
+    return db.query(models.HeadDevice).filter(models.HeadDevice.serial_number == serial).first()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.find_headdevices_by_license"><code class="name flex">
+<span>def <span class="ident">find_headdevices_by_license</span></span>(<span>db: sqlalchemy.orm.session.Session, lic_id: int)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Returns all head devices with specific license</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def find_headdevices_by_license(db: Session, lic_id: int):
+    &#34;&#34;&#34;
+    Returns all head devices with specific license
+    &#34;&#34;&#34;
+    return db.query(models.HeadDevice).filter(models.HeadDevice.license_id == lic_id).all()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.find_headdevices_by_team"><code class="name flex">
+<span>def <span class="ident">find_headdevices_by_team</span></span>(<span>db: sqlalchemy.orm.session.Session, team_id: int)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Returns all head devices in specific team</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def find_headdevices_by_team(db: Session, team_id: int):
+    &#34;&#34;&#34;
+    Returns all head devices in specific team
+    &#34;&#34;&#34;
+    return db.query(models.HeadDevice).filter(models.HeadDevice.team_id == team_id).all()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.find_license"><code class="name flex">
+<span>def <span class="ident">find_license</span></span>(<span>db: sqlalchemy.orm.session.Session, name: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>finds one license by given string name</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def find_license(db: Session, name: str):
+    &#34;&#34;&#34;
+    finds one license by given string name
+    &#34;&#34;&#34;
+    return db.query(models.License).filter(models.License.license_id == name).first()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.find_pc"><code class="name flex">
+<span>def <span class="ident">find_pc</span></span>(<span>db: sqlalchemy.orm.session.Session, username: str, hostname: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Finds one pc with given username and hostname</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def find_pc(db: Session, username: str, hostname: str):
+    &#34;&#34;&#34;
+    Finds one pc with given username and hostname
+    &#34;&#34;&#34;
+    return db.query(models.PC).filter(and_(models.PC.username == username,
+                                           models.PC.hostname == hostname)).first()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.find_pc_by_name"><code class="name flex">
+<span>def <span class="ident">find_pc_by_name</span></span>(<span>db: sqlalchemy.orm.session.Session, username: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Finds one pc by its username</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def find_pc_by_name(db: Session, username: str):
+    &#34;&#34;&#34;
+    Finds one pc by its username
+    &#34;&#34;&#34;
+    return db.query(models.PC).filter(models.PC.username == username).first()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.find_pc_by_name_all"><code class="name flex">
+<span>def <span class="ident">find_pc_by_name_all</span></span>(<span>db: sqlalchemy.orm.session.Session, username: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Finds all pcs with same username</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def find_pc_by_name_all(db: Session, username: str):
+    &#34;&#34;&#34;
+    Finds all pcs with same username
     &#34;&#34;&#34;
     return db.query(models.PC).filter(models.PC.username == username).offset(0).limit(100).all()</code></pre>
 </details>
@@ -753,6 +1585,38 @@ def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_i
     return db.query(models.Team).filter(models.Team.name == name).first()</code></pre>
 </details>
 </dd>
+<dt id="sql_app.crud.find_user"><code class="name flex">
+<span>def <span class="ident">find_user</span></span>(<span>db: sqlalchemy.orm.session.Session, name: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Finds one user by given username</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def find_user(db: Session, name: str):
+    &#34;&#34;&#34;
+    Finds one user by given username
+    &#34;&#34;&#34;
+    return db.query(models.User).filter(models.User.username == name).first()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.find_user_byid"><code class="name flex">
+<span>def <span class="ident">find_user_byid</span></span>(<span>db: sqlalchemy.orm.session.Session, id: int)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Finds one user by given id</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def find_user_byid(db: Session, id: int):
+    &#34;&#34;&#34;
+    Finds one user by given id
+    &#34;&#34;&#34;
+    return db.query(models.User).filter(models.User.id == id).first()</code></pre>
+</details>
+</dd>
 <dt id="sql_app.crud.get_body_device"><code class="name flex">
 <span>def <span class="ident">get_body_device</span></span>(<span>db: sqlalchemy.orm.session.Session, body_id: int)</span>
 </code></dt>
@@ -785,6 +1649,22 @@ def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_i
     return db.query(models.BodyDevice).offset(skip).limit(limit).all()</code></pre>
 </details>
 </dd>
+<dt id="sql_app.crud.get_bodydevices_with_ids"><code class="name flex">
+<span>def <span class="ident">get_bodydevices_with_ids</span></span>(<span>db: sqlalchemy.orm.session.Session, ids: [])</span>
+</code></dt>
+<dd>
+<div class="desc"><p>returns all bodydevices with given ids</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_bodydevices_with_ids(db: Session, ids: []):
+    &#34;&#34;&#34;
+    returns all bodydevices with given ids
+    &#34;&#34;&#34;
+    return db.query(models.BodyDevice).filter(models.BodyDevice.id.in_(ids)).all()</code></pre>
+</details>
+</dd>
 <dt id="sql_app.crud.get_device"><code class="name flex">
 <span>def <span class="ident">get_device</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int)</span>
 </code></dt>
@@ -801,6 +1681,39 @@ def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_i
     return db.query(models.Device).filter(models.Device.id == device_id).first()</code></pre>
 </details>
 </dd>
+<dt id="sql_app.crud.get_device_licenses"><code class="name flex">
+<span>def <span class="ident">get_device_licenses</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>returns all entries in devices_licenses table with given device_id</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_device_licenses(db: Session, device_id: int):
+    &#34;&#34;&#34;
+    returns all entries in devices_licenses table with given device_id
+    &#34;&#34;&#34;
+    return db.query(models.DeviceLicense).filter(models.DeviceLicense.device_id == device_id).all()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.get_devicelicense_by_devicelicense"><code class="name flex">
+<span>def <span class="ident">get_devicelicense_by_devicelicense</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, license_id: int)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>returns entry in devices_licenses table with given device id and license id</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_devicelicense_by_devicelicense(db: Session, device_id: int, license_id: int):
+    &#34;&#34;&#34;
+    returns entry in devices_licenses table with given device id and license id
+    &#34;&#34;&#34;
+    return db.query(models.DeviceLicense).filter(and_(models.DeviceLicense.device_id == device_id,
+                                                      models.DeviceLicense.license_id == license_id)).first()</code></pre>
+</details>
+</dd>
 <dt id="sql_app.crud.get_devices"><code class="name flex">
 <span>def <span class="ident">get_devices</span></span>(<span>db: sqlalchemy.orm.session.Session, skip: int = 0, limit: int = 100)</span>
 </code></dt>
@@ -817,6 +1730,348 @@ def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_i
     return db.query(models.Device).offset(skip).limit(limit).all()</code></pre>
 </details>
 </dd>
+<dt id="sql_app.crud.get_devices_by_team"><code class="name flex">
+<span>def <span class="ident">get_devices_by_team</span></span>(<span>db: sqlalchemy.orm.session.Session, team: int)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>returns all devices with same team</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_devices_by_team(db: Session, team: int):
+    &#34;&#34;&#34;
+    returns all devices with same team
+    &#34;&#34;&#34;
+    return db.query(models.Device).filter(models.Device.team_id == team).all()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.get_devices_with_ids"><code class="name flex">
+<span>def <span class="ident">get_devices_with_ids</span></span>(<span>db: sqlalchemy.orm.session.Session, ids: [])</span>
+</code></dt>
+<dd>
+<div class="desc"><p>returns all devices with given ids</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_devices_with_ids(db: Session, ids: []):
+    &#34;&#34;&#34;
+    returns all devices with given ids
+    &#34;&#34;&#34;
+    return db.query(models.Device).filter(models.Device.id.in_(ids)).all()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.get_filtered_bodydevices"><code class="name flex">
+<span>def <span class="ident">get_filtered_bodydevices</span></span>(<span>db: sqlalchemy.orm.session.Session, body_id: str, license_id: str, team: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>returns filtered body devices based on given attributes</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_filtered_bodydevices(db: Session, body_id: str, license_id: str, team: str):
+    &#34;&#34;&#34;
+    returns filtered body devices based on given attributes
+    &#34;&#34;&#34;
+    execute_string = &#34;SELECT * FROM body_devices AS device WHERE&#34;
+    before_me = False
+    all_all = True
+    if body_id != &#34;all&#34;:
+        all_all = False
+        body_dev = find_bodydevice_by_serial(db, body_id)
+        if body_dev != None:
+            if before_me:
+                execute_string += &#34; AND device.id = &#34; + str(body_dev.id)
+            else:
+                before_me = True
+                execute_string += &#34; device.id = &#34; + str(body_dev.id)
+    if license_id != &#34;all&#34;:
+        all_all = False
+        license = find_license(db, license_id)
+        if license != None:
+            if before_me:
+                execute_string += &#34; AND device.license_id = &#34; + str(license.id)
+            else:
+                before_me = True
+                execute_string += &#34; device.license_id = &#34; + str(license.id)
+    if team != &#34;all&#34;:
+        all_all = False
+        tem = find_team(db, team)
+        if tem != None:
+            if before_me:
+                execute_string += &#34; AND device.team_id = &#34; + str(tem.id)
+            else:
+                before_me = True
+                execute_string += &#34; device.team_id = &#34; + str(tem.id)
+    if all_all:
+        before_me = True
+        execute_string = &#34;SELECT * FROM body_devices AS devices&#34;
+
+    if not before_me:
+        execute_string = &#34;SELECT * FROM body_devices AS devices WHERE devices.id = -1&#34;
+    result = db.execute(execute_string)
+    return result</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.get_filtered_devices"><code class="name flex">
+<span>def <span class="ident">get_filtered_devices</span></span>(<span>db: sqlalchemy.orm.session.Session, keyman_id: str, license_name: str, license_id: str, team: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>returns filtered keyman devices based on given attributes</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_filtered_devices(db: Session, keyman_id: str, license_name: str, license_id: str, team: str):
+    &#34;&#34;&#34;
+    returns filtered keyman devices based on given attributes
+    &#34;&#34;&#34;
+    execute_string = &#34;SELECT * FROM devices AS device WHERE&#34;
+    before_me = False
+    all_all = True
+    if keyman_id != &#34;all&#34;:
+        all_all = False
+        keyman_dev = find_device_by_serial(db, keyman_id)
+        if keyman_dev != None:
+            if before_me:
+                execute_string += &#34; AND device.id = &#34; + str(keyman_dev.id)
+            else:
+                before_me = True
+                execute_string += &#34; device.id = &#34; + str(keyman_dev.id)
+    if license_name != &#34;all&#34;:
+        all_all = False
+        license = get_licenses_by_name(db, license_name)
+        if len(license) &gt; 0:
+            lic_ids = []
+            for l in license:
+                lic_ids.append(l.id)
+            dev_lics = find_devicelicenses_by_licid_array(db, lic_ids)
+            lic_ids = &#34;(&#34;
+            for l in dev_lics:
+                lic_ids += str(l.device_id) + &#34;, &#34;
+            def_lic_ids = lic_ids[:-2] + &#34;)&#34;
+            if before_me:
+                execute_string += &#34; AND device.id IN &#34; + def_lic_ids
+            else:
+                before_me = True
+                execute_string += &#34; device.id IN &#34; + def_lic_ids
+    if license_id != &#34;all&#34;:
+        all_all = False
+        license = find_license(db, license_id)
+        licen_devs = get_license_devices(db, license.id)
+        ids = &#34;(&#34;
+        for lic in licen_devs:
+            ids += str(lic.device_id) + &#34;, &#34;
+        def_ids = ids[:-2] + &#34;)&#34;
+        if license != None:
+            if before_me:
+                execute_string += &#34; AND device.id IN &#34; + def_ids
+            else:
+                before_me = True
+                execute_string += &#34; device.id IN &#34; + def_ids
+    if team != &#34;all&#34;:
+        all_all = False
+        tem = find_team(db, team)
+        if tem != None:
+            if before_me:
+                execute_string += &#34; AND device.team_id = &#34; + str(tem.id)
+            else:
+                before_me = True
+                execute_string += &#34; device.team_id = &#34; + str(tem.id)
+    if all_all:
+        before_me = True
+        execute_string = &#34;SELECT * FROM devices AS devices&#34;
+
+    if not before_me:
+        execute_string = &#34;SELECT * FROM devices AS devices WHERE devices.id = -1&#34;
+    result = db.execute(execute_string)
+    return result</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.get_filtered_headdevices"><code class="name flex">
+<span>def <span class="ident">get_filtered_headdevices</span></span>(<span>db: sqlalchemy.orm.session.Session, body_id: str, license_id: str, team: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>returns filtered head devices based on given attributes</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_filtered_headdevices(db: Session, body_id: str, license_id: str, team: str):
+    &#34;&#34;&#34;
+    returns filtered head devices based on given attributes
+    &#34;&#34;&#34;
+    execute_string = &#34;SELECT * FROM head_devices AS device WHERE&#34;
+    before_me = False
+    all_all = True
+    if body_id != &#34;all&#34;:
+        all_all = False
+        head_dev = find_headdevice_by_serial(db, body_id)
+        if head_dev != None:
+            if before_me:
+                execute_string += &#34; AND device.id = &#34; + str(head_dev.id)
+            else:
+                before_me = True
+                execute_string += &#34; device.id = &#34; + str(head_dev.id)
+    if license_id != &#34;all&#34;:
+        all_all = False
+        license = find_license(db, license_id)
+        if license != None:
+            if before_me:
+                execute_string += &#34; AND device.license_id = &#34; + str(license.id)
+            else:
+                before_me = True
+                execute_string += &#34; device.license_id = &#34; + str(license.id)
+    if team != &#34;all&#34;:
+        all_all = False
+        tem = find_team(db, team)
+        if tem != None:
+            if before_me:
+                execute_string += &#34; AND device.team_id = &#34; + str(tem.id)
+            else:
+                before_me = True
+                execute_string += &#34; device.team_id = &#34; + str(tem.id)
+    if all_all:
+        before_me = True
+        execute_string = &#34;SELECT * FROM body_devices AS devices&#34;
+
+    if not before_me:
+        execute_string = &#34;SELECT * FROM body_devices AS devices WHERE devices.id = -1&#34;
+    result = db.execute(execute_string)
+    return result</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.get_filtered_ldlogs"><code class="name flex">
+<span>def <span class="ident">get_filtered_ldlogs</span></span>(<span>db: sqlalchemy.orm.session.Session, pc: str, tema: str, lic: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Function creates query string used for filtering by pc username, team name and license name.
+Depending on selected filters assembles query string for database</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_filtered_ldlogs(db: Session, pc: str, tema: str, lic: str):
+    &#34;&#34;&#34;
+    Function creates query string used for filtering by pc username, team name and license name.
+    Depending on selected filters assembles query string for database
+    &#34;&#34;&#34;
+    execute_string = &#34;SELECT * FROM ld_logs AS logs WHERE&#34;
+    before_me = False
+    all_all = True
+    if pc != &#34;all&#34;:
+        all_all = False
+        pc = find_pc_by_username(db, pc)
+        if pc != None:
+            if before_me:
+                execute_string += &#34; AND logs.pc_id = &#34; + str(pc.id)
+            else:
+                before_me = True
+                execute_string += &#34; logs.pc_id = &#34; + str(pc.id)
+    if tema != &#34;all&#34;:
+        all_all = False
+        team = find_team(db, tema)
+        if team != None:
+            head_devices = find_headdevices_by_team(db, team.id)
+            body_devices = find_bodydevices_by_team(db, team.id)
+            if len(head_devices) &gt; 0 and len(body_devices) &gt; 0:
+                h_ids = &#34;(&#34;
+                for h in head_devices:
+                    h_ids += str(h.id) + &#34;, &#34;
+                def_h_ids = h_ids[:-2] + &#34;)&#34;
+                b_ids = &#34;(&#34;
+                for b in body_devices:
+                    b_ids += str(b.id) + &#34;, &#34;
+                def_b_ids = b_ids[:-2] + &#34;)&#34;
+                if before_me:
+                    execute_string += &#34; AND (logs.head_id IN &#34; + def_h_ids + &#34; OR logs.body_id IN &#34; + def_b_ids + &#34;)&#34;
+                else:
+                    before_me = True
+                    execute_string += &#34; (logs.head_id IN &#34; + def_h_ids + &#34; OR logs.body_id IN &#34; + def_b_ids + &#34;)&#34;
+            elif len(head_devices) == 0 and len(body_devices) &gt; 0:
+                b_ids = &#34;(&#34;
+                for b in body_devices:
+                    b_ids += str(b.id) + &#34;, &#34;
+                def_b_ids = b_ids[:-2] + &#34;)&#34;
+                if before_me:
+                    execute_string += &#34; AND logs.body_id IN &#34; + def_b_ids
+                else:
+                    before_me = True
+                    execute_string += &#34; logs.body_id IN &#34; + def_b_ids
+            elif len(head_devices) &gt; 0 and len(body_devices) == 0:
+                h_ids = &#34;(&#34;
+                for h in head_devices:
+                    h_ids += str(h.id) + &#34;, &#34;
+                def_h_ids = h_ids[:-2] + &#34;)&#34;
+                if before_me:
+                    execute_string += &#34; AND logs.head_id IN &#34; + def_h_ids
+                else:
+                    before_me = True
+                    execute_string += &#34; logs.head_id IN &#34; + def_h_ids
+            else:
+                if before_me:
+                    execute_string += &#34; AND (logs.head_id = -1 OR logs.body_id = -1)&#34;
+                else:
+                    before_me = True
+                    execute_string += &#34; (logs.head_id = -1 OR logs.body_id = -1)&#34;
+    if lic != &#34;all&#34;:
+        all_all = False
+        license = find_license(db, lic)
+        if license != None:
+            head_devices = find_headdevices_by_license(db, license.id)
+            body_devices = find_bodydevices_by_license(db, license.id)
+            if len(head_devices) &gt; 0 and len(body_devices) &gt; 0:
+                h_ids = &#34;(&#34;
+                for h in head_devices:
+                    h_ids += str(h.id) + &#34;, &#34;
+                def_h_ids = h_ids[:-2] + &#34;)&#34;
+                b_ids = &#34;(&#34;
+                for b in body_devices:
+                    b_ids += str(b.id) + &#34;, &#34;
+                def_b_ids = b_ids[:-2] + &#34;)&#34;
+                if before_me:
+                    execute_string += &#34; AND (logs.head_id IN &#34; + def_h_ids + &#34; OR logs.body_id IN &#34; + def_b_ids + &#34;)&#34;
+                else:
+                    before_me = True
+                    execute_string += &#34; (logs.head_id IN &#34; + def_h_ids + &#34; OR logs.body_id IN &#34; + def_b_ids + &#34;)&#34;
+            elif len(head_devices) == 0 and len(body_devices) &gt; 0:
+                b_ids = &#34;(&#34;
+                for b in body_devices:
+                    b_ids += str(b.id) + &#34;, &#34;
+                def_b_ids = b_ids[:-2] + &#34;)&#34;
+                if before_me:
+                    execute_string += &#34; AND logs.body_id IN &#34; + def_b_ids
+                else:
+                    before_me = True
+                    execute_string += &#34; logs.body_id IN &#34; + def_b_ids
+            elif len(head_devices) &gt; 0 and len(body_devices) == 0:
+                h_ids = &#34;(&#34;
+                for h in head_devices:
+                    h_ids += str(h.id) + &#34;, &#34;
+                def_h_ids = h_ids[:-2] + &#34;)&#34;
+                if before_me:
+                    execute_string += &#34; AND logs.head_id IN &#34; + def_h_ids
+                else:
+                    before_me = True
+                    execute_string += &#34; logs.head_id IN &#34; + def_h_ids
+            else:
+                if before_me:
+                    execute_string += &#34; AND (logs.head_id = -1 OR logs.body_id = -1)&#34;
+                else:
+                    before_me = True
+                    execute_string += &#34; (logs.head_id = -1 OR logs.body_id = -1)&#34;
+    if all_all:
+        before_me = True
+        execute_string = &#34;SELECT * FROM ld_logs AS logs&#34;
+
+    if not before_me:
+        execute_string = &#34;SELECT * FROM ld_logs AS logs WHERE logs.id = -1&#34;
+    result = db.execute(execute_string)
+    return result</code></pre>
+</details>
+</dd>
 <dt id="sql_app.crud.get_filtered_logs"><code class="name flex">
 <span>def <span class="ident">get_filtered_logs</span></span>(<span>db: sqlalchemy.orm.session.Session, pc: str, tema: str, lic: str)</span>
 </code></dt>
@@ -833,31 +2088,38 @@ Depending on selected filters assembles query string for database</p></div>
     Depending on selected filters assembles query string for database
     &#34;&#34;&#34;
     execute_string = &#34;SELECT * FROM usb_logs AS logs&#34;
+    pcs = find_pc_by_username(db, pc)
     if pc != &#34;all&#34;:
-        pcs = find_pc_by_username(db, pc)
-        execute_string += &#34;  WHERE logs.pc_id = &#34; + str(pcs.id)
+        if pcs is not None:
+            execute_string += &#34;  WHERE logs.pc_id = &#34; + str(pcs.id)
     if tema != &#34;all&#34;:
         team = find_team(db, tema)
-        pcs = get_pcs_by_team(db, team.id)
-        pc_ids = &#34;(&#34;
-        for p in pcs:
-            pc_ids += str(p.id) + &#34;, &#34;
-        def_pc_ids = pc_ids[:-2] + &#34;)&#34;
-        if pc != &#34;all&#34;:
-            execute_string += &#34; AND logs.pc_id IN &#34; + def_pc_ids
-        else:
-            execute_string += &#34; WHERE logs.pc_id IN &#34; + def_pc_ids
+        if team is not None:
+            devs = get_devices_by_team(db, team.id)
+            d_ids = &#34;(&#34;
+            for p in devs:
+                d_ids += str(p.id) + &#34;, &#34;
+            def_d_ids = d_ids[:-2] + &#34;)&#34;
+            if pc != &#34;all&#34; and pcs is not None:
+                if len(def_d_ids) &gt; 1:
+                    execute_string += &#34; AND logs.device_id IN &#34; + def_d_ids
+            else:
+                if len(def_d_ids) &gt; 1:
+                    execute_string += &#34; WHERE logs.device_id IN &#34; + def_d_ids
     if lic != &#34;all&#34;:
-        license = find_license(db, lic)
-        device_licenses = get_license_devices(db, license.id)
-        dev_ids = &#34;(&#34;
-        for dev in device_licenses:
-            dev_ids += str(dev.device_id) + &#34;, &#34;
-        defin_ids = dev_ids[:-2] + &#34;)&#34;
-        if pc != &#34;all&#34; or tema != &#34;all&#34;:
-            execute_string += &#34; AND logs.device_id IN &#34; + defin_ids
-        else:
-            execute_string += &#34; WHERE logs.device_id IN &#34; + defin_ids
+        license = get_licenses_by_name(db, lic)
+        if license is not None:
+            device_licenses = get_license_devices(db, license.id)
+            dev_ids = &#34;(&#34;
+            for dev in device_licenses:
+                dev_ids += str(dev.device_id) + &#34;, &#34;
+            defin_ids = dev_ids[:-2] + &#34;)&#34;
+            if pc != &#34;all&#34; or tema != &#34;all&#34;:
+                if len(defin_ids) &gt; 1:
+                    execute_string += &#34; AND logs.device_id IN &#34; + defin_ids
+            else:
+                if len(defin_ids) &gt; 1:
+                    execute_string += &#34; WHERE logs.device_id IN &#34; + defin_ids
 
     # executing assembled query string
     result = db.execute(execute_string)
@@ -896,6 +2158,22 @@ Depending on selected filters assembles query string for database</p></div>
     return db.query(models.HeadDevice).offset(skip).limit(limit).all()</code></pre>
 </details>
 </dd>
+<dt id="sql_app.crud.get_headdevices_with_ids"><code class="name flex">
+<span>def <span class="ident">get_headdevices_with_ids</span></span>(<span>db: sqlalchemy.orm.session.Session, ids: [])</span>
+</code></dt>
+<dd>
+<div class="desc"><p>returns all headdevices with given ids</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_headdevices_with_ids(db: Session, ids: []):
+    &#34;&#34;&#34;
+    returns all headdevices with given ids
+    &#34;&#34;&#34;
+    return db.query(models.HeadDevice).filter(models.HeadDevice.id.in_(ids)).all()</code></pre>
+</details>
+</dd>
 <dt id="sql_app.crud.get_ld_logs"><code class="name flex">
 <span>def <span class="ident">get_ld_logs</span></span>(<span>db: sqlalchemy.orm.session.Session, skip: int = 0, limit: int = 100)</span>
 </code></dt>
@@ -909,7 +2187,7 @@ Depending on selected filters assembles query string for database</p></div>
     &#34;&#34;&#34;
     Returns all ld debugger logs in database
     &#34;&#34;&#34;
-    return db.query(models.LDLog).offset(skip).limit(limit).all()</code></pre>
+    return db.query(models.LDLog).order_by(desc(models.LDLog.timestamp)).offset(skip).limit(limit).all()</code></pre>
 </details>
 </dd>
 <dt id="sql_app.crud.get_license"><code class="name flex">
@@ -932,14 +2210,14 @@ Depending on selected filters assembles query string for database</p></div>
 <span>def <span class="ident">get_license_devices</span></span>(<span>db: sqlalchemy.orm.session.Session, license_id: int)</span>
 </code></dt>
 <dd>
-<div class="desc"><p>returns all entries in devices_licenses table</p></div>
+<div class="desc"><p>returns all entries in devices_licenses table with given license_id</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
 <pre><code class="python">def get_license_devices(db: Session, license_id: int):
     &#34;&#34;&#34;
-    returns all entries in devices_licenses table
+    returns all entries in devices_licenses table with given license_id
     &#34;&#34;&#34;
     return db.query(models.DeviceLicense).filter(models.DeviceLicense.license_id == license_id).all()</code></pre>
 </details>
@@ -960,6 +2238,19 @@ Depending on selected filters assembles query string for database</p></div>
     return db.query(models.License).offset(skip).limit(limit).all()</code></pre>
 </details>
 </dd>
+<dt id="sql_app.crud.get_licenses_by_name"><code class="name flex">
+<span>def <span class="ident">get_licenses_by_name</span></span>(<span>db: sqlalchemy.orm.session.Session, name: str)</span>
+</code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_licenses_by_name(db: Session, name: str):
+    return db.query(models.License).filter(models.License.name == name).all()</code></pre>
+</details>
+</dd>
 <dt id="sql_app.crud.get_log"><code class="name flex">
 <span>def <span class="ident">get_log</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, skip: int = 0, limit: int = 100)</span>
 </code></dt>
@@ -1024,22 +2315,6 @@ Depending on selected filters assembles query string for database</p></div>
     return db.query(models.PC).offset(skip).limit(limit).all()</code></pre>
 </details>
 </dd>
-<dt id="sql_app.crud.get_pcs_by_team"><code class="name flex">
-<span>def <span class="ident">get_pcs_by_team</span></span>(<span>db: sqlalchemy.orm.session.Session, team_id: int)</span>
-</code></dt>
-<dd>
-<div class="desc"><p>returns all pcs in given team by team id</p></div>
-<details class="source">
-<summary>
-<span>Expand source code</span>
-</summary>
-<pre><code class="python">def get_pcs_by_team(db: Session, team_id: int):
-    &#34;&#34;&#34;
-    returns all pcs in given team by team id
-    &#34;&#34;&#34;
-    return db.query(models.PC).filter(models.PC.team_id == team_id).all()</code></pre>
-</details>
-</dd>
 <dt id="sql_app.crud.get_team"><code class="name flex">
 <span>def <span class="ident">get_team</span></span>(<span>db: sqlalchemy.orm.session.Session, team_id: int)</span>
 </code></dt>
@@ -1072,28 +2347,291 @@ Depending on selected filters assembles query string for database</p></div>
     return db.query(models.Team).offset(skip).limit(limit).all()</code></pre>
 </details>
 </dd>
-<dt id="sql_app.crud.update_pc"><code class="name flex">
-<span>def <span class="ident">update_pc</span></span>(<span>db: sqlalchemy.orm.session.Session, pc_id: int, team: str)</span>
+<dt id="sql_app.crud.get_users"><code class="name flex">
+<span>def <span class="ident">get_users</span></span>(<span>db: sqlalchemy.orm.session.Session, skip: int = 0, limit: int = 100)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Returns all users saved in database</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def get_users(db: Session, skip: int = 0, limit: int = 100):
+    &#34;&#34;&#34;
+    Returns all users saved in database
+    &#34;&#34;&#34;
+    return db.query(models.User).offset(skip).limit(limit).all()</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.update_bodydevice_comm"><code class="name flex">
+<span>def <span class="ident">update_bodydevice_comm</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, comm: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Updates body devices comment with new one given by user</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def update_bodydevice_comm(db: Session, device_id: int, comm: str):
+    &#34;&#34;&#34;
+    Updates body devices comment with new one given by user
+    &#34;&#34;&#34;
+    old_dev = get_body_device(db, device_id)
+    new = {&#39;id&#39;: old_dev.id, &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: old_dev.inventory_number,
+           &#39;comment&#39;: comm, &#39;team_id&#39;: old_dev.team_id, &#39;license_id&#39;: old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.update_bodydevice_inv"><code class="name flex">
+<span>def <span class="ident">update_bodydevice_inv</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, dev_inv: str)</span>
 </code></dt>
 <dd>
-<div class="desc"><p>Function updates team of one specific pc</p></div>
+<div class="desc"><p>Updates body devices inventory number with new one given by user</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">def update_pc(db: Session, pc_id: int, team: str):
+<pre><code class="python">def update_bodydevice_inv(db: Session, device_id: int, dev_inv: str):
     &#34;&#34;&#34;
-    Function updates team of one specific pc
+    Updates body devices inventory number with new one given by user
     &#34;&#34;&#34;
-    old_pc = get_pc(db, pc_id)
+    old_dev = get_body_device(db, device_id)
+    new = {&#39;id&#39;: old_dev.id, &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: dev_inv,
+           &#39;comment&#39;: old_dev.comment, &#39;team_id&#39;: old_dev.team_id, &#39;license_id&#39;: old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.update_bodydevice_license"><code class="name flex">
+<span>def <span class="ident">update_bodydevice_license</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, lic_id: int)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Updates body devices license with one given by user</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def update_bodydevice_license(db: Session, device_id: int, lic_id: int):
+    &#34;&#34;&#34;
+    Updates body devices license with one given by user
+    &#34;&#34;&#34;
+    old_dev = get_body_device(db, device_id)
+    lic = get_license(db, lic_id)
+    new = {&#39;id&#39;: old_dev.id, &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: old_dev.inventory_number,
+           &#39;comment&#39;: old_dev.comment, &#39;team_id&#39;: old_dev.team_id, &#39;license_id&#39;: lic.id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.update_bodydevice_team"><code class="name flex">
+<span>def <span class="ident">update_bodydevice_team</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, team_id: int)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Updates body devices team with one given by user</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def update_bodydevice_team(db: Session, device_id: int, team_id: int):
+    &#34;&#34;&#34;
+    Updates body devices team with one given by user
+    &#34;&#34;&#34;
+    old_dev = get_body_device(db, device_id)
+    team = get_team(db, team_id)
+    new = {&#39;id&#39;: old_dev.id, &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: old_dev.inventory_number,
+           &#39;comment&#39;: old_dev.comment, &#39;team_id&#39;: team.id, &#39;license_id&#39;: old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.update_device"><code class="name flex">
+<span>def <span class="ident">update_device</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, team: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Updates team of one specific pc</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def update_device(db: Session, device_id: int, team: str):
+    &#34;&#34;&#34;
+    Updates team of one specific pc
+    &#34;&#34;&#34;
+    old_dev = get_device(db, device_id)
     team = get_team(db, int(team))
-    new = {&#39;id&#39;: old_pc.id, &#39;username&#39;: old_pc.username, &#39;hostname&#39;: old_pc.hostname, &#39;assigned&#39;: True,
-           &#39;team_id&#39;: team.id}
+    new = {&#39;id&#39;: old_dev.id, &#39;vendor_id&#39;: old_dev.vendor_id, &#39;product_id&#39;: old_dev.product_id,
+           &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: old_dev.inventory_number,
+           &#39;comment&#39;: old_dev.comment, &#39;team_id&#39;: team.id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.update_device_com"><code class="name flex">
+<span>def <span class="ident">update_device_com</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, comm: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Updates team of one specific pc</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def update_device_com(db: Session, device_id: int, comm: str):
+    &#34;&#34;&#34;
+    Updates team of one specific pc
+    &#34;&#34;&#34;
+    old_dev = get_device(db, device_id)
+    if old_dev.team_id != None:
+        team = get_team(db, int(old_dev.team_id))
+        teamid = team.id
+    else:
+        teamid = None
+    new = {&#39;id&#39;: old_dev.id, &#39;vendor_id&#39;: old_dev.vendor_id, &#39;product_id&#39;: old_dev.product_id,
+           &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: old_dev.inventory_number,
+           &#39;comment&#39;: comm, &#39;team_id&#39;: teamid}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.update_device_inv"><code class="name flex">
+<span>def <span class="ident">update_device_inv</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, inv: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Updates inventory number of one specific pc</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def update_device_inv(db: Session, device_id: int, inv: str):
+    &#34;&#34;&#34;
+    Updates inventory number of one specific pc
+    &#34;&#34;&#34;
+    old_dev = get_device(db, device_id)
+    if old_dev.team_id != None:
+        team = get_team(db, int(old_dev.team_id))
+        teamid = team.id
+    else:
+        teamid = None
+    new = {&#39;id&#39;: old_dev.id, &#39;vendor_id&#39;: old_dev.vendor_id, &#39;product_id&#39;: old_dev.product_id,
+           &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: inv,
+           &#39;comment&#39;: old_dev.comment, &#39;team_id&#39;: teamid}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.update_headdevice_comm"><code class="name flex">
+<span>def <span class="ident">update_headdevice_comm</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, comm: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Updates head devices comment with new one given by user</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def update_headdevice_comm(db: Session, device_id: int, comm: str):
+    &#34;&#34;&#34;
+    Updates head devices comment with new one given by user
+    &#34;&#34;&#34;
+    old_dev = get_head_device(db, device_id)
+    new = {&#39;id&#39;: old_dev.id, &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: old_dev.inventory_number,
+           &#39;comment&#39;: comm, &#39;team_id&#39;: old_dev.team_id, &#39;license_id&#39;: old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.update_headdevice_inv"><code class="name flex">
+<span>def <span class="ident">update_headdevice_inv</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, dev_inv: str)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Updates head devices inventory number with new one given by user</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def update_headdevice_inv(db: Session, device_id: int, dev_inv: str):
+    &#34;&#34;&#34;
+    Updates head devices inventory number with new one given by user
+    &#34;&#34;&#34;
+    old_dev = get_head_device(db, device_id)
+    new = {&#39;id&#39;: old_dev.id, &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: dev_inv,
+           &#39;comment&#39;: old_dev.comment, &#39;team_id&#39;: old_dev.team_id, &#39;license_id&#39;: old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.update_headdevice_license"><code class="name flex">
+<span>def <span class="ident">update_headdevice_license</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, lic_id: int)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Updates head devices license with one given by user</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def update_headdevice_license(db: Session, device_id: int, lic_id: int):
+    &#34;&#34;&#34;
+    Updates head devices license with one given by user
+    &#34;&#34;&#34;
+    old_dev = get_head_device(db, device_id)
+    lic = get_license(db, lic_id)
+    new = {&#39;id&#39;: old_dev.id, &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: old_dev.inventory_number,
+           &#39;comment&#39;: old_dev.comment, &#39;team_id&#39;: old_dev.team_id, &#39;license_id&#39;: lic.id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev</code></pre>
+</details>
+</dd>
+<dt id="sql_app.crud.update_headdevice_team"><code class="name flex">
+<span>def <span class="ident">update_headdevice_team</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, team_id: int)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Updates head devices team with one given by user</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def update_headdevice_team(db: Session, device_id: int, team_id: int):
+    &#34;&#34;&#34;
+    Updates head devices team with one given by user
+    &#34;&#34;&#34;
+    old_dev = get_head_device(db, device_id)
+    team = get_team(db, team_id)
+    new = {&#39;id&#39;: old_dev.id, &#39;serial_number&#39;: old_dev.serial_number, &#39;inventory_number&#39;: old_dev.inventory_number,
+           &#39;comment&#39;: old_dev.comment, &#39;team_id&#39;: team.id, &#39;license_id&#39;: old_dev.license_id}
     for key, value in new.items():
-        setattr(old_pc, key, value)
+        setattr(old_dev, key, value)
     db.commit()
-    db.refresh(old_pc)
-    return old_pc</code></pre>
+    db.refresh(old_dev)
+    return old_dev</code></pre>
 </details>
 </dd>
 </dl>
@@ -1114,6 +2652,8 @@ Depending on selected filters assembles query string for database</p></div>
 </li>
 <li><h3><a href="#header-functions">Functions</a></h3>
 <ul class="">
+<li><code><a title="sql_app.crud.change_role" href="#sql_app.crud.change_role">change_role</a></code></li>
+<li><code><a title="sql_app.crud.change_team" href="#sql_app.crud.change_team">change_team</a></code></li>
 <li><code><a title="sql_app.crud.create_body_device" href="#sql_app.crud.create_body_device">create_body_device</a></code></li>
 <li><code><a title="sql_app.crud.create_device" href="#sql_app.crud.create_device">create_device</a></code></li>
 <li><code><a title="sql_app.crud.create_device_license" href="#sql_app.crud.create_device_license">create_device_license</a></code></li>
@@ -1123,10 +2663,21 @@ Depending on selected filters assembles query string for database</p></div>
 <li><code><a title="sql_app.crud.create_license" href="#sql_app.crud.create_license">create_license</a></code></li>
 <li><code><a title="sql_app.crud.create_pc" href="#sql_app.crud.create_pc">create_pc</a></code></li>
 <li><code><a title="sql_app.crud.create_team" href="#sql_app.crud.create_team">create_team</a></code></li>
+<li><code><a title="sql_app.crud.create_user" href="#sql_app.crud.create_user">create_user</a></code></li>
+<li><code><a title="sql_app.crud.delete_device_license" href="#sql_app.crud.delete_device_license">delete_device_license</a></code></li>
 <li><code><a title="sql_app.crud.find_body_device" href="#sql_app.crud.find_body_device">find_body_device</a></code></li>
+<li><code><a title="sql_app.crud.find_bodydevice_by_serial" href="#sql_app.crud.find_bodydevice_by_serial">find_bodydevice_by_serial</a></code></li>
+<li><code><a title="sql_app.crud.find_bodydevices_by_license" href="#sql_app.crud.find_bodydevices_by_license">find_bodydevices_by_license</a></code></li>
+<li><code><a title="sql_app.crud.find_bodydevices_by_team" href="#sql_app.crud.find_bodydevices_by_team">find_bodydevices_by_team</a></code></li>
 <li><code><a title="sql_app.crud.find_device" href="#sql_app.crud.find_device">find_device</a></code></li>
+<li><code><a title="sql_app.crud.find_device_by_serial" href="#sql_app.crud.find_device_by_serial">find_device_by_serial</a></code></li>
+<li><code><a title="sql_app.crud.find_devicelicenses_by_licid_array" href="#sql_app.crud.find_devicelicenses_by_licid_array">find_devicelicenses_by_licid_array</a></code></li>
+<li><code><a title="sql_app.crud.find_filtered_ldlogs" href="#sql_app.crud.find_filtered_ldlogs">find_filtered_ldlogs</a></code></li>
 <li><code><a title="sql_app.crud.find_filtered_logs" href="#sql_app.crud.find_filtered_logs">find_filtered_logs</a></code></li>
 <li><code><a title="sql_app.crud.find_head_device" href="#sql_app.crud.find_head_device">find_head_device</a></code></li>
+<li><code><a title="sql_app.crud.find_headdevice_by_serial" href="#sql_app.crud.find_headdevice_by_serial">find_headdevice_by_serial</a></code></li>
+<li><code><a title="sql_app.crud.find_headdevices_by_license" href="#sql_app.crud.find_headdevices_by_license">find_headdevices_by_license</a></code></li>
+<li><code><a title="sql_app.crud.find_headdevices_by_team" href="#sql_app.crud.find_headdevices_by_team">find_headdevices_by_team</a></code></li>
 <li><code><a title="sql_app.crud.find_license" href="#sql_app.crud.find_license">find_license</a></code></li>
 <li><code><a title="sql_app.crud.find_pc" href="#sql_app.crud.find_pc">find_pc</a></code></li>
 <li><code><a title="sql_app.crud.find_pc_by_name" href="#sql_app.crud.find_pc_by_name">find_pc_by_name</a></code></li>
@@ -1134,25 +2685,48 @@ Depending on selected filters assembles query string for database</p></div>
 <li><code><a title="sql_app.crud.find_pc_by_username" href="#sql_app.crud.find_pc_by_username">find_pc_by_username</a></code></li>
 <li><code><a title="sql_app.crud.find_pcs" href="#sql_app.crud.find_pcs">find_pcs</a></code></li>
 <li><code><a title="sql_app.crud.find_team" href="#sql_app.crud.find_team">find_team</a></code></li>
+<li><code><a title="sql_app.crud.find_user" href="#sql_app.crud.find_user">find_user</a></code></li>
+<li><code><a title="sql_app.crud.find_user_byid" href="#sql_app.crud.find_user_byid">find_user_byid</a></code></li>
 <li><code><a title="sql_app.crud.get_body_device" href="#sql_app.crud.get_body_device">get_body_device</a></code></li>
 <li><code><a title="sql_app.crud.get_body_devices" href="#sql_app.crud.get_body_devices">get_body_devices</a></code></li>
+<li><code><a title="sql_app.crud.get_bodydevices_with_ids" href="#sql_app.crud.get_bodydevices_with_ids">get_bodydevices_with_ids</a></code></li>
 <li><code><a title="sql_app.crud.get_device" href="#sql_app.crud.get_device">get_device</a></code></li>
+<li><code><a title="sql_app.crud.get_device_licenses" href="#sql_app.crud.get_device_licenses">get_device_licenses</a></code></li>
+<li><code><a title="sql_app.crud.get_devicelicense_by_devicelicense" href="#sql_app.crud.get_devicelicense_by_devicelicense">get_devicelicense_by_devicelicense</a></code></li>
 <li><code><a title="sql_app.crud.get_devices" href="#sql_app.crud.get_devices">get_devices</a></code></li>
+<li><code><a title="sql_app.crud.get_devices_by_team" href="#sql_app.crud.get_devices_by_team">get_devices_by_team</a></code></li>
+<li><code><a title="sql_app.crud.get_devices_with_ids" href="#sql_app.crud.get_devices_with_ids">get_devices_with_ids</a></code></li>
+<li><code><a title="sql_app.crud.get_filtered_bodydevices" href="#sql_app.crud.get_filtered_bodydevices">get_filtered_bodydevices</a></code></li>
+<li><code><a title="sql_app.crud.get_filtered_devices" href="#sql_app.crud.get_filtered_devices">get_filtered_devices</a></code></li>
+<li><code><a title="sql_app.crud.get_filtered_headdevices" href="#sql_app.crud.get_filtered_headdevices">get_filtered_headdevices</a></code></li>
+<li><code><a title="sql_app.crud.get_filtered_ldlogs" href="#sql_app.crud.get_filtered_ldlogs">get_filtered_ldlogs</a></code></li>
 <li><code><a title="sql_app.crud.get_filtered_logs" href="#sql_app.crud.get_filtered_logs">get_filtered_logs</a></code></li>
 <li><code><a title="sql_app.crud.get_head_device" href="#sql_app.crud.get_head_device">get_head_device</a></code></li>
 <li><code><a title="sql_app.crud.get_head_devices" href="#sql_app.crud.get_head_devices">get_head_devices</a></code></li>
+<li><code><a title="sql_app.crud.get_headdevices_with_ids" href="#sql_app.crud.get_headdevices_with_ids">get_headdevices_with_ids</a></code></li>
 <li><code><a title="sql_app.crud.get_ld_logs" href="#sql_app.crud.get_ld_logs">get_ld_logs</a></code></li>
 <li><code><a title="sql_app.crud.get_license" href="#sql_app.crud.get_license">get_license</a></code></li>
 <li><code><a title="sql_app.crud.get_license_devices" href="#sql_app.crud.get_license_devices">get_license_devices</a></code></li>
 <li><code><a title="sql_app.crud.get_licenses" href="#sql_app.crud.get_licenses">get_licenses</a></code></li>
+<li><code><a title="sql_app.crud.get_licenses_by_name" href="#sql_app.crud.get_licenses_by_name">get_licenses_by_name</a></code></li>
 <li><code><a title="sql_app.crud.get_log" href="#sql_app.crud.get_log">get_log</a></code></li>
 <li><code><a title="sql_app.crud.get_logs" href="#sql_app.crud.get_logs">get_logs</a></code></li>
 <li><code><a title="sql_app.crud.get_pc" href="#sql_app.crud.get_pc">get_pc</a></code></li>
 <li><code><a title="sql_app.crud.get_pcs" href="#sql_app.crud.get_pcs">get_pcs</a></code></li>
-<li><code><a title="sql_app.crud.get_pcs_by_team" href="#sql_app.crud.get_pcs_by_team">get_pcs_by_team</a></code></li>
 <li><code><a title="sql_app.crud.get_team" href="#sql_app.crud.get_team">get_team</a></code></li>
 <li><code><a title="sql_app.crud.get_teams" href="#sql_app.crud.get_teams">get_teams</a></code></li>
-<li><code><a title="sql_app.crud.update_pc" href="#sql_app.crud.update_pc">update_pc</a></code></li>
+<li><code><a title="sql_app.crud.get_users" href="#sql_app.crud.get_users">get_users</a></code></li>
+<li><code><a title="sql_app.crud.update_bodydevice_comm" href="#sql_app.crud.update_bodydevice_comm">update_bodydevice_comm</a></code></li>
+<li><code><a title="sql_app.crud.update_bodydevice_inv" href="#sql_app.crud.update_bodydevice_inv">update_bodydevice_inv</a></code></li>
+<li><code><a title="sql_app.crud.update_bodydevice_license" href="#sql_app.crud.update_bodydevice_license">update_bodydevice_license</a></code></li>
+<li><code><a title="sql_app.crud.update_bodydevice_team" href="#sql_app.crud.update_bodydevice_team">update_bodydevice_team</a></code></li>
+<li><code><a title="sql_app.crud.update_device" href="#sql_app.crud.update_device">update_device</a></code></li>
+<li><code><a title="sql_app.crud.update_device_com" href="#sql_app.crud.update_device_com">update_device_com</a></code></li>
+<li><code><a title="sql_app.crud.update_device_inv" href="#sql_app.crud.update_device_inv">update_device_inv</a></code></li>
+<li><code><a title="sql_app.crud.update_headdevice_comm" href="#sql_app.crud.update_headdevice_comm">update_headdevice_comm</a></code></li>
+<li><code><a title="sql_app.crud.update_headdevice_inv" href="#sql_app.crud.update_headdevice_inv">update_headdevice_inv</a></code></li>
+<li><code><a title="sql_app.crud.update_headdevice_license" href="#sql_app.crud.update_headdevice_license">update_headdevice_license</a></code></li>
+<li><code><a title="sql_app.crud.update_headdevice_team" href="#sql_app.crud.update_headdevice_team">update_headdevice_team</a></code></li>
 </ul>
 </li>
 </ul>
diff --git a/server/doc/sql_app/documentation.html b/server/doc/sql_app/documentation.html
deleted file mode 100644
index 3807832..0000000
--- a/server/doc/sql_app/documentation.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
-<meta name="generator" content="pdoc 0.10.0" />
-<title>sql_app API documentation</title>
-<meta name="description" content="" />
-<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
-<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
-<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
-<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
-<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
-<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
-<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
-<script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
-</head>
-<body>
-<main>
-<article id="content">
-<header>
-<h1 class="title">Package <code>sql_app</code></h1>
-</header>
-<section id="section-intro">
-</section>
-<section>
-<h2 class="section-title" id="header-submodules">Sub-modules</h2>
-<dl>
-<dt><code class="name"><a title="sql_app.api" href="api/index.html">sql_app.api</a></code></dt>
-<dd>
-<div class="desc"></div>
-</dd>
-<dt><code class="name"><a title="sql_app.crud" href="crud.html">sql_app.crud</a></code></dt>
-<dd>
-<div class="desc"></div>
-</dd>
-<dt><code class="name"><a title="sql_app.database" href="database.html">sql_app.database</a></code></dt>
-<dd>
-<div class="desc"></div>
-</dd>
-<dt><code class="name"><a title="sql_app.main" href="main.html">sql_app.main</a></code></dt>
-<dd>
-<div class="desc"></div>
-</dd>
-<dt><code class="name"><a title="sql_app.models" href="models.html">sql_app.models</a></code></dt>
-<dd>
-<div class="desc"></div>
-</dd>
-<dt><code class="name"><a title="sql_app.schemas" href="schemas.html">sql_app.schemas</a></code></dt>
-<dd>
-<div class="desc"></div>
-</dd>
-</dl>
-</section>
-<section>
-</section>
-<section>
-</section>
-<section>
-</section>
-</article>
-<nav id="sidebar">
-<h1>Index</h1>
-<div class="toc">
-<ul></ul>
-</div>
-<ul id="index">
-<li><h3><a href="#header-submodules">Sub-modules</a></h3>
-<ul>
-<li><code><a title="sql_app.api" href="api/index.html">sql_app.api</a></code></li>
-<li><code><a title="sql_app.crud" href="crud.html">sql_app.crud</a></code></li>
-<li><code><a title="sql_app.database" href="database.html">sql_app.database</a></code></li>
-<li><code><a title="sql_app.main" href="main.html">sql_app.main</a></code></li>
-<li><code><a title="sql_app.models" href="models.html">sql_app.models</a></code></li>
-<li><code><a title="sql_app.schemas" href="schemas.html">sql_app.schemas</a></code></li>
-</ul>
-</li>
-</ul>
-</nav>
-</main>
-<footer id="footer">
-<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
-</footer>
-</body>
-</html>
\ No newline at end of file
diff --git a/server/doc/sql_app/index.html b/server/doc/sql_app/index.html
new file mode 100644
index 0000000..3807832
--- /dev/null
+++ b/server/doc/sql_app/index.html
@@ -0,0 +1,85 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
+<meta name="generator" content="pdoc 0.10.0" />
+<title>sql_app API documentation</title>
+<meta name="description" content="" />
+<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
+<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
+<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
+<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
+<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
+<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
+<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
+<script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
+</head>
+<body>
+<main>
+<article id="content">
+<header>
+<h1 class="title">Package <code>sql_app</code></h1>
+</header>
+<section id="section-intro">
+</section>
+<section>
+<h2 class="section-title" id="header-submodules">Sub-modules</h2>
+<dl>
+<dt><code class="name"><a title="sql_app.api" href="api/index.html">sql_app.api</a></code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt><code class="name"><a title="sql_app.crud" href="crud.html">sql_app.crud</a></code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt><code class="name"><a title="sql_app.database" href="database.html">sql_app.database</a></code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt><code class="name"><a title="sql_app.main" href="main.html">sql_app.main</a></code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt><code class="name"><a title="sql_app.models" href="models.html">sql_app.models</a></code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt><code class="name"><a title="sql_app.schemas" href="schemas.html">sql_app.schemas</a></code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+</dl>
+</section>
+<section>
+</section>
+<section>
+</section>
+<section>
+</section>
+</article>
+<nav id="sidebar">
+<h1>Index</h1>
+<div class="toc">
+<ul></ul>
+</div>
+<ul id="index">
+<li><h3><a href="#header-submodules">Sub-modules</a></h3>
+<ul>
+<li><code><a title="sql_app.api" href="api/index.html">sql_app.api</a></code></li>
+<li><code><a title="sql_app.crud" href="crud.html">sql_app.crud</a></code></li>
+<li><code><a title="sql_app.database" href="database.html">sql_app.database</a></code></li>
+<li><code><a title="sql_app.main" href="main.html">sql_app.main</a></code></li>
+<li><code><a title="sql_app.models" href="models.html">sql_app.models</a></code></li>
+<li><code><a title="sql_app.schemas" href="schemas.html">sql_app.schemas</a></code></li>
+</ul>
+</li>
+</ul>
+</nav>
+</main>
+<footer id="footer">
+<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
+</footer>
+</body>
+</html>
\ No newline at end of file
diff --git a/server/doc/sql_app/main.html b/server/doc/sql_app/main.html
index fabf34b..2e35621 100644
--- a/server/doc/sql_app/main.html
+++ b/server/doc/sql_app/main.html
@@ -37,6 +37,11 @@ from sql_app.api.usb_logs import usblogs
 from sql_app.api.usb_logs_web import usblogs_web
 from sql_app.api.teams import teams
 from sql_app.api.teams_web import teams_web
+from sql_app.api.auth import auth
+from sql_app.api.ld_logs_web import ldlogs_web
+from sql_app.api.bodydevices_web import body_device_web
+from sql_app.api.headdevices_web import head_device_web
+from sql_app.api.users_web import users
 from fastapi import FastAPI
 
 
@@ -55,6 +60,11 @@ app.include_router(licenses_web)
 app.include_router(pcs_web)
 app.include_router(teams_web)
 app.include_router(usblogs_web)
+app.include_router(ldlogs_web)
+app.include_router(body_device_web)
+app.include_router(users)
+app.include_router(head_device_web)
+app.include_router(auth)
 
 
 if __name__ == &#34;__main__&#34;:
diff --git a/server/doc/sql_app/models.html b/server/doc/sql_app/models.html
index 6cc705a..c554ff0 100644
--- a/server/doc/sql_app/models.html
+++ b/server/doc/sql_app/models.html
@@ -42,12 +42,16 @@ class Device(Base):
     vendor_id = Column(String, index=True, nullable=False)
     product_id = Column(String, index=True, nullable=False)
     serial_number = Column(String, index=True, nullable=False)
-    assigned = Column(Boolean, index=True, nullable=False)
+    inventory_number = Column(String, index=True, nullable=True)
+    comment = Column(String, index=True, nullable=True)
+
+    team_id = Column(Integer, ForeignKey(&#34;teams.id&#34;))
 
     # relationships for foreign keys, thus connecting table with usb_logs and licenses
     # tables
     logs = relationship(&#34;USBLog&#34;, back_populates=&#34;device&#34;)
     licenses = relationship(&#34;DeviceLicense&#34;, back_populates=&#34;device_lic&#34;)
+    team = relationship(&#34;Team&#34;, back_populates=&#34;devices&#34;)
 
 
 class USBLog(Base):
@@ -75,11 +79,14 @@ class License(Base):
     __tablename__ = &#34;licenses&#34;
 
     id = Column(Integer, primary_key=True, index=True)
-    name = Column(String, index=True, nullable=False)
-    expiration_date = Column(DateTime(timezone=True), server_default=func.now())
+    name = Column(String, index=True, nullable=True)
+    license_id = Column(String, index=True, nullable=False)
+    expiration_date = Column(DateTime(timezone=True), nullable=True)
 
     # relationships for foreign keys, thus connecting table with devices table
     devices = relationship(&#34;DeviceLicense&#34;, back_populates=&#34;licenses&#34;)
+    bodydevice_lic = relationship(&#34;BodyDevice&#34;, back_populates=&#34;license&#34;)
+    headdevice_lic = relationship(&#34;HeadDevice&#34;, back_populates=&#34;license&#34;)
 
 
 class DeviceLicense(Base):
@@ -108,12 +115,9 @@ class PC(Base):
     id = Column(Integer, primary_key=True, index=True)
     username = Column(String, index=True, nullable=False)
     hostname = Column(String, index=True, nullable=False)
-    assigned = Column(Boolean, index=True, nullable=False)
-    team_id = Column(Integer, ForeignKey(&#34;teams.id&#34;))
 
     # relationships for foreign keys, thus connecting table with teams, usb_logs and ld_logs
     # tables
-    team = relationship(&#34;Team&#34;, back_populates=&#34;pcs&#34;)
     logs_pc = relationship(&#34;USBLog&#34;, back_populates=&#34;pc&#34;)
     ld_pc = relationship(&#34;LDLog&#34;, back_populates=&#34;ldpc&#34;)
 
@@ -127,8 +131,9 @@ class Team(Base):
     id = Column(Integer, primary_key=True, index=True)
     name = Column(String, index=True, nullable=False)
 
-    # relationships for foreign keys, thus connecting table with pc table
-    pcs = relationship(&#34;PC&#34;, back_populates=&#34;team&#34;)
+    devices = relationship(&#34;Device&#34;, back_populates=&#34;team&#34;)
+    body_devices = relationship(&#34;BodyDevice&#34;, back_populates=&#34;team&#34;)
+    head_devices = relationship(&#34;HeadDevice&#34;, back_populates=&#34;team&#34;)
 
 
 class HeadDevice(Base):
@@ -139,9 +144,16 @@ class HeadDevice(Base):
 
     id = Column(Integer, primary_key=True, index=True)
     serial_number = Column(String, index=True, nullable=False)
+    inventory_number = Column(String, index=True, nullable=True)
+    comment = Column(String, index=True, nullable=True)
+
+    team_id = Column(Integer, ForeignKey(&#34;teams.id&#34;))
+    license_id = Column(Integer, ForeignKey(&#34;licenses.id&#34;))
 
     # relationships for foreign keys, thus connecting table with ld_logs table
     h_logs = relationship(&#34;LDLog&#34;, back_populates=&#34;head_device&#34;)
+    license = relationship(&#34;License&#34;, back_populates=&#34;headdevice_lic&#34;)
+    team = relationship(&#34;Team&#34;, back_populates=&#34;head_devices&#34;)
 
 
 class BodyDevice(Base):
@@ -152,9 +164,16 @@ class BodyDevice(Base):
 
     id = Column(Integer, primary_key=True, index=True)
     serial_number = Column(String, index=True, nullable=False)
+    inventory_number = Column(String, index=True, nullable=True)
+    comment = Column(String, index=True, nullable=True)
+
+    team_id = Column(Integer, ForeignKey(&#34;teams.id&#34;))
+    license_id = Column(Integer, ForeignKey(&#34;licenses.id&#34;))
 
     # relationships for foreign keys, thus connecting table with ld_logs table
     b_logs = relationship(&#34;LDLog&#34;, back_populates=&#34;body_device&#34;)
+    license = relationship(&#34;License&#34;, back_populates=&#34;bodydevice_lic&#34;)
+    team = relationship(&#34;Team&#34;, back_populates=&#34;body_devices&#34;)
 
 
 class LDLog(Base):
@@ -174,7 +193,19 @@ class LDLog(Base):
     # tables
     ldpc = relationship(&#34;PC&#34;, back_populates=&#34;ld_pc&#34;)
     head_device = relationship(&#34;HeadDevice&#34;, back_populates=&#34;h_logs&#34;)
-    body_device = relationship(&#34;BodyDevice&#34;, back_populates=&#34;b_logs&#34;)</code></pre>
+    body_device = relationship(&#34;BodyDevice&#34;, back_populates=&#34;b_logs&#34;)
+
+
+class User(Base):
+    &#34;&#34;&#34;
+    Class defining user in database with its own role
+    &#34;&#34;&#34;
+    __tablename__ = &#34;users&#34;
+
+    id = Column(Integer, primary_key=True, index=True)
+    username = Column(String, index=True, nullable=False)
+    password = Column(String, index=True, nullable=False)
+    role = Column(String, index=True, nullable=False)</code></pre>
 </details>
 </section>
 <section>
@@ -210,9 +241,16 @@ for example, any mapped columns or relationships.</p></div>
 
     id = Column(Integer, primary_key=True, index=True)
     serial_number = Column(String, index=True, nullable=False)
+    inventory_number = Column(String, index=True, nullable=True)
+    comment = Column(String, index=True, nullable=True)
+
+    team_id = Column(Integer, ForeignKey(&#34;teams.id&#34;))
+    license_id = Column(Integer, ForeignKey(&#34;licenses.id&#34;))
 
     # relationships for foreign keys, thus connecting table with ld_logs table
-    b_logs = relationship(&#34;LDLog&#34;, back_populates=&#34;body_device&#34;)</code></pre>
+    b_logs = relationship(&#34;LDLog&#34;, back_populates=&#34;body_device&#34;)
+    license = relationship(&#34;License&#34;, back_populates=&#34;bodydevice_lic&#34;)
+    team = relationship(&#34;Team&#34;, back_populates=&#34;body_devices&#34;)</code></pre>
 </details>
 <h3>Ancestors</h3>
 <ul class="hlist">
@@ -245,32 +283,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.BodyDevice.id"><code class="name">var <span class="ident">id</span></code></dt>
-<dd>
-<div class="desc"></div>
-<details class="source">
-<summary>
-<span>Expand source code</span>
-</summary>
-<pre><code class="python">def __get__(self, instance, owner):
-    if instance is None:
-        return self
-
-    dict_ = instance_dict(instance)
-    if self._supports_population and self.key in dict_:
-        return dict_[self.key]
-    else:
-        try:
-            state = instance_state(instance)
-        except AttributeError as err:
-            util.raise_(
-                orm_exc.UnmappedInstanceError(instance),
-                replace_context=err,
-            )
-        return self.impl.get(state, dict_)</code></pre>
-</details>
-</dd>
-<dt id="sql_app.models.BodyDevice.serial_number"><code class="name">var <span class="ident">serial_number</span></code></dt>
+<dt id="sql_app.models.BodyDevice.comment"><code class="name">var <span class="ident">comment</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -295,48 +308,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-</dl>
-</dd>
-<dt id="sql_app.models.Device"><code class="flex name class">
-<span>class <span class="ident">Device</span></span>
-<span>(</span><span>**kwargs)</span>
-</code></dt>
-<dd>
-<div class="desc"><p>Class defining database table devices</p>
-<p>A simple constructor that allows initialization from kwargs.</p>
-<p>Sets attributes on the constructed instance using the names and
-values in <code>kwargs</code>.</p>
-<p>Only keys that are present as
-attributes of the instance's class are allowed. These could be,
-for example, any mapped columns or relationships.</p></div>
-<details class="source">
-<summary>
-<span>Expand source code</span>
-</summary>
-<pre><code class="python">class Device(Base):
-    &#34;&#34;&#34;
-    Class defining database table devices
-    &#34;&#34;&#34;
-    __tablename__ = &#34;devices&#34;
-
-    id = Column(Integer, primary_key=True, index=True)
-    vendor_id = Column(String, index=True, nullable=False)
-    product_id = Column(String, index=True, nullable=False)
-    serial_number = Column(String, index=True, nullable=False)
-    assigned = Column(Boolean, index=True, nullable=False)
-
-    # relationships for foreign keys, thus connecting table with usb_logs and licenses
-    # tables
-    logs = relationship(&#34;USBLog&#34;, back_populates=&#34;device&#34;)
-    licenses = relationship(&#34;DeviceLicense&#34;, back_populates=&#34;device_lic&#34;)</code></pre>
-</details>
-<h3>Ancestors</h3>
-<ul class="hlist">
-<li>sqlalchemy.orm.decl_api.Base</li>
-</ul>
-<h3>Instance variables</h3>
-<dl>
-<dt id="sql_app.models.Device.assigned"><code class="name">var <span class="ident">assigned</span></code></dt>
+<dt id="sql_app.models.BodyDevice.id"><code class="name">var <span class="ident">id</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -361,7 +333,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.Device.id"><code class="name">var <span class="ident">id</span></code></dt>
+<dt id="sql_app.models.BodyDevice.inventory_number"><code class="name">var <span class="ident">inventory_number</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -386,7 +358,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.Device.licenses"><code class="name">var <span class="ident">licenses</span></code></dt>
+<dt id="sql_app.models.BodyDevice.license"><code class="name">var <span class="ident">license</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -411,7 +383,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.Device.logs"><code class="name">var <span class="ident">logs</span></code></dt>
+<dt id="sql_app.models.BodyDevice.license_id"><code class="name">var <span class="ident">license_id</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -436,7 +408,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.Device.product_id"><code class="name">var <span class="ident">product_id</span></code></dt>
+<dt id="sql_app.models.BodyDevice.serial_number"><code class="name">var <span class="ident">serial_number</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -461,7 +433,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.Device.serial_number"><code class="name">var <span class="ident">serial_number</span></code></dt>
+<dt id="sql_app.models.BodyDevice.team"><code class="name">var <span class="ident">team</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -486,7 +458,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.Device.vendor_id"><code class="name">var <span class="ident">vendor_id</span></code></dt>
+<dt id="sql_app.models.BodyDevice.team_id"><code class="name">var <span class="ident">team_id</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -513,12 +485,12 @@ for example, any mapped columns or relationships.</p></div>
 </dd>
 </dl>
 </dd>
-<dt id="sql_app.models.DeviceLicense"><code class="flex name class">
-<span>class <span class="ident">DeviceLicense</span></span>
+<dt id="sql_app.models.Device"><code class="flex name class">
+<span>class <span class="ident">Device</span></span>
 <span>(</span><span>**kwargs)</span>
 </code></dt>
 <dd>
-<div class="desc"><p>Class defining database table devices_licenses</p>
+<div class="desc"><p>Class defining database table devices</p>
 <p>A simple constructor that allows initialization from kwargs.</p>
 <p>Sets attributes on the constructed instance using the names and
 values in <code>kwargs</code>.</p>
@@ -529,21 +501,26 @@ for example, any mapped columns or relationships.</p></div>
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">class DeviceLicense(Base):
+<pre><code class="python">class Device(Base):
     &#34;&#34;&#34;
-    Class defining database table devices_licenses
+    Class defining database table devices
     &#34;&#34;&#34;
-    __tablename__ = &#34;devices_licenses&#34;
+    __tablename__ = &#34;devices&#34;
 
     id = Column(Integer, primary_key=True, index=True)
-    device_id = Column(Integer, ForeignKey(&#34;devices.id&#34;))
-    license_id = Column(Integer, ForeignKey(&#34;licenses.id&#34;))
-    assigned_datetime = Column(String, index=True, nullable=False)
+    vendor_id = Column(String, index=True, nullable=False)
+    product_id = Column(String, index=True, nullable=False)
+    serial_number = Column(String, index=True, nullable=False)
+    inventory_number = Column(String, index=True, nullable=True)
+    comment = Column(String, index=True, nullable=True)
 
-    # relationships for foreign keys, thus connecting table with devices and licenses
+    team_id = Column(Integer, ForeignKey(&#34;teams.id&#34;))
+
+    # relationships for foreign keys, thus connecting table with usb_logs and licenses
     # tables
-    device_lic = relationship(&#34;Device&#34;, back_populates=&#34;licenses&#34;)
-    licenses = relationship(&#34;License&#34;, back_populates=&#34;devices&#34;)</code></pre>
+    logs = relationship(&#34;USBLog&#34;, back_populates=&#34;device&#34;)
+    licenses = relationship(&#34;DeviceLicense&#34;, back_populates=&#34;device_lic&#34;)
+    team = relationship(&#34;Team&#34;, back_populates=&#34;devices&#34;)</code></pre>
 </details>
 <h3>Ancestors</h3>
 <ul class="hlist">
@@ -551,7 +528,7 @@ for example, any mapped columns or relationships.</p></div>
 </ul>
 <h3>Instance variables</h3>
 <dl>
-<dt id="sql_app.models.DeviceLicense.assigned_datetime"><code class="name">var <span class="ident">assigned_datetime</span></code></dt>
+<dt id="sql_app.models.Device.comment"><code class="name">var <span class="ident">comment</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -576,7 +553,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.DeviceLicense.device_id"><code class="name">var <span class="ident">device_id</span></code></dt>
+<dt id="sql_app.models.Device.id"><code class="name">var <span class="ident">id</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -601,7 +578,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.DeviceLicense.device_lic"><code class="name">var <span class="ident">device_lic</span></code></dt>
+<dt id="sql_app.models.Device.inventory_number"><code class="name">var <span class="ident">inventory_number</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -626,7 +603,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.DeviceLicense.id"><code class="name">var <span class="ident">id</span></code></dt>
+<dt id="sql_app.models.Device.licenses"><code class="name">var <span class="ident">licenses</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -651,7 +628,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.DeviceLicense.license_id"><code class="name">var <span class="ident">license_id</span></code></dt>
+<dt id="sql_app.models.Device.logs"><code class="name">var <span class="ident">logs</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -676,7 +653,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.DeviceLicense.licenses"><code class="name">var <span class="ident">licenses</span></code></dt>
+<dt id="sql_app.models.Device.product_id"><code class="name">var <span class="ident">product_id</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -701,43 +678,32 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-</dl>
-</dd>
-<dt id="sql_app.models.HeadDevice"><code class="flex name class">
-<span>class <span class="ident">HeadDevice</span></span>
-<span>(</span><span>**kwargs)</span>
-</code></dt>
+<dt id="sql_app.models.Device.serial_number"><code class="name">var <span class="ident">serial_number</span></code></dt>
 <dd>
-<div class="desc"><p>Class defining database table head_devices</p>
-<p>A simple constructor that allows initialization from kwargs.</p>
-<p>Sets attributes on the constructed instance using the names and
-values in <code>kwargs</code>.</p>
-<p>Only keys that are present as
-attributes of the instance's class are allowed. These could be,
-for example, any mapped columns or relationships.</p></div>
+<div class="desc"></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">class HeadDevice(Base):
-    &#34;&#34;&#34;
-    Class defining database table head_devices
-    &#34;&#34;&#34;
-    __tablename__ = &#34;head_devices&#34;
-
-    id = Column(Integer, primary_key=True, index=True)
-    serial_number = Column(String, index=True, nullable=False)
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
 
-    # relationships for foreign keys, thus connecting table with ld_logs table
-    h_logs = relationship(&#34;LDLog&#34;, back_populates=&#34;head_device&#34;)</code></pre>
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
 </details>
-<h3>Ancestors</h3>
-<ul class="hlist">
-<li>sqlalchemy.orm.decl_api.Base</li>
-</ul>
-<h3>Instance variables</h3>
-<dl>
-<dt id="sql_app.models.HeadDevice.h_logs"><code class="name">var <span class="ident">h_logs</span></code></dt>
+</dd>
+<dt id="sql_app.models.Device.team"><code class="name">var <span class="ident">team</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -762,7 +728,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.HeadDevice.id"><code class="name">var <span class="ident">id</span></code></dt>
+<dt id="sql_app.models.Device.team_id"><code class="name">var <span class="ident">team_id</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -787,7 +753,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.HeadDevice.serial_number"><code class="name">var <span class="ident">serial_number</span></code></dt>
+<dt id="sql_app.models.Device.vendor_id"><code class="name">var <span class="ident">vendor_id</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -814,12 +780,12 @@ for example, any mapped columns or relationships.</p></div>
 </dd>
 </dl>
 </dd>
-<dt id="sql_app.models.LDLog"><code class="flex name class">
-<span>class <span class="ident">LDLog</span></span>
+<dt id="sql_app.models.DeviceLicense"><code class="flex name class">
+<span>class <span class="ident">DeviceLicense</span></span>
 <span>(</span><span>**kwargs)</span>
 </code></dt>
 <dd>
-<div class="desc"><p>Class defining database table ld_logs</p>
+<div class="desc"><p>Class defining database table devices_licenses</p>
 <p>A simple constructor that allows initialization from kwargs.</p>
 <p>Sets attributes on the constructed instance using the names and
 values in <code>kwargs</code>.</p>
@@ -830,24 +796,21 @@ for example, any mapped columns or relationships.</p></div>
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">class LDLog(Base):
+<pre><code class="python">class DeviceLicense(Base):
     &#34;&#34;&#34;
-    Class defining database table ld_logs
+    Class defining database table devices_licenses
     &#34;&#34;&#34;
-    __tablename__ = &#34;ld_logs&#34;
+    __tablename__ = &#34;devices_licenses&#34;
 
     id = Column(Integer, primary_key=True, index=True)
-    pc_id = Column(Integer, ForeignKey(&#34;pc.id&#34;))
-    timestamp = Column(DateTime(timezone=True), server_default=func.now())
-    status = Column(String, index=True, nullable=False)
-    head_id = Column(Integer, ForeignKey(&#34;head_devices.id&#34;))
-    body_id = Column(Integer, ForeignKey(&#34;body_devices.id&#34;))
+    device_id = Column(Integer, ForeignKey(&#34;devices.id&#34;))
+    license_id = Column(Integer, ForeignKey(&#34;licenses.id&#34;))
+    assigned_datetime = Column(String, index=True, nullable=False)
 
-    # relationships for foreign keys, thus connecting table with pc, head_devices and body_devices
+    # relationships for foreign keys, thus connecting table with devices and licenses
     # tables
-    ldpc = relationship(&#34;PC&#34;, back_populates=&#34;ld_pc&#34;)
-    head_device = relationship(&#34;HeadDevice&#34;, back_populates=&#34;h_logs&#34;)
-    body_device = relationship(&#34;BodyDevice&#34;, back_populates=&#34;b_logs&#34;)</code></pre>
+    device_lic = relationship(&#34;Device&#34;, back_populates=&#34;licenses&#34;)
+    licenses = relationship(&#34;License&#34;, back_populates=&#34;devices&#34;)</code></pre>
 </details>
 <h3>Ancestors</h3>
 <ul class="hlist">
@@ -855,7 +818,7 @@ for example, any mapped columns or relationships.</p></div>
 </ul>
 <h3>Instance variables</h3>
 <dl>
-<dt id="sql_app.models.LDLog.body_device"><code class="name">var <span class="ident">body_device</span></code></dt>
+<dt id="sql_app.models.DeviceLicense.assigned_datetime"><code class="name">var <span class="ident">assigned_datetime</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -880,7 +843,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.LDLog.body_id"><code class="name">var <span class="ident">body_id</span></code></dt>
+<dt id="sql_app.models.DeviceLicense.device_id"><code class="name">var <span class="ident">device_id</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -905,7 +868,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.LDLog.head_device"><code class="name">var <span class="ident">head_device</span></code></dt>
+<dt id="sql_app.models.DeviceLicense.device_lic"><code class="name">var <span class="ident">device_lic</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -930,7 +893,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.LDLog.head_id"><code class="name">var <span class="ident">head_id</span></code></dt>
+<dt id="sql_app.models.DeviceLicense.id"><code class="name">var <span class="ident">id</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -955,7 +918,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.LDLog.id"><code class="name">var <span class="ident">id</span></code></dt>
+<dt id="sql_app.models.DeviceLicense.license_id"><code class="name">var <span class="ident">license_id</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -980,7 +943,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.LDLog.ldpc"><code class="name">var <span class="ident">ldpc</span></code></dt>
+<dt id="sql_app.models.DeviceLicense.licenses"><code class="name">var <span class="ident">licenses</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1005,30 +968,491 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.LDLog.pc_id"><code class="name">var <span class="ident">pc_id</span></code></dt>
+</dl>
+</dd>
+<dt id="sql_app.models.HeadDevice"><code class="flex name class">
+<span>class <span class="ident">HeadDevice</span></span>
+<span>(</span><span>**kwargs)</span>
+</code></dt>
 <dd>
-<div class="desc"></div>
+<div class="desc"><p>Class defining database table head_devices</p>
+<p>A simple constructor that allows initialization from kwargs.</p>
+<p>Sets attributes on the constructed instance using the names and
+values in <code>kwargs</code>.</p>
+<p>Only keys that are present as
+attributes of the instance's class are allowed. These could be,
+for example, any mapped columns or relationships.</p></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">def __get__(self, instance, owner):
-    if instance is None:
-        return self
+<pre><code class="python">class HeadDevice(Base):
+    &#34;&#34;&#34;
+    Class defining database table head_devices
+    &#34;&#34;&#34;
+    __tablename__ = &#34;head_devices&#34;
 
-    dict_ = instance_dict(instance)
-    if self._supports_population and self.key in dict_:
-        return dict_[self.key]
-    else:
-        try:
-            state = instance_state(instance)
-        except AttributeError as err:
-            util.raise_(
-                orm_exc.UnmappedInstanceError(instance),
-                replace_context=err,
-            )
-        return self.impl.get(state, dict_)</code></pre>
-</details>
+    id = Column(Integer, primary_key=True, index=True)
+    serial_number = Column(String, index=True, nullable=False)
+    inventory_number = Column(String, index=True, nullable=True)
+    comment = Column(String, index=True, nullable=True)
+
+    team_id = Column(Integer, ForeignKey(&#34;teams.id&#34;))
+    license_id = Column(Integer, ForeignKey(&#34;licenses.id&#34;))
+
+    # relationships for foreign keys, thus connecting table with ld_logs table
+    h_logs = relationship(&#34;LDLog&#34;, back_populates=&#34;head_device&#34;)
+    license = relationship(&#34;License&#34;, back_populates=&#34;headdevice_lic&#34;)
+    team = relationship(&#34;Team&#34;, back_populates=&#34;head_devices&#34;)</code></pre>
+</details>
+<h3>Ancestors</h3>
+<ul class="hlist">
+<li>sqlalchemy.orm.decl_api.Base</li>
+</ul>
+<h3>Instance variables</h3>
+<dl>
+<dt id="sql_app.models.HeadDevice.comment"><code class="name">var <span class="ident">comment</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.models.HeadDevice.h_logs"><code class="name">var <span class="ident">h_logs</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.models.HeadDevice.id"><code class="name">var <span class="ident">id</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.models.HeadDevice.inventory_number"><code class="name">var <span class="ident">inventory_number</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.models.HeadDevice.license"><code class="name">var <span class="ident">license</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.models.HeadDevice.license_id"><code class="name">var <span class="ident">license_id</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.models.HeadDevice.serial_number"><code class="name">var <span class="ident">serial_number</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.models.HeadDevice.team"><code class="name">var <span class="ident">team</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.models.HeadDevice.team_id"><code class="name">var <span class="ident">team_id</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+</dl>
+</dd>
+<dt id="sql_app.models.LDLog"><code class="flex name class">
+<span>class <span class="ident">LDLog</span></span>
+<span>(</span><span>**kwargs)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Class defining database table ld_logs</p>
+<p>A simple constructor that allows initialization from kwargs.</p>
+<p>Sets attributes on the constructed instance using the names and
+values in <code>kwargs</code>.</p>
+<p>Only keys that are present as
+attributes of the instance's class are allowed. These could be,
+for example, any mapped columns or relationships.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">class LDLog(Base):
+    &#34;&#34;&#34;
+    Class defining database table ld_logs
+    &#34;&#34;&#34;
+    __tablename__ = &#34;ld_logs&#34;
+
+    id = Column(Integer, primary_key=True, index=True)
+    pc_id = Column(Integer, ForeignKey(&#34;pc.id&#34;))
+    timestamp = Column(DateTime(timezone=True), server_default=func.now())
+    status = Column(String, index=True, nullable=False)
+    head_id = Column(Integer, ForeignKey(&#34;head_devices.id&#34;))
+    body_id = Column(Integer, ForeignKey(&#34;body_devices.id&#34;))
+
+    # relationships for foreign keys, thus connecting table with pc, head_devices and body_devices
+    # tables
+    ldpc = relationship(&#34;PC&#34;, back_populates=&#34;ld_pc&#34;)
+    head_device = relationship(&#34;HeadDevice&#34;, back_populates=&#34;h_logs&#34;)
+    body_device = relationship(&#34;BodyDevice&#34;, back_populates=&#34;b_logs&#34;)</code></pre>
+</details>
+<h3>Ancestors</h3>
+<ul class="hlist">
+<li>sqlalchemy.orm.decl_api.Base</li>
+</ul>
+<h3>Instance variables</h3>
+<dl>
+<dt id="sql_app.models.LDLog.body_device"><code class="name">var <span class="ident">body_device</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.models.LDLog.body_id"><code class="name">var <span class="ident">body_id</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.models.LDLog.head_device"><code class="name">var <span class="ident">head_device</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.models.LDLog.head_id"><code class="name">var <span class="ident">head_id</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.models.LDLog.id"><code class="name">var <span class="ident">id</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.models.LDLog.ldpc"><code class="name">var <span class="ident">ldpc</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.models.LDLog.pc_id"><code class="name">var <span class="ident">pc_id</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
 </dd>
 <dt id="sql_app.models.LDLog.status"><code class="name">var <span class="ident">status</span></code></dt>
 <dd>
@@ -1105,19 +1529,72 @@ for example, any mapped columns or relationships.</p></div>
     __tablename__ = &#34;licenses&#34;
 
     id = Column(Integer, primary_key=True, index=True)
-    name = Column(String, index=True, nullable=False)
-    expiration_date = Column(DateTime(timezone=True), server_default=func.now())
+    name = Column(String, index=True, nullable=True)
+    license_id = Column(String, index=True, nullable=False)
+    expiration_date = Column(DateTime(timezone=True), nullable=True)
 
     # relationships for foreign keys, thus connecting table with devices table
-    devices = relationship(&#34;DeviceLicense&#34;, back_populates=&#34;licenses&#34;)</code></pre>
+    devices = relationship(&#34;DeviceLicense&#34;, back_populates=&#34;licenses&#34;)
+    bodydevice_lic = relationship(&#34;BodyDevice&#34;, back_populates=&#34;license&#34;)
+    headdevice_lic = relationship(&#34;HeadDevice&#34;, back_populates=&#34;license&#34;)</code></pre>
+</details>
+<h3>Ancestors</h3>
+<ul class="hlist">
+<li>sqlalchemy.orm.decl_api.Base</li>
+</ul>
+<h3>Instance variables</h3>
+<dl>
+<dt id="sql_app.models.License.bodydevice_lic"><code class="name">var <span class="ident">bodydevice_lic</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.models.License.devices"><code class="name">var <span class="ident">devices</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
 </details>
-<h3>Ancestors</h3>
-<ul class="hlist">
-<li>sqlalchemy.orm.decl_api.Base</li>
-</ul>
-<h3>Instance variables</h3>
-<dl>
-<dt id="sql_app.models.License.devices"><code class="name">var <span class="ident">devices</span></code></dt>
+</dd>
+<dt id="sql_app.models.License.expiration_date"><code class="name">var <span class="ident">expiration_date</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1142,7 +1619,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.License.expiration_date"><code class="name">var <span class="ident">expiration_date</span></code></dt>
+<dt id="sql_app.models.License.headdevice_lic"><code class="name">var <span class="ident">headdevice_lic</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1192,6 +1669,31 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
+<dt id="sql_app.models.License.license_id"><code class="name">var <span class="ident">license_id</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
 <dt id="sql_app.models.License.name"><code class="name">var <span class="ident">name</span></code></dt>
 <dd>
 <div class="desc"></div>
@@ -1244,12 +1746,9 @@ for example, any mapped columns or relationships.</p></div>
     id = Column(Integer, primary_key=True, index=True)
     username = Column(String, index=True, nullable=False)
     hostname = Column(String, index=True, nullable=False)
-    assigned = Column(Boolean, index=True, nullable=False)
-    team_id = Column(Integer, ForeignKey(&#34;teams.id&#34;))
 
     # relationships for foreign keys, thus connecting table with teams, usb_logs and ld_logs
     # tables
-    team = relationship(&#34;Team&#34;, back_populates=&#34;pcs&#34;)
     logs_pc = relationship(&#34;USBLog&#34;, back_populates=&#34;pc&#34;)
     ld_pc = relationship(&#34;LDLog&#34;, back_populates=&#34;ldpc&#34;)</code></pre>
 </details>
@@ -1259,7 +1758,7 @@ for example, any mapped columns or relationships.</p></div>
 </ul>
 <h3>Instance variables</h3>
 <dl>
-<dt id="sql_app.models.PC.assigned"><code class="name">var <span class="ident">assigned</span></code></dt>
+<dt id="sql_app.models.PC.hostname"><code class="name">var <span class="ident">hostname</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1284,7 +1783,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.PC.hostname"><code class="name">var <span class="ident">hostname</span></code></dt>
+<dt id="sql_app.models.PC.id"><code class="name">var <span class="ident">id</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1309,7 +1808,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.PC.id"><code class="name">var <span class="ident">id</span></code></dt>
+<dt id="sql_app.models.PC.ld_pc"><code class="name">var <span class="ident">ld_pc</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1334,7 +1833,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.PC.ld_pc"><code class="name">var <span class="ident">ld_pc</span></code></dt>
+<dt id="sql_app.models.PC.logs_pc"><code class="name">var <span class="ident">logs_pc</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1359,7 +1858,69 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.PC.logs_pc"><code class="name">var <span class="ident">logs_pc</span></code></dt>
+<dt id="sql_app.models.PC.username"><code class="name">var <span class="ident">username</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+</dl>
+</dd>
+<dt id="sql_app.models.Team"><code class="flex name class">
+<span>class <span class="ident">Team</span></span>
+<span>(</span><span>**kwargs)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Class defining database table teams</p>
+<p>A simple constructor that allows initialization from kwargs.</p>
+<p>Sets attributes on the constructed instance using the names and
+values in <code>kwargs</code>.</p>
+<p>Only keys that are present as
+attributes of the instance's class are allowed. These could be,
+for example, any mapped columns or relationships.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">class Team(Base):
+    &#34;&#34;&#34;
+    Class defining database table teams
+    &#34;&#34;&#34;
+    __tablename__ = &#34;teams&#34;
+
+    id = Column(Integer, primary_key=True, index=True)
+    name = Column(String, index=True, nullable=False)
+
+    devices = relationship(&#34;Device&#34;, back_populates=&#34;team&#34;)
+    body_devices = relationship(&#34;BodyDevice&#34;, back_populates=&#34;team&#34;)
+    head_devices = relationship(&#34;HeadDevice&#34;, back_populates=&#34;team&#34;)</code></pre>
+</details>
+<h3>Ancestors</h3>
+<ul class="hlist">
+<li>sqlalchemy.orm.decl_api.Base</li>
+</ul>
+<h3>Instance variables</h3>
+<dl>
+<dt id="sql_app.models.Team.body_devices"><code class="name">var <span class="ident">body_devices</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1384,7 +1945,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.PC.team"><code class="name">var <span class="ident">team</span></code></dt>
+<dt id="sql_app.models.Team.devices"><code class="name">var <span class="ident">devices</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1409,7 +1970,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.PC.team_id"><code class="name">var <span class="ident">team_id</span></code></dt>
+<dt id="sql_app.models.Team.head_devices"><code class="name">var <span class="ident">head_devices</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1434,7 +1995,32 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.PC.username"><code class="name">var <span class="ident">username</span></code></dt>
+<dt id="sql_app.models.Team.id"><code class="name">var <span class="ident">id</span></code></dt>
+<dd>
+<div class="desc"></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
+
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
+</details>
+</dd>
+<dt id="sql_app.models.Team.name"><code class="name">var <span class="ident">name</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1461,12 +2047,12 @@ for example, any mapped columns or relationships.</p></div>
 </dd>
 </dl>
 </dd>
-<dt id="sql_app.models.Team"><code class="flex name class">
-<span>class <span class="ident">Team</span></span>
+<dt id="sql_app.models.USBLog"><code class="flex name class">
+<span>class <span class="ident">USBLog</span></span>
 <span>(</span><span>**kwargs)</span>
 </code></dt>
 <dd>
-<div class="desc"><p>Class defining database table teams</p>
+<div class="desc"><p>Class defining database table usb_logs</p>
 <p>A simple constructor that allows initialization from kwargs.</p>
 <p>Sets attributes on the constructed instance using the names and
 values in <code>kwargs</code>.</p>
@@ -1477,17 +2063,22 @@ for example, any mapped columns or relationships.</p></div>
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">class Team(Base):
+<pre><code class="python">class USBLog(Base):
     &#34;&#34;&#34;
-    Class defining database table teams
+    Class defining database table usb_logs
     &#34;&#34;&#34;
-    __tablename__ = &#34;teams&#34;
+    __tablename__ = &#34;usb_logs&#34;
 
     id = Column(Integer, primary_key=True, index=True)
-    name = Column(String, index=True, nullable=False)
+    pc_id = Column(Integer, ForeignKey(&#34;pc.id&#34;))
+    timestamp = Column(DateTime(timezone=True), server_default=func.now())
+    status = Column(String, index=True, nullable=False)
+    device_id = Column(Integer, ForeignKey(&#34;devices.id&#34;))
 
-    # relationships for foreign keys, thus connecting table with pc table
-    pcs = relationship(&#34;PC&#34;, back_populates=&#34;team&#34;)</code></pre>
+    # relationships for foreign keys, thus connecting table with devices and pc
+    # tables
+    device = relationship(&#34;Device&#34;, back_populates=&#34;logs&#34;)
+    pc = relationship(&#34;PC&#34;, back_populates=&#34;logs_pc&#34;)</code></pre>
 </details>
 <h3>Ancestors</h3>
 <ul class="hlist">
@@ -1495,7 +2086,7 @@ for example, any mapped columns or relationships.</p></div>
 </ul>
 <h3>Instance variables</h3>
 <dl>
-<dt id="sql_app.models.Team.id"><code class="name">var <span class="ident">id</span></code></dt>
+<dt id="sql_app.models.USBLog.device"><code class="name">var <span class="ident">device</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1520,7 +2111,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.Team.name"><code class="name">var <span class="ident">name</span></code></dt>
+<dt id="sql_app.models.USBLog.device_id"><code class="name">var <span class="ident">device_id</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1545,7 +2136,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.Team.pcs"><code class="name">var <span class="ident">pcs</span></code></dt>
+<dt id="sql_app.models.USBLog.id"><code class="name">var <span class="ident">id</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1570,48 +2161,32 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-</dl>
-</dd>
-<dt id="sql_app.models.USBLog"><code class="flex name class">
-<span>class <span class="ident">USBLog</span></span>
-<span>(</span><span>**kwargs)</span>
-</code></dt>
+<dt id="sql_app.models.USBLog.pc"><code class="name">var <span class="ident">pc</span></code></dt>
 <dd>
-<div class="desc"><p>Class defining database table usb_logs</p>
-<p>A simple constructor that allows initialization from kwargs.</p>
-<p>Sets attributes on the constructed instance using the names and
-values in <code>kwargs</code>.</p>
-<p>Only keys that are present as
-attributes of the instance's class are allowed. These could be,
-for example, any mapped columns or relationships.</p></div>
+<div class="desc"></div>
 <details class="source">
 <summary>
 <span>Expand source code</span>
 </summary>
-<pre><code class="python">class USBLog(Base):
-    &#34;&#34;&#34;
-    Class defining database table usb_logs
-    &#34;&#34;&#34;
-    __tablename__ = &#34;usb_logs&#34;
-
-    id = Column(Integer, primary_key=True, index=True)
-    pc_id = Column(Integer, ForeignKey(&#34;pc.id&#34;))
-    timestamp = Column(DateTime(timezone=True), server_default=func.now())
-    status = Column(String, index=True, nullable=False)
-    device_id = Column(Integer, ForeignKey(&#34;devices.id&#34;))
+<pre><code class="python">def __get__(self, instance, owner):
+    if instance is None:
+        return self
 
-    # relationships for foreign keys, thus connecting table with devices and pc
-    # tables
-    device = relationship(&#34;Device&#34;, back_populates=&#34;logs&#34;)
-    pc = relationship(&#34;PC&#34;, back_populates=&#34;logs_pc&#34;)</code></pre>
+    dict_ = instance_dict(instance)
+    if self._supports_population and self.key in dict_:
+        return dict_[self.key]
+    else:
+        try:
+            state = instance_state(instance)
+        except AttributeError as err:
+            util.raise_(
+                orm_exc.UnmappedInstanceError(instance),
+                replace_context=err,
+            )
+        return self.impl.get(state, dict_)</code></pre>
 </details>
-<h3>Ancestors</h3>
-<ul class="hlist">
-<li>sqlalchemy.orm.decl_api.Base</li>
-</ul>
-<h3>Instance variables</h3>
-<dl>
-<dt id="sql_app.models.USBLog.device"><code class="name">var <span class="ident">device</span></code></dt>
+</dd>
+<dt id="sql_app.models.USBLog.pc_id"><code class="name">var <span class="ident">pc_id</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1636,7 +2211,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.USBLog.device_id"><code class="name">var <span class="ident">device_id</span></code></dt>
+<dt id="sql_app.models.USBLog.status"><code class="name">var <span class="ident">status</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1661,7 +2236,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.USBLog.id"><code class="name">var <span class="ident">id</span></code></dt>
+<dt id="sql_app.models.USBLog.timestamp"><code class="name">var <span class="ident">timestamp</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1686,7 +2261,42 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.USBLog.pc"><code class="name">var <span class="ident">pc</span></code></dt>
+</dl>
+</dd>
+<dt id="sql_app.models.User"><code class="flex name class">
+<span>class <span class="ident">User</span></span>
+<span>(</span><span>**kwargs)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Class defining user in database with its own role</p>
+<p>A simple constructor that allows initialization from kwargs.</p>
+<p>Sets attributes on the constructed instance using the names and
+values in <code>kwargs</code>.</p>
+<p>Only keys that are present as
+attributes of the instance's class are allowed. These could be,
+for example, any mapped columns or relationships.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">class User(Base):
+    &#34;&#34;&#34;
+    Class defining user in database with its own role
+    &#34;&#34;&#34;
+    __tablename__ = &#34;users&#34;
+
+    id = Column(Integer, primary_key=True, index=True)
+    username = Column(String, index=True, nullable=False)
+    password = Column(String, index=True, nullable=False)
+    role = Column(String, index=True, nullable=False)</code></pre>
+</details>
+<h3>Ancestors</h3>
+<ul class="hlist">
+<li>sqlalchemy.orm.decl_api.Base</li>
+</ul>
+<h3>Instance variables</h3>
+<dl>
+<dt id="sql_app.models.User.id"><code class="name">var <span class="ident">id</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1711,7 +2321,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.USBLog.pc_id"><code class="name">var <span class="ident">pc_id</span></code></dt>
+<dt id="sql_app.models.User.password"><code class="name">var <span class="ident">password</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1736,7 +2346,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.USBLog.status"><code class="name">var <span class="ident">status</span></code></dt>
+<dt id="sql_app.models.User.role"><code class="name">var <span class="ident">role</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1761,7 +2371,7 @@ for example, any mapped columns or relationships.</p></div>
         return self.impl.get(state, dict_)</code></pre>
 </details>
 </dd>
-<dt id="sql_app.models.USBLog.timestamp"><code class="name">var <span class="ident">timestamp</span></code></dt>
+<dt id="sql_app.models.User.username"><code class="name">var <span class="ident">username</span></code></dt>
 <dd>
 <div class="desc"></div>
 <details class="source">
@@ -1806,21 +2416,30 @@ for example, any mapped columns or relationships.</p></div>
 <ul>
 <li>
 <h4><code><a title="sql_app.models.BodyDevice" href="#sql_app.models.BodyDevice">BodyDevice</a></code></h4>
-<ul class="">
+<ul class="two-column">
 <li><code><a title="sql_app.models.BodyDevice.b_logs" href="#sql_app.models.BodyDevice.b_logs">b_logs</a></code></li>
+<li><code><a title="sql_app.models.BodyDevice.comment" href="#sql_app.models.BodyDevice.comment">comment</a></code></li>
 <li><code><a title="sql_app.models.BodyDevice.id" href="#sql_app.models.BodyDevice.id">id</a></code></li>
+<li><code><a title="sql_app.models.BodyDevice.inventory_number" href="#sql_app.models.BodyDevice.inventory_number">inventory_number</a></code></li>
+<li><code><a title="sql_app.models.BodyDevice.license" href="#sql_app.models.BodyDevice.license">license</a></code></li>
+<li><code><a title="sql_app.models.BodyDevice.license_id" href="#sql_app.models.BodyDevice.license_id">license_id</a></code></li>
 <li><code><a title="sql_app.models.BodyDevice.serial_number" href="#sql_app.models.BodyDevice.serial_number">serial_number</a></code></li>
+<li><code><a title="sql_app.models.BodyDevice.team" href="#sql_app.models.BodyDevice.team">team</a></code></li>
+<li><code><a title="sql_app.models.BodyDevice.team_id" href="#sql_app.models.BodyDevice.team_id">team_id</a></code></li>
 </ul>
 </li>
 <li>
 <h4><code><a title="sql_app.models.Device" href="#sql_app.models.Device">Device</a></code></h4>
 <ul class="two-column">
-<li><code><a title="sql_app.models.Device.assigned" href="#sql_app.models.Device.assigned">assigned</a></code></li>
+<li><code><a title="sql_app.models.Device.comment" href="#sql_app.models.Device.comment">comment</a></code></li>
 <li><code><a title="sql_app.models.Device.id" href="#sql_app.models.Device.id">id</a></code></li>
+<li><code><a title="sql_app.models.Device.inventory_number" href="#sql_app.models.Device.inventory_number">inventory_number</a></code></li>
 <li><code><a title="sql_app.models.Device.licenses" href="#sql_app.models.Device.licenses">licenses</a></code></li>
 <li><code><a title="sql_app.models.Device.logs" href="#sql_app.models.Device.logs">logs</a></code></li>
 <li><code><a title="sql_app.models.Device.product_id" href="#sql_app.models.Device.product_id">product_id</a></code></li>
 <li><code><a title="sql_app.models.Device.serial_number" href="#sql_app.models.Device.serial_number">serial_number</a></code></li>
+<li><code><a title="sql_app.models.Device.team" href="#sql_app.models.Device.team">team</a></code></li>
+<li><code><a title="sql_app.models.Device.team_id" href="#sql_app.models.Device.team_id">team_id</a></code></li>
 <li><code><a title="sql_app.models.Device.vendor_id" href="#sql_app.models.Device.vendor_id">vendor_id</a></code></li>
 </ul>
 </li>
@@ -1837,10 +2456,16 @@ for example, any mapped columns or relationships.</p></div>
 </li>
 <li>
 <h4><code><a title="sql_app.models.HeadDevice" href="#sql_app.models.HeadDevice">HeadDevice</a></code></h4>
-<ul class="">
+<ul class="two-column">
+<li><code><a title="sql_app.models.HeadDevice.comment" href="#sql_app.models.HeadDevice.comment">comment</a></code></li>
 <li><code><a title="sql_app.models.HeadDevice.h_logs" href="#sql_app.models.HeadDevice.h_logs">h_logs</a></code></li>
 <li><code><a title="sql_app.models.HeadDevice.id" href="#sql_app.models.HeadDevice.id">id</a></code></li>
+<li><code><a title="sql_app.models.HeadDevice.inventory_number" href="#sql_app.models.HeadDevice.inventory_number">inventory_number</a></code></li>
+<li><code><a title="sql_app.models.HeadDevice.license" href="#sql_app.models.HeadDevice.license">license</a></code></li>
+<li><code><a title="sql_app.models.HeadDevice.license_id" href="#sql_app.models.HeadDevice.license_id">license_id</a></code></li>
 <li><code><a title="sql_app.models.HeadDevice.serial_number" href="#sql_app.models.HeadDevice.serial_number">serial_number</a></code></li>
+<li><code><a title="sql_app.models.HeadDevice.team" href="#sql_app.models.HeadDevice.team">team</a></code></li>
+<li><code><a title="sql_app.models.HeadDevice.team_id" href="#sql_app.models.HeadDevice.team_id">team_id</a></code></li>
 </ul>
 </li>
 <li>
@@ -1859,32 +2484,34 @@ for example, any mapped columns or relationships.</p></div>
 </li>
 <li>
 <h4><code><a title="sql_app.models.License" href="#sql_app.models.License">License</a></code></h4>
-<ul class="">
+<ul class="two-column">
+<li><code><a title="sql_app.models.License.bodydevice_lic" href="#sql_app.models.License.bodydevice_lic">bodydevice_lic</a></code></li>
 <li><code><a title="sql_app.models.License.devices" href="#sql_app.models.License.devices">devices</a></code></li>
 <li><code><a title="sql_app.models.License.expiration_date" href="#sql_app.models.License.expiration_date">expiration_date</a></code></li>
+<li><code><a title="sql_app.models.License.headdevice_lic" href="#sql_app.models.License.headdevice_lic">headdevice_lic</a></code></li>
 <li><code><a title="sql_app.models.License.id" href="#sql_app.models.License.id">id</a></code></li>
+<li><code><a title="sql_app.models.License.license_id" href="#sql_app.models.License.license_id">license_id</a></code></li>
 <li><code><a title="sql_app.models.License.name" href="#sql_app.models.License.name">name</a></code></li>
 </ul>
 </li>
 <li>
 <h4><code><a title="sql_app.models.PC" href="#sql_app.models.PC">PC</a></code></h4>
-<ul class="two-column">
-<li><code><a title="sql_app.models.PC.assigned" href="#sql_app.models.PC.assigned">assigned</a></code></li>
+<ul class="">
 <li><code><a title="sql_app.models.PC.hostname" href="#sql_app.models.PC.hostname">hostname</a></code></li>
 <li><code><a title="sql_app.models.PC.id" href="#sql_app.models.PC.id">id</a></code></li>
 <li><code><a title="sql_app.models.PC.ld_pc" href="#sql_app.models.PC.ld_pc">ld_pc</a></code></li>
 <li><code><a title="sql_app.models.PC.logs_pc" href="#sql_app.models.PC.logs_pc">logs_pc</a></code></li>
-<li><code><a title="sql_app.models.PC.team" href="#sql_app.models.PC.team">team</a></code></li>
-<li><code><a title="sql_app.models.PC.team_id" href="#sql_app.models.PC.team_id">team_id</a></code></li>
 <li><code><a title="sql_app.models.PC.username" href="#sql_app.models.PC.username">username</a></code></li>
 </ul>
 </li>
 <li>
 <h4><code><a title="sql_app.models.Team" href="#sql_app.models.Team">Team</a></code></h4>
 <ul class="">
+<li><code><a title="sql_app.models.Team.body_devices" href="#sql_app.models.Team.body_devices">body_devices</a></code></li>
+<li><code><a title="sql_app.models.Team.devices" href="#sql_app.models.Team.devices">devices</a></code></li>
+<li><code><a title="sql_app.models.Team.head_devices" href="#sql_app.models.Team.head_devices">head_devices</a></code></li>
 <li><code><a title="sql_app.models.Team.id" href="#sql_app.models.Team.id">id</a></code></li>
 <li><code><a title="sql_app.models.Team.name" href="#sql_app.models.Team.name">name</a></code></li>
-<li><code><a title="sql_app.models.Team.pcs" href="#sql_app.models.Team.pcs">pcs</a></code></li>
 </ul>
 </li>
 <li>
@@ -1899,6 +2526,15 @@ for example, any mapped columns or relationships.</p></div>
 <li><code><a title="sql_app.models.USBLog.timestamp" href="#sql_app.models.USBLog.timestamp">timestamp</a></code></li>
 </ul>
 </li>
+<li>
+<h4><code><a title="sql_app.models.User" href="#sql_app.models.User">User</a></code></h4>
+<ul class="">
+<li><code><a title="sql_app.models.User.id" href="#sql_app.models.User.id">id</a></code></li>
+<li><code><a title="sql_app.models.User.password" href="#sql_app.models.User.password">password</a></code></li>
+<li><code><a title="sql_app.models.User.role" href="#sql_app.models.User.role">role</a></code></li>
+<li><code><a title="sql_app.models.User.username" href="#sql_app.models.User.username">username</a></code></li>
+</ul>
+</li>
 </ul>
 </li>
 </ul>
diff --git a/server/doc/sql_app/schemas.html b/server/doc/sql_app/schemas.html
index ffeb06a..d37e2ed 100644
--- a/server/doc/sql_app/schemas.html
+++ b/server/doc/sql_app/schemas.html
@@ -76,6 +76,8 @@ class DeviceBase(BaseModel):
     vendor_id: str
     product_id: str
     serial_number: str
+    inventory_number: str
+    comment: str
 
 
 class DeviceCreate(DeviceBase):
@@ -87,7 +89,6 @@ class Device(DeviceCreate):
     Class used for creating and reading devices entries
     &#34;&#34;&#34;
     id: int
-    assigned: bool
     logs: List[USBLog] = []
     licenses: List[DeviceLicense] = []
 
@@ -95,6 +96,15 @@ class Device(DeviceCreate):
         orm_mode = True
 
 
+class DeviceTemp(BaseModel):
+    &#34;&#34;&#34;
+    Class used for reading data from client
+    &#34;&#34;&#34;
+    vendor_id: str
+    product_id: str
+    serial_number: str
+
+
 class LDLogBase(BaseModel):
     timestamp: datetime
     status: str
@@ -118,6 +128,8 @@ class LDLog(LDLogCreate):
 
 class BodyDeviceBase(BaseModel):
     serial_number: str
+    inventory_number: str
+    comment: str
 
 
 class BodyDeviceCreate(BodyDeviceBase):
@@ -135,8 +147,17 @@ class BodyDevice(BodyDeviceCreate):
         orm_mode = True
 
 
+class BodyDeviceTemp(BaseModel):
+    &#34;&#34;&#34;
+    Class used for reading body device data from client
+    &#34;&#34;&#34;
+    serial_number: str
+
+
 class HeadDeviceBase(BaseModel):
     serial_number: str
+    inventory_number: str
+    comment: str
 
 
 class HeadDeviceCreate(HeadDeviceBase):
@@ -154,6 +175,13 @@ class HeadDevice(HeadDeviceCreate):
         orm_mode = True
 
 
+class HeadDeviceTemp(BaseModel):
+    &#34;&#34;&#34;
+    Class used for reading head device data from client
+    &#34;&#34;&#34;
+    serial_number: str
+
+
 class PCBase(BaseModel):
     username: str
     hostname: str
@@ -168,8 +196,8 @@ class PC(PCCreate):
     Class used for creating and reading pc entries
     &#34;&#34;&#34;
     id: int
-    assigned: bool
     logs_pc: List[USBLog] = []
+    logs_ld: List[LDLog] = []
 
     class Config:
         orm_mode = True
@@ -188,7 +216,7 @@ class Team(TeamCreate):
     Class used for creating and reading team entries
     &#34;&#34;&#34;
     id: int
-    pcs: List[PC] = []
+    devices: List[Device] = []
 
     class Config:
         orm_mode = True
@@ -196,6 +224,7 @@ class Team(TeamCreate):
 
 class LicenseBase(BaseModel):
     name: str
+    license_id: str
     expiration_date: date
 
 
@@ -209,6 +238,8 @@ class License(LicenseCreate):
     &#34;&#34;&#34;
     id: int
     devices: List[DeviceLicense] = []
+    head_devices: List[HeadDevice] = []
+    body_devices: List[BodyDevice] = []
 
     class Config:
         orm_mode = True
@@ -221,7 +252,7 @@ class USBTempBase(BaseModel):
     username: str
     hostname: str
     timestamp: str
-    device: DeviceBase
+    device: DeviceTemp
     status: str
 
 
@@ -244,8 +275,8 @@ class LDTempBase(BaseModel):
     username: str
     hostname: str
     timestamp: str
-    head_device: HeadDeviceBase
-    body_device: BodyDeviceBase
+    head_device: HeadDeviceTemp
+    body_device: BodyDeviceTemp
     status: str
 
 
@@ -258,6 +289,26 @@ class LDTemp(LDTempCreate):
     head_id: int
     body_id: int
 
+    class Config:
+        orm_mode = True
+
+
+class UserBase(BaseModel):
+    &#34;&#34;&#34;
+    Classes used for creating new User entry
+    &#34;&#34;&#34;
+    username: str
+    password: str
+    role: str
+
+
+class UserCreate(UserBase):
+    pass
+
+
+class User(UserCreate):
+    id: int
+
     class Config:
         orm_mode = True</code></pre>
 </details>
@@ -300,6 +351,11 @@ class LDTemp(LDTempCreate):
 <li>pydantic.main.BaseModel</li>
 <li>pydantic.utils.Representation</li>
 </ul>
+<h3>Subclasses</h3>
+<ul class="hlist">
+<li>pydantic.main.BodyDevice</li>
+<li>pydantic.main.BodyDevice</li>
+</ul>
 <h3>Class variables</h3>
 <dl>
 <dt id="sql_app.schemas.BodyDevice.Config"><code class="name">var <span class="ident">Config</span></code></dt>
@@ -328,7 +384,9 @@ class LDTemp(LDTempCreate):
 <span>Expand source code</span>
 </summary>
 <pre><code class="python">class BodyDeviceBase(BaseModel):
-    serial_number: str</code></pre>
+    serial_number: str
+    inventory_number: str
+    comment: str</code></pre>
 </details>
 <h3>Ancestors</h3>
 <ul class="hlist">
@@ -341,6 +399,14 @@ class LDTemp(LDTempCreate):
 </ul>
 <h3>Class variables</h3>
 <dl>
+<dt id="sql_app.schemas.BodyDeviceBase.comment"><code class="name">var <span class="ident">comment</span> : str</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt id="sql_app.schemas.BodyDeviceBase.inventory_number"><code class="name">var <span class="ident">inventory_number</span> : str</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
 <dt id="sql_app.schemas.BodyDeviceBase.serial_number"><code class="name">var <span class="ident">serial_number</span> : str</code></dt>
 <dd>
 <div class="desc"></div>
@@ -372,6 +438,37 @@ class LDTemp(LDTempCreate):
 <li><a title="sql_app.schemas.BodyDevice" href="#sql_app.schemas.BodyDevice">BodyDevice</a></li>
 </ul>
 </dd>
+<dt id="sql_app.schemas.BodyDeviceTemp"><code class="flex name class">
+<span>class <span class="ident">BodyDeviceTemp</span></span>
+<span>(</span><span>**data: Any)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Class used for reading body device data from client</p>
+<p>Create a new model by parsing and validating input data from keyword arguments.</p>
+<p>Raises ValidationError if the input data cannot be parsed to form a valid model.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">class BodyDeviceTemp(BaseModel):
+    &#34;&#34;&#34;
+    Class used for reading body device data from client
+    &#34;&#34;&#34;
+    serial_number: str</code></pre>
+</details>
+<h3>Ancestors</h3>
+<ul class="hlist">
+<li>pydantic.main.BaseModel</li>
+<li>pydantic.utils.Representation</li>
+</ul>
+<h3>Class variables</h3>
+<dl>
+<dt id="sql_app.schemas.BodyDeviceTemp.serial_number"><code class="name">var <span class="ident">serial_number</span> : str</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+</dl>
+</dd>
 <dt id="sql_app.schemas.Device"><code class="flex name class">
 <span>class <span class="ident">Device</span></span>
 <span>(</span><span>**data: Any)</span>
@@ -389,7 +486,6 @@ class LDTemp(LDTempCreate):
     Class used for creating and reading devices entries
     &#34;&#34;&#34;
     id: int
-    assigned: bool
     logs: List[USBLog] = []
     licenses: List[DeviceLicense] = []
 
@@ -415,6 +511,8 @@ class LDTemp(LDTempCreate):
 <li>pydantic.main.Device</li>
 <li>pydantic.main.Device</li>
 <li>pydantic.main.Device</li>
+<li>pydantic.main.Device</li>
+<li>pydantic.main.Device</li>
 </ul>
 <h3>Class variables</h3>
 <dl>
@@ -422,10 +520,6 @@ class LDTemp(LDTempCreate):
 <dd>
 <div class="desc"></div>
 </dd>
-<dt id="sql_app.schemas.Device.assigned"><code class="name">var <span class="ident">assigned</span> : bool</code></dt>
-<dd>
-<div class="desc"></div>
-</dd>
 <dt id="sql_app.schemas.Device.id"><code class="name">var <span class="ident">id</span> : int</code></dt>
 <dd>
 <div class="desc"></div>
@@ -454,7 +548,9 @@ class LDTemp(LDTempCreate):
 <pre><code class="python">class DeviceBase(BaseModel):
     vendor_id: str
     product_id: str
-    serial_number: str</code></pre>
+    serial_number: str
+    inventory_number: str
+    comment: str</code></pre>
 </details>
 <h3>Ancestors</h3>
 <ul class="hlist">
@@ -467,6 +563,14 @@ class LDTemp(LDTempCreate):
 </ul>
 <h3>Class variables</h3>
 <dl>
+<dt id="sql_app.schemas.DeviceBase.comment"><code class="name">var <span class="ident">comment</span> : str</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt id="sql_app.schemas.DeviceBase.inventory_number"><code class="name">var <span class="ident">inventory_number</span> : str</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
 <dt id="sql_app.schemas.DeviceBase.product_id"><code class="name">var <span class="ident">product_id</span> : str</code></dt>
 <dd>
 <div class="desc"></div>
@@ -550,6 +654,8 @@ class LDTemp(LDTempCreate):
 <li>pydantic.main.DeviceLicense</li>
 <li>pydantic.main.DeviceLicense</li>
 <li>pydantic.main.DeviceLicense</li>
+<li>pydantic.main.DeviceLicense</li>
+<li>pydantic.main.DeviceLicense</li>
 </ul>
 <h3>Class variables</h3>
 <dl>
@@ -629,6 +735,47 @@ class LDTemp(LDTempCreate):
 <li><a title="sql_app.schemas.DeviceLicense" href="#sql_app.schemas.DeviceLicense">DeviceLicense</a></li>
 </ul>
 </dd>
+<dt id="sql_app.schemas.DeviceTemp"><code class="flex name class">
+<span>class <span class="ident">DeviceTemp</span></span>
+<span>(</span><span>**data: Any)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Class used for reading data from client</p>
+<p>Create a new model by parsing and validating input data from keyword arguments.</p>
+<p>Raises ValidationError if the input data cannot be parsed to form a valid model.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">class DeviceTemp(BaseModel):
+    &#34;&#34;&#34;
+    Class used for reading data from client
+    &#34;&#34;&#34;
+    vendor_id: str
+    product_id: str
+    serial_number: str</code></pre>
+</details>
+<h3>Ancestors</h3>
+<ul class="hlist">
+<li>pydantic.main.BaseModel</li>
+<li>pydantic.utils.Representation</li>
+</ul>
+<h3>Class variables</h3>
+<dl>
+<dt id="sql_app.schemas.DeviceTemp.product_id"><code class="name">var <span class="ident">product_id</span> : str</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt id="sql_app.schemas.DeviceTemp.serial_number"><code class="name">var <span class="ident">serial_number</span> : str</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt id="sql_app.schemas.DeviceTemp.vendor_id"><code class="name">var <span class="ident">vendor_id</span> : str</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+</dl>
+</dd>
 <dt id="sql_app.schemas.HeadDevice"><code class="flex name class">
 <span>class <span class="ident">HeadDevice</span></span>
 <span>(</span><span>**data: Any)</span>
@@ -658,6 +805,11 @@ class LDTemp(LDTempCreate):
 <li>pydantic.main.BaseModel</li>
 <li>pydantic.utils.Representation</li>
 </ul>
+<h3>Subclasses</h3>
+<ul class="hlist">
+<li>pydantic.main.HeadDevice</li>
+<li>pydantic.main.HeadDevice</li>
+</ul>
 <h3>Class variables</h3>
 <dl>
 <dt id="sql_app.schemas.HeadDevice.Config"><code class="name">var <span class="ident">Config</span></code></dt>
@@ -686,7 +838,9 @@ class LDTemp(LDTempCreate):
 <span>Expand source code</span>
 </summary>
 <pre><code class="python">class HeadDeviceBase(BaseModel):
-    serial_number: str</code></pre>
+    serial_number: str
+    inventory_number: str
+    comment: str</code></pre>
 </details>
 <h3>Ancestors</h3>
 <ul class="hlist">
@@ -699,6 +853,14 @@ class LDTemp(LDTempCreate):
 </ul>
 <h3>Class variables</h3>
 <dl>
+<dt id="sql_app.schemas.HeadDeviceBase.comment"><code class="name">var <span class="ident">comment</span> : str</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt id="sql_app.schemas.HeadDeviceBase.inventory_number"><code class="name">var <span class="ident">inventory_number</span> : str</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
 <dt id="sql_app.schemas.HeadDeviceBase.serial_number"><code class="name">var <span class="ident">serial_number</span> : str</code></dt>
 <dd>
 <div class="desc"></div>
@@ -730,6 +892,37 @@ class LDTemp(LDTempCreate):
 <li><a title="sql_app.schemas.HeadDevice" href="#sql_app.schemas.HeadDevice">HeadDevice</a></li>
 </ul>
 </dd>
+<dt id="sql_app.schemas.HeadDeviceTemp"><code class="flex name class">
+<span>class <span class="ident">HeadDeviceTemp</span></span>
+<span>(</span><span>**data: Any)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Class used for reading head device data from client</p>
+<p>Create a new model by parsing and validating input data from keyword arguments.</p>
+<p>Raises ValidationError if the input data cannot be parsed to form a valid model.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">class HeadDeviceTemp(BaseModel):
+    &#34;&#34;&#34;
+    Class used for reading head device data from client
+    &#34;&#34;&#34;
+    serial_number: str</code></pre>
+</details>
+<h3>Ancestors</h3>
+<ul class="hlist">
+<li>pydantic.main.BaseModel</li>
+<li>pydantic.utils.Representation</li>
+</ul>
+<h3>Class variables</h3>
+<dl>
+<dt id="sql_app.schemas.HeadDeviceTemp.serial_number"><code class="name">var <span class="ident">serial_number</span> : str</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+</dl>
+</dd>
 <dt id="sql_app.schemas.LDLog"><code class="flex name class">
 <span>class <span class="ident">LDLog</span></span>
 <span>(</span><span>**data: Any)</span>
@@ -764,6 +957,14 @@ class LDTemp(LDTempCreate):
 <ul class="hlist">
 <li>pydantic.main.LDLog</li>
 <li>pydantic.main.LDLog</li>
+<li>pydantic.main.LDLog</li>
+<li>pydantic.main.LDLog</li>
+<li>pydantic.main.LDLog</li>
+<li>pydantic.main.LDLog</li>
+<li>pydantic.main.LDLog</li>
+<li>pydantic.main.LDLog</li>
+<li>pydantic.main.LDLog</li>
+<li>pydantic.main.LDLog</li>
 </ul>
 <h3>Class variables</h3>
 <dl>
@@ -912,8 +1113,8 @@ class LDTemp(LDTempCreate):
     username: str
     hostname: str
     timestamp: str
-    head_device: HeadDeviceBase
-    body_device: BodyDeviceBase
+    head_device: HeadDeviceTemp
+    body_device: BodyDeviceTemp
     status: str</code></pre>
 </details>
 <h3>Ancestors</h3>
@@ -927,11 +1128,11 @@ class LDTemp(LDTempCreate):
 </ul>
 <h3>Class variables</h3>
 <dl>
-<dt id="sql_app.schemas.LDTempBase.body_device"><code class="name">var <span class="ident">body_device</span> : <a title="sql_app.schemas.BodyDeviceBase" href="#sql_app.schemas.BodyDeviceBase">BodyDeviceBase</a></code></dt>
+<dt id="sql_app.schemas.LDTempBase.body_device"><code class="name">var <span class="ident">body_device</span> : <a title="sql_app.schemas.BodyDeviceTemp" href="#sql_app.schemas.BodyDeviceTemp">BodyDeviceTemp</a></code></dt>
 <dd>
 <div class="desc"></div>
 </dd>
-<dt id="sql_app.schemas.LDTempBase.head_device"><code class="name">var <span class="ident">head_device</span> : <a title="sql_app.schemas.HeadDeviceBase" href="#sql_app.schemas.HeadDeviceBase">HeadDeviceBase</a></code></dt>
+<dt id="sql_app.schemas.LDTempBase.head_device"><code class="name">var <span class="ident">head_device</span> : <a title="sql_app.schemas.HeadDeviceTemp" href="#sql_app.schemas.HeadDeviceTemp">HeadDeviceTemp</a></code></dt>
 <dd>
 <div class="desc"></div>
 </dd>
@@ -997,6 +1198,8 @@ class LDTemp(LDTempCreate):
     &#34;&#34;&#34;
     id: int
     devices: List[DeviceLicense] = []
+    head_devices: List[HeadDevice] = []
+    body_devices: List[BodyDevice] = []
 
     class Config:
         orm_mode = True</code></pre>
@@ -1019,10 +1222,18 @@ class LDTemp(LDTempCreate):
 <dd>
 <div class="desc"></div>
 </dd>
+<dt id="sql_app.schemas.License.body_devices"><code class="name">var <span class="ident">body_devices</span> : List[<a title="sql_app.schemas.BodyDevice" href="#sql_app.schemas.BodyDevice">BodyDevice</a>]</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
 <dt id="sql_app.schemas.License.devices"><code class="name">var <span class="ident">devices</span> : List[<a title="sql_app.schemas.DeviceLicense" href="#sql_app.schemas.DeviceLicense">DeviceLicense</a>]</code></dt>
 <dd>
 <div class="desc"></div>
 </dd>
+<dt id="sql_app.schemas.License.head_devices"><code class="name">var <span class="ident">head_devices</span> : List[<a title="sql_app.schemas.HeadDevice" href="#sql_app.schemas.HeadDevice">HeadDevice</a>]</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
 <dt id="sql_app.schemas.License.id"><code class="name">var <span class="ident">id</span> : int</code></dt>
 <dd>
 <div class="desc"></div>
@@ -1042,6 +1253,7 @@ class LDTemp(LDTempCreate):
 </summary>
 <pre><code class="python">class LicenseBase(BaseModel):
     name: str
+    license_id: str
     expiration_date: date</code></pre>
 </details>
 <h3>Ancestors</h3>
@@ -1059,6 +1271,10 @@ class LDTemp(LDTempCreate):
 <dd>
 <div class="desc"></div>
 </dd>
+<dt id="sql_app.schemas.LicenseBase.license_id"><code class="name">var <span class="ident">license_id</span> : str</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
 <dt id="sql_app.schemas.LicenseBase.name"><code class="name">var <span class="ident">name</span> : str</code></dt>
 <dd>
 <div class="desc"></div>
@@ -1107,8 +1323,8 @@ class LDTemp(LDTempCreate):
     Class used for creating and reading pc entries
     &#34;&#34;&#34;
     id: int
-    assigned: bool
     logs_pc: List[USBLog] = []
+    logs_ld: List[LDLog] = []
 
     class Config:
         orm_mode = True</code></pre>
@@ -1128,8 +1344,6 @@ class LDTemp(LDTempCreate):
 <li>pydantic.main.PC</li>
 <li>pydantic.main.PC</li>
 <li>pydantic.main.PC</li>
-<li>pydantic.main.PC</li>
-<li>pydantic.main.PC</li>
 </ul>
 <h3>Class variables</h3>
 <dl>
@@ -1137,11 +1351,11 @@ class LDTemp(LDTempCreate):
 <dd>
 <div class="desc"></div>
 </dd>
-<dt id="sql_app.schemas.PC.assigned"><code class="name">var <span class="ident">assigned</span> : bool</code></dt>
+<dt id="sql_app.schemas.PC.id"><code class="name">var <span class="ident">id</span> : int</code></dt>
 <dd>
 <div class="desc"></div>
 </dd>
-<dt id="sql_app.schemas.PC.id"><code class="name">var <span class="ident">id</span> : int</code></dt>
+<dt id="sql_app.schemas.PC.logs_ld"><code class="name">var <span class="ident">logs_ld</span> : List[<a title="sql_app.schemas.LDLog" href="#sql_app.schemas.LDLog">LDLog</a>]</code></dt>
 <dd>
 <div class="desc"></div>
 </dd>
@@ -1229,7 +1443,7 @@ class LDTemp(LDTempCreate):
     Class used for creating and reading team entries
     &#34;&#34;&#34;
     id: int
-    pcs: List[PC] = []
+    devices: List[Device] = []
 
     class Config:
         orm_mode = True</code></pre>
@@ -1252,11 +1466,11 @@ class LDTemp(LDTempCreate):
 <dd>
 <div class="desc"></div>
 </dd>
-<dt id="sql_app.schemas.Team.id"><code class="name">var <span class="ident">id</span> : int</code></dt>
+<dt id="sql_app.schemas.Team.devices"><code class="name">var <span class="ident">devices</span> : List[<a title="sql_app.schemas.Device" href="#sql_app.schemas.Device">Device</a>]</code></dt>
 <dd>
 <div class="desc"></div>
 </dd>
-<dt id="sql_app.schemas.Team.pcs"><code class="name">var <span class="ident">pcs</span> : List[<a title="sql_app.schemas.PC" href="#sql_app.schemas.PC">PC</a>]</code></dt>
+<dt id="sql_app.schemas.Team.id"><code class="name">var <span class="ident">id</span> : int</code></dt>
 <dd>
 <div class="desc"></div>
 </dd>
@@ -1512,7 +1726,7 @@ class LDTemp(LDTempCreate):
     username: str
     hostname: str
     timestamp: str
-    device: DeviceBase
+    device: DeviceTemp
     status: str</code></pre>
 </details>
 <h3>Ancestors</h3>
@@ -1527,7 +1741,7 @@ class LDTemp(LDTempCreate):
 </ul>
 <h3>Class variables</h3>
 <dl>
-<dt id="sql_app.schemas.USBTempBase.device"><code class="name">var <span class="ident">device</span> : <a title="sql_app.schemas.DeviceBase" href="#sql_app.schemas.DeviceBase">DeviceBase</a></code></dt>
+<dt id="sql_app.schemas.USBTempBase.device"><code class="name">var <span class="ident">device</span> : <a title="sql_app.schemas.DeviceTemp" href="#sql_app.schemas.DeviceTemp">DeviceTemp</a></code></dt>
 <dd>
 <div class="desc"></div>
 </dd>
@@ -1571,6 +1785,114 @@ class LDTemp(LDTempCreate):
 <li>pydantic.utils.Representation</li>
 </ul>
 </dd>
+<dt id="sql_app.schemas.User"><code class="flex name class">
+<span>class <span class="ident">User</span></span>
+<span>(</span><span>**data: Any)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Classes used for creating new User entry</p>
+<p>Create a new model by parsing and validating input data from keyword arguments.</p>
+<p>Raises ValidationError if the input data cannot be parsed to form a valid model.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">class User(UserCreate):
+    id: int
+
+    class Config:
+        orm_mode = True</code></pre>
+</details>
+<h3>Ancestors</h3>
+<ul class="hlist">
+<li><a title="sql_app.schemas.UserCreate" href="#sql_app.schemas.UserCreate">UserCreate</a></li>
+<li><a title="sql_app.schemas.UserBase" href="#sql_app.schemas.UserBase">UserBase</a></li>
+<li>pydantic.main.BaseModel</li>
+<li>pydantic.utils.Representation</li>
+</ul>
+<h3>Class variables</h3>
+<dl>
+<dt id="sql_app.schemas.User.Config"><code class="name">var <span class="ident">Config</span></code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt id="sql_app.schemas.User.id"><code class="name">var <span class="ident">id</span> : int</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+</dl>
+</dd>
+<dt id="sql_app.schemas.UserBase"><code class="flex name class">
+<span>class <span class="ident">UserBase</span></span>
+<span>(</span><span>**data: Any)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Classes used for creating new User entry</p>
+<p>Create a new model by parsing and validating input data from keyword arguments.</p>
+<p>Raises ValidationError if the input data cannot be parsed to form a valid model.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">class UserBase(BaseModel):
+    &#34;&#34;&#34;
+    Classes used for creating new User entry
+    &#34;&#34;&#34;
+    username: str
+    password: str
+    role: str</code></pre>
+</details>
+<h3>Ancestors</h3>
+<ul class="hlist">
+<li>pydantic.main.BaseModel</li>
+<li>pydantic.utils.Representation</li>
+</ul>
+<h3>Subclasses</h3>
+<ul class="hlist">
+<li><a title="sql_app.schemas.UserCreate" href="#sql_app.schemas.UserCreate">UserCreate</a></li>
+</ul>
+<h3>Class variables</h3>
+<dl>
+<dt id="sql_app.schemas.UserBase.password"><code class="name">var <span class="ident">password</span> : str</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt id="sql_app.schemas.UserBase.role"><code class="name">var <span class="ident">role</span> : str</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+<dt id="sql_app.schemas.UserBase.username"><code class="name">var <span class="ident">username</span> : str</code></dt>
+<dd>
+<div class="desc"></div>
+</dd>
+</dl>
+</dd>
+<dt id="sql_app.schemas.UserCreate"><code class="flex name class">
+<span>class <span class="ident">UserCreate</span></span>
+<span>(</span><span>**data: Any)</span>
+</code></dt>
+<dd>
+<div class="desc"><p>Classes used for creating new User entry</p>
+<p>Create a new model by parsing and validating input data from keyword arguments.</p>
+<p>Raises ValidationError if the input data cannot be parsed to form a valid model.</p></div>
+<details class="source">
+<summary>
+<span>Expand source code</span>
+</summary>
+<pre><code class="python">class UserCreate(UserBase):
+    pass</code></pre>
+</details>
+<h3>Ancestors</h3>
+<ul class="hlist">
+<li><a title="sql_app.schemas.UserBase" href="#sql_app.schemas.UserBase">UserBase</a></li>
+<li>pydantic.main.BaseModel</li>
+<li>pydantic.utils.Representation</li>
+</ul>
+<h3>Subclasses</h3>
+<ul class="hlist">
+<li><a title="sql_app.schemas.User" href="#sql_app.schemas.User">User</a></li>
+</ul>
+</dd>
 </dl>
 </section>
 </article>
@@ -1598,6 +1920,8 @@ class LDTemp(LDTempCreate):
 <li>
 <h4><code><a title="sql_app.schemas.BodyDeviceBase" href="#sql_app.schemas.BodyDeviceBase">BodyDeviceBase</a></code></h4>
 <ul class="">
+<li><code><a title="sql_app.schemas.BodyDeviceBase.comment" href="#sql_app.schemas.BodyDeviceBase.comment">comment</a></code></li>
+<li><code><a title="sql_app.schemas.BodyDeviceBase.inventory_number" href="#sql_app.schemas.BodyDeviceBase.inventory_number">inventory_number</a></code></li>
 <li><code><a title="sql_app.schemas.BodyDeviceBase.serial_number" href="#sql_app.schemas.BodyDeviceBase.serial_number">serial_number</a></code></li>
 </ul>
 </li>
@@ -1605,10 +1929,15 @@ class LDTemp(LDTempCreate):
 <h4><code><a title="sql_app.schemas.BodyDeviceCreate" href="#sql_app.schemas.BodyDeviceCreate">BodyDeviceCreate</a></code></h4>
 </li>
 <li>
+<h4><code><a title="sql_app.schemas.BodyDeviceTemp" href="#sql_app.schemas.BodyDeviceTemp">BodyDeviceTemp</a></code></h4>
+<ul class="">
+<li><code><a title="sql_app.schemas.BodyDeviceTemp.serial_number" href="#sql_app.schemas.BodyDeviceTemp.serial_number">serial_number</a></code></li>
+</ul>
+</li>
+<li>
 <h4><code><a title="sql_app.schemas.Device" href="#sql_app.schemas.Device">Device</a></code></h4>
 <ul class="">
 <li><code><a title="sql_app.schemas.Device.Config" href="#sql_app.schemas.Device.Config">Config</a></code></li>
-<li><code><a title="sql_app.schemas.Device.assigned" href="#sql_app.schemas.Device.assigned">assigned</a></code></li>
 <li><code><a title="sql_app.schemas.Device.id" href="#sql_app.schemas.Device.id">id</a></code></li>
 <li><code><a title="sql_app.schemas.Device.licenses" href="#sql_app.schemas.Device.licenses">licenses</a></code></li>
 <li><code><a title="sql_app.schemas.Device.logs" href="#sql_app.schemas.Device.logs">logs</a></code></li>
@@ -1617,6 +1946,8 @@ class LDTemp(LDTempCreate):
 <li>
 <h4><code><a title="sql_app.schemas.DeviceBase" href="#sql_app.schemas.DeviceBase">DeviceBase</a></code></h4>
 <ul class="">
+<li><code><a title="sql_app.schemas.DeviceBase.comment" href="#sql_app.schemas.DeviceBase.comment">comment</a></code></li>
+<li><code><a title="sql_app.schemas.DeviceBase.inventory_number" href="#sql_app.schemas.DeviceBase.inventory_number">inventory_number</a></code></li>
 <li><code><a title="sql_app.schemas.DeviceBase.product_id" href="#sql_app.schemas.DeviceBase.product_id">product_id</a></code></li>
 <li><code><a title="sql_app.schemas.DeviceBase.serial_number" href="#sql_app.schemas.DeviceBase.serial_number">serial_number</a></code></li>
 <li><code><a title="sql_app.schemas.DeviceBase.vendor_id" href="#sql_app.schemas.DeviceBase.vendor_id">vendor_id</a></code></li>
@@ -1644,6 +1975,14 @@ class LDTemp(LDTempCreate):
 <h4><code><a title="sql_app.schemas.DeviceLicenseCreate" href="#sql_app.schemas.DeviceLicenseCreate">DeviceLicenseCreate</a></code></h4>
 </li>
 <li>
+<h4><code><a title="sql_app.schemas.DeviceTemp" href="#sql_app.schemas.DeviceTemp">DeviceTemp</a></code></h4>
+<ul class="">
+<li><code><a title="sql_app.schemas.DeviceTemp.product_id" href="#sql_app.schemas.DeviceTemp.product_id">product_id</a></code></li>
+<li><code><a title="sql_app.schemas.DeviceTemp.serial_number" href="#sql_app.schemas.DeviceTemp.serial_number">serial_number</a></code></li>
+<li><code><a title="sql_app.schemas.DeviceTemp.vendor_id" href="#sql_app.schemas.DeviceTemp.vendor_id">vendor_id</a></code></li>
+</ul>
+</li>
+<li>
 <h4><code><a title="sql_app.schemas.HeadDevice" href="#sql_app.schemas.HeadDevice">HeadDevice</a></code></h4>
 <ul class="">
 <li><code><a title="sql_app.schemas.HeadDevice.Config" href="#sql_app.schemas.HeadDevice.Config">Config</a></code></li>
@@ -1654,6 +1993,8 @@ class LDTemp(LDTempCreate):
 <li>
 <h4><code><a title="sql_app.schemas.HeadDeviceBase" href="#sql_app.schemas.HeadDeviceBase">HeadDeviceBase</a></code></h4>
 <ul class="">
+<li><code><a title="sql_app.schemas.HeadDeviceBase.comment" href="#sql_app.schemas.HeadDeviceBase.comment">comment</a></code></li>
+<li><code><a title="sql_app.schemas.HeadDeviceBase.inventory_number" href="#sql_app.schemas.HeadDeviceBase.inventory_number">inventory_number</a></code></li>
 <li><code><a title="sql_app.schemas.HeadDeviceBase.serial_number" href="#sql_app.schemas.HeadDeviceBase.serial_number">serial_number</a></code></li>
 </ul>
 </li>
@@ -1661,6 +2002,12 @@ class LDTemp(LDTempCreate):
 <h4><code><a title="sql_app.schemas.HeadDeviceCreate" href="#sql_app.schemas.HeadDeviceCreate">HeadDeviceCreate</a></code></h4>
 </li>
 <li>
+<h4><code><a title="sql_app.schemas.HeadDeviceTemp" href="#sql_app.schemas.HeadDeviceTemp">HeadDeviceTemp</a></code></h4>
+<ul class="">
+<li><code><a title="sql_app.schemas.HeadDeviceTemp.serial_number" href="#sql_app.schemas.HeadDeviceTemp.serial_number">serial_number</a></code></li>
+</ul>
+</li>
+<li>
 <h4><code><a title="sql_app.schemas.LDLog" href="#sql_app.schemas.LDLog">LDLog</a></code></h4>
 <ul class="">
 <li><code><a title="sql_app.schemas.LDLog.Config" href="#sql_app.schemas.LDLog.Config">Config</a></code></li>
@@ -1706,7 +2053,9 @@ class LDTemp(LDTempCreate):
 <h4><code><a title="sql_app.schemas.License" href="#sql_app.schemas.License">License</a></code></h4>
 <ul class="">
 <li><code><a title="sql_app.schemas.License.Config" href="#sql_app.schemas.License.Config">Config</a></code></li>
+<li><code><a title="sql_app.schemas.License.body_devices" href="#sql_app.schemas.License.body_devices">body_devices</a></code></li>
 <li><code><a title="sql_app.schemas.License.devices" href="#sql_app.schemas.License.devices">devices</a></code></li>
+<li><code><a title="sql_app.schemas.License.head_devices" href="#sql_app.schemas.License.head_devices">head_devices</a></code></li>
 <li><code><a title="sql_app.schemas.License.id" href="#sql_app.schemas.License.id">id</a></code></li>
 </ul>
 </li>
@@ -1714,6 +2063,7 @@ class LDTemp(LDTempCreate):
 <h4><code><a title="sql_app.schemas.LicenseBase" href="#sql_app.schemas.LicenseBase">LicenseBase</a></code></h4>
 <ul class="">
 <li><code><a title="sql_app.schemas.LicenseBase.expiration_date" href="#sql_app.schemas.LicenseBase.expiration_date">expiration_date</a></code></li>
+<li><code><a title="sql_app.schemas.LicenseBase.license_id" href="#sql_app.schemas.LicenseBase.license_id">license_id</a></code></li>
 <li><code><a title="sql_app.schemas.LicenseBase.name" href="#sql_app.schemas.LicenseBase.name">name</a></code></li>
 </ul>
 </li>
@@ -1724,8 +2074,8 @@ class LDTemp(LDTempCreate):
 <h4><code><a title="sql_app.schemas.PC" href="#sql_app.schemas.PC">PC</a></code></h4>
 <ul class="">
 <li><code><a title="sql_app.schemas.PC.Config" href="#sql_app.schemas.PC.Config">Config</a></code></li>
-<li><code><a title="sql_app.schemas.PC.assigned" href="#sql_app.schemas.PC.assigned">assigned</a></code></li>
 <li><code><a title="sql_app.schemas.PC.id" href="#sql_app.schemas.PC.id">id</a></code></li>
+<li><code><a title="sql_app.schemas.PC.logs_ld" href="#sql_app.schemas.PC.logs_ld">logs_ld</a></code></li>
 <li><code><a title="sql_app.schemas.PC.logs_pc" href="#sql_app.schemas.PC.logs_pc">logs_pc</a></code></li>
 </ul>
 </li>
@@ -1743,8 +2093,8 @@ class LDTemp(LDTempCreate):
 <h4><code><a title="sql_app.schemas.Team" href="#sql_app.schemas.Team">Team</a></code></h4>
 <ul class="">
 <li><code><a title="sql_app.schemas.Team.Config" href="#sql_app.schemas.Team.Config">Config</a></code></li>
+<li><code><a title="sql_app.schemas.Team.devices" href="#sql_app.schemas.Team.devices">devices</a></code></li>
 <li><code><a title="sql_app.schemas.Team.id" href="#sql_app.schemas.Team.id">id</a></code></li>
-<li><code><a title="sql_app.schemas.Team.pcs" href="#sql_app.schemas.Team.pcs">pcs</a></code></li>
 </ul>
 </li>
 <li>
@@ -1796,6 +2146,24 @@ class LDTemp(LDTempCreate):
 <li>
 <h4><code><a title="sql_app.schemas.USBTempCreate" href="#sql_app.schemas.USBTempCreate">USBTempCreate</a></code></h4>
 </li>
+<li>
+<h4><code><a title="sql_app.schemas.User" href="#sql_app.schemas.User">User</a></code></h4>
+<ul class="">
+<li><code><a title="sql_app.schemas.User.Config" href="#sql_app.schemas.User.Config">Config</a></code></li>
+<li><code><a title="sql_app.schemas.User.id" href="#sql_app.schemas.User.id">id</a></code></li>
+</ul>
+</li>
+<li>
+<h4><code><a title="sql_app.schemas.UserBase" href="#sql_app.schemas.UserBase">UserBase</a></code></h4>
+<ul class="">
+<li><code><a title="sql_app.schemas.UserBase.password" href="#sql_app.schemas.UserBase.password">password</a></code></li>
+<li><code><a title="sql_app.schemas.UserBase.role" href="#sql_app.schemas.UserBase.role">role</a></code></li>
+<li><code><a title="sql_app.schemas.UserBase.username" href="#sql_app.schemas.UserBase.username">username</a></code></li>
+</ul>
+</li>
+<li>
+<h4><code><a title="sql_app.schemas.UserCreate" href="#sql_app.schemas.UserCreate">UserCreate</a></code></h4>
+</li>
 </ul>
 </li>
 </ul>
diff --git a/server/sql_app/api/auth.py b/server/sql_app/api/auth.py
index a66baca..425d8ba 100644
--- a/server/sql_app/api/auth.py
+++ b/server/sql_app/api/auth.py
@@ -50,14 +50,23 @@ fake_users_db = {
 
 
 def verify_password(plain_password, hashed_password):
+    """
+    Verifies plain text password with hashed password
+    """
     return pwd_context.verify(plain_password, hashed_password)
 
 
 def get_hash_password(password):
+    """
+    Returns hashed password
+    """
     return pwd_context.hash(password)
 
 
 def auth_user(db, username: str, password: str):
+    """
+    Determines if given password belongs to user with given username
+    """
     user = crud.find_user(db, username)
     if not user:
         return None
diff --git a/server/sql_app/api/bodydevices_web.py b/server/sql_app/api/bodydevices_web.py
index 48b345e..b00c8d8 100644
--- a/server/sql_app/api/bodydevices_web.py
+++ b/server/sql_app/api/bodydevices_web.py
@@ -33,111 +33,139 @@ def get_db():
 async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
                        Authorize: AuthJWT = Depends()):
     """
-    Returns template with all body devices and its current states
+    Returns template with all body devices and necessary attributes
     """
     Authorize.jwt_optional()
     current_user = Authorize.get_jwt_subject()
 
+    device_dict = []
     devices = crud.get_body_devices(db, skip=skip, limit=limit)
-    statuses = []
-    # adding state for each device in list
-    for i in range(0, len(devices)):
-        statuses.append(devices[i].b_logs[len(devices[i].b_logs) - 1].status)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    for dev in devices:
+        lic = crud.get_license(db, dev.license_id)
+        device_dict.append({"device": dev, "license": lic, "log": dev.b_logs[len(dev.b_logs) - 1]})
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
     if current_user == "admin":
-        return templates.TemplateResponse("body_devices.html", {"request": request, "devs": len(devices), "devices": devices,
-                                                           "statuses": statuses, "licenses": licenses, "user": current_user})
+        return templates.TemplateResponse("body_devices.html", {"request": request, "devices": device_dict,
+                                                                "devs": devices, "teams": teams, "licenses": licenses,
+                                                                "user": current_user})
     else:
         current_user = "guest"
-        return templates.TemplateResponse("body_devices_normal.html", {"request": request, "devs": len(devices), "devices": devices,
-                                                           "statuses": statuses, "licenses": licenses, "user": current_user})
+        return templates.TemplateResponse("body_devices_normal.html", {"request": request, "devices": device_dict,
+                                                                "devs": devices, "teams": teams, "licenses": licenses,
+                                                                "user": current_user})
 
 
 @body_device_web.post("/body-devices-web", response_class=HTMLResponse)
-async def filter_devices(request: Request, skip: int = 0, limit: int = 100, lic: str = Form("all"),
+async def filter_devices(request: Request, skip: int = 0, limit: int = 100,
+                         body_id: str = Form("all"), lic_id: str = Form("all"), team: str = Form("all"),
                          db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
     """
-    Endpoint used for filtering body devices by license. returns html template with only
-    body devices that has assigned license defined by user input
+    Endpoint used for filtering body devices by user given inputs. returns html template with only
+    body devices that has attributes defined by user input
     """
     Authorize.jwt_optional()
     current_user = Authorize.get_jwt_subject()
-    devices = crud.get_body_devices(db, skip=skip, limit=limit)
-    def_devices = []
+    device_dict = []
+    devices_f = crud.get_filtered_bodydevices(db, body_id, lic_id, team)
+    ids = []
+    for d in devices_f:
+        ids.append(d[0])
+    devices = crud.get_bodydevices_with_ids(db, ids)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
     for dev in devices:
-        for l in dev.debug_licenses:
-            if dev not in def_devices and l.b_licenses.name == lic:
-                def_devices.append(dev)
-    # if input was default all
-    if lic == "all":
-        def_devices = devices
-    statuses = []
-    for i in range(0, len(def_devices)):
-        statuses.append(def_devices[i].b_logs[len(def_devices[i].b_logs) - 1].status)
+        lic = crud.get_license(db, dev.license_id)
+        device_dict.append({"device": dev, "license": lic, "log": dev.b_logs[len(dev.b_logs) - 1]})
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
     if current_user == "admin":
-        return templates.TemplateResponse("body_devices.html",
-                                          {"request": request, "devs": len(def_devices), "devices": def_devices,
-                                           "statuses": statuses, "licenses": licenses, "user": current_user})
+        return templates.TemplateResponse("body_devices.html", {"request": request, "devices": device_dict,
+                                                                "devs": devices, "teams": teams, "licenses": licenses,
+                                                                "user": current_user})
     else:
         current_user = "guest"
-        return templates.TemplateResponse("body_devices_normal.html",
-                                          {"request": request, "devs": len(def_devices), "devices": def_devices,
-                                           "statuses": statuses, "licenses": licenses, "user": current_user})
+        return templates.TemplateResponse("body_devices_normal.html", {"request": request, "devices": device_dict,
+                                                                       "devs": devices, "teams": teams,
+                                                                       "licenses": licenses,
+                                                                       "user": current_user})
 
 
 @body_device_web.get("/body-device-license/{device_id}", response_class=HTMLResponse)
 async def connect_dev_lic(request: Request, device_id: int, db: Session = Depends(get_db),
                           Authorize: AuthJWT = Depends()):
     """
-    Returns template with one body device and all available licenses that can be assigned to it.
+    Returns template with one body device and all available licenses that can be assigned to it. Plus available teams
+    that can be assigned to device, inventory number and comment text input for this device.
     """
     Authorize.jwt_optional()
     current_user = Authorize.get_jwt_subject()
     if current_user != "admin":
         return RedirectResponse(url=f"/logs-web", status_code=303)
     device = crud.get_body_device(db, device_id)
-    dev_licenses = crud.get_bodydevice_license(db, device_id)
-    lic_names = []
-    dev_lics = []
-    for dev_lic in dev_licenses:
-        dev_lics.append(dev_lic.b_licenses)
-    for dev_lic in dev_licenses:
-        lic_names.append(dev_lic.b_licenses.name)
     licenses = crud.get_licenses(db, 0, 100)
     lic_left = []
     for lic in licenses:
-        if lic.name not in lic_names and lic not in lic_left:
+        if lic != device.license:
             lic_left.append(lic)
+    teams = crud.get_teams(db, 0, 100)
     return templates.TemplateResponse("body_device_license.html",
-                                      {"request": request, "device": device, "licenses": lic_left, "dev_lic": dev_lics})
+                                      {"request": request, "device": device, "licenses": lic_left, "teams": teams})
 
 
-@body_device_web.post("/body-devices-web/{device_id}")
+@body_device_web.post("/body-devices-web-lic/{device_id}")
 async def connect_post(device_id: int, lic: str = Form(...), db: Session = Depends(get_db),
                        Authorize: AuthJWT = Depends()):
     """
-    Endpoint called from template for connecting body device with license. Adds entry to bodydevices_licenses
-    table and redirects to body-devices-web endpoint
+    Endpoint called from template from body_device_license.html template. Connects body device with license
+    and redirects to body-devices-web endpoint
     """
     Authorize.jwt_optional()
     current_user = Authorize.get_jwt_subject()
     if current_user != "admin":
         return RedirectResponse(url=f"/logs-web", status_code=303)
-    crud.create_body_device_license(db, device_id, int(lic), datetime.now())
+    crud.update_bodydevice_license(db, device_id, int(lic))
     return RedirectResponse(url=f"/body-devices-web", status_code=303)
 
 
-@body_device_web.post("/body-devices-web-del/{device_id}")
-async def delete_post(device_id: int, b_lic: str = Form(...), db: Session = Depends(get_db),
+@body_device_web.post("/body-devices-web-team/{device_id}")
+async def delete_post(device_id: int, team_con: str = Form(...), db: Session = Depends(get_db),
                       Authorize: AuthJWT = Depends()):
     """
-    Endpoint called from template for connecting body device with license. Adds entry to devices_licenses
-    table and redirects to body-devices-web endpoint
+    Endpoint called from template from body_device_license.html template, connects device with new team
+    and redirects to body-devices-web endpoint
+    """
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != "admin":
+        return RedirectResponse(url=f"/logs-web", status_code=303)
+    crud.update_bodydevice_team(db, device_id, int(team_con))
+    return RedirectResponse(url=f"/body-devices-web", status_code=303)
+
+
+@body_device_web.post("/body-devices-inv/{device_id}")
+async def device_inv(device_id: int, dev_inv: str = Form(...), db: Session = Depends(get_db),
+                     Authorize: AuthJWT = Depends()):
+    """
+    Endpoint called from template from body_device_license.html template, updates devices inventory number
+    and redirects to body-devices-web endpoint
     """
     Authorize.jwt_optional()
     current_user = Authorize.get_jwt_subject()
     if current_user != "admin":
         return RedirectResponse(url=f"/logs-web", status_code=303)
-    crud.delete_bodydevice_license(db, device_id, int(b_lic))
-    return RedirectResponse(url=f"/body-devices-web", status_code=303)
\ No newline at end of file
+    crud.update_bodydevice_inv(db, device_id, dev_inv)
+    return RedirectResponse(url=f"/body-devices-web", status_code=303)
+
+
+@body_device_web.post("/body-devices-comm/{device_id}")
+async def device_inv(device_id: int, dev_com: str = Form(...), db: Session = Depends(get_db),
+                     Authorize: AuthJWT = Depends()):
+    """
+    Endpoint called from template from body_device_license.html template, updates devices comment
+    and redirects to body-devices-web endpoint
+    """
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != "admin":
+        return RedirectResponse(url=f"/logs-web", status_code=303)
+    crud.update_bodydevice_comm(db, device_id, dev_com)
+    return RedirectResponse(url=f"/body-devices-web", status_code=303)
diff --git a/server/sql_app/api/devices_web.py b/server/sql_app/api/devices_web.py
index 73fdf61..ff0f029 100644
--- a/server/sql_app/api/devices_web.py
+++ b/server/sql_app/api/devices_web.py
@@ -33,7 +33,7 @@ def get_db():
 async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
                        Authorize: AuthJWT = Depends()):
     """
-    Returns template with all devices and its current states
+    Returns template with all devices and its necessary attributes
     """
     Authorize.jwt_optional()
     current_user = Authorize.get_jwt_subject()
@@ -65,7 +65,7 @@ async def filter_devices(request: Request, skip: int = 0, limit: int = 100,
                          lic_id: str = Form("all"), team: str = Form("all"),
                          db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
     """
-    Endpoint used for filtering devices by license. returns html template with only
+    Endpoint used for filtering devices by user given inputs. returns html template with only
     devices that has assigned license defined by user input
     """
     Authorize.jwt_optional()
@@ -99,7 +99,8 @@ async def filter_devices(request: Request, skip: int = 0, limit: int = 100,
 async def connect_dev_lic(request: Request, device_id: int, db: Session = Depends(get_db),
                           Authorize: AuthJWT = Depends()):
     """
-    Returns template with one device and all available licenses that can be assigned to it.
+    Returns template with one device and all available licenses that can be assigned to it. Plus all teams that can
+    be assigned to device, inventory number text input and comment text input
     """
     Authorize.jwt_optional()
     current_user = Authorize.get_jwt_subject()
@@ -128,7 +129,7 @@ async def connect_dev_lic(request: Request, device_id: int, db: Session = Depend
 async def connect_post(device_id: int, lic: str = Form(...), db: Session = Depends(get_db),
                        Authorize: AuthJWT = Depends()):
     """
-    Endpoint called from template for connecting device with license. Adds entry to devices_licenses
+    Endpoint called from devicelicense.html template. Adds entry to devices_licenses
     table and redirects to devices-web endpoint
     """
     Authorize.jwt_optional()
@@ -143,8 +144,8 @@ async def connect_post(device_id: int, lic: str = Form(...), db: Session = Depen
 async def delete_post(device_id: int, lic_del: str = Form(...), db: Session = Depends(get_db),
                       Authorize: AuthJWT = Depends()):
     """
-    Endpoint called from template for deleting device-license connection. Adds entry to bodydevices_licenses
-    table and redirects to devices-web endpoint
+    Endpoint called from devicelicense.html template for deleting device-license connection. Deletes entry in
+    bodydevices_licenses table and redirects to devices-web endpoint
     """
     Authorize.jwt_optional()
     current_user = Authorize.get_jwt_subject()
@@ -153,12 +154,12 @@ async def delete_post(device_id: int, lic_del: str = Form(...), db: Session = De
     crud.delete_device_license(db, device_id, int(lic_del))
     return RedirectResponse(url=f"/devices-web", status_code=303)
 
+
 @device_web.post("/devices-web-team/{device_id}")
 async def dev_team_con(device_id: int, team_con: str = Form(...), db: Session = Depends(get_db),
-                      Authorize: AuthJWT = Depends()):
+                       Authorize: AuthJWT = Depends()):
     """
-    Endpoint called from template for deleting device-license connection. Adds entry to bodydevices_licenses
-    table and redirects to devices-web endpoint
+    Endpoint called from devicelicense.html template, connects device with team and redirects to devices-web endpoint
     """
     Authorize.jwt_optional()
     current_user = Authorize.get_jwt_subject()
@@ -167,12 +168,13 @@ async def dev_team_con(device_id: int, team_con: str = Form(...), db: Session =
     crud.update_device(db, device_id, team_con)
     return RedirectResponse(url=f"/devices-web", status_code=303)
 
+
 @device_web.post("/devices-web-inv/{device_id}")
 async def dev_inv_new(device_id: int, dev_inv: str = Form(...), db: Session = Depends(get_db),
                       Authorize: AuthJWT = Depends()):
     """
-    Endpoint called from template for deleting device-license connection. Adds entry to bodydevices_licenses
-    table and redirects to devices-web endpoint
+    Endpoint called from template devicelicense.html, updates inventory number of device and redirects to devices-web
+    endpoint
     """
     Authorize.jwt_optional()
     current_user = Authorize.get_jwt_subject()
@@ -181,12 +183,13 @@ async def dev_inv_new(device_id: int, dev_inv: str = Form(...), db: Session = De
     crud.update_device_inv(db, device_id, dev_inv)
     return RedirectResponse(url=f"/devices-web", status_code=303)
 
+
 @device_web.post("/devices-web-comment/{device_id}")
 async def dev_comm_new(device_id: int, dev_com: str = Form(...), db: Session = Depends(get_db),
-                      Authorize: AuthJWT = Depends()):
+                       Authorize: AuthJWT = Depends()):
     """
-    Endpoint called from template for deleting device-license connection. Adds entry to bodydevices_licenses
-    table and redirects to devices-web endpoint
+    Endpoint called from template devicelicense.html, updates comment of device and redirects to devices-web
+    endpoint
     """
     Authorize.jwt_optional()
     current_user = Authorize.get_jwt_subject()
diff --git a/server/sql_app/api/headdevices_web.py b/server/sql_app/api/headdevices_web.py
new file mode 100644
index 0000000..2e6452b
--- /dev/null
+++ b/server/sql_app/api/headdevices_web.py
@@ -0,0 +1,169 @@
+from datetime import datetime
+
+from fastapi import Depends, APIRouter, Form
+from fastapi import Request
+from fastapi.responses import HTMLResponse, RedirectResponse
+from fastapi.templating import Jinja2Templates
+from fastapi_jwt_auth import AuthJWT
+from pydantic import BaseModel
+from sqlalchemy.orm import Session
+from sql_app.api.auth import fake_users_db
+from sql_app import crud, models
+from ..database import SessionLocal, engine
+
+models.Base.metadata.create_all(bind=engine)
+
+# Path to html templates used in this file
+templates = Jinja2Templates(directory="templates/head_devices")
+
+# prefix used for all endpoints in this file
+head_device_web = APIRouter(prefix="")
+
+
+# Dependency
+def get_db():
+    db = SessionLocal()
+    try:
+        yield db
+    finally:
+        db.close()
+
+
+@head_device_web.get("/head-devices-web", response_class=HTMLResponse)
+async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
+    """
+    Returns template with all head devices and necessary attributes
+    """
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+
+    device_dict = []
+    devices = crud.get_head_devices(db, skip=skip, limit=limit)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    for dev in devices:
+        lic = crud.get_license(db, dev.license_id)
+        device_dict.append({"device": dev, "license": lic, "log": dev.h_logs[len(dev.h_logs) - 1]})
+    licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if current_user == "admin":
+        return templates.TemplateResponse("head_devices.html", {"request": request, "devices": device_dict,
+                                                                "devs": devices, "teams": teams, "licenses": licenses,
+                                                                "user": current_user})
+    else:
+        current_user = "guest"
+        return templates.TemplateResponse("head_devices_normal.html", {"request": request, "devices": device_dict,
+                                                                "devs": devices, "teams": teams, "licenses": licenses,
+                                                                "user": current_user})
+
+
+@head_device_web.post("/head-devices-web", response_class=HTMLResponse)
+async def filter_devices(request: Request, skip: int = 0, limit: int = 100,
+                         body_id: str = Form("all"), lic_id: str = Form("all"), team: str = Form("all"),
+                         db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
+    """
+    Endpoint used for filtering head devices by user given inputs. returns html template with only
+    head devices that has attributes defined by user input
+    """
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    device_dict = []
+    devices_f = crud.get_filtered_headdevices(db, body_id, lic_id, team)
+    ids = []
+    for d in devices_f:
+        ids.append(d[0])
+    devices = crud.get_headdevices_with_ids(db, ids)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    for dev in devices:
+        lic = crud.get_license(db, dev.license_id)
+        device_dict.append({"device": dev, "license": lic, "log": dev.h_logs[len(dev.h_logs) - 1]})
+    licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if current_user == "admin":
+        return templates.TemplateResponse("head_devices.html", {"request": request, "devices": device_dict,
+                                                                "devs": devices, "teams": teams, "licenses": licenses,
+                                                                "user": current_user})
+    else:
+        current_user = "guest"
+        return templates.TemplateResponse("head_devices_normal.html", {"request": request, "devices": device_dict,
+                                                                       "devs": devices, "teams": teams,
+                                                                       "licenses": licenses,
+                                                                       "user": current_user})
+
+
+@head_device_web.get("/head-device-license/{device_id}", response_class=HTMLResponse)
+async def connect_dev_lic(request: Request, device_id: int, db: Session = Depends(get_db),
+                          Authorize: AuthJWT = Depends()):
+    """
+    Returns template with one head device and all available licenses that can be assigned to it, plus team and comment
+    and inventory number inputs.
+    """
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != "admin":
+        return RedirectResponse(url=f"/logs-web", status_code=303)
+    device = crud.get_head_device(db, device_id)
+    licenses = crud.get_licenses(db, 0, 100)
+    lic_left = []
+    for lic in licenses:
+        if lic != device.license:
+            lic_left.append(lic)
+    teams = crud.get_teams(db, 0, 100)
+    return templates.TemplateResponse("headlicense.html",
+                                      {"request": request, "device": device, "licenses": lic_left, "teams": teams})
+
+
+@head_device_web.post("/head-devices-web-lic/{device_id}")
+async def connect_post(device_id: int, lic: str = Form(...), db: Session = Depends(get_db),
+                       Authorize: AuthJWT = Depends()):
+    """
+    Endpoint called from template for connecting head device with license and redirects to head-devices-web endpoint
+    """
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != "admin":
+        return RedirectResponse(url=f"/logs-web", status_code=303)
+    crud.update_headdevice_license(db, device_id, int(lic))
+    return RedirectResponse(url=f"/head-devices-web", status_code=303)
+
+
+@head_device_web.post("/head-devices-web-team/{device_id}")
+async def delete_post(device_id: int, team_con: str = Form(...), db: Session = Depends(get_db),
+                      Authorize: AuthJWT = Depends()):
+    """
+    Endpoint called from template for connecting head device with team and redirects to body-devices-web endpoint
+    """
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != "admin":
+        return RedirectResponse(url=f"/logs-web", status_code=303)
+    crud.update_headdevice_team(db, device_id, int(team_con))
+    return RedirectResponse(url=f"/head-devices-web", status_code=303)
+
+
+@head_device_web.post("/head-devices-inv/{device_id}")
+async def device_inv(device_id: int, dev_inv: str = Form(...), db: Session = Depends(get_db),
+                     Authorize: AuthJWT = Depends()):
+    """
+    Endpoint called from within from headlicense.html template. Changes head devices inventory number with new one
+    given from user
+    """
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != "admin":
+        return RedirectResponse(url=f"/logs-web", status_code=303)
+    crud.update_headdevice_inv(db, device_id, dev_inv)
+    return RedirectResponse(url=f"/head-devices-web", status_code=303)
+
+
+@head_device_web.post("/head-devices-comm/{device_id}")
+async def device_inv(device_id: int, dev_com: str = Form(...), db: Session = Depends(get_db),
+                     Authorize: AuthJWT = Depends()):
+    """
+    Endpoint called from within from headlicense.html template. Changes head devices comment with new one
+    given from user
+    """
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != "admin":
+        return RedirectResponse(url=f"/logs-web", status_code=303)
+    crud.update_headdevice_comm(db, device_id, dev_com)
+    return RedirectResponse(url=f"/head-devices-web", status_code=303)
\ No newline at end of file
diff --git a/server/sql_app/crud.py b/server/sql_app/crud.py
index 6892343..2935853 100644
--- a/server/sql_app/crud.py
+++ b/server/sql_app/crud.py
@@ -32,18 +32,63 @@ def find_device_by_serial(db: Session, ser: str):
     """
     return db.query(models.Device).filter(and_(models.Device.serial_number == ser)).first()
 
+
 def get_devices_with_ids(db: Session, ids: []):
     """
     returns all devices with given ids
     """
     return db.query(models.Device).filter(models.Device.id.in_(ids)).all()
 
+
+def get_bodydevices_with_ids(db: Session, ids: []):
+    """
+    returns all bodydevices with given ids
+    """
+    return db.query(models.BodyDevice).filter(models.BodyDevice.id.in_(ids)).all()
+
+
+def get_headdevices_with_ids(db: Session, ids: []):
+    """
+    returns all headdevices with given ids
+    """
+    return db.query(models.HeadDevice).filter(models.HeadDevice.id.in_(ids)).all()
+
+
+def find_headdevices_by_team(db: Session, team_id: int):
+    """
+    Returns all head devices in specific team
+    """
+    return db.query(models.HeadDevice).filter(models.HeadDevice.team_id == team_id).all()
+
+
+def find_bodydevices_by_team(db: Session, team_id: int):
+    """
+    Returns all body devices in specific team
+    """
+    return db.query(models.BodyDevice).filter(models.BodyDevice.team_id == team_id).all()
+
+
+def find_headdevices_by_license(db: Session, lic_id: int):
+    """
+    Returns all head devices with specific license
+    """
+    return db.query(models.HeadDevice).filter(models.HeadDevice.license_id == lic_id).all()
+
+
+def find_bodydevices_by_license(db: Session, lic_id: int):
+    """
+    Returns all body devices with specific license
+    """
+    return db.query(models.BodyDevice).filter(models.BodyDevice.license_id == lic_id).all()
+
+
 def get_devices_by_team(db: Session, team: int):
     """
     returns all devices with same team
     """
     return db.query(models.Device).filter(models.Device.team_id == team).all()
 
+
 def create_device(db: Session, device: schemas.DeviceTemp):
     """
     creates new device with data from given DeviceBase object
@@ -121,28 +166,6 @@ def get_devicelicense_by_devicelicense(db: Session, device_id: int, license_id:
                                                       models.DeviceLicense.license_id == license_id)).first()
 
 
-def get_bodydevicelicense_by_bodydevicelicense(db: Session, device_id: int, license_id: int):
-    """
-    returns entry in bodydevices_licenses table with given body device id and license id
-    """
-    return db.query(models.BodyDeviceLicense).filter(and_(models.BodyDeviceLicense.bodydevice_id == device_id,
-                                                          models.BodyDeviceLicense.license_id == license_id)).first()
-
-
-def get_license_bodydevice(db: Session, license_id: int):
-    """
-    returns all entries in bodydevices_licenses with given license_id
-    """
-    return db.query(models.BodyDeviceLicense).filter(models.BodyDeviceLicense.license_id == license_id).all()
-
-
-def get_bodydevice_license(db: Session, device_id: int):
-    """
-    returns all entries in bodydevices_licenses with given license_id
-    """
-    return db.query(models.BodyDeviceLicense).filter(models.BodyDeviceLicense.bodydevice_id == device_id).all()
-
-
 def create_device_license(db: Session, device: int, license: int, time: datetime):
     """
     creates new entry in devices_licenses table with device id, license id and time.
@@ -165,28 +188,6 @@ def delete_device_license(db: Session, device: int, license: int):
     return db_lic
 
 
-def delete_bodydevice_license(db: Session, device: int, license: int):
-    """
-    deletes entry in devices_licenses table with device id, license id and time.
-    """
-    db_device_license = get_bodydevicelicense_by_bodydevicelicense(db, device, license)
-    db_lic = db.delete(db_device_license)
-    db.commit()
-    return db_lic
-
-
-def create_body_device_license(db: Session, device: int, license: int, time: datetime):
-    """
-    creates new entry in devices_licenses table with device id, license id and time.
-    """
-    db_device_license = models.BodyDeviceLicense(bodydevice_id=device, license_id=license,
-                                                 assigned_datetime=time)
-    db.add(db_device_license)
-    db.commit()
-    db.refresh(db_device_license)
-    return db_device_license
-
-
 def find_pc_by_username(db: Session, name: str):
     """
     Finds one pc by given username
@@ -415,17 +416,147 @@ def find_body_device(db: Session, serial: schemas.BodyDeviceTemp):
     return db.query(models.BodyDevice).filter(models.BodyDevice.serial_number == serial.serial_number).first()
 
 
+def find_bodydevice_by_serial(db: Session, serial: str):
+    """
+    Finds one specific body device by given serial number
+    """
+    return db.query(models.BodyDevice).filter(models.BodyDevice.serial_number == serial).first()
+
+
+def find_headdevice_by_serial(db: Session, serial: str):
+    """
+    Finds one specific head device by given serial number
+    """
+    return db.query(models.HeadDevice).filter(models.HeadDevice.serial_number == serial).first()
+
+
 def create_body_device(db: Session, log: schemas.BodyDeviceTemp):
     """
     Creates new Body device
     """
-    db_body = models.BodyDevice(serial_number=log.serial_number)
+    db_body = models.BodyDevice(serial_number=log.serial_number, inventory_number="", comment="")
     db.add(db_body)
     db.commit()
     db.refresh(db_body)
     return db_body
 
 
+def update_bodydevice_license(db: Session, device_id: int, lic_id: int):
+    """
+    Updates body devices license with one given by user
+    """
+    old_dev = get_body_device(db, device_id)
+    lic = get_license(db, lic_id)
+    new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
+           'comment': old_dev.comment, 'team_id': old_dev.team_id, 'license_id': lic.id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_bodydevice_team(db: Session, device_id: int, team_id: int):
+    """
+    Updates body devices team with one given by user
+    """
+    old_dev = get_body_device(db, device_id)
+    team = get_team(db, team_id)
+    new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
+           'comment': old_dev.comment, 'team_id': team.id, 'license_id': old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_bodydevice_inv(db: Session, device_id: int, dev_inv: str):
+    """
+    Updates body devices inventory number with new one given by user
+    """
+    old_dev = get_body_device(db, device_id)
+    new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': dev_inv,
+           'comment': old_dev.comment, 'team_id': old_dev.team_id, 'license_id': old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_bodydevice_comm(db: Session, device_id: int, comm: str):
+    """
+    Updates body devices comment with new one given by user
+    """
+    old_dev = get_body_device(db, device_id)
+    new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
+           'comment': comm, 'team_id': old_dev.team_id, 'license_id': old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_headdevice_license(db: Session, device_id: int, lic_id: int):
+    """
+    Updates head devices license with one given by user
+    """
+    old_dev = get_head_device(db, device_id)
+    lic = get_license(db, lic_id)
+    new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
+           'comment': old_dev.comment, 'team_id': old_dev.team_id, 'license_id': lic.id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_headdevice_team(db: Session, device_id: int, team_id: int):
+    """
+    Updates head devices team with one given by user
+    """
+    old_dev = get_head_device(db, device_id)
+    team = get_team(db, team_id)
+    new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
+           'comment': old_dev.comment, 'team_id': team.id, 'license_id': old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_headdevice_inv(db: Session, device_id: int, dev_inv: str):
+    """
+    Updates head devices inventory number with new one given by user
+    """
+    old_dev = get_head_device(db, device_id)
+    new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': dev_inv,
+           'comment': old_dev.comment, 'team_id': old_dev.team_id, 'license_id': old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_headdevice_comm(db: Session, device_id: int, comm: str):
+    """
+    Updates head devices comment with new one given by user
+    """
+    old_dev = get_head_device(db, device_id)
+    new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
+           'comment': comm, 'team_id': old_dev.team_id, 'license_id': old_dev.license_id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
 def get_ld_logs(db: Session, skip: int = 0, limit: int = 100):
     """
     Returns all ld debugger logs in database
@@ -477,41 +608,134 @@ def get_filtered_ldlogs(db: Session, pc: str, tema: str, lic: str):
     Function creates query string used for filtering by pc username, team name and license name.
     Depending on selected filters assembles query string for database
     """
-    execute_string = "SELECT * FROM ld_logs AS logs"
-    pcs = find_pc_by_username(db, pc)
+    execute_string = "SELECT * FROM ld_logs AS logs WHERE"
+    before_me = False
+    all_all = True
     if pc != "all":
-        if pcs is not None:
-            execute_string += "  WHERE logs.pc_id = " + str(pcs.id)
+        all_all = False
+        pc = find_pc_by_username(db, pc)
+        if pc != None:
+            if before_me:
+                execute_string += " AND logs.pc_id = " + str(pc.id)
+            else:
+                before_me = True
+                execute_string += " logs.pc_id = " + str(pc.id)
+        else:
+            if before_me:
+                execute_string += " AND logs.pc_id = -1"
+            else:
+                before_me = True
+                execute_string += " logs.pc_id = -1"
     if tema != "all":
+        all_all = False
         team = find_team(db, tema)
-        if team is not None:
-            devs = get_devices_by_team(db, team.id)
-            d_ids = "("
-            for p in devs:
-                d_ids += str(p.id) + ", "
-            def_d_ids = d_ids[:-2] + ")"
-            if pc != "all" and pcs is not None:
-                if len(def_d_ids) > 1:
-                    execute_string += " AND logs.device_id IN " + def_d_ids
+        if team != None:
+            head_devices = find_headdevices_by_team(db, team.id)
+            body_devices = find_bodydevices_by_team(db, team.id)
+            if len(head_devices) > 0 and len(body_devices) > 0:
+                h_ids = "("
+                for h in head_devices:
+                    h_ids += str(h.id) + ", "
+                def_h_ids = h_ids[:-2] + ")"
+                b_ids = "("
+                for b in body_devices:
+                    b_ids += str(b.id) + ", "
+                def_b_ids = b_ids[:-2] + ")"
+                if before_me:
+                    execute_string += " AND (logs.head_id IN " + def_h_ids + " OR logs.body_id IN " + def_b_ids + ")"
+                else:
+                    before_me = True
+                    execute_string += " (logs.head_id IN " + def_h_ids + " OR logs.body_id IN " + def_b_ids + ")"
+            elif len(head_devices) == 0 and len(body_devices) > 0:
+                b_ids = "("
+                for b in body_devices:
+                    b_ids += str(b.id) + ", "
+                def_b_ids = b_ids[:-2] + ")"
+                if before_me:
+                    execute_string += " AND logs.body_id IN " + def_b_ids
+                else:
+                    before_me = True
+                    execute_string += " logs.body_id IN " + def_b_ids
+            elif len(head_devices) > 0 and len(body_devices) == 0:
+                h_ids = "("
+                for h in head_devices:
+                    h_ids += str(h.id) + ", "
+                def_h_ids = h_ids[:-2] + ")"
+                if before_me:
+                    execute_string += " AND logs.head_id IN " + def_h_ids
+                else:
+                    before_me = True
+                    execute_string += " logs.head_id IN " + def_h_ids
             else:
-                if len(def_d_ids) > 1:
-                    execute_string += " WHERE logs.device_id IN " + def_d_ids
+                if before_me:
+                    execute_string += " AND (logs.head_id = -1 OR logs.body_id = -1)"
+                else:
+                    before_me = True
+                    execute_string += " (logs.head_id = -1 OR logs.body_id = -1)"
+        else:
+            if before_me:
+                execute_string += " AND logs.pc_id = -1"
+            else:
+                before_me = True
+                execute_string += " logs.pc_id = -1"
     if lic != "all":
-        license = get_licenses_by_name(db, lic)
-        if license is not None:
-            device_licenses = get_license_bodydevice(db, license.id)
-            dev_ids = "("
-            for dev in device_licenses:
-                dev_ids += str(dev.bodydevice_id) + ", "
-            defin_ids = dev_ids[:-2] + ")"
-            if pc != "all" or tema != "all":
-                if len(defin_ids) > 1:
-                    execute_string += " AND logs.body_id IN " + defin_ids
+        all_all = False
+        license = find_license(db, lic)
+        if license != None:
+            head_devices = find_headdevices_by_license(db, license.id)
+            body_devices = find_bodydevices_by_license(db, license.id)
+            if len(head_devices) > 0 and len(body_devices) > 0:
+                h_ids = "("
+                for h in head_devices:
+                    h_ids += str(h.id) + ", "
+                def_h_ids = h_ids[:-2] + ")"
+                b_ids = "("
+                for b in body_devices:
+                    b_ids += str(b.id) + ", "
+                def_b_ids = b_ids[:-2] + ")"
+                if before_me:
+                    execute_string += " AND (logs.head_id IN " + def_h_ids + " OR logs.body_id IN " + def_b_ids + ")"
+                else:
+                    before_me = True
+                    execute_string += " (logs.head_id IN " + def_h_ids + " OR logs.body_id IN " + def_b_ids + ")"
+            elif len(head_devices) == 0 and len(body_devices) > 0:
+                b_ids = "("
+                for b in body_devices:
+                    b_ids += str(b.id) + ", "
+                def_b_ids = b_ids[:-2] + ")"
+                if before_me:
+                    execute_string += " AND logs.body_id IN " + def_b_ids
+                else:
+                    before_me = True
+                    execute_string += " logs.body_id IN " + def_b_ids
+            elif len(head_devices) > 0 and len(body_devices) == 0:
+                h_ids = "("
+                for h in head_devices:
+                    h_ids += str(h.id) + ", "
+                def_h_ids = h_ids[:-2] + ")"
+                if before_me:
+                    execute_string += " AND logs.head_id IN " + def_h_ids
+                else:
+                    before_me = True
+                    execute_string += " logs.head_id IN " + def_h_ids
             else:
-                if len(defin_ids) > 1:
-                    execute_string += " WHERE logs.body_id IN " + defin_ids
+                if before_me:
+                    execute_string += " AND (logs.head_id = -1 OR logs.body_id = -1)"
+                else:
+                    before_me = True
+                    execute_string += " (logs.head_id = -1 OR logs.body_id = -1)"
+        else:
+            if before_me:
+                execute_string += " AND logs.pc_id = -1"
+            else:
+                before_me = True
+                execute_string += " logs.pc_id = -1"
+    if all_all:
+        before_me = True
+        execute_string = "SELECT * FROM ld_logs AS logs"
 
-    # executing assembled query string
+    if not before_me:
+        execute_string = "SELECT * FROM ld_logs AS logs WHERE logs.id = -1"
     result = db.execute(execute_string)
     return result
 
@@ -526,6 +750,8 @@ def get_filtered_logs(db: Session, pc: str, tema: str, lic: str):
     if pc != "all":
         if pcs is not None:
             execute_string += "  WHERE logs.pc_id = " + str(pcs.id)
+        else:
+            execute_string += "  WHERE logs.pc_id = -1"
     if tema != "all":
         team = find_team(db, tema)
         if team is not None:
@@ -534,16 +760,28 @@ def get_filtered_logs(db: Session, pc: str, tema: str, lic: str):
             for p in devs:
                 d_ids += str(p.id) + ", "
             def_d_ids = d_ids[:-2] + ")"
-            if pc != "all" and pcs is not None:
+            if pc != "all":
                 if len(def_d_ids) > 1:
                     execute_string += " AND logs.device_id IN " + def_d_ids
+                else:
+                    execute_string += " AND logs.device_id IN (-1)"
             else:
                 if len(def_d_ids) > 1:
                     execute_string += " WHERE logs.device_id IN " + def_d_ids
+                else:
+                    execute_string += " WHERE logs.device_id IN (-1)"
+        else:
+            if pc != "all":
+                execute_string += " AND logs.device_id IN (-1)"
+            else:
+                execute_string += " WHERE logs.device_id IN (-1)"
     if lic != "all":
         license = get_licenses_by_name(db, lic)
-        if license is not None:
-            device_licenses = get_license_devices(db, license.id)
+        if len(license) > 0:
+            ids = []
+            for l in license:
+                ids.append(l.id)
+            device_licenses = find_devicelicenses_by_licid_array(db, ids)
             dev_ids = "("
             for dev in device_licenses:
                 dev_ids += str(dev.device_id) + ", "
@@ -551,18 +789,151 @@ def get_filtered_logs(db: Session, pc: str, tema: str, lic: str):
             if pc != "all" or tema != "all":
                 if len(defin_ids) > 1:
                     execute_string += " AND logs.device_id IN " + defin_ids
+                else:
+                    execute_string += " AND logs.device_id IN (-1)"
             else:
                 if len(defin_ids) > 1:
                     execute_string += " WHERE logs.device_id IN " + defin_ids
+                else:
+                    execute_string += " WHERE logs.device_id IN (-1)"
+        else:
+            if pc != "all" or tema != "all":
+                execute_string += " AND logs.device_id IN (-1)"
+            else:
+                execute_string += " WHERE logs.device_id IN (-1)"
 
     # executing assembled query string
     result = db.execute(execute_string)
     return result
 
 
+def get_filtered_bodydevices(db: Session, body_id: str, license_id: str, team: str):
+    """
+    returns filtered body devices based on given attributes
+    """
+    execute_string = "SELECT * FROM body_devices AS device WHERE"
+    before_me = False
+    all_all = True
+    if body_id != "all":
+        all_all = False
+        body_dev = find_bodydevice_by_serial(db, body_id)
+        if body_dev != None:
+            if before_me:
+                execute_string += " AND device.id = " + str(body_dev.id)
+            else:
+                before_me = True
+                execute_string += " device.id = " + str(body_dev.id)
+        else:
+            if before_me:
+                execute_string += " AND device.id = -1"
+            else:
+                before_me = True
+                execute_string += " device.id = -1"
+    if license_id != "all":
+        all_all = False
+        license = find_license(db, license_id)
+        if license != None:
+            if before_me:
+                execute_string += " AND device.license_id = " + str(license.id)
+            else:
+                before_me = True
+                execute_string += " device.license_id = " + str(license.id)
+        else:
+            if before_me:
+                execute_string += " AND device.id = -1"
+            else:
+                before_me = True
+                execute_string += " device.id = -1"
+    if team != "all":
+        all_all = False
+        tem = find_team(db, team)
+        if tem != None:
+            if before_me:
+                execute_string += " AND device.team_id = " + str(tem.id)
+            else:
+                before_me = True
+                execute_string += " device.team_id = " + str(tem.id)
+        else:
+            if before_me:
+                execute_string += " AND device.id = -1"
+            else:
+                before_me = True
+                execute_string += " device.id = -1"
+    if all_all:
+        before_me = True
+        execute_string = "SELECT * FROM body_devices AS devices"
+
+    if not before_me:
+        execute_string = "SELECT * FROM body_devices AS devices WHERE devices.id = -1"
+    result = db.execute(execute_string)
+    return result
+
+
+def get_filtered_headdevices(db: Session, body_id: str, license_id: str, team: str):
+    """
+    returns filtered head devices based on given attributes
+    """
+    execute_string = "SELECT * FROM head_devices AS device WHERE"
+    before_me = False
+    all_all = True
+    if body_id != "all":
+        all_all = False
+        head_dev = find_headdevice_by_serial(db, body_id)
+        if head_dev != None:
+            if before_me:
+                execute_string += " AND device.id = " + str(head_dev.id)
+            else:
+                before_me = True
+                execute_string += " device.id = " + str(head_dev.id)
+        else:
+            if before_me:
+                execute_string += " AND device.id = -1"
+            else:
+                before_me = True
+                execute_string += " device.id = -1"
+    if license_id != "all":
+        all_all = False
+        license = find_license(db, license_id)
+        if license != None:
+            if before_me:
+                execute_string += " AND device.license_id = " + str(license.id)
+            else:
+                before_me = True
+                execute_string += " device.license_id = " + str(license.id)
+        else:
+            if before_me:
+                execute_string += " AND device.id = -1"
+            else:
+                before_me = True
+                execute_string += " device.id = -1"
+    if team != "all":
+        all_all = False
+        tem = find_team(db, team)
+        if tem != None:
+            if before_me:
+                execute_string += " AND device.team_id = " + str(tem.id)
+            else:
+                before_me = True
+                execute_string += " device.team_id = " + str(tem.id)
+        else:
+            if before_me:
+                execute_string += " AND device.id = -1"
+            else:
+                before_me = True
+                execute_string += " device.id = -1"
+    if all_all:
+        before_me = True
+        execute_string = "SELECT * FROM body_devices AS devices"
+
+    if not before_me:
+        execute_string = "SELECT * FROM body_devices AS devices WHERE devices.id = -1"
+    result = db.execute(execute_string)
+    return result
+
+
 def get_filtered_devices(db: Session, keyman_id: str, license_name: str, license_id: str, team: str):
     """
-    returns filtered devices based on given atributes
+    returns filtered keyman devices based on given attributes
     """
     execute_string = "SELECT * FROM devices AS device WHERE"
     before_me = False
@@ -576,6 +947,12 @@ def get_filtered_devices(db: Session, keyman_id: str, license_name: str, license
             else:
                 before_me = True
                 execute_string += " device.id = " + str(keyman_dev.id)
+        else:
+            if before_me:
+                execute_string += " AND device.id = -1"
+            else:
+                before_me = True
+                execute_string += " device.id = -1"
     if license_name != "all":
         all_all = False
         license = get_licenses_by_name(db, license_name)
@@ -588,20 +965,30 @@ def get_filtered_devices(db: Session, keyman_id: str, license_name: str, license
             for l in dev_lics:
                 lic_ids += str(l.device_id) + ", "
             def_lic_ids = lic_ids[:-2] + ")"
+            if len(def_lic_ids) < 1:
+                def_lic_ids = "(-1)"
             if before_me:
                 execute_string += " AND device.id IN " + def_lic_ids
             else:
                 before_me = True
                 execute_string += " device.id IN " + def_lic_ids
+        else:
+            if before_me:
+                execute_string += " AND device.id = -1"
+            else:
+                before_me = True
+                execute_string += " device.id = -1"
     if license_id != "all":
         all_all = False
         license = find_license(db, license_id)
-        licen_devs = get_license_devices(db, license.id)
-        ids = "("
-        for lic in licen_devs:
-            ids += str(lic.device_id) + ", "
-        def_ids = ids[:-2] + ")"
         if license != None:
+            licen_devs = get_license_devices(db, license.id)
+            ids = "("
+            for lic in licen_devs:
+                ids += str(lic.device_id) + ", "
+            def_ids = ids[:-2] + ")"
+            if len(def_ids) < 1:
+                def_ids = "(-1)"
             if before_me:
                 execute_string += " AND device.id IN " + def_ids
             else:
diff --git a/server/sql_app/main.py b/server/sql_app/main.py
index 637bfaf..5c5bbb5 100644
--- a/server/sql_app/main.py
+++ b/server/sql_app/main.py
@@ -12,6 +12,7 @@ from sql_app.api.teams_web import teams_web
 from sql_app.api.auth import auth
 from sql_app.api.ld_logs_web import ldlogs_web
 from sql_app.api.bodydevices_web import body_device_web
+from sql_app.api.headdevices_web import head_device_web
 from sql_app.api.users_web import users
 from fastapi import FastAPI
 
@@ -34,9 +35,10 @@ app.include_router(usblogs_web)
 app.include_router(ldlogs_web)
 app.include_router(body_device_web)
 app.include_router(users)
+app.include_router(head_device_web)
 app.include_router(auth)
 
 '''
 if __name__ == "__main__":
-    uvicorn.run(app, host="192.168.64.1", port=8000)
+    uvicorn.run(app, host="192.168.0.22", port=8000)
 '''
diff --git a/server/sql_app/schemas.py b/server/sql_app/schemas.py
index eeab5a6..afb2bdc 100644
--- a/server/sql_app/schemas.py
+++ b/server/sql_app/schemas.py
@@ -69,6 +69,9 @@ class Device(DeviceCreate):
 
 
 class DeviceTemp(BaseModel):
+    """
+    Class used for reading data from client
+    """
     vendor_id: str
     product_id: str
     serial_number: str
@@ -117,6 +120,9 @@ class BodyDevice(BodyDeviceCreate):
 
 
 class BodyDeviceTemp(BaseModel):
+    """
+    Class used for reading body device data from client
+    """
     serial_number: str
 
 
@@ -142,6 +148,9 @@ class HeadDevice(HeadDeviceCreate):
 
 
 class HeadDeviceTemp(BaseModel):
+    """
+    Class used for reading head device data from client
+    """
     serial_number: str
 
 
diff --git a/server/templates/auth/login.html b/server/templates/auth/login.html
index fa536c5..cccf299 100644
--- a/server/templates/auth/login.html
+++ b/server/templates/auth/login.html
@@ -7,9 +7,9 @@
 <body>
 <form action="/login" method="post">
   <label for="username">Username:</label><br>
-  <input type="text" id="username" name="username"><br><br>
-    <label for="password">Password:</label>
-  <input type="password" id="password" name="password">
+  <input type="text" id="username" name="username"><br>
+    <label for="password">Password:</label><br>
+  <input type="password" id="password" name="password"><br>
   <input type="submit" value="LogIn">
 </form>
 </body>
diff --git a/server/templates/auth/signup.html b/server/templates/auth/signup.html
index b8b19ff..03334be 100644
--- a/server/templates/auth/signup.html
+++ b/server/templates/auth/signup.html
@@ -7,9 +7,9 @@
 <body>
 <form action="/signup" method="post">
   <label for="username">Username:</label><br>
-  <input type="text" id="username" name="username"><br><br>
-    <label for="password">Password:</label>
-  <input type="password" id="password" name="password">
+  <input type="text" id="username" name="username"><br>
+    <label for="password">Password:</label><br>
+  <input type="password" id="password" name="password"><br>
   <input type="submit" value="Signup">
 </form>
 </body>
diff --git a/server/templates/body-devices/body_device_license.html b/server/templates/body-devices/body_device_license.html
index d0c1896..f738966 100644
--- a/server/templates/body-devices/body_device_license.html
+++ b/server/templates/body-devices/body_device_license.html
@@ -5,26 +5,45 @@
     <title>Body Device License Connect</title>
 </head>
 <body>
-<h6><p>Vendor ID: {{device.vendor_id}}</p>
+<h6>
     <p>Serial Number: {{device.serial_number}}</p>
 </h6>
-<form action="/body-devices-web/{{device.id}}" method="post">
+<h4>
+    License ID: {{device.license.license_id}}
+</h4>
+<form action="/body-devices-web-lic/{{device.id}}" method="post">
   <label for="lic">Licenses:</label>
   <select id="lic" name="lic">
       {% for license in licenses %}
-    <option value={{license.id}}>{{license.name}}</option>
+    <option value={{license.id}}>{{license.license_id}}</option>
       {% endfor %}
   </select>
   <input type="submit" value="Connect">
 </form>
-<form action="/body-devices-web-del/{{device.id}}" method="post">
-  <label for="b_lic">Licenses:</label>
-  <select id="b_lic" name="b_lic" >
-      {% for license in dev_lic %}
-    <option value={{license.id}}>{{license.name}}</option>
+<div style='padding-top:20px'>
+<form action="/body-devices-web-team/{{device.id}}" method="post">
+  <label for="team_con">Teams:</label>
+  <select id="team_con" name="team_con" >
+      {% for team in teams %}
+    <option value={{team.id}}>{{team.name}}</option>
       {% endfor %}
   </select>
-  <input type="submit" value="Delete">
+  <input type="submit" value="Connect">
+</form>
+</div>
+<div style='padding-top:20px'>
+<form action="/body-devices-inv/{{device.id}}" method="post">
+  <label for="dev_inv">Inventory Number:</label><br>
+  <input type="text" id="dev_inv" name="dev_inv" value="{{device.inventory_number}}">
+  <input type="submit" value="Submit">
+</form>
+</div>
+<div style='padding-top:20px'>
+<form action="/body-devices-comm/{{device.id}}" method="post">
+  <label for="dev_com">Comment:</label><br>
+  <input type="text" id="dev_com" name="dev_com" value="{{device.comment}}">
+  <input type="submit" value="Submit">
 </form>
+</div>
 </body>
 </html>
\ No newline at end of file
diff --git a/server/templates/body-devices/body_devices.html b/server/templates/body-devices/body_devices.html
index a929689..3492e41 100644
--- a/server/templates/body-devices/body_devices.html
+++ b/server/templates/body-devices/body_devices.html
@@ -49,7 +49,8 @@
       <option value="/logs-web">Vector Logs</option>
       <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Keyman Devices</option>
-      <option value="/body-devices-web" selected>Lauterbach Devices</option>
+      <option value="/body-devices-web" selected>Lauterbach Body Devices</option>
+      <option value="/head-devices-web">Lauterbach Head Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
@@ -58,11 +59,25 @@
   <input type="submit" value="OK">
 </form>
 <form action="/body-devices-web" method="post">
-    <label for="lic">License:</label>
-    <input id="lic" name="lic" type="text" list="licenses" value="" placeholder="all">
-    <datalist id="licenses">
+    <label for="body_id">Body Device ID:</label>
+    <input id="body_id" name="body_id" type="text" list="body_ids" value="" placeholder="all">
+    <datalist id="body_ids">
+        {% for dev in devs %}
+        <option value="{{dev.serial_number}}"></option>
+        {% endfor %}
+    </datalist>
+    <label for="lic_id">License ID:</label>
+    <input id="lic_id" name="lic_id" type="text" list="licenses_ids" value="" placeholder="all">
+    <datalist id="licenses_ids">
         {% for license in licenses %}
-        <option value="{{license.name}}"></option>
+        <option value="{{license.license_id}}"></option>
+        {% endfor %}
+    </datalist>
+    <label for="team">Team:</label>
+    <input id="team" name="team" type="text" list="teams" value="" placeholder="all">
+    <datalist id="teams">
+        {% for team in teams %}
+        <option value="{{team.name}}">{{team.name}}</option>
         {% endfor %}
     </datalist>
   <input type="submit" value="Filter">
@@ -71,30 +86,29 @@
     <TR>
         <TH>ID</TH>
         <TH>Lauterbach Body ID</TH>
-        <TH>Licenses</TH>
+        <TH>License ID</TH>
+        <TH>Inventory Number</TH>
+        <TH>Team</TH>
+        <TH>Last Username</TH>
+        <TH>Last Hostname</TH>
+        <TH>Last Detection</TH>
         <TH>Status</TH>
+        <TH>Comment</TH>
     </TR>
-    {% for i in range(devs) %}
+    {% for dev in devices %}
     <TR>
-        <TD class="ID"><a href="/body-device-license/{{devices[i].id}}">{{devices[i].id}}</a></TD>
-        <TD class="Serial Number">{{devices[i].serial_number}}</TD>
-        <TD class="License">
-            {% for lic in devices[i].debug_licenses %}
-                {{lic.b_licenses.name}}<BR>
-            {% endfor %}
-        </TD>
-        <TD class="Status">{{statuses[i]}}</TD>
+        <TD class="ID"><a href="/body-device-license/{{dev['device'].id}}">{{dev['device'].id}}</a></TD>
+        <TD class="Lauterbach Body ID">{{dev['device'].serial_number}}</TD>
+        <TD class="License ID">{{dev['license'].license_id}}</TD>
+        <TD class="Inventory Number">{{dev['device'].inventory_number}}</TD>
+        <TD class="Team">{{dev['device'].team.name}}</TD>
+        <TD class="Last Username">{{dev['log'].ldpc.username}}</TD>
+        <TD class="Last Hostname">{{dev['log'].ldpc.hostname}}</TD>
+        <TD class="Last Detection">{{dev['log'].timestamp}}</TD>
+        <TD class="Status">{{dev['log'].status}}</TD>
+        <TD class="Comment">{{dev['device'].comment}}</TD>
     </TR>
     {% endfor %}
-    <TR>
-        <TD class="ID"></TD>
-        <TD class="Serial Number"></TD>
-        <TD class="License">
-            <form action="/license-create" method="get">
-                <input type="submit" value="Add">
-            </form>
-        </TD>
-    </TR>
 </table>
 </body>
 </html>
\ No newline at end of file
diff --git a/server/templates/body-devices/body_devices_normal.html b/server/templates/body-devices/body_devices_normal.html
index db8159f..39ba939 100644
--- a/server/templates/body-devices/body_devices_normal.html
+++ b/server/templates/body-devices/body_devices_normal.html
@@ -49,7 +49,8 @@
       <option value="/logs-web">Vector Logs</option>
       <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Keyman Devices</option>
-      <option value="/body-devices-web" selected>Lauterbach Devices</option>
+      <option value="/body-devices-web" selected>Lauterbach Body Devices</option>
+      <option value="/head-devices-web">Lauterbach Head Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
@@ -57,11 +58,25 @@
   <input type="submit" value="OK">
 </form>
 <form action="/body-devices-web" method="post">
-    <label for="lic">License:</label>
-    <input id="lic" name="lic" type="text" list="licenses" value="" placeholder="all">
-    <datalist id="licenses">
+    <label for="body_id">Body Device ID:</label>
+    <input id="body_id" name="body_id" type="text" list="body_ids" value="" placeholder="all">
+    <datalist id="body_ids">
+        {% for dev in devs %}
+        <option value="{{dev.serial_number}}"></option>
+        {% endfor %}
+    </datalist>
+    <label for="lic_id">License ID:</label>
+    <input id="lic_id" name="lic_id" type="text" list="licenses_ids" value="" placeholder="all">
+    <datalist id="licenses_ids">
         {% for license in licenses %}
-        <option value="{{license.name}}"></option>
+        <option value="{{license.license_id}}"></option>
+        {% endfor %}
+    </datalist>
+    <label for="team">Team:</label>
+    <input id="team" name="team" type="text" list="teams" value="" placeholder="all">
+    <datalist id="teams">
+        {% for team in teams %}
+        <option value="{{team.name}}">{{team.name}}</option>
         {% endfor %}
     </datalist>
   <input type="submit" value="Filter">
@@ -70,19 +85,27 @@
     <TR>
         <TH>ID</TH>
         <TH>Lauterbach Body ID</TH>
-        <TH>Licenses</TH>
+        <TH>License ID</TH>
+        <TH>Inventory Number</TH>
+        <TH>Team</TH>
+        <TH>Last Username</TH>
+        <TH>Last Hostname</TH>
+        <TH>Last Detection</TH>
         <TH>Status</TH>
+        <TH>Comment</TH>
     </TR>
-    {% for i in range(devs) %}
+    {% for dev in devices %}
     <TR>
-        <TD class="ID">{{devices[i].id}}</TD>
-        <TD class="Serial Number">{{devices[i].serial_number}}</TD>
-        <TD class="License">
-            {% for lic in devices[i].debug_licenses %}
-                {{lic.b_licenses.name}}<BR>
-            {% endfor %}
-        </TD>
-        <TD class="Status">{{statuses[i]}}</TD>
+        <TD class="ID">{{dev['device'].id}}</TD>
+        <TD class="Lauterbach Body ID">{{dev['device'].serial_number}}</TD>
+        <TD class="License ID">{{dev['license'].license_id}}</TD>
+        <TD class="Inventory Number">{{dev['device'].inventory_number}}</TD>
+        <TD class="Team">{{dev['device'].team.name}}</TD>
+        <TD class="Last Username">{{dev['log'].ldpc.username}}</TD>
+        <TD class="Last Hostname">{{dev['log'].ldpc.hostname}}</TD>
+        <TD class="Last Detection">{{dev['log'].timestamp}}</TD>
+        <TD class="Status">{{dev['log'].status}}</TD>
+        <TD class="Comment">{{dev['device'].comment}}</TD>
     </TR>
     {% endfor %}
 </table>
diff --git a/server/templates/devices/devices.html b/server/templates/devices/devices.html
index b0e09e2..4d8c620 100644
--- a/server/templates/devices/devices.html
+++ b/server/templates/devices/devices.html
@@ -49,7 +49,8 @@
       <option value="/logs-web">Vector Logs</option>
       <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web" selected>Keyman Devices</option>
-      <option value="/body-devices-web">Lauterbach Devices</option>
+      <option value="/body-devices-web">Lauterbach Body Devices</option>
+      <option value="/head-devices-web">Lauterbach Head Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
diff --git a/server/templates/devices/devices_normal.html b/server/templates/devices/devices_normal.html
index abd3400..1c77480 100644
--- a/server/templates/devices/devices_normal.html
+++ b/server/templates/devices/devices_normal.html
@@ -49,7 +49,8 @@
       <option value="/logs-web">Vector Logs</option>
       <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web" selected>Keyman Devices</option>
-      <option value="/body-devices-web">Lauterbach Devices</option>
+      <option value="/body-devices-web">Lauterbach Body Devices</option>
+      <option value="/head-devices-web">Lauterbach Head Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
diff --git a/server/templates/head_devices/head_devices.html b/server/templates/head_devices/head_devices.html
new file mode 100644
index 0000000..42117e4
--- /dev/null
+++ b/server/templates/head_devices/head_devices.html
@@ -0,0 +1,114 @@
+<html>
+<head>
+    <style>
+        #devices {
+  font-family: Arial, Helvetica, sans-serif;
+  border-collapse: collapse;
+  width: 100%;
+}
+
+#devices td, #devices th {
+  border: 1px solid #ddd;
+  padding: 8px;
+}
+
+#devices tr:nth-child(even){background-color: #f2f2f2;}
+
+#devices tr:hover {background-color: #ddd;}
+
+#devices th {
+  padding-top: 12px;
+  padding-bottom: 12px;
+  text-align: left;
+  background-color: #47BBF5;
+  color: black;
+}
+    </style>
+    <title>Head Devices Details</title>
+</head>
+<body>
+<div style='float:left;padding-right:20px'>
+<b>Your role: {{user}}</b>
+</div>
+<div style='float:left;padding-right:5px'>
+<form action="/login" method="get">
+    <input type="submit" value="Login" />
+</form>
+</div>
+<div style='float:left;padding-right:5px'>
+<form action="/signup" method="get">
+    <input type="submit" value="Sign Up" />
+</form>
+</div>
+<form action="/logout" method="get">
+    <input type="submit" value="Logout" />
+</form>
+<form action="" method="get">
+  <label for="view">Choose view:</label>
+  <select id="view" name="view" onchange="this.form.action=this.value;">
+      <option value="/logs-web">Vector Logs</option>
+      <option value="/ldlogs-web">Lauterbach Logs</option>
+      <option value="/devices-web">Keyman Devices</option>
+      <option value="/body-devices-web">Lauterbach Body Devices</option>
+      <option value="/head-devices-web" selected>Lauterbach Head Devices</option>
+      <option value="/teams-web">Teams</option>
+      <option value="/pcs-web">PCs</option>
+      <option value="/licenses-web">Licenses</option>
+      <option value="/users-web">Users</option>
+  </select>
+  <input type="submit" value="OK">
+</form>
+<form action="/head-devices-web" method="post">
+    <label for="body_id">Head Device ID:</label>
+    <input id="body_id" name="body_id" type="text" list="body_ids" value="" placeholder="all">
+    <datalist id="body_ids">
+        {% for dev in devs %}
+        <option value="{{dev.serial_number}}"></option>
+        {% endfor %}
+    </datalist>
+    <label for="lic_id">License ID:</label>
+    <input id="lic_id" name="lic_id" type="text" list="licenses_ids" value="" placeholder="all">
+    <datalist id="licenses_ids">
+        {% for license in licenses %}
+        <option value="{{license.license_id}}"></option>
+        {% endfor %}
+    </datalist>
+    <label for="team">Team:</label>
+    <input id="team" name="team" type="text" list="teams" value="" placeholder="all">
+    <datalist id="teams">
+        {% for team in teams %}
+        <option value="{{team.name}}">{{team.name}}</option>
+        {% endfor %}
+    </datalist>
+  <input type="submit" value="Filter">
+</form>
+<table id="devices">
+    <TR>
+        <TH>ID</TH>
+        <TH>Lauterbach Head ID</TH>
+        <TH>License ID</TH>
+        <TH>Inventory Number</TH>
+        <TH>Team</TH>
+        <TH>Last Username</TH>
+        <TH>Last Hostname</TH>
+        <TH>Last Detection</TH>
+        <TH>Status</TH>
+        <TH>Comment</TH>
+    </TR>
+    {% for dev in devices %}
+    <TR>
+        <TD class="ID"><a href="/head-device-license/{{dev['device'].id}}">{{dev['device'].id}}</a></TD>
+        <TD class="Lauterbach Head ID">{{dev['device'].serial_number}}</TD>
+        <TD class="License ID">{{dev['license'].license_id}}</TD>
+        <TD class="Inventory Number">{{dev['device'].inventory_number}}</TD>
+        <TD class="Team">{{dev['device'].team.name}}</TD>
+        <TD class="Last Username">{{dev['log'].ldpc.username}}</TD>
+        <TD class="Last Hostname">{{dev['log'].ldpc.hostname}}</TD>
+        <TD class="Last Detection">{{dev['log'].timestamp}}</TD>
+        <TD class="Status">{{dev['log'].status}}</TD>
+        <TD class="Comment">{{dev['device'].comment}}</TD>
+    </TR>
+    {% endfor %}
+</table>
+</body>
+</html>
\ No newline at end of file
diff --git a/server/templates/head_devices/head_devices_normal.html b/server/templates/head_devices/head_devices_normal.html
new file mode 100644
index 0000000..8df6d97
--- /dev/null
+++ b/server/templates/head_devices/head_devices_normal.html
@@ -0,0 +1,113 @@
+<html>
+<head>
+    <style>
+        #devices {
+  font-family: Arial, Helvetica, sans-serif;
+  border-collapse: collapse;
+  width: 100%;
+}
+
+#devices td, #devices th {
+  border: 1px solid #ddd;
+  padding: 8px;
+}
+
+#devices tr:nth-child(even){background-color: #f2f2f2;}
+
+#devices tr:hover {background-color: #ddd;}
+
+#devices th {
+  padding-top: 12px;
+  padding-bottom: 12px;
+  text-align: left;
+  background-color: #47BBF5;
+  color: black;
+}
+    </style>
+    <title>Devices Details</title>
+</head>
+<body>
+<div style='float:left;padding-right:20px'>
+<b>Your role: {{user}}</b>
+</div>
+<div style='float:left;padding-right:5px'>
+<form action="/login" method="get">
+    <input type="submit" value="Login" />
+</form>
+</div>
+<div style='float:left;padding-right:5px'>
+<form action="/signup" method="get">
+    <input type="submit" value="Sign Up" />
+</form>
+</div>
+<form action="/logout" method="get">
+    <input type="submit" value="Logout" />
+</form>
+<form action="" method="get">
+  <label for="view">Choose view:</label>
+  <select id="view" name="view" onchange="this.form.action=this.value;">
+      <option value="/logs-web">Vector Logs</option>
+      <option value="/ldlogs-web">Lauterbach Logs</option>
+      <option value="/devices-web">Keyman Devices</option>
+      <option value="/body-devices-web">Lauterbach Body Devices</option>
+      <option value="/head-devices-web" selected>Lauterbach Head Devices</option>
+      <option value="/teams-web">Teams</option>
+      <option value="/pcs-web">PCs</option>
+      <option value="/licenses-web">Licenses</option>
+  </select>
+  <input type="submit" value="OK">
+</form>
+<form action="/head-devices-web" method="post">
+    <label for="body_id">Head Device ID:</label>
+    <input id="body_id" name="body_id" type="text" list="body_ids" value="" placeholder="all">
+    <datalist id="body_ids">
+        {% for dev in devs %}
+        <option value="{{dev.serial_number}}"></option>
+        {% endfor %}
+    </datalist>
+    <label for="lic_id">License ID:</label>
+    <input id="lic_id" name="lic_id" type="text" list="licenses_ids" value="" placeholder="all">
+    <datalist id="licenses_ids">
+        {% for license in licenses %}
+        <option value="{{license.license_id}}"></option>
+        {% endfor %}
+    </datalist>
+    <label for="team">Team:</label>
+    <input id="team" name="team" type="text" list="teams" value="" placeholder="all">
+    <datalist id="teams">
+        {% for team in teams %}
+        <option value="{{team.name}}">{{team.name}}</option>
+        {% endfor %}
+    </datalist>
+  <input type="submit" value="Filter">
+</form>
+<table id="devices">
+    <TR>
+        <TH>ID</TH>
+        <TH>Lauterbach Head ID</TH>
+        <TH>License ID</TH>
+        <TH>Inventory Number</TH>
+        <TH>Team</TH>
+        <TH>Last Username</TH>
+        <TH>Last Hostname</TH>
+        <TH>Last Detection</TH>
+        <TH>Status</TH>
+        <TH>Comment</TH>
+    </TR>
+    {% for dev in devices %}
+    <TR>
+        <TD class="ID">{{dev['device'].id}}</TD>
+        <TD class="Lauterbach Head ID">{{dev['device'].serial_number}}</TD>
+        <TD class="License ID">{{dev['license'].license_id}}</TD>
+        <TD class="Inventory Number">{{dev['device'].inventory_number}}</TD>
+        <TD class="Team">{{dev['device'].team.name}}</TD>
+        <TD class="Last Username">{{dev['log'].ldpc.username}}</TD>
+        <TD class="Last Hostname">{{dev['log'].ldpc.hostname}}</TD>
+        <TD class="Last Detection">{{dev['log'].timestamp}}</TD>
+        <TD class="Status">{{dev['log'].status}}</TD>
+        <TD class="Comment">{{dev['device'].comment}}</TD>
+    </TR>
+    {% endfor %}
+</table>
+</body>
+</html>
\ No newline at end of file
diff --git a/server/templates/head_devices/headlicense.html b/server/templates/head_devices/headlicense.html
new file mode 100644
index 0000000..784e0bf
--- /dev/null
+++ b/server/templates/head_devices/headlicense.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>Head Device License Connect</title>
+</head>
+<body>
+<h6>
+    <p>Serial Number: {{device.serial_number}}</p>
+</h6>
+<h4>
+    License ID: {{device.license.license_id}}
+</h4>
+<form action="/head-devices-web-lic/{{device.id}}" method="post">
+  <label for="lic">Licenses:</label>
+  <select id="lic" name="lic">
+      {% for license in licenses %}
+    <option value={{license.id}}>{{license.license_id}}</option>
+      {% endfor %}
+  </select>
+  <input type="submit" value="Connect">
+</form>
+<div style='padding-top:20px'>
+<form action="/head-devices-web-team/{{device.id}}" method="post">
+  <label for="team_con">Teams:</label>
+  <select id="team_con" name="team_con" >
+      {% for team in teams %}
+    <option value={{team.id}}>{{team.name}}</option>
+      {% endfor %}
+  </select>
+  <input type="submit" value="Connect">
+</form>
+</div>
+<div style='padding-top:20px'>
+<form action="/head-devices-inv/{{device.id}}" method="post">
+  <label for="dev_inv">Inventory Number:</label><br>
+  <input type="text" id="dev_inv" name="dev_inv" value="{{device.inventory_number}}">
+  <input type="submit" value="Submit">
+</form>
+</div>
+<div style='padding-top:20px'>
+<form action="/head-devices-comm/{{device.id}}" method="post">
+  <label for="dev_com">Comment:</label><br>
+  <input type="text" id="dev_com" name="dev_com" value="{{device.comment}}">
+  <input type="submit" value="Submit">
+</form>
+</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/server/templates/ld-logs/ldlogs.html b/server/templates/ld-logs/ldlogs.html
index 7723f2a..e7f36cf 100644
--- a/server/templates/ld-logs/ldlogs.html
+++ b/server/templates/ld-logs/ldlogs.html
@@ -49,7 +49,8 @@
       <option value="/logs-web">Vector Logs</option>
       <option value="/ldlogs-web" selected>Lauterbach Logs</option>
       <option value="/devices-web">Keyman Devices</option>
-      <option value="/body-devices-web">Lauterbach Devices</option>
+      <option value="/body-devices-web">Lauterbach Body Devices</option>
+      <option value="/head-devices-web">Lauterbach Head Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
@@ -76,7 +77,7 @@
     <input id="lic" name="lic" type="text" list="licenses" value="" placeholder="all">
     <datalist id="licenses">
         {% for license in licenses %}
-        <option value="{{license.name}}"></option>
+        <option value="{{license.license_id}}"></option>
         {% endfor %}
     </datalist>
   <input type="submit" value="Filter">
@@ -86,7 +87,8 @@
         <TH>ID</TH>
         <TH>PC Username</TH>
         <TH>PC Hostname</TH>
-        <TH>Team</TH>
+        <TH>Head Team</TH>
+        <TH>Body Team</TH>
         <TH>Timestamp</TH>
         <TH>Status</TH>
         <TH>Lauterbach Head ID</TH>
@@ -97,11 +99,8 @@
         <TD class="ID">{{log.id}}</TD>
         <TD class="Username">{{log.ldpc.username}}</TD>
         <TD class="Hostname">{{log.ldpc.hostname}}</TD>
-        {% if log.ldpc.team == None %}
-            <TD class="Team">NONE</TD>
-        {% else %}
-            <TD class="Team">{{log.ldpc.team.name}}</TD>
-        {% endif %}
+        <TD class="Head Team">{{log.head_device.team.name}}</TD>
+        <TD class="Body Team">{{log.body_device.team.name}}</TD>
         <TD class="Timestamp">{{log.timestamp}}</TD>
         <TD class="Status">{{log.status}}</TD>
         <TD class="HeadDeviceSerialNumber">{{log.head_device.serial_number}}</TD>
diff --git a/server/templates/ld-logs/ldlogs_normal.html b/server/templates/ld-logs/ldlogs_normal.html
index 303b83f..bcdf40a 100644
--- a/server/templates/ld-logs/ldlogs_normal.html
+++ b/server/templates/ld-logs/ldlogs_normal.html
@@ -49,7 +49,8 @@
       <option value="/logs-web">Vector Logs</option>
       <option value="/ldlogs-web" selected>Lauterbach Logs</option>
       <option value="/devices-web">Keyman Devices</option>
-      <option value="/body-devices-web">Lauterbach Devices</option>
+      <option value="/body-devices-web">Lauterbach Body Devices</option>
+      <option value="/head-devices-web">Lauterbach Head Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
@@ -75,7 +76,7 @@
     <input id="lic" name="lic" type="text" list="licenses" value="" placeholder="all">
     <datalist id="licenses">
         {% for license in licenses %}
-        <option value="{{license.name}}"></option>
+        <option value="{{license.name}} : {{license.license_id}}"></option>
         {% endfor %}
     </datalist>
   <input type="submit" value="Filter">
@@ -85,7 +86,8 @@
         <TH>ID</TH>
         <TH>PC Username</TH>
         <TH>PC Hostname</TH>
-        <TH>Team</TH>
+        <TH>Head Team</TH>
+        <TH>Body Team</TH>
         <TH>Timestamp</TH>
         <TH>Status</TH>
         <TH>Lauterbach Head ID</TH>
@@ -96,17 +98,14 @@
         <TD class="ID">{{log.id}}</TD>
         <TD class="Username">{{log.ldpc.username}}</TD>
         <TD class="Hostname">{{log.ldpc.hostname}}</TD>
-        {% if log.ldpc.team == None %}
-            <TD class="Team">NONE</TD>
-        {% else %}
-            <TD class="Team">{{log.ldpc.team.name}}</TD>
-        {% endif %}
+        <TD class="Head Team">{{log.head_device.team.name}}</TD>
+        <TD class="Body Team">{{log.body_device.team.name}}</TD>
         <TD class="Timestamp">{{log.timestamp}}</TD>
         <TD class="Status">{{log.status}}</TD>
         <TD class="HeadDeviceSerialNumber">{{log.head_device.serial_number}}</TD>
         <TD class="BodyDeviceSerialNumber">{{log.body_device.serial_number}}</TD>
     </TR>
-    {% endfor %}
+        {% endfor %}
 </table>
 </body>
 </html>
\ No newline at end of file
diff --git a/server/templates/licenses/license_create.html b/server/templates/licenses/license_create.html
index 707ce4e..03b9d6a 100644
--- a/server/templates/licenses/license_create.html
+++ b/server/templates/licenses/license_create.html
@@ -6,12 +6,12 @@
 </head>
 <body>
 <form action="/licenses-web" method="post">
-  <label for="name">Name:</label><br>
-  <input type="text" id="name" name="name"><br><br>
-    <label for="lic_id">License ID:</label><br>
-  <input type="text" id="lic_id" name="lic_id"><br><br>
+  <label for="name">Name:</label>
+  <input type="text" id="name" name="name"><br>
+    <label for="lic_id">License ID:</label>
+  <input type="text" id="lic_id" name="lic_id"><br>
     <label for="expdate">Expiration Date</label>
-  <input type="date" id="expdate" name="expdate" min={{minimum_date}}>
+  <input type="date" id="expdate" name="expdate" min={{minimum_date}}><br>
   <input type="submit" value="Submit">
 </form>
 </body>
diff --git a/server/templates/pcs/pcs.html b/server/templates/pcs/pcs.html
index a723452..ec873ad 100644
--- a/server/templates/pcs/pcs.html
+++ b/server/templates/pcs/pcs.html
@@ -49,7 +49,8 @@
       <option value="/logs-web">Vector Logs</option>
       <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Keyman Devices</option>
-      <option value="/body-devices-web">Lauterbach Devices</option>
+      <option value="/body-devices-web">Lauterbach Body Devices</option>
+      <option value="/head-devices-web">Lauterbach Head Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web" selected>PCs</option>
       <option value="/licenses-web">Licenses</option>
diff --git a/server/templates/pcs/pcs_normal.html b/server/templates/pcs/pcs_normal.html
index 1ca892d..c5051aa 100644
--- a/server/templates/pcs/pcs_normal.html
+++ b/server/templates/pcs/pcs_normal.html
@@ -49,7 +49,8 @@
       <option value="/logs-web">Vector Logs</option>
       <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Keyman Devices</option>
-      <option value="/body-devices-web">Lauterbach Devices</option>
+      <option value="/body-devices-web">Lauterbach Body Devices</option>
+      <option value="/head-devices-web">Lauterbach Head Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web" selected>PCs</option>
       <option value="/licenses-web">Licenses</option>
diff --git a/server/templates/teams/team_change.html b/server/templates/teams/team_change.html
index 3ef6f23..247d43b 100644
--- a/server/templates/teams/team_change.html
+++ b/server/templates/teams/team_change.html
@@ -7,8 +7,8 @@
 <body>
 <h4>Team: {{team.name}}</h4>
 <form action="/teams-change-process/{{team.id}}" method="post">
-  <label for="name">Name:</label><br>
-  <input type="text" id="name" name="name"><br><br>
+  <label for="name">Name:</label>
+  <input type="text" id="name" name="name"><br>
   <input type="submit" value="Submit">
 </form>
 </body>
diff --git a/server/templates/teams/team_create.html b/server/templates/teams/team_create.html
index 28fb63d..85fc777 100644
--- a/server/templates/teams/team_create.html
+++ b/server/templates/teams/team_create.html
@@ -6,8 +6,8 @@
 </head>
 <body>
 <form action="/teams-web-con" method="post">
-  <label for="name">Name:</label><br>
-  <input type="text" id="name" name="name"><br><br>
+  <label for="name">Name:</label>
+  <input type="text" id="name" name="name"><br>
   <input type="submit" value="Submit">
 </form>
 </body>
diff --git a/server/templates/teams/teams.html b/server/templates/teams/teams.html
index 6957999..539f3da 100644
--- a/server/templates/teams/teams.html
+++ b/server/templates/teams/teams.html
@@ -49,7 +49,8 @@
       <option value="/logs-web">Vector Logs</option>
       <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Keyman Devices</option>
-      <option value="/body-devices-web">Lauterbach Devices</option>
+      <option value="/body-devices-web">Lauterbach Body Devices</option>
+      <option value="/head-devices-web">Lauterbach Head Devices</option>
       <option value="/teams-web" selected>Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
diff --git a/server/templates/teams/teams_normal.html b/server/templates/teams/teams_normal.html
index c928f52..2a2ac88 100644
--- a/server/templates/teams/teams_normal.html
+++ b/server/templates/teams/teams_normal.html
@@ -49,7 +49,8 @@
       <option value="/logs-web">Vector Logs</option>
       <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Keyman Devices</option>
-      <option value="/body-devices-web">Lauterbach Devices</option>
+      <option value="/body-devices-web">Lauterbach Body Devices</option>
+      <option value="/head-devices-web">Lauterbach Head Devices</option>
       <option value="/teams-web" selected>Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
diff --git a/server/templates/usb-logs/crossroad.html b/server/templates/usb-logs/crossroad.html
index 01db9b9..3f16cf0 100644
--- a/server/templates/usb-logs/crossroad.html
+++ b/server/templates/usb-logs/crossroad.html
@@ -12,7 +12,8 @@
       <option value="/logs-web">Vector Logs</option>
       <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Keyman Devices</option>
-      <option value="/body-devices-web">Lauterbach Devices</option>
+      <option value="/body-devices-web">Lauterbach Body Devices</option>
+      <option value="/head-devices-web">Lauterbach Head Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
@@ -24,34 +25,50 @@
 <table>
     <TR>
         <TH>URL</TH>
+        <TH>Name</TH>
         <TH>Purpose</TH>
     </TR>
     <TR>
         <TD class="URL">/logs-web</TD>
-        <TD class="Purpose">Shows all saves Keyman logs. User can filter through license, team and user</TD>
+        <TD class="Name">Vector Logs</TD>
+        <TD class="Purpose">Shows all saved Keyman logs. User can filter through license, team and user</TD>
     </TR>
     <TR>
         <TD class="URL">/ldlogs-web</TD>
-        <TD class="Purpose">Shows all saves LD debugger logs. User can filter through license, team and user</TD>
+        <TD class="Name">Lauterbach Logs</TD>
+        <TD class="Purpose">Shows all saved LD debugger logs. User can filter through license, team and user</TD>
     </TR>
     <TR>
         <TD class="URL">/devices-web</TD>
-        <TD class="Purpose">Shows all Keyman devices saved in database and its last state (connected, disconnected)</TD>
+        <TD class="Name">Keyman Devices</TD>
+        <TD class="Purpose">Shows all Keyman devices saved in database and its license, inventory number, last pc and
+                            last detection. User can filter through keyman id, license type, license id and team</TD>
     </TR>
     <TR>
         <TD class="URL">/body-devices-web</TD>
-        <TD class="Purpose">Shows all LD Body devices saved in database and its last state (connected, disconnected)</TD>
+        <TD class="Name">Lauterbach Body Devices</TD>
+        <TD class="Purpose">Shows all Lauterbach Body devices saved in database and its license, inventory number, last pc and
+                            last detection. User can filter through body device serial nummber, license id and team</TD>
+    </TR>
+     <TR>
+        <TD class="URL">/head-devices-web</TD>
+        <TD class="Name">Lauterbach Head Devices</TD>
+        <TD class="Purpose">Shows all Lauterbach Head devices saved in database and its license, inventory number, last pc and
+                            last detection. User can filter through body device serial nummber, license id and team</TD>
     </TR>
     <TR>
         <TD class="URL">/teams-web</TD>
-        <TD class="Purpose">Shows all teams currently saved in database and its members</TD>
+        <TD class="Name">Teams</TD>
+        <TD class="Purpose">Shows all teams currently saved in database</TD>
     </TR>
     <TR>
         <TD class="URL">/pcs-web</TD>
-        <TD class="Purpose">Shows all PCS currently saved in database and its team</TD>
+        <TD class="Name">PCs</TD>
+        <TD class="Purpose">Shows all PCS currently saved in database</TD>
     </TR>
     <TR>
         <TD class="URL">/licenses-web</TD>
+        <TD class="Name">Licenses</TD>
         <TD class="Purpose">Shows all Licenses currently saved in database and its expiration date</TD>
     </TR>
 </table>
diff --git a/server/templates/usb-logs/logs.html b/server/templates/usb-logs/logs.html
index 34e14cd..fdecc00 100644
--- a/server/templates/usb-logs/logs.html
+++ b/server/templates/usb-logs/logs.html
@@ -49,7 +49,8 @@
       <option value="/logs-web" selected>Vector Logs</option>
       <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Keyman Devices</option>
-      <option value="/body-devices-web">Lauterbach Devices</option>
+      <option value="/body-devices-web">Lauterbach Body Devices</option>
+      <option value="/head-devices-web">Lauterbach Head Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
diff --git a/server/templates/usb-logs/logs_normal.html b/server/templates/usb-logs/logs_normal.html
index 99c3a9c..d954447 100644
--- a/server/templates/usb-logs/logs_normal.html
+++ b/server/templates/usb-logs/logs_normal.html
@@ -49,7 +49,8 @@
       <option value="/logs-web" selected>Vector Logs</option>
       <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Keyman Devices</option>
-      <option value="/body-devices-web">Lauterbach Devices</option>
+      <option value="/body-devices-web">Lauterbach Body Devices</option>
+      <option value="/head-devices-web">Lauterbach Head Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
diff --git a/server/templates/users/users.html b/server/templates/users/users.html
index 6b56b9a..bdbec4b 100644
--- a/server/templates/users/users.html
+++ b/server/templates/users/users.html
@@ -46,7 +46,8 @@
       <option value="/logs-web">Vector Logs</option>
       <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Keyman Devices</option>
-      <option value="/body-devices-web">Lauterbach Devices</option>
+      <option value="/body-devices-web">Lauterbach Body Devices</option>
+      <option value="/head-devices-web">Lauterbach Head Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
