1
|
<!doctype html>
|
2
|
<html lang="en">
|
3
|
<head>
|
4
|
<meta charset="utf-8">
|
5
|
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
|
6
|
<meta name="generator" content="pdoc 0.10.0" />
|
7
|
<title>sql_app.crud API documentation</title>
|
8
|
<meta name="description" content="" />
|
9
|
<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>
|
10
|
<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>
|
11
|
<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
|
12
|
<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>
|
13
|
<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>
|
14
|
<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>
|
15
|
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
|
16
|
<script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
|
17
|
</head>
|
18
|
<body>
|
19
|
<main>
|
20
|
<article id="content">
|
21
|
<header>
|
22
|
<h1 class="title">Module <code>sql_app.crud</code></h1>
|
23
|
</header>
|
24
|
<section id="section-intro">
|
25
|
<details class="source">
|
26
|
<summary>
|
27
|
<span>Expand source code</span>
|
28
|
</summary>
|
29
|
<pre><code class="python">from datetime import datetime, date
|
30
|
|
31
|
from sqlalchemy.orm import Session
|
32
|
from sqlalchemy import and_, desc
|
33
|
from . import models, schemas
|
34
|
|
35
|
|
36
|
def get_device(db: Session, device_id: int):
|
37
|
"""
|
38
|
returns one specific devices by given id
|
39
|
"""
|
40
|
return db.query(models.Device).filter(models.Device.id == device_id).first()
|
41
|
|
42
|
|
43
|
def get_devices(db: Session, skip: int = 0, limit: int = 100):
|
44
|
"""
|
45
|
returns all devices in database
|
46
|
"""
|
47
|
return db.query(models.Device).offset(skip).limit(limit).all()
|
48
|
|
49
|
|
50
|
def find_device(db: Session, device: schemas.DeviceTemp):
|
51
|
"""
|
52
|
finds one device with serial_number same as in given DeviceBase object
|
53
|
"""
|
54
|
return db.query(models.Device).filter(and_(models.Device.serial_number == device.serial_number)).first()
|
55
|
|
56
|
|
57
|
def find_device_by_serial(db: Session, ser: str):
|
58
|
"""
|
59
|
finds one device with serial_number same as in given DeviceBase object
|
60
|
"""
|
61
|
return db.query(models.Device).filter(and_(models.Device.serial_number == ser)).first()
|
62
|
|
63
|
|
64
|
def get_devices_with_ids(db: Session, ids: []):
|
65
|
"""
|
66
|
returns all devices with given ids
|
67
|
"""
|
68
|
return db.query(models.Device).filter(models.Device.id.in_(ids)).all()
|
69
|
|
70
|
|
71
|
def get_bodydevices_with_ids(db: Session, ids: []):
|
72
|
"""
|
73
|
returns all bodydevices with given ids
|
74
|
"""
|
75
|
return db.query(models.BodyDevice).filter(models.BodyDevice.id.in_(ids)).all()
|
76
|
|
77
|
|
78
|
def get_headdevices_with_ids(db: Session, ids: []):
|
79
|
"""
|
80
|
returns all headdevices with given ids
|
81
|
"""
|
82
|
return db.query(models.HeadDevice).filter(models.HeadDevice.id.in_(ids)).all()
|
83
|
|
84
|
|
85
|
def find_headdevices_by_team(db: Session, team_id: int):
|
86
|
"""
|
87
|
Returns all head devices in specific team
|
88
|
"""
|
89
|
return db.query(models.HeadDevice).filter(models.HeadDevice.team_id == team_id).all()
|
90
|
|
91
|
|
92
|
def find_bodydevices_by_team(db: Session, team_id: int):
|
93
|
"""
|
94
|
Returns all body devices in specific team
|
95
|
"""
|
96
|
return db.query(models.BodyDevice).filter(models.BodyDevice.team_id == team_id).all()
|
97
|
|
98
|
|
99
|
def find_headdevices_by_license(db: Session, lic_id: int):
|
100
|
"""
|
101
|
Returns all head devices with specific license
|
102
|
"""
|
103
|
return db.query(models.HeadDevice).filter(models.HeadDevice.license_id == lic_id).all()
|
104
|
|
105
|
|
106
|
def find_bodydevices_by_license(db: Session, lic_id: int):
|
107
|
"""
|
108
|
Returns all body devices with specific license
|
109
|
"""
|
110
|
return db.query(models.BodyDevice).filter(models.BodyDevice.license_id == lic_id).all()
|
111
|
|
112
|
|
113
|
def get_devices_by_team(db: Session, team: int):
|
114
|
"""
|
115
|
returns all devices with same team
|
116
|
"""
|
117
|
return db.query(models.Device).filter(models.Device.team_id == team).all()
|
118
|
|
119
|
|
120
|
def create_device(db: Session, device: schemas.DeviceTemp):
|
121
|
"""
|
122
|
creates new device with data from given DeviceBase object
|
123
|
"""
|
124
|
db_device = models.Device(vendor_id=device.vendor_id, product_id=device.product_id,
|
125
|
serial_number=device.serial_number, inventory_number="", comment="")
|
126
|
db.add(db_device)
|
127
|
db.commit()
|
128
|
db.refresh(db_device)
|
129
|
return db_device
|
130
|
|
131
|
|
132
|
def get_license(db: Session, license_id: int):
|
133
|
"""
|
134
|
returns one specific license by given id
|
135
|
"""
|
136
|
return db.query(models.License).filter(models.License.id == license_id).first()
|
137
|
|
138
|
|
139
|
def get_licenses(db: Session, skip: int = 0, limit: int = 100):
|
140
|
"""
|
141
|
returns all licenses in database
|
142
|
"""
|
143
|
return db.query(models.License).offset(skip).limit(limit).all()
|
144
|
|
145
|
|
146
|
def find_license(db: Session, name: str):
|
147
|
"""
|
148
|
finds one license by given string name
|
149
|
"""
|
150
|
return db.query(models.License).filter(models.License.license_id == name).first()
|
151
|
|
152
|
|
153
|
def get_licenses_by_name(db: Session, name: str):
|
154
|
return db.query(models.License).filter(models.License.name == name).all()
|
155
|
|
156
|
|
157
|
def create_license(db: Session, name: str, lic_id: str, expdate: date):
|
158
|
"""
|
159
|
creates new license with given name and expiration date
|
160
|
"""
|
161
|
db_license = models.License(name=name, license_id=lic_id, expiration_date=expdate)
|
162
|
db.add(db_license)
|
163
|
db.commit()
|
164
|
db.refresh(db_license)
|
165
|
return db_license
|
166
|
|
167
|
|
168
|
def get_license_devices(db: Session, license_id: int):
|
169
|
"""
|
170
|
returns all entries in devices_licenses table with given license_id
|
171
|
"""
|
172
|
return db.query(models.DeviceLicense).filter(models.DeviceLicense.license_id == license_id).all()
|
173
|
|
174
|
|
175
|
def find_devicelicenses_by_licid_array(db: Session, lcs: []):
|
176
|
"""
|
177
|
Finds all device_licenses with license_id in given id array
|
178
|
"""
|
179
|
return db.query(models.DeviceLicense).filter(models.DeviceLicense.license_id.in_(lcs)).all()
|
180
|
|
181
|
|
182
|
def get_device_licenses(db: Session, device_id: int):
|
183
|
"""
|
184
|
returns all entries in devices_licenses table with given device_id
|
185
|
"""
|
186
|
return db.query(models.DeviceLicense).filter(models.DeviceLicense.device_id == device_id).all()
|
187
|
|
188
|
|
189
|
def get_devicelicense_by_devicelicense(db: Session, device_id: int, license_id: int):
|
190
|
"""
|
191
|
returns entry in devices_licenses table with given device id and license id
|
192
|
"""
|
193
|
return db.query(models.DeviceLicense).filter(and_(models.DeviceLicense.device_id == device_id,
|
194
|
models.DeviceLicense.license_id == license_id)).first()
|
195
|
|
196
|
|
197
|
def create_device_license(db: Session, device: int, license: int, time: datetime):
|
198
|
"""
|
199
|
creates new entry in devices_licenses table with device id, license id and time.
|
200
|
"""
|
201
|
db_device_license = models.DeviceLicense(device_id=device, license_id=license,
|
202
|
assigned_datetime=time)
|
203
|
db.add(db_device_license)
|
204
|
db.commit()
|
205
|
db.refresh(db_device_license)
|
206
|
return db_device_license
|
207
|
|
208
|
|
209
|
def delete_device_license(db: Session, device: int, license: int):
|
210
|
"""
|
211
|
deletes entry in devices_licenses table with device id, license id and time.
|
212
|
"""
|
213
|
db_device_license = get_devicelicense_by_devicelicense(db, device, license)
|
214
|
db_lic = db.delete(db_device_license)
|
215
|
db.commit()
|
216
|
return db_lic
|
217
|
|
218
|
|
219
|
def find_pc_by_username(db: Session, name: str):
|
220
|
"""
|
221
|
Finds one pc by given username
|
222
|
"""
|
223
|
return db.query(models.PC).filter(models.PC.username == name).first()
|
224
|
|
225
|
|
226
|
def get_pc(db: Session, pc_id: int):
|
227
|
"""
|
228
|
returns one specific pc by given id
|
229
|
"""
|
230
|
return db.query(models.PC).filter(models.PC.id == pc_id).first()
|
231
|
|
232
|
|
233
|
def update_device(db: Session, device_id: int, team: str):
|
234
|
"""
|
235
|
Updates team of one specific pc
|
236
|
"""
|
237
|
old_dev = get_device(db, device_id)
|
238
|
team = get_team(db, int(team))
|
239
|
new = {'id': old_dev.id, 'vendor_id': old_dev.vendor_id, 'product_id': old_dev.product_id,
|
240
|
'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
|
241
|
'comment': old_dev.comment, 'team_id': team.id}
|
242
|
for key, value in new.items():
|
243
|
setattr(old_dev, key, value)
|
244
|
db.commit()
|
245
|
db.refresh(old_dev)
|
246
|
return old_dev
|
247
|
|
248
|
|
249
|
def update_device_inv(db: Session, device_id: int, inv: str):
|
250
|
"""
|
251
|
Updates inventory number of one specific pc
|
252
|
"""
|
253
|
old_dev = get_device(db, device_id)
|
254
|
if old_dev.team_id != None:
|
255
|
team = get_team(db, int(old_dev.team_id))
|
256
|
teamid = team.id
|
257
|
else:
|
258
|
teamid = None
|
259
|
new = {'id': old_dev.id, 'vendor_id': old_dev.vendor_id, 'product_id': old_dev.product_id,
|
260
|
'serial_number': old_dev.serial_number, 'inventory_number': inv,
|
261
|
'comment': old_dev.comment, 'team_id': teamid}
|
262
|
for key, value in new.items():
|
263
|
setattr(old_dev, key, value)
|
264
|
db.commit()
|
265
|
db.refresh(old_dev)
|
266
|
return old_dev
|
267
|
|
268
|
|
269
|
def update_device_com(db: Session, device_id: int, comm: str):
|
270
|
"""
|
271
|
Updates team of one specific pc
|
272
|
"""
|
273
|
old_dev = get_device(db, device_id)
|
274
|
if old_dev.team_id != None:
|
275
|
team = get_team(db, int(old_dev.team_id))
|
276
|
teamid = team.id
|
277
|
else:
|
278
|
teamid = None
|
279
|
new = {'id': old_dev.id, 'vendor_id': old_dev.vendor_id, 'product_id': old_dev.product_id,
|
280
|
'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
|
281
|
'comment': comm, 'team_id': teamid}
|
282
|
for key, value in new.items():
|
283
|
setattr(old_dev, key, value)
|
284
|
db.commit()
|
285
|
db.refresh(old_dev)
|
286
|
return old_dev
|
287
|
|
288
|
|
289
|
def change_role(db: Session, usr_id: int, role: str):
|
290
|
"""
|
291
|
Updates team of one specific pc
|
292
|
"""
|
293
|
old_usr = find_user_byid(db, usr_id)
|
294
|
new = {'id': old_usr.id, 'username': old_usr.username, 'password': old_usr.password, 'role': role}
|
295
|
for key, value in new.items():
|
296
|
setattr(old_usr, key, value)
|
297
|
db.commit()
|
298
|
db.refresh(old_usr)
|
299
|
return old_usr
|
300
|
|
301
|
|
302
|
def get_pcs(db: Session, skip: int = 0, limit: int = 100):
|
303
|
"""
|
304
|
returns all pcs in database
|
305
|
"""
|
306
|
return db.query(models.PC).offset(skip).limit(limit).all()
|
307
|
|
308
|
|
309
|
def find_pc(db: Session, username: str, hostname: str):
|
310
|
"""
|
311
|
Finds one pc with given username and hostname
|
312
|
"""
|
313
|
return db.query(models.PC).filter(and_(models.PC.username == username,
|
314
|
models.PC.hostname == hostname)).first()
|
315
|
|
316
|
|
317
|
def find_pc_by_name(db: Session, username: str):
|
318
|
"""
|
319
|
Finds one pc by its username
|
320
|
"""
|
321
|
return db.query(models.PC).filter(models.PC.username == username).first()
|
322
|
|
323
|
|
324
|
def find_pc_by_name_all(db: Session, username: str):
|
325
|
"""
|
326
|
Finds all pcs with same username
|
327
|
"""
|
328
|
return db.query(models.PC).filter(models.PC.username == username).offset(0).limit(100).all()
|
329
|
|
330
|
|
331
|
def find_pcs(db: Session, pcs: []):
|
332
|
"""
|
333
|
Finds all pcs with ids in given id array
|
334
|
"""
|
335
|
return db.query(models.PC).filter(models.PC.id.in_(pcs)).all()
|
336
|
|
337
|
|
338
|
def create_pc(db: Session, user: str, host: str):
|
339
|
"""
|
340
|
creates new pc with given username and hostname
|
341
|
"""
|
342
|
db_pc = models.PC(username=user, hostname=host)
|
343
|
db.add(db_pc)
|
344
|
db.commit()
|
345
|
db.refresh(db_pc)
|
346
|
return db_pc
|
347
|
|
348
|
|
349
|
def get_team(db: Session, team_id: int):
|
350
|
"""
|
351
|
returns one specific team wit given id
|
352
|
"""
|
353
|
return db.query(models.Team).filter(models.Team.id == team_id).first()
|
354
|
|
355
|
|
356
|
def get_teams(db: Session, skip: int = 0, limit: int = 100):
|
357
|
"""
|
358
|
returns all teams currently saved in database
|
359
|
"""
|
360
|
return db.query(models.Team).offset(skip).limit(limit).all()
|
361
|
|
362
|
|
363
|
def find_team(db: Session, name: str):
|
364
|
"""
|
365
|
Finds one specific team by its name
|
366
|
"""
|
367
|
return db.query(models.Team).filter(models.Team.name == name).first()
|
368
|
|
369
|
|
370
|
def create_team(db: Session, name: str):
|
371
|
"""
|
372
|
Creates new team with given name
|
373
|
"""
|
374
|
db_team = models.Team(name=name)
|
375
|
db.add(db_team)
|
376
|
db.commit()
|
377
|
db.refresh(db_team)
|
378
|
return db_team
|
379
|
|
380
|
|
381
|
def change_team(db: Session, team_id: int, name: str):
|
382
|
"""
|
383
|
Updates name of one specific team
|
384
|
"""
|
385
|
old_team = get_team(db, team_id)
|
386
|
new = {'id': old_team.id, 'name': name}
|
387
|
for key, value in new.items():
|
388
|
setattr(old_team, key, value)
|
389
|
db.commit()
|
390
|
db.refresh(old_team)
|
391
|
return old_team
|
392
|
|
393
|
|
394
|
def get_head_device(db: Session, head_id: int):
|
395
|
"""
|
396
|
Returns one specific head device by given id
|
397
|
"""
|
398
|
return db.query(models.HeadDevice).filter(models.HeadDevice.id == head_id).first()
|
399
|
|
400
|
|
401
|
def get_head_devices(db: Session, skip: int = 0, limit: int = 100):
|
402
|
"""
|
403
|
Returns all head devices saved in database
|
404
|
"""
|
405
|
return db.query(models.HeadDevice).offset(skip).limit(limit).all()
|
406
|
|
407
|
|
408
|
def find_head_device(db: Session, serial: schemas.HeadDeviceTemp):
|
409
|
"""
|
410
|
Finds one head device by its serial number
|
411
|
"""
|
412
|
return db.query(models.HeadDevice).filter(models.HeadDevice.serial_number == serial.serial_number).first()
|
413
|
|
414
|
|
415
|
def create_head_device(db: Session, log: schemas.HeadDeviceTemp):
|
416
|
"""
|
417
|
Creates new head device
|
418
|
"""
|
419
|
db_head = models.HeadDevice(serial_number=log.serial_number)
|
420
|
db.add(db_head)
|
421
|
db.commit()
|
422
|
db.refresh(db_head)
|
423
|
return db_head
|
424
|
|
425
|
|
426
|
def get_body_device(db: Session, body_id: int):
|
427
|
"""
|
428
|
Returns one specific body device by given id
|
429
|
"""
|
430
|
return db.query(models.BodyDevice).filter(models.BodyDevice.id == body_id).first()
|
431
|
|
432
|
|
433
|
def get_body_devices(db: Session, skip: int = 0, limit: int = 100):
|
434
|
"""
|
435
|
Returns all body devices saved in database
|
436
|
"""
|
437
|
return db.query(models.BodyDevice).offset(skip).limit(limit).all()
|
438
|
|
439
|
|
440
|
def find_body_device(db: Session, serial: schemas.BodyDeviceTemp):
|
441
|
"""
|
442
|
Finds one body device by its serial number
|
443
|
"""
|
444
|
return db.query(models.BodyDevice).filter(models.BodyDevice.serial_number == serial.serial_number).first()
|
445
|
|
446
|
|
447
|
def find_bodydevice_by_serial(db: Session, serial: str):
|
448
|
"""
|
449
|
Finds one specific body device by given serial number
|
450
|
"""
|
451
|
return db.query(models.BodyDevice).filter(models.BodyDevice.serial_number == serial).first()
|
452
|
|
453
|
|
454
|
def find_headdevice_by_serial(db: Session, serial: str):
|
455
|
"""
|
456
|
Finds one specific head device by given serial number
|
457
|
"""
|
458
|
return db.query(models.HeadDevice).filter(models.HeadDevice.serial_number == serial).first()
|
459
|
|
460
|
|
461
|
def create_body_device(db: Session, log: schemas.BodyDeviceTemp):
|
462
|
"""
|
463
|
Creates new Body device
|
464
|
"""
|
465
|
db_body = models.BodyDevice(serial_number=log.serial_number, inventory_number="", comment="")
|
466
|
db.add(db_body)
|
467
|
db.commit()
|
468
|
db.refresh(db_body)
|
469
|
return db_body
|
470
|
|
471
|
|
472
|
def update_bodydevice_license(db: Session, device_id: int, lic_id: int):
|
473
|
"""
|
474
|
Updates body devices license with one given by user
|
475
|
"""
|
476
|
old_dev = get_body_device(db, device_id)
|
477
|
lic = get_license(db, lic_id)
|
478
|
new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
|
479
|
'comment': old_dev.comment, 'team_id': old_dev.team_id, 'license_id': lic.id}
|
480
|
for key, value in new.items():
|
481
|
setattr(old_dev, key, value)
|
482
|
db.commit()
|
483
|
db.refresh(old_dev)
|
484
|
return old_dev
|
485
|
|
486
|
|
487
|
def update_bodydevice_team(db: Session, device_id: int, team_id: int):
|
488
|
"""
|
489
|
Updates body devices team with one given by user
|
490
|
"""
|
491
|
old_dev = get_body_device(db, device_id)
|
492
|
team = get_team(db, team_id)
|
493
|
new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
|
494
|
'comment': old_dev.comment, 'team_id': team.id, 'license_id': old_dev.license_id}
|
495
|
for key, value in new.items():
|
496
|
setattr(old_dev, key, value)
|
497
|
db.commit()
|
498
|
db.refresh(old_dev)
|
499
|
return old_dev
|
500
|
|
501
|
|
502
|
def update_bodydevice_inv(db: Session, device_id: int, dev_inv: str):
|
503
|
"""
|
504
|
Updates body devices inventory number with new one given by user
|
505
|
"""
|
506
|
old_dev = get_body_device(db, device_id)
|
507
|
new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': dev_inv,
|
508
|
'comment': old_dev.comment, 'team_id': old_dev.team_id, 'license_id': old_dev.license_id}
|
509
|
for key, value in new.items():
|
510
|
setattr(old_dev, key, value)
|
511
|
db.commit()
|
512
|
db.refresh(old_dev)
|
513
|
return old_dev
|
514
|
|
515
|
|
516
|
def update_bodydevice_comm(db: Session, device_id: int, comm: str):
|
517
|
"""
|
518
|
Updates body devices comment with new one given by user
|
519
|
"""
|
520
|
old_dev = get_body_device(db, device_id)
|
521
|
new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
|
522
|
'comment': comm, 'team_id': old_dev.team_id, 'license_id': old_dev.license_id}
|
523
|
for key, value in new.items():
|
524
|
setattr(old_dev, key, value)
|
525
|
db.commit()
|
526
|
db.refresh(old_dev)
|
527
|
return old_dev
|
528
|
|
529
|
|
530
|
def update_headdevice_license(db: Session, device_id: int, lic_id: int):
|
531
|
"""
|
532
|
Updates head devices license with one given by user
|
533
|
"""
|
534
|
old_dev = get_head_device(db, device_id)
|
535
|
lic = get_license(db, lic_id)
|
536
|
new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
|
537
|
'comment': old_dev.comment, 'team_id': old_dev.team_id, 'license_id': lic.id}
|
538
|
for key, value in new.items():
|
539
|
setattr(old_dev, key, value)
|
540
|
db.commit()
|
541
|
db.refresh(old_dev)
|
542
|
return old_dev
|
543
|
|
544
|
|
545
|
def update_headdevice_team(db: Session, device_id: int, team_id: int):
|
546
|
"""
|
547
|
Updates head devices team with one given by user
|
548
|
"""
|
549
|
old_dev = get_head_device(db, device_id)
|
550
|
team = get_team(db, team_id)
|
551
|
new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
|
552
|
'comment': old_dev.comment, 'team_id': team.id, 'license_id': old_dev.license_id}
|
553
|
for key, value in new.items():
|
554
|
setattr(old_dev, key, value)
|
555
|
db.commit()
|
556
|
db.refresh(old_dev)
|
557
|
return old_dev
|
558
|
|
559
|
|
560
|
def update_headdevice_inv(db: Session, device_id: int, dev_inv: str):
|
561
|
"""
|
562
|
Updates head devices inventory number with new one given by user
|
563
|
"""
|
564
|
old_dev = get_head_device(db, device_id)
|
565
|
new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': dev_inv,
|
566
|
'comment': old_dev.comment, 'team_id': old_dev.team_id, 'license_id': old_dev.license_id}
|
567
|
for key, value in new.items():
|
568
|
setattr(old_dev, key, value)
|
569
|
db.commit()
|
570
|
db.refresh(old_dev)
|
571
|
return old_dev
|
572
|
|
573
|
|
574
|
def update_headdevice_comm(db: Session, device_id: int, comm: str):
|
575
|
"""
|
576
|
Updates head devices comment with new one given by user
|
577
|
"""
|
578
|
old_dev = get_head_device(db, device_id)
|
579
|
new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
|
580
|
'comment': comm, 'team_id': old_dev.team_id, 'license_id': old_dev.license_id}
|
581
|
for key, value in new.items():
|
582
|
setattr(old_dev, key, value)
|
583
|
db.commit()
|
584
|
db.refresh(old_dev)
|
585
|
return old_dev
|
586
|
|
587
|
|
588
|
def get_ld_logs(db: Session, skip: int = 0, limit: int = 100):
|
589
|
"""
|
590
|
Returns all ld debugger logs in database
|
591
|
"""
|
592
|
return db.query(models.LDLog).order_by(desc(models.LDLog.timestamp)).offset(skip).limit(limit).all()
|
593
|
|
594
|
|
595
|
def create_ld_logs(db: Session, item: schemas.LDTempBase, head_id: int, body_id: int, pc_id: int, date: datetime):
|
596
|
"""
|
597
|
Creates new ld log for ld_logs database table
|
598
|
"""
|
599
|
db_ld = models.LDLog(pc_id=pc_id, timestamp=date, status=item.status, head_id=head_id, body_id=body_id)
|
600
|
db.add(db_ld)
|
601
|
db.commit()
|
602
|
db.refresh(db_ld)
|
603
|
return db_ld
|
604
|
|
605
|
|
606
|
def get_logs(db: Session, skip: int = 0, limit: int = 100):
|
607
|
"""
|
608
|
Returns all usb logs in database ordered by timestamp
|
609
|
"""
|
610
|
return db.query(models.USBLog).order_by(desc(models.USBLog.timestamp)).offset(skip).limit(limit).all()
|
611
|
|
612
|
|
613
|
def get_log(db: Session, device_id: int, skip: int = 0, limit: int = 100):
|
614
|
"""
|
615
|
Returns all usb logs in database sorted by id
|
616
|
"""
|
617
|
return db.query(models.USBLog).filter(models.USBLog.device_id == device_id).offset(skip).limit(limit).all()
|
618
|
|
619
|
|
620
|
def find_filtered_logs(db: Session, logs: []):
|
621
|
"""
|
622
|
Returns all usb logs with ids in given id array.
|
623
|
"""
|
624
|
return db.query(models.USBLog).filter(models.USBLog.id.in_(logs)).order_by(desc(models.USBLog.timestamp)).all()
|
625
|
|
626
|
|
627
|
def find_filtered_ldlogs(db: Session, logs: []):
|
628
|
"""
|
629
|
Returns all ld logs with ids in given id array.
|
630
|
"""
|
631
|
return db.query(models.LDLog).filter(models.LDLog.id.in_(logs)).order_by(desc(models.LDLog.timestamp)).all()
|
632
|
|
633
|
|
634
|
def get_filtered_ldlogs(db: Session, pc: str, tema: str, lic: str):
|
635
|
"""
|
636
|
Function creates query string used for filtering by pc username, team name and license name.
|
637
|
Depending on selected filters assembles query string for database
|
638
|
"""
|
639
|
execute_string = "SELECT * FROM ld_logs AS logs WHERE"
|
640
|
before_me = False
|
641
|
all_all = True
|
642
|
if pc != "all":
|
643
|
all_all = False
|
644
|
pc = find_pc_by_username(db, pc)
|
645
|
if pc != None:
|
646
|
if before_me:
|
647
|
execute_string += " AND logs.pc_id = " + str(pc.id)
|
648
|
else:
|
649
|
before_me = True
|
650
|
execute_string += " logs.pc_id = " + str(pc.id)
|
651
|
if tema != "all":
|
652
|
all_all = False
|
653
|
team = find_team(db, tema)
|
654
|
if team != None:
|
655
|
head_devices = find_headdevices_by_team(db, team.id)
|
656
|
body_devices = find_bodydevices_by_team(db, team.id)
|
657
|
if len(head_devices) > 0 and len(body_devices) > 0:
|
658
|
h_ids = "("
|
659
|
for h in head_devices:
|
660
|
h_ids += str(h.id) + ", "
|
661
|
def_h_ids = h_ids[:-2] + ")"
|
662
|
b_ids = "("
|
663
|
for b in body_devices:
|
664
|
b_ids += str(b.id) + ", "
|
665
|
def_b_ids = b_ids[:-2] + ")"
|
666
|
if before_me:
|
667
|
execute_string += " AND (logs.head_id IN " + def_h_ids + " OR logs.body_id IN " + def_b_ids + ")"
|
668
|
else:
|
669
|
before_me = True
|
670
|
execute_string += " (logs.head_id IN " + def_h_ids + " OR logs.body_id IN " + def_b_ids + ")"
|
671
|
elif len(head_devices) == 0 and len(body_devices) > 0:
|
672
|
b_ids = "("
|
673
|
for b in body_devices:
|
674
|
b_ids += str(b.id) + ", "
|
675
|
def_b_ids = b_ids[:-2] + ")"
|
676
|
if before_me:
|
677
|
execute_string += " AND logs.body_id IN " + def_b_ids
|
678
|
else:
|
679
|
before_me = True
|
680
|
execute_string += " logs.body_id IN " + def_b_ids
|
681
|
elif len(head_devices) > 0 and len(body_devices) == 0:
|
682
|
h_ids = "("
|
683
|
for h in head_devices:
|
684
|
h_ids += str(h.id) + ", "
|
685
|
def_h_ids = h_ids[:-2] + ")"
|
686
|
if before_me:
|
687
|
execute_string += " AND logs.head_id IN " + def_h_ids
|
688
|
else:
|
689
|
before_me = True
|
690
|
execute_string += " logs.head_id IN " + def_h_ids
|
691
|
else:
|
692
|
if before_me:
|
693
|
execute_string += " AND (logs.head_id = -1 OR logs.body_id = -1)"
|
694
|
else:
|
695
|
before_me = True
|
696
|
execute_string += " (logs.head_id = -1 OR logs.body_id = -1)"
|
697
|
if lic != "all":
|
698
|
all_all = False
|
699
|
license = find_license(db, lic)
|
700
|
if license != None:
|
701
|
head_devices = find_headdevices_by_license(db, license.id)
|
702
|
body_devices = find_bodydevices_by_license(db, license.id)
|
703
|
if len(head_devices) > 0 and len(body_devices) > 0:
|
704
|
h_ids = "("
|
705
|
for h in head_devices:
|
706
|
h_ids += str(h.id) + ", "
|
707
|
def_h_ids = h_ids[:-2] + ")"
|
708
|
b_ids = "("
|
709
|
for b in body_devices:
|
710
|
b_ids += str(b.id) + ", "
|
711
|
def_b_ids = b_ids[:-2] + ")"
|
712
|
if before_me:
|
713
|
execute_string += " AND (logs.head_id IN " + def_h_ids + " OR logs.body_id IN " + def_b_ids + ")"
|
714
|
else:
|
715
|
before_me = True
|
716
|
execute_string += " (logs.head_id IN " + def_h_ids + " OR logs.body_id IN " + def_b_ids + ")"
|
717
|
elif len(head_devices) == 0 and len(body_devices) > 0:
|
718
|
b_ids = "("
|
719
|
for b in body_devices:
|
720
|
b_ids += str(b.id) + ", "
|
721
|
def_b_ids = b_ids[:-2] + ")"
|
722
|
if before_me:
|
723
|
execute_string += " AND logs.body_id IN " + def_b_ids
|
724
|
else:
|
725
|
before_me = True
|
726
|
execute_string += " logs.body_id IN " + def_b_ids
|
727
|
elif len(head_devices) > 0 and len(body_devices) == 0:
|
728
|
h_ids = "("
|
729
|
for h in head_devices:
|
730
|
h_ids += str(h.id) + ", "
|
731
|
def_h_ids = h_ids[:-2] + ")"
|
732
|
if before_me:
|
733
|
execute_string += " AND logs.head_id IN " + def_h_ids
|
734
|
else:
|
735
|
before_me = True
|
736
|
execute_string += " logs.head_id IN " + def_h_ids
|
737
|
else:
|
738
|
if before_me:
|
739
|
execute_string += " AND (logs.head_id = -1 OR logs.body_id = -1)"
|
740
|
else:
|
741
|
before_me = True
|
742
|
execute_string += " (logs.head_id = -1 OR logs.body_id = -1)"
|
743
|
if all_all:
|
744
|
before_me = True
|
745
|
execute_string = "SELECT * FROM ld_logs AS logs"
|
746
|
|
747
|
if not before_me:
|
748
|
execute_string = "SELECT * FROM ld_logs AS logs WHERE logs.id = -1"
|
749
|
result = db.execute(execute_string)
|
750
|
return result
|
751
|
|
752
|
|
753
|
def get_filtered_logs(db: Session, pc: str, tema: str, lic: str):
|
754
|
"""
|
755
|
Function creates query string used for filtering by pc username, team name and license name.
|
756
|
Depending on selected filters assembles query string for database
|
757
|
"""
|
758
|
execute_string = "SELECT * FROM usb_logs AS logs"
|
759
|
pcs = find_pc_by_username(db, pc)
|
760
|
if pc != "all":
|
761
|
if pcs is not None:
|
762
|
execute_string += " WHERE logs.pc_id = " + str(pcs.id)
|
763
|
if tema != "all":
|
764
|
team = find_team(db, tema)
|
765
|
if team is not None:
|
766
|
devs = get_devices_by_team(db, team.id)
|
767
|
d_ids = "("
|
768
|
for p in devs:
|
769
|
d_ids += str(p.id) + ", "
|
770
|
def_d_ids = d_ids[:-2] + ")"
|
771
|
if pc != "all" and pcs is not None:
|
772
|
if len(def_d_ids) > 1:
|
773
|
execute_string += " AND logs.device_id IN " + def_d_ids
|
774
|
else:
|
775
|
if len(def_d_ids) > 1:
|
776
|
execute_string += " WHERE logs.device_id IN " + def_d_ids
|
777
|
if lic != "all":
|
778
|
license = get_licenses_by_name(db, lic)
|
779
|
if license is not None:
|
780
|
device_licenses = get_license_devices(db, license.id)
|
781
|
dev_ids = "("
|
782
|
for dev in device_licenses:
|
783
|
dev_ids += str(dev.device_id) + ", "
|
784
|
defin_ids = dev_ids[:-2] + ")"
|
785
|
if pc != "all" or tema != "all":
|
786
|
if len(defin_ids) > 1:
|
787
|
execute_string += " AND logs.device_id IN " + defin_ids
|
788
|
else:
|
789
|
if len(defin_ids) > 1:
|
790
|
execute_string += " WHERE logs.device_id IN " + defin_ids
|
791
|
|
792
|
# executing assembled query string
|
793
|
result = db.execute(execute_string)
|
794
|
return result
|
795
|
|
796
|
|
797
|
def get_filtered_bodydevices(db: Session, body_id: str, license_id: str, team: str):
|
798
|
"""
|
799
|
returns filtered body devices based on given attributes
|
800
|
"""
|
801
|
execute_string = "SELECT * FROM body_devices AS device WHERE"
|
802
|
before_me = False
|
803
|
all_all = True
|
804
|
if body_id != "all":
|
805
|
all_all = False
|
806
|
body_dev = find_bodydevice_by_serial(db, body_id)
|
807
|
if body_dev != None:
|
808
|
if before_me:
|
809
|
execute_string += " AND device.id = " + str(body_dev.id)
|
810
|
else:
|
811
|
before_me = True
|
812
|
execute_string += " device.id = " + str(body_dev.id)
|
813
|
if license_id != "all":
|
814
|
all_all = False
|
815
|
license = find_license(db, license_id)
|
816
|
if license != None:
|
817
|
if before_me:
|
818
|
execute_string += " AND device.license_id = " + str(license.id)
|
819
|
else:
|
820
|
before_me = True
|
821
|
execute_string += " device.license_id = " + str(license.id)
|
822
|
if team != "all":
|
823
|
all_all = False
|
824
|
tem = find_team(db, team)
|
825
|
if tem != None:
|
826
|
if before_me:
|
827
|
execute_string += " AND device.team_id = " + str(tem.id)
|
828
|
else:
|
829
|
before_me = True
|
830
|
execute_string += " device.team_id = " + str(tem.id)
|
831
|
if all_all:
|
832
|
before_me = True
|
833
|
execute_string = "SELECT * FROM body_devices AS devices"
|
834
|
|
835
|
if not before_me:
|
836
|
execute_string = "SELECT * FROM body_devices AS devices WHERE devices.id = -1"
|
837
|
result = db.execute(execute_string)
|
838
|
return result
|
839
|
|
840
|
|
841
|
def get_filtered_headdevices(db: Session, body_id: str, license_id: str, team: str):
|
842
|
"""
|
843
|
returns filtered head devices based on given attributes
|
844
|
"""
|
845
|
execute_string = "SELECT * FROM head_devices AS device WHERE"
|
846
|
before_me = False
|
847
|
all_all = True
|
848
|
if body_id != "all":
|
849
|
all_all = False
|
850
|
head_dev = find_headdevice_by_serial(db, body_id)
|
851
|
if head_dev != None:
|
852
|
if before_me:
|
853
|
execute_string += " AND device.id = " + str(head_dev.id)
|
854
|
else:
|
855
|
before_me = True
|
856
|
execute_string += " device.id = " + str(head_dev.id)
|
857
|
if license_id != "all":
|
858
|
all_all = False
|
859
|
license = find_license(db, license_id)
|
860
|
if license != None:
|
861
|
if before_me:
|
862
|
execute_string += " AND device.license_id = " + str(license.id)
|
863
|
else:
|
864
|
before_me = True
|
865
|
execute_string += " device.license_id = " + str(license.id)
|
866
|
if team != "all":
|
867
|
all_all = False
|
868
|
tem = find_team(db, team)
|
869
|
if tem != None:
|
870
|
if before_me:
|
871
|
execute_string += " AND device.team_id = " + str(tem.id)
|
872
|
else:
|
873
|
before_me = True
|
874
|
execute_string += " device.team_id = " + str(tem.id)
|
875
|
if all_all:
|
876
|
before_me = True
|
877
|
execute_string = "SELECT * FROM body_devices AS devices"
|
878
|
|
879
|
if not before_me:
|
880
|
execute_string = "SELECT * FROM body_devices AS devices WHERE devices.id = -1"
|
881
|
result = db.execute(execute_string)
|
882
|
return result
|
883
|
|
884
|
|
885
|
def get_filtered_devices(db: Session, keyman_id: str, license_name: str, license_id: str, team: str):
|
886
|
"""
|
887
|
returns filtered keyman devices based on given attributes
|
888
|
"""
|
889
|
execute_string = "SELECT * FROM devices AS device WHERE"
|
890
|
before_me = False
|
891
|
all_all = True
|
892
|
if keyman_id != "all":
|
893
|
all_all = False
|
894
|
keyman_dev = find_device_by_serial(db, keyman_id)
|
895
|
if keyman_dev != None:
|
896
|
if before_me:
|
897
|
execute_string += " AND device.id = " + str(keyman_dev.id)
|
898
|
else:
|
899
|
before_me = True
|
900
|
execute_string += " device.id = " + str(keyman_dev.id)
|
901
|
if license_name != "all":
|
902
|
all_all = False
|
903
|
license = get_licenses_by_name(db, license_name)
|
904
|
if len(license) > 0:
|
905
|
lic_ids = []
|
906
|
for l in license:
|
907
|
lic_ids.append(l.id)
|
908
|
dev_lics = find_devicelicenses_by_licid_array(db, lic_ids)
|
909
|
lic_ids = "("
|
910
|
for l in dev_lics:
|
911
|
lic_ids += str(l.device_id) + ", "
|
912
|
def_lic_ids = lic_ids[:-2] + ")"
|
913
|
if before_me:
|
914
|
execute_string += " AND device.id IN " + def_lic_ids
|
915
|
else:
|
916
|
before_me = True
|
917
|
execute_string += " device.id IN " + def_lic_ids
|
918
|
if license_id != "all":
|
919
|
all_all = False
|
920
|
license = find_license(db, license_id)
|
921
|
licen_devs = get_license_devices(db, license.id)
|
922
|
ids = "("
|
923
|
for lic in licen_devs:
|
924
|
ids += str(lic.device_id) + ", "
|
925
|
def_ids = ids[:-2] + ")"
|
926
|
if license != None:
|
927
|
if before_me:
|
928
|
execute_string += " AND device.id IN " + def_ids
|
929
|
else:
|
930
|
before_me = True
|
931
|
execute_string += " device.id IN " + def_ids
|
932
|
if team != "all":
|
933
|
all_all = False
|
934
|
tem = find_team(db, team)
|
935
|
if tem != None:
|
936
|
if before_me:
|
937
|
execute_string += " AND device.team_id = " + str(tem.id)
|
938
|
else:
|
939
|
before_me = True
|
940
|
execute_string += " device.team_id = " + str(tem.id)
|
941
|
if all_all:
|
942
|
before_me = True
|
943
|
execute_string = "SELECT * FROM devices AS devices"
|
944
|
|
945
|
if not before_me:
|
946
|
execute_string = "SELECT * FROM devices AS devices WHERE devices.id = -1"
|
947
|
result = db.execute(execute_string)
|
948
|
return result
|
949
|
|
950
|
|
951
|
def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_id: int, date: datetime):
|
952
|
"""
|
953
|
Creates new USB log for usb_logs database table
|
954
|
"""
|
955
|
db_log = models.USBLog(pc_id=pc_id, timestamp=date, status=item.status, device_id=dev_id)
|
956
|
db.add(db_log)
|
957
|
db.commit()
|
958
|
db.refresh(db_log)
|
959
|
return db_log
|
960
|
|
961
|
|
962
|
def get_users(db: Session, skip: int = 0, limit: int = 100):
|
963
|
"""
|
964
|
Returns all users saved in database
|
965
|
"""
|
966
|
return db.query(models.User).offset(skip).limit(limit).all()
|
967
|
|
968
|
|
969
|
def find_user(db: Session, name: str):
|
970
|
"""
|
971
|
Finds one user by given username
|
972
|
"""
|
973
|
return db.query(models.User).filter(models.User.username == name).first()
|
974
|
|
975
|
|
976
|
def find_user_byid(db: Session, id: int):
|
977
|
"""
|
978
|
Finds one user by given id
|
979
|
"""
|
980
|
return db.query(models.User).filter(models.User.id == id).first()
|
981
|
|
982
|
|
983
|
def create_user(db: Session, name: str, passw: str, rol: str):
|
984
|
"""
|
985
|
Creates new user
|
986
|
"""
|
987
|
db_user = models.User(username=name, password=passw, role=rol)
|
988
|
db.add(db_user)
|
989
|
db.commit()
|
990
|
db.refresh(db_user)
|
991
|
return db_user</code></pre>
|
992
|
</details>
|
993
|
</section>
|
994
|
<section>
|
995
|
</section>
|
996
|
<section>
|
997
|
</section>
|
998
|
<section>
|
999
|
<h2 class="section-title" id="header-functions">Functions</h2>
|
1000
|
<dl>
|
1001
|
<dt id="sql_app.crud.change_role"><code class="name flex">
|
1002
|
<span>def <span class="ident">change_role</span></span>(<span>db: sqlalchemy.orm.session.Session, usr_id: int, role: str)</span>
|
1003
|
</code></dt>
|
1004
|
<dd>
|
1005
|
<div class="desc"><p>Updates team of one specific pc</p></div>
|
1006
|
<details class="source">
|
1007
|
<summary>
|
1008
|
<span>Expand source code</span>
|
1009
|
</summary>
|
1010
|
<pre><code class="python">def change_role(db: Session, usr_id: int, role: str):
|
1011
|
"""
|
1012
|
Updates team of one specific pc
|
1013
|
"""
|
1014
|
old_usr = find_user_byid(db, usr_id)
|
1015
|
new = {'id': old_usr.id, 'username': old_usr.username, 'password': old_usr.password, 'role': role}
|
1016
|
for key, value in new.items():
|
1017
|
setattr(old_usr, key, value)
|
1018
|
db.commit()
|
1019
|
db.refresh(old_usr)
|
1020
|
return old_usr</code></pre>
|
1021
|
</details>
|
1022
|
</dd>
|
1023
|
<dt id="sql_app.crud.change_team"><code class="name flex">
|
1024
|
<span>def <span class="ident">change_team</span></span>(<span>db: sqlalchemy.orm.session.Session, team_id: int, name: str)</span>
|
1025
|
</code></dt>
|
1026
|
<dd>
|
1027
|
<div class="desc"><p>Updates name of one specific team</p></div>
|
1028
|
<details class="source">
|
1029
|
<summary>
|
1030
|
<span>Expand source code</span>
|
1031
|
</summary>
|
1032
|
<pre><code class="python">def change_team(db: Session, team_id: int, name: str):
|
1033
|
"""
|
1034
|
Updates name of one specific team
|
1035
|
"""
|
1036
|
old_team = get_team(db, team_id)
|
1037
|
new = {'id': old_team.id, 'name': name}
|
1038
|
for key, value in new.items():
|
1039
|
setattr(old_team, key, value)
|
1040
|
db.commit()
|
1041
|
db.refresh(old_team)
|
1042
|
return old_team</code></pre>
|
1043
|
</details>
|
1044
|
</dd>
|
1045
|
<dt id="sql_app.crud.create_body_device"><code class="name flex">
|
1046
|
<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>
|
1047
|
</code></dt>
|
1048
|
<dd>
|
1049
|
<div class="desc"><p>Creates new Body device</p></div>
|
1050
|
<details class="source">
|
1051
|
<summary>
|
1052
|
<span>Expand source code</span>
|
1053
|
</summary>
|
1054
|
<pre><code class="python">def create_body_device(db: Session, log: schemas.BodyDeviceTemp):
|
1055
|
"""
|
1056
|
Creates new Body device
|
1057
|
"""
|
1058
|
db_body = models.BodyDevice(serial_number=log.serial_number, inventory_number="", comment="")
|
1059
|
db.add(db_body)
|
1060
|
db.commit()
|
1061
|
db.refresh(db_body)
|
1062
|
return db_body</code></pre>
|
1063
|
</details>
|
1064
|
</dd>
|
1065
|
<dt id="sql_app.crud.create_device"><code class="name flex">
|
1066
|
<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>
|
1067
|
</code></dt>
|
1068
|
<dd>
|
1069
|
<div class="desc"><p>creates new device with data from given DeviceBase object</p></div>
|
1070
|
<details class="source">
|
1071
|
<summary>
|
1072
|
<span>Expand source code</span>
|
1073
|
</summary>
|
1074
|
<pre><code class="python">def create_device(db: Session, device: schemas.DeviceTemp):
|
1075
|
"""
|
1076
|
creates new device with data from given DeviceBase object
|
1077
|
"""
|
1078
|
db_device = models.Device(vendor_id=device.vendor_id, product_id=device.product_id,
|
1079
|
serial_number=device.serial_number, inventory_number="", comment="")
|
1080
|
db.add(db_device)
|
1081
|
db.commit()
|
1082
|
db.refresh(db_device)
|
1083
|
return db_device</code></pre>
|
1084
|
</details>
|
1085
|
</dd>
|
1086
|
<dt id="sql_app.crud.create_device_license"><code class="name flex">
|
1087
|
<span>def <span class="ident">create_device_license</span></span>(<span>db: sqlalchemy.orm.session.Session, device: int, license: int, time: datetime.datetime)</span>
|
1088
|
</code></dt>
|
1089
|
<dd>
|
1090
|
<div class="desc"><p>creates new entry in devices_licenses table with device id, license id and time.</p></div>
|
1091
|
<details class="source">
|
1092
|
<summary>
|
1093
|
<span>Expand source code</span>
|
1094
|
</summary>
|
1095
|
<pre><code class="python">def create_device_license(db: Session, device: int, license: int, time: datetime):
|
1096
|
"""
|
1097
|
creates new entry in devices_licenses table with device id, license id and time.
|
1098
|
"""
|
1099
|
db_device_license = models.DeviceLicense(device_id=device, license_id=license,
|
1100
|
assigned_datetime=time)
|
1101
|
db.add(db_device_license)
|
1102
|
db.commit()
|
1103
|
db.refresh(db_device_license)
|
1104
|
return db_device_license</code></pre>
|
1105
|
</details>
|
1106
|
</dd>
|
1107
|
<dt id="sql_app.crud.create_device_logs"><code class="name flex">
|
1108
|
<span>def <span class="ident">create_device_logs</span></span>(<span>db: sqlalchemy.orm.session.Session, item: <a title="sql_app.schemas.USBTempBase" href="schemas.html#sql_app.schemas.USBTempBase">USBTempBase</a>, dev_id: int, pc_id: int, date: datetime.datetime)</span>
|
1109
|
</code></dt>
|
1110
|
<dd>
|
1111
|
<div class="desc"><p>Creates new USB log for usb_logs database table</p></div>
|
1112
|
<details class="source">
|
1113
|
<summary>
|
1114
|
<span>Expand source code</span>
|
1115
|
</summary>
|
1116
|
<pre><code class="python">def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_id: int, date: datetime):
|
1117
|
"""
|
1118
|
Creates new USB log for usb_logs database table
|
1119
|
"""
|
1120
|
db_log = models.USBLog(pc_id=pc_id, timestamp=date, status=item.status, device_id=dev_id)
|
1121
|
db.add(db_log)
|
1122
|
db.commit()
|
1123
|
db.refresh(db_log)
|
1124
|
return db_log</code></pre>
|
1125
|
</details>
|
1126
|
</dd>
|
1127
|
<dt id="sql_app.crud.create_head_device"><code class="name flex">
|
1128
|
<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>
|
1129
|
</code></dt>
|
1130
|
<dd>
|
1131
|
<div class="desc"><p>Creates new head device</p></div>
|
1132
|
<details class="source">
|
1133
|
<summary>
|
1134
|
<span>Expand source code</span>
|
1135
|
</summary>
|
1136
|
<pre><code class="python">def create_head_device(db: Session, log: schemas.HeadDeviceTemp):
|
1137
|
"""
|
1138
|
Creates new head device
|
1139
|
"""
|
1140
|
db_head = models.HeadDevice(serial_number=log.serial_number)
|
1141
|
db.add(db_head)
|
1142
|
db.commit()
|
1143
|
db.refresh(db_head)
|
1144
|
return db_head</code></pre>
|
1145
|
</details>
|
1146
|
</dd>
|
1147
|
<dt id="sql_app.crud.create_ld_logs"><code class="name flex">
|
1148
|
<span>def <span class="ident">create_ld_logs</span></span>(<span>db: sqlalchemy.orm.session.Session, item: <a title="sql_app.schemas.LDTempBase" href="schemas.html#sql_app.schemas.LDTempBase">LDTempBase</a>, head_id: int, body_id: int, pc_id: int, date: datetime.datetime)</span>
|
1149
|
</code></dt>
|
1150
|
<dd>
|
1151
|
<div class="desc"><p>Creates new ld log for ld_logs database table</p></div>
|
1152
|
<details class="source">
|
1153
|
<summary>
|
1154
|
<span>Expand source code</span>
|
1155
|
</summary>
|
1156
|
<pre><code class="python">def create_ld_logs(db: Session, item: schemas.LDTempBase, head_id: int, body_id: int, pc_id: int, date: datetime):
|
1157
|
"""
|
1158
|
Creates new ld log for ld_logs database table
|
1159
|
"""
|
1160
|
db_ld = models.LDLog(pc_id=pc_id, timestamp=date, status=item.status, head_id=head_id, body_id=body_id)
|
1161
|
db.add(db_ld)
|
1162
|
db.commit()
|
1163
|
db.refresh(db_ld)
|
1164
|
return db_ld</code></pre>
|
1165
|
</details>
|
1166
|
</dd>
|
1167
|
<dt id="sql_app.crud.create_license"><code class="name flex">
|
1168
|
<span>def <span class="ident">create_license</span></span>(<span>db: sqlalchemy.orm.session.Session, name: str, lic_id: str, expdate: datetime.date)</span>
|
1169
|
</code></dt>
|
1170
|
<dd>
|
1171
|
<div class="desc"><p>creates new license with given name and expiration date</p></div>
|
1172
|
<details class="source">
|
1173
|
<summary>
|
1174
|
<span>Expand source code</span>
|
1175
|
</summary>
|
1176
|
<pre><code class="python">def create_license(db: Session, name: str, lic_id: str, expdate: date):
|
1177
|
"""
|
1178
|
creates new license with given name and expiration date
|
1179
|
"""
|
1180
|
db_license = models.License(name=name, license_id=lic_id, expiration_date=expdate)
|
1181
|
db.add(db_license)
|
1182
|
db.commit()
|
1183
|
db.refresh(db_license)
|
1184
|
return db_license</code></pre>
|
1185
|
</details>
|
1186
|
</dd>
|
1187
|
<dt id="sql_app.crud.create_pc"><code class="name flex">
|
1188
|
<span>def <span class="ident">create_pc</span></span>(<span>db: sqlalchemy.orm.session.Session, user: str, host: str)</span>
|
1189
|
</code></dt>
|
1190
|
<dd>
|
1191
|
<div class="desc"><p>creates new pc with given username and hostname</p></div>
|
1192
|
<details class="source">
|
1193
|
<summary>
|
1194
|
<span>Expand source code</span>
|
1195
|
</summary>
|
1196
|
<pre><code class="python">def create_pc(db: Session, user: str, host: str):
|
1197
|
"""
|
1198
|
creates new pc with given username and hostname
|
1199
|
"""
|
1200
|
db_pc = models.PC(username=user, hostname=host)
|
1201
|
db.add(db_pc)
|
1202
|
db.commit()
|
1203
|
db.refresh(db_pc)
|
1204
|
return db_pc</code></pre>
|
1205
|
</details>
|
1206
|
</dd>
|
1207
|
<dt id="sql_app.crud.create_team"><code class="name flex">
|
1208
|
<span>def <span class="ident">create_team</span></span>(<span>db: sqlalchemy.orm.session.Session, name: str)</span>
|
1209
|
</code></dt>
|
1210
|
<dd>
|
1211
|
<div class="desc"><p>Creates new team with given name</p></div>
|
1212
|
<details class="source">
|
1213
|
<summary>
|
1214
|
<span>Expand source code</span>
|
1215
|
</summary>
|
1216
|
<pre><code class="python">def create_team(db: Session, name: str):
|
1217
|
"""
|
1218
|
Creates new team with given name
|
1219
|
"""
|
1220
|
db_team = models.Team(name=name)
|
1221
|
db.add(db_team)
|
1222
|
db.commit()
|
1223
|
db.refresh(db_team)
|
1224
|
return db_team</code></pre>
|
1225
|
</details>
|
1226
|
</dd>
|
1227
|
<dt id="sql_app.crud.create_user"><code class="name flex">
|
1228
|
<span>def <span class="ident">create_user</span></span>(<span>db: sqlalchemy.orm.session.Session, name: str, passw: str, rol: str)</span>
|
1229
|
</code></dt>
|
1230
|
<dd>
|
1231
|
<div class="desc"><p>Creates new user</p></div>
|
1232
|
<details class="source">
|
1233
|
<summary>
|
1234
|
<span>Expand source code</span>
|
1235
|
</summary>
|
1236
|
<pre><code class="python">def create_user(db: Session, name: str, passw: str, rol: str):
|
1237
|
"""
|
1238
|
Creates new user
|
1239
|
"""
|
1240
|
db_user = models.User(username=name, password=passw, role=rol)
|
1241
|
db.add(db_user)
|
1242
|
db.commit()
|
1243
|
db.refresh(db_user)
|
1244
|
return db_user</code></pre>
|
1245
|
</details>
|
1246
|
</dd>
|
1247
|
<dt id="sql_app.crud.delete_device_license"><code class="name flex">
|
1248
|
<span>def <span class="ident">delete_device_license</span></span>(<span>db: sqlalchemy.orm.session.Session, device: int, license: int)</span>
|
1249
|
</code></dt>
|
1250
|
<dd>
|
1251
|
<div class="desc"><p>deletes entry in devices_licenses table with device id, license id and time.</p></div>
|
1252
|
<details class="source">
|
1253
|
<summary>
|
1254
|
<span>Expand source code</span>
|
1255
|
</summary>
|
1256
|
<pre><code class="python">def delete_device_license(db: Session, device: int, license: int):
|
1257
|
"""
|
1258
|
deletes entry in devices_licenses table with device id, license id and time.
|
1259
|
"""
|
1260
|
db_device_license = get_devicelicense_by_devicelicense(db, device, license)
|
1261
|
db_lic = db.delete(db_device_license)
|
1262
|
db.commit()
|
1263
|
return db_lic</code></pre>
|
1264
|
</details>
|
1265
|
</dd>
|
1266
|
<dt id="sql_app.crud.find_body_device"><code class="name flex">
|
1267
|
<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>
|
1268
|
</code></dt>
|
1269
|
<dd>
|
1270
|
<div class="desc"><p>Finds one body device by its serial number</p></div>
|
1271
|
<details class="source">
|
1272
|
<summary>
|
1273
|
<span>Expand source code</span>
|
1274
|
</summary>
|
1275
|
<pre><code class="python">def find_body_device(db: Session, serial: schemas.BodyDeviceTemp):
|
1276
|
"""
|
1277
|
Finds one body device by its serial number
|
1278
|
"""
|
1279
|
return db.query(models.BodyDevice).filter(models.BodyDevice.serial_number == serial.serial_number).first()</code></pre>
|
1280
|
</details>
|
1281
|
</dd>
|
1282
|
<dt id="sql_app.crud.find_bodydevice_by_serial"><code class="name flex">
|
1283
|
<span>def <span class="ident">find_bodydevice_by_serial</span></span>(<span>db: sqlalchemy.orm.session.Session, serial: str)</span>
|
1284
|
</code></dt>
|
1285
|
<dd>
|
1286
|
<div class="desc"><p>Finds one specific body device by given serial number</p></div>
|
1287
|
<details class="source">
|
1288
|
<summary>
|
1289
|
<span>Expand source code</span>
|
1290
|
</summary>
|
1291
|
<pre><code class="python">def find_bodydevice_by_serial(db: Session, serial: str):
|
1292
|
"""
|
1293
|
Finds one specific body device by given serial number
|
1294
|
"""
|
1295
|
return db.query(models.BodyDevice).filter(models.BodyDevice.serial_number == serial).first()</code></pre>
|
1296
|
</details>
|
1297
|
</dd>
|
1298
|
<dt id="sql_app.crud.find_bodydevices_by_license"><code class="name flex">
|
1299
|
<span>def <span class="ident">find_bodydevices_by_license</span></span>(<span>db: sqlalchemy.orm.session.Session, lic_id: int)</span>
|
1300
|
</code></dt>
|
1301
|
<dd>
|
1302
|
<div class="desc"><p>Returns all body devices with specific license</p></div>
|
1303
|
<details class="source">
|
1304
|
<summary>
|
1305
|
<span>Expand source code</span>
|
1306
|
</summary>
|
1307
|
<pre><code class="python">def find_bodydevices_by_license(db: Session, lic_id: int):
|
1308
|
"""
|
1309
|
Returns all body devices with specific license
|
1310
|
"""
|
1311
|
return db.query(models.BodyDevice).filter(models.BodyDevice.license_id == lic_id).all()</code></pre>
|
1312
|
</details>
|
1313
|
</dd>
|
1314
|
<dt id="sql_app.crud.find_bodydevices_by_team"><code class="name flex">
|
1315
|
<span>def <span class="ident">find_bodydevices_by_team</span></span>(<span>db: sqlalchemy.orm.session.Session, team_id: int)</span>
|
1316
|
</code></dt>
|
1317
|
<dd>
|
1318
|
<div class="desc"><p>Returns all body devices in specific team</p></div>
|
1319
|
<details class="source">
|
1320
|
<summary>
|
1321
|
<span>Expand source code</span>
|
1322
|
</summary>
|
1323
|
<pre><code class="python">def find_bodydevices_by_team(db: Session, team_id: int):
|
1324
|
"""
|
1325
|
Returns all body devices in specific team
|
1326
|
"""
|
1327
|
return db.query(models.BodyDevice).filter(models.BodyDevice.team_id == team_id).all()</code></pre>
|
1328
|
</details>
|
1329
|
</dd>
|
1330
|
<dt id="sql_app.crud.find_device"><code class="name flex">
|
1331
|
<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>
|
1332
|
</code></dt>
|
1333
|
<dd>
|
1334
|
<div class="desc"><p>finds one device with
|
1335
|
serial_number same as in given DeviceBase object</p></div>
|
1336
|
<details class="source">
|
1337
|
<summary>
|
1338
|
<span>Expand source code</span>
|
1339
|
</summary>
|
1340
|
<pre><code class="python">def find_device(db: Session, device: schemas.DeviceTemp):
|
1341
|
"""
|
1342
|
finds one device with serial_number same as in given DeviceBase object
|
1343
|
"""
|
1344
|
return db.query(models.Device).filter(and_(models.Device.serial_number == device.serial_number)).first()</code></pre>
|
1345
|
</details>
|
1346
|
</dd>
|
1347
|
<dt id="sql_app.crud.find_device_by_serial"><code class="name flex">
|
1348
|
<span>def <span class="ident">find_device_by_serial</span></span>(<span>db: sqlalchemy.orm.session.Session, ser: str)</span>
|
1349
|
</code></dt>
|
1350
|
<dd>
|
1351
|
<div class="desc"><p>finds one device with serial_number same as in given DeviceBase object</p></div>
|
1352
|
<details class="source">
|
1353
|
<summary>
|
1354
|
<span>Expand source code</span>
|
1355
|
</summary>
|
1356
|
<pre><code class="python">def find_device_by_serial(db: Session, ser: str):
|
1357
|
"""
|
1358
|
finds one device with serial_number same as in given DeviceBase object
|
1359
|
"""
|
1360
|
return db.query(models.Device).filter(and_(models.Device.serial_number == ser)).first()</code></pre>
|
1361
|
</details>
|
1362
|
</dd>
|
1363
|
<dt id="sql_app.crud.find_devicelicenses_by_licid_array"><code class="name flex">
|
1364
|
<span>def <span class="ident">find_devicelicenses_by_licid_array</span></span>(<span>db: sqlalchemy.orm.session.Session, lcs: [])</span>
|
1365
|
</code></dt>
|
1366
|
<dd>
|
1367
|
<div class="desc"><p>Finds all device_licenses with license_id in given id array</p></div>
|
1368
|
<details class="source">
|
1369
|
<summary>
|
1370
|
<span>Expand source code</span>
|
1371
|
</summary>
|
1372
|
<pre><code class="python">def find_devicelicenses_by_licid_array(db: Session, lcs: []):
|
1373
|
"""
|
1374
|
Finds all device_licenses with license_id in given id array
|
1375
|
"""
|
1376
|
return db.query(models.DeviceLicense).filter(models.DeviceLicense.license_id.in_(lcs)).all()</code></pre>
|
1377
|
</details>
|
1378
|
</dd>
|
1379
|
<dt id="sql_app.crud.find_filtered_ldlogs"><code class="name flex">
|
1380
|
<span>def <span class="ident">find_filtered_ldlogs</span></span>(<span>db: sqlalchemy.orm.session.Session, logs: [])</span>
|
1381
|
</code></dt>
|
1382
|
<dd>
|
1383
|
<div class="desc"><p>Returns all ld logs with ids in given id array.</p></div>
|
1384
|
<details class="source">
|
1385
|
<summary>
|
1386
|
<span>Expand source code</span>
|
1387
|
</summary>
|
1388
|
<pre><code class="python">def find_filtered_ldlogs(db: Session, logs: []):
|
1389
|
"""
|
1390
|
Returns all ld logs with ids in given id array.
|
1391
|
"""
|
1392
|
return db.query(models.LDLog).filter(models.LDLog.id.in_(logs)).order_by(desc(models.LDLog.timestamp)).all()</code></pre>
|
1393
|
</details>
|
1394
|
</dd>
|
1395
|
<dt id="sql_app.crud.find_filtered_logs"><code class="name flex">
|
1396
|
<span>def <span class="ident">find_filtered_logs</span></span>(<span>db: sqlalchemy.orm.session.Session, logs: [])</span>
|
1397
|
</code></dt>
|
1398
|
<dd>
|
1399
|
<div class="desc"><p>Returns all usb logs with ids in given id array.</p></div>
|
1400
|
<details class="source">
|
1401
|
<summary>
|
1402
|
<span>Expand source code</span>
|
1403
|
</summary>
|
1404
|
<pre><code class="python">def find_filtered_logs(db: Session, logs: []):
|
1405
|
"""
|
1406
|
Returns all usb logs with ids in given id array.
|
1407
|
"""
|
1408
|
return db.query(models.USBLog).filter(models.USBLog.id.in_(logs)).order_by(desc(models.USBLog.timestamp)).all()</code></pre>
|
1409
|
</details>
|
1410
|
</dd>
|
1411
|
<dt id="sql_app.crud.find_head_device"><code class="name flex">
|
1412
|
<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>
|
1413
|
</code></dt>
|
1414
|
<dd>
|
1415
|
<div class="desc"><p>Finds one head device by its serial number</p></div>
|
1416
|
<details class="source">
|
1417
|
<summary>
|
1418
|
<span>Expand source code</span>
|
1419
|
</summary>
|
1420
|
<pre><code class="python">def find_head_device(db: Session, serial: schemas.HeadDeviceTemp):
|
1421
|
"""
|
1422
|
Finds one head device by its serial number
|
1423
|
"""
|
1424
|
return db.query(models.HeadDevice).filter(models.HeadDevice.serial_number == serial.serial_number).first()</code></pre>
|
1425
|
</details>
|
1426
|
</dd>
|
1427
|
<dt id="sql_app.crud.find_headdevice_by_serial"><code class="name flex">
|
1428
|
<span>def <span class="ident">find_headdevice_by_serial</span></span>(<span>db: sqlalchemy.orm.session.Session, serial: str)</span>
|
1429
|
</code></dt>
|
1430
|
<dd>
|
1431
|
<div class="desc"><p>Finds one specific head device by given serial number</p></div>
|
1432
|
<details class="source">
|
1433
|
<summary>
|
1434
|
<span>Expand source code</span>
|
1435
|
</summary>
|
1436
|
<pre><code class="python">def find_headdevice_by_serial(db: Session, serial: str):
|
1437
|
"""
|
1438
|
Finds one specific head device by given serial number
|
1439
|
"""
|
1440
|
return db.query(models.HeadDevice).filter(models.HeadDevice.serial_number == serial).first()</code></pre>
|
1441
|
</details>
|
1442
|
</dd>
|
1443
|
<dt id="sql_app.crud.find_headdevices_by_license"><code class="name flex">
|
1444
|
<span>def <span class="ident">find_headdevices_by_license</span></span>(<span>db: sqlalchemy.orm.session.Session, lic_id: int)</span>
|
1445
|
</code></dt>
|
1446
|
<dd>
|
1447
|
<div class="desc"><p>Returns all head devices with specific license</p></div>
|
1448
|
<details class="source">
|
1449
|
<summary>
|
1450
|
<span>Expand source code</span>
|
1451
|
</summary>
|
1452
|
<pre><code class="python">def find_headdevices_by_license(db: Session, lic_id: int):
|
1453
|
"""
|
1454
|
Returns all head devices with specific license
|
1455
|
"""
|
1456
|
return db.query(models.HeadDevice).filter(models.HeadDevice.license_id == lic_id).all()</code></pre>
|
1457
|
</details>
|
1458
|
</dd>
|
1459
|
<dt id="sql_app.crud.find_headdevices_by_team"><code class="name flex">
|
1460
|
<span>def <span class="ident">find_headdevices_by_team</span></span>(<span>db: sqlalchemy.orm.session.Session, team_id: int)</span>
|
1461
|
</code></dt>
|
1462
|
<dd>
|
1463
|
<div class="desc"><p>Returns all head devices in specific team</p></div>
|
1464
|
<details class="source">
|
1465
|
<summary>
|
1466
|
<span>Expand source code</span>
|
1467
|
</summary>
|
1468
|
<pre><code class="python">def find_headdevices_by_team(db: Session, team_id: int):
|
1469
|
"""
|
1470
|
Returns all head devices in specific team
|
1471
|
"""
|
1472
|
return db.query(models.HeadDevice).filter(models.HeadDevice.team_id == team_id).all()</code></pre>
|
1473
|
</details>
|
1474
|
</dd>
|
1475
|
<dt id="sql_app.crud.find_license"><code class="name flex">
|
1476
|
<span>def <span class="ident">find_license</span></span>(<span>db: sqlalchemy.orm.session.Session, name: str)</span>
|
1477
|
</code></dt>
|
1478
|
<dd>
|
1479
|
<div class="desc"><p>finds one license by given string name</p></div>
|
1480
|
<details class="source">
|
1481
|
<summary>
|
1482
|
<span>Expand source code</span>
|
1483
|
</summary>
|
1484
|
<pre><code class="python">def find_license(db: Session, name: str):
|
1485
|
"""
|
1486
|
finds one license by given string name
|
1487
|
"""
|
1488
|
return db.query(models.License).filter(models.License.license_id == name).first()</code></pre>
|
1489
|
</details>
|
1490
|
</dd>
|
1491
|
<dt id="sql_app.crud.find_pc"><code class="name flex">
|
1492
|
<span>def <span class="ident">find_pc</span></span>(<span>db: sqlalchemy.orm.session.Session, username: str, hostname: str)</span>
|
1493
|
</code></dt>
|
1494
|
<dd>
|
1495
|
<div class="desc"><p>Finds one pc with given username and hostname</p></div>
|
1496
|
<details class="source">
|
1497
|
<summary>
|
1498
|
<span>Expand source code</span>
|
1499
|
</summary>
|
1500
|
<pre><code class="python">def find_pc(db: Session, username: str, hostname: str):
|
1501
|
"""
|
1502
|
Finds one pc with given username and hostname
|
1503
|
"""
|
1504
|
return db.query(models.PC).filter(and_(models.PC.username == username,
|
1505
|
models.PC.hostname == hostname)).first()</code></pre>
|
1506
|
</details>
|
1507
|
</dd>
|
1508
|
<dt id="sql_app.crud.find_pc_by_name"><code class="name flex">
|
1509
|
<span>def <span class="ident">find_pc_by_name</span></span>(<span>db: sqlalchemy.orm.session.Session, username: str)</span>
|
1510
|
</code></dt>
|
1511
|
<dd>
|
1512
|
<div class="desc"><p>Finds one pc by its username</p></div>
|
1513
|
<details class="source">
|
1514
|
<summary>
|
1515
|
<span>Expand source code</span>
|
1516
|
</summary>
|
1517
|
<pre><code class="python">def find_pc_by_name(db: Session, username: str):
|
1518
|
"""
|
1519
|
Finds one pc by its username
|
1520
|
"""
|
1521
|
return db.query(models.PC).filter(models.PC.username == username).first()</code></pre>
|
1522
|
</details>
|
1523
|
</dd>
|
1524
|
<dt id="sql_app.crud.find_pc_by_name_all"><code class="name flex">
|
1525
|
<span>def <span class="ident">find_pc_by_name_all</span></span>(<span>db: sqlalchemy.orm.session.Session, username: str)</span>
|
1526
|
</code></dt>
|
1527
|
<dd>
|
1528
|
<div class="desc"><p>Finds all pcs with same username</p></div>
|
1529
|
<details class="source">
|
1530
|
<summary>
|
1531
|
<span>Expand source code</span>
|
1532
|
</summary>
|
1533
|
<pre><code class="python">def find_pc_by_name_all(db: Session, username: str):
|
1534
|
"""
|
1535
|
Finds all pcs with same username
|
1536
|
"""
|
1537
|
return db.query(models.PC).filter(models.PC.username == username).offset(0).limit(100).all()</code></pre>
|
1538
|
</details>
|
1539
|
</dd>
|
1540
|
<dt id="sql_app.crud.find_pc_by_username"><code class="name flex">
|
1541
|
<span>def <span class="ident">find_pc_by_username</span></span>(<span>db: sqlalchemy.orm.session.Session, name: str)</span>
|
1542
|
</code></dt>
|
1543
|
<dd>
|
1544
|
<div class="desc"><p>Finds one pc by given username</p></div>
|
1545
|
<details class="source">
|
1546
|
<summary>
|
1547
|
<span>Expand source code</span>
|
1548
|
</summary>
|
1549
|
<pre><code class="python">def find_pc_by_username(db: Session, name: str):
|
1550
|
"""
|
1551
|
Finds one pc by given username
|
1552
|
"""
|
1553
|
return db.query(models.PC).filter(models.PC.username == name).first()</code></pre>
|
1554
|
</details>
|
1555
|
</dd>
|
1556
|
<dt id="sql_app.crud.find_pcs"><code class="name flex">
|
1557
|
<span>def <span class="ident">find_pcs</span></span>(<span>db: sqlalchemy.orm.session.Session, pcs: [])</span>
|
1558
|
</code></dt>
|
1559
|
<dd>
|
1560
|
<div class="desc"><p>Finds all pcs with ids in given id array</p></div>
|
1561
|
<details class="source">
|
1562
|
<summary>
|
1563
|
<span>Expand source code</span>
|
1564
|
</summary>
|
1565
|
<pre><code class="python">def find_pcs(db: Session, pcs: []):
|
1566
|
"""
|
1567
|
Finds all pcs with ids in given id array
|
1568
|
"""
|
1569
|
return db.query(models.PC).filter(models.PC.id.in_(pcs)).all()</code></pre>
|
1570
|
</details>
|
1571
|
</dd>
|
1572
|
<dt id="sql_app.crud.find_team"><code class="name flex">
|
1573
|
<span>def <span class="ident">find_team</span></span>(<span>db: sqlalchemy.orm.session.Session, name: str)</span>
|
1574
|
</code></dt>
|
1575
|
<dd>
|
1576
|
<div class="desc"><p>Finds one specific team by its name</p></div>
|
1577
|
<details class="source">
|
1578
|
<summary>
|
1579
|
<span>Expand source code</span>
|
1580
|
</summary>
|
1581
|
<pre><code class="python">def find_team(db: Session, name: str):
|
1582
|
"""
|
1583
|
Finds one specific team by its name
|
1584
|
"""
|
1585
|
return db.query(models.Team).filter(models.Team.name == name).first()</code></pre>
|
1586
|
</details>
|
1587
|
</dd>
|
1588
|
<dt id="sql_app.crud.find_user"><code class="name flex">
|
1589
|
<span>def <span class="ident">find_user</span></span>(<span>db: sqlalchemy.orm.session.Session, name: str)</span>
|
1590
|
</code></dt>
|
1591
|
<dd>
|
1592
|
<div class="desc"><p>Finds one user by given username</p></div>
|
1593
|
<details class="source">
|
1594
|
<summary>
|
1595
|
<span>Expand source code</span>
|
1596
|
</summary>
|
1597
|
<pre><code class="python">def find_user(db: Session, name: str):
|
1598
|
"""
|
1599
|
Finds one user by given username
|
1600
|
"""
|
1601
|
return db.query(models.User).filter(models.User.username == name).first()</code></pre>
|
1602
|
</details>
|
1603
|
</dd>
|
1604
|
<dt id="sql_app.crud.find_user_byid"><code class="name flex">
|
1605
|
<span>def <span class="ident">find_user_byid</span></span>(<span>db: sqlalchemy.orm.session.Session, id: int)</span>
|
1606
|
</code></dt>
|
1607
|
<dd>
|
1608
|
<div class="desc"><p>Finds one user by given id</p></div>
|
1609
|
<details class="source">
|
1610
|
<summary>
|
1611
|
<span>Expand source code</span>
|
1612
|
</summary>
|
1613
|
<pre><code class="python">def find_user_byid(db: Session, id: int):
|
1614
|
"""
|
1615
|
Finds one user by given id
|
1616
|
"""
|
1617
|
return db.query(models.User).filter(models.User.id == id).first()</code></pre>
|
1618
|
</details>
|
1619
|
</dd>
|
1620
|
<dt id="sql_app.crud.get_body_device"><code class="name flex">
|
1621
|
<span>def <span class="ident">get_body_device</span></span>(<span>db: sqlalchemy.orm.session.Session, body_id: int)</span>
|
1622
|
</code></dt>
|
1623
|
<dd>
|
1624
|
<div class="desc"><p>Returns one specific body device by given id</p></div>
|
1625
|
<details class="source">
|
1626
|
<summary>
|
1627
|
<span>Expand source code</span>
|
1628
|
</summary>
|
1629
|
<pre><code class="python">def get_body_device(db: Session, body_id: int):
|
1630
|
"""
|
1631
|
Returns one specific body device by given id
|
1632
|
"""
|
1633
|
return db.query(models.BodyDevice).filter(models.BodyDevice.id == body_id).first()</code></pre>
|
1634
|
</details>
|
1635
|
</dd>
|
1636
|
<dt id="sql_app.crud.get_body_devices"><code class="name flex">
|
1637
|
<span>def <span class="ident">get_body_devices</span></span>(<span>db: sqlalchemy.orm.session.Session, skip: int = 0, limit: int = 100)</span>
|
1638
|
</code></dt>
|
1639
|
<dd>
|
1640
|
<div class="desc"><p>Returns all body devices saved in database</p></div>
|
1641
|
<details class="source">
|
1642
|
<summary>
|
1643
|
<span>Expand source code</span>
|
1644
|
</summary>
|
1645
|
<pre><code class="python">def get_body_devices(db: Session, skip: int = 0, limit: int = 100):
|
1646
|
"""
|
1647
|
Returns all body devices saved in database
|
1648
|
"""
|
1649
|
return db.query(models.BodyDevice).offset(skip).limit(limit).all()</code></pre>
|
1650
|
</details>
|
1651
|
</dd>
|
1652
|
<dt id="sql_app.crud.get_bodydevices_with_ids"><code class="name flex">
|
1653
|
<span>def <span class="ident">get_bodydevices_with_ids</span></span>(<span>db: sqlalchemy.orm.session.Session, ids: [])</span>
|
1654
|
</code></dt>
|
1655
|
<dd>
|
1656
|
<div class="desc"><p>returns all bodydevices with given ids</p></div>
|
1657
|
<details class="source">
|
1658
|
<summary>
|
1659
|
<span>Expand source code</span>
|
1660
|
</summary>
|
1661
|
<pre><code class="python">def get_bodydevices_with_ids(db: Session, ids: []):
|
1662
|
"""
|
1663
|
returns all bodydevices with given ids
|
1664
|
"""
|
1665
|
return db.query(models.BodyDevice).filter(models.BodyDevice.id.in_(ids)).all()</code></pre>
|
1666
|
</details>
|
1667
|
</dd>
|
1668
|
<dt id="sql_app.crud.get_device"><code class="name flex">
|
1669
|
<span>def <span class="ident">get_device</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int)</span>
|
1670
|
</code></dt>
|
1671
|
<dd>
|
1672
|
<div class="desc"><p>returns one specific devices by given id</p></div>
|
1673
|
<details class="source">
|
1674
|
<summary>
|
1675
|
<span>Expand source code</span>
|
1676
|
</summary>
|
1677
|
<pre><code class="python">def get_device(db: Session, device_id: int):
|
1678
|
"""
|
1679
|
returns one specific devices by given id
|
1680
|
"""
|
1681
|
return db.query(models.Device).filter(models.Device.id == device_id).first()</code></pre>
|
1682
|
</details>
|
1683
|
</dd>
|
1684
|
<dt id="sql_app.crud.get_device_licenses"><code class="name flex">
|
1685
|
<span>def <span class="ident">get_device_licenses</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int)</span>
|
1686
|
</code></dt>
|
1687
|
<dd>
|
1688
|
<div class="desc"><p>returns all entries in devices_licenses table with given device_id</p></div>
|
1689
|
<details class="source">
|
1690
|
<summary>
|
1691
|
<span>Expand source code</span>
|
1692
|
</summary>
|
1693
|
<pre><code class="python">def get_device_licenses(db: Session, device_id: int):
|
1694
|
"""
|
1695
|
returns all entries in devices_licenses table with given device_id
|
1696
|
"""
|
1697
|
return db.query(models.DeviceLicense).filter(models.DeviceLicense.device_id == device_id).all()</code></pre>
|
1698
|
</details>
|
1699
|
</dd>
|
1700
|
<dt id="sql_app.crud.get_devicelicense_by_devicelicense"><code class="name flex">
|
1701
|
<span>def <span class="ident">get_devicelicense_by_devicelicense</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, license_id: int)</span>
|
1702
|
</code></dt>
|
1703
|
<dd>
|
1704
|
<div class="desc"><p>returns entry in devices_licenses table with given device id and license id</p></div>
|
1705
|
<details class="source">
|
1706
|
<summary>
|
1707
|
<span>Expand source code</span>
|
1708
|
</summary>
|
1709
|
<pre><code class="python">def get_devicelicense_by_devicelicense(db: Session, device_id: int, license_id: int):
|
1710
|
"""
|
1711
|
returns entry in devices_licenses table with given device id and license id
|
1712
|
"""
|
1713
|
return db.query(models.DeviceLicense).filter(and_(models.DeviceLicense.device_id == device_id,
|
1714
|
models.DeviceLicense.license_id == license_id)).first()</code></pre>
|
1715
|
</details>
|
1716
|
</dd>
|
1717
|
<dt id="sql_app.crud.get_devices"><code class="name flex">
|
1718
|
<span>def <span class="ident">get_devices</span></span>(<span>db: sqlalchemy.orm.session.Session, skip: int = 0, limit: int = 100)</span>
|
1719
|
</code></dt>
|
1720
|
<dd>
|
1721
|
<div class="desc"><p>returns all devices in database</p></div>
|
1722
|
<details class="source">
|
1723
|
<summary>
|
1724
|
<span>Expand source code</span>
|
1725
|
</summary>
|
1726
|
<pre><code class="python">def get_devices(db: Session, skip: int = 0, limit: int = 100):
|
1727
|
"""
|
1728
|
returns all devices in database
|
1729
|
"""
|
1730
|
return db.query(models.Device).offset(skip).limit(limit).all()</code></pre>
|
1731
|
</details>
|
1732
|
</dd>
|
1733
|
<dt id="sql_app.crud.get_devices_by_team"><code class="name flex">
|
1734
|
<span>def <span class="ident">get_devices_by_team</span></span>(<span>db: sqlalchemy.orm.session.Session, team: int)</span>
|
1735
|
</code></dt>
|
1736
|
<dd>
|
1737
|
<div class="desc"><p>returns all devices with same team</p></div>
|
1738
|
<details class="source">
|
1739
|
<summary>
|
1740
|
<span>Expand source code</span>
|
1741
|
</summary>
|
1742
|
<pre><code class="python">def get_devices_by_team(db: Session, team: int):
|
1743
|
"""
|
1744
|
returns all devices with same team
|
1745
|
"""
|
1746
|
return db.query(models.Device).filter(models.Device.team_id == team).all()</code></pre>
|
1747
|
</details>
|
1748
|
</dd>
|
1749
|
<dt id="sql_app.crud.get_devices_with_ids"><code class="name flex">
|
1750
|
<span>def <span class="ident">get_devices_with_ids</span></span>(<span>db: sqlalchemy.orm.session.Session, ids: [])</span>
|
1751
|
</code></dt>
|
1752
|
<dd>
|
1753
|
<div class="desc"><p>returns all devices with given ids</p></div>
|
1754
|
<details class="source">
|
1755
|
<summary>
|
1756
|
<span>Expand source code</span>
|
1757
|
</summary>
|
1758
|
<pre><code class="python">def get_devices_with_ids(db: Session, ids: []):
|
1759
|
"""
|
1760
|
returns all devices with given ids
|
1761
|
"""
|
1762
|
return db.query(models.Device).filter(models.Device.id.in_(ids)).all()</code></pre>
|
1763
|
</details>
|
1764
|
</dd>
|
1765
|
<dt id="sql_app.crud.get_filtered_bodydevices"><code class="name flex">
|
1766
|
<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>
|
1767
|
</code></dt>
|
1768
|
<dd>
|
1769
|
<div class="desc"><p>returns filtered body devices based on given attributes</p></div>
|
1770
|
<details class="source">
|
1771
|
<summary>
|
1772
|
<span>Expand source code</span>
|
1773
|
</summary>
|
1774
|
<pre><code class="python">def get_filtered_bodydevices(db: Session, body_id: str, license_id: str, team: str):
|
1775
|
"""
|
1776
|
returns filtered body devices based on given attributes
|
1777
|
"""
|
1778
|
execute_string = "SELECT * FROM body_devices AS device WHERE"
|
1779
|
before_me = False
|
1780
|
all_all = True
|
1781
|
if body_id != "all":
|
1782
|
all_all = False
|
1783
|
body_dev = find_bodydevice_by_serial(db, body_id)
|
1784
|
if body_dev != None:
|
1785
|
if before_me:
|
1786
|
execute_string += " AND device.id = " + str(body_dev.id)
|
1787
|
else:
|
1788
|
before_me = True
|
1789
|
execute_string += " device.id = " + str(body_dev.id)
|
1790
|
if license_id != "all":
|
1791
|
all_all = False
|
1792
|
license = find_license(db, license_id)
|
1793
|
if license != None:
|
1794
|
if before_me:
|
1795
|
execute_string += " AND device.license_id = " + str(license.id)
|
1796
|
else:
|
1797
|
before_me = True
|
1798
|
execute_string += " device.license_id = " + str(license.id)
|
1799
|
if team != "all":
|
1800
|
all_all = False
|
1801
|
tem = find_team(db, team)
|
1802
|
if tem != None:
|
1803
|
if before_me:
|
1804
|
execute_string += " AND device.team_id = " + str(tem.id)
|
1805
|
else:
|
1806
|
before_me = True
|
1807
|
execute_string += " device.team_id = " + str(tem.id)
|
1808
|
if all_all:
|
1809
|
before_me = True
|
1810
|
execute_string = "SELECT * FROM body_devices AS devices"
|
1811
|
|
1812
|
if not before_me:
|
1813
|
execute_string = "SELECT * FROM body_devices AS devices WHERE devices.id = -1"
|
1814
|
result = db.execute(execute_string)
|
1815
|
return result</code></pre>
|
1816
|
</details>
|
1817
|
</dd>
|
1818
|
<dt id="sql_app.crud.get_filtered_devices"><code class="name flex">
|
1819
|
<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>
|
1820
|
</code></dt>
|
1821
|
<dd>
|
1822
|
<div class="desc"><p>returns filtered keyman devices based on given attributes</p></div>
|
1823
|
<details class="source">
|
1824
|
<summary>
|
1825
|
<span>Expand source code</span>
|
1826
|
</summary>
|
1827
|
<pre><code class="python">def get_filtered_devices(db: Session, keyman_id: str, license_name: str, license_id: str, team: str):
|
1828
|
"""
|
1829
|
returns filtered keyman devices based on given attributes
|
1830
|
"""
|
1831
|
execute_string = "SELECT * FROM devices AS device WHERE"
|
1832
|
before_me = False
|
1833
|
all_all = True
|
1834
|
if keyman_id != "all":
|
1835
|
all_all = False
|
1836
|
keyman_dev = find_device_by_serial(db, keyman_id)
|
1837
|
if keyman_dev != None:
|
1838
|
if before_me:
|
1839
|
execute_string += " AND device.id = " + str(keyman_dev.id)
|
1840
|
else:
|
1841
|
before_me = True
|
1842
|
execute_string += " device.id = " + str(keyman_dev.id)
|
1843
|
if license_name != "all":
|
1844
|
all_all = False
|
1845
|
license = get_licenses_by_name(db, license_name)
|
1846
|
if len(license) > 0:
|
1847
|
lic_ids = []
|
1848
|
for l in license:
|
1849
|
lic_ids.append(l.id)
|
1850
|
dev_lics = find_devicelicenses_by_licid_array(db, lic_ids)
|
1851
|
lic_ids = "("
|
1852
|
for l in dev_lics:
|
1853
|
lic_ids += str(l.device_id) + ", "
|
1854
|
def_lic_ids = lic_ids[:-2] + ")"
|
1855
|
if before_me:
|
1856
|
execute_string += " AND device.id IN " + def_lic_ids
|
1857
|
else:
|
1858
|
before_me = True
|
1859
|
execute_string += " device.id IN " + def_lic_ids
|
1860
|
if license_id != "all":
|
1861
|
all_all = False
|
1862
|
license = find_license(db, license_id)
|
1863
|
licen_devs = get_license_devices(db, license.id)
|
1864
|
ids = "("
|
1865
|
for lic in licen_devs:
|
1866
|
ids += str(lic.device_id) + ", "
|
1867
|
def_ids = ids[:-2] + ")"
|
1868
|
if license != None:
|
1869
|
if before_me:
|
1870
|
execute_string += " AND device.id IN " + def_ids
|
1871
|
else:
|
1872
|
before_me = True
|
1873
|
execute_string += " device.id IN " + def_ids
|
1874
|
if team != "all":
|
1875
|
all_all = False
|
1876
|
tem = find_team(db, team)
|
1877
|
if tem != None:
|
1878
|
if before_me:
|
1879
|
execute_string += " AND device.team_id = " + str(tem.id)
|
1880
|
else:
|
1881
|
before_me = True
|
1882
|
execute_string += " device.team_id = " + str(tem.id)
|
1883
|
if all_all:
|
1884
|
before_me = True
|
1885
|
execute_string = "SELECT * FROM devices AS devices"
|
1886
|
|
1887
|
if not before_me:
|
1888
|
execute_string = "SELECT * FROM devices AS devices WHERE devices.id = -1"
|
1889
|
result = db.execute(execute_string)
|
1890
|
return result</code></pre>
|
1891
|
</details>
|
1892
|
</dd>
|
1893
|
<dt id="sql_app.crud.get_filtered_headdevices"><code class="name flex">
|
1894
|
<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>
|
1895
|
</code></dt>
|
1896
|
<dd>
|
1897
|
<div class="desc"><p>returns filtered head devices based on given attributes</p></div>
|
1898
|
<details class="source">
|
1899
|
<summary>
|
1900
|
<span>Expand source code</span>
|
1901
|
</summary>
|
1902
|
<pre><code class="python">def get_filtered_headdevices(db: Session, body_id: str, license_id: str, team: str):
|
1903
|
"""
|
1904
|
returns filtered head devices based on given attributes
|
1905
|
"""
|
1906
|
execute_string = "SELECT * FROM head_devices AS device WHERE"
|
1907
|
before_me = False
|
1908
|
all_all = True
|
1909
|
if body_id != "all":
|
1910
|
all_all = False
|
1911
|
head_dev = find_headdevice_by_serial(db, body_id)
|
1912
|
if head_dev != None:
|
1913
|
if before_me:
|
1914
|
execute_string += " AND device.id = " + str(head_dev.id)
|
1915
|
else:
|
1916
|
before_me = True
|
1917
|
execute_string += " device.id = " + str(head_dev.id)
|
1918
|
if license_id != "all":
|
1919
|
all_all = False
|
1920
|
license = find_license(db, license_id)
|
1921
|
if license != None:
|
1922
|
if before_me:
|
1923
|
execute_string += " AND device.license_id = " + str(license.id)
|
1924
|
else:
|
1925
|
before_me = True
|
1926
|
execute_string += " device.license_id = " + str(license.id)
|
1927
|
if team != "all":
|
1928
|
all_all = False
|
1929
|
tem = find_team(db, team)
|
1930
|
if tem != None:
|
1931
|
if before_me:
|
1932
|
execute_string += " AND device.team_id = " + str(tem.id)
|
1933
|
else:
|
1934
|
before_me = True
|
1935
|
execute_string += " device.team_id = " + str(tem.id)
|
1936
|
if all_all:
|
1937
|
before_me = True
|
1938
|
execute_string = "SELECT * FROM body_devices AS devices"
|
1939
|
|
1940
|
if not before_me:
|
1941
|
execute_string = "SELECT * FROM body_devices AS devices WHERE devices.id = -1"
|
1942
|
result = db.execute(execute_string)
|
1943
|
return result</code></pre>
|
1944
|
</details>
|
1945
|
</dd>
|
1946
|
<dt id="sql_app.crud.get_filtered_ldlogs"><code class="name flex">
|
1947
|
<span>def <span class="ident">get_filtered_ldlogs</span></span>(<span>db: sqlalchemy.orm.session.Session, pc: str, tema: str, lic: str)</span>
|
1948
|
</code></dt>
|
1949
|
<dd>
|
1950
|
<div class="desc"><p>Function creates query string used for filtering by pc username, team name and license name.
|
1951
|
Depending on selected filters assembles query string for database</p></div>
|
1952
|
<details class="source">
|
1953
|
<summary>
|
1954
|
<span>Expand source code</span>
|
1955
|
</summary>
|
1956
|
<pre><code class="python">def get_filtered_ldlogs(db: Session, pc: str, tema: str, lic: str):
|
1957
|
"""
|
1958
|
Function creates query string used for filtering by pc username, team name and license name.
|
1959
|
Depending on selected filters assembles query string for database
|
1960
|
"""
|
1961
|
execute_string = "SELECT * FROM ld_logs AS logs WHERE"
|
1962
|
before_me = False
|
1963
|
all_all = True
|
1964
|
if pc != "all":
|
1965
|
all_all = False
|
1966
|
pc = find_pc_by_username(db, pc)
|
1967
|
if pc != None:
|
1968
|
if before_me:
|
1969
|
execute_string += " AND logs.pc_id = " + str(pc.id)
|
1970
|
else:
|
1971
|
before_me = True
|
1972
|
execute_string += " logs.pc_id = " + str(pc.id)
|
1973
|
if tema != "all":
|
1974
|
all_all = False
|
1975
|
team = find_team(db, tema)
|
1976
|
if team != None:
|
1977
|
head_devices = find_headdevices_by_team(db, team.id)
|
1978
|
body_devices = find_bodydevices_by_team(db, team.id)
|
1979
|
if len(head_devices) > 0 and len(body_devices) > 0:
|
1980
|
h_ids = "("
|
1981
|
for h in head_devices:
|
1982
|
h_ids += str(h.id) + ", "
|
1983
|
def_h_ids = h_ids[:-2] + ")"
|
1984
|
b_ids = "("
|
1985
|
for b in body_devices:
|
1986
|
b_ids += str(b.id) + ", "
|
1987
|
def_b_ids = b_ids[:-2] + ")"
|
1988
|
if before_me:
|
1989
|
execute_string += " AND (logs.head_id IN " + def_h_ids + " OR logs.body_id IN " + def_b_ids + ")"
|
1990
|
else:
|
1991
|
before_me = True
|
1992
|
execute_string += " (logs.head_id IN " + def_h_ids + " OR logs.body_id IN " + def_b_ids + ")"
|
1993
|
elif len(head_devices) == 0 and len(body_devices) > 0:
|
1994
|
b_ids = "("
|
1995
|
for b in body_devices:
|
1996
|
b_ids += str(b.id) + ", "
|
1997
|
def_b_ids = b_ids[:-2] + ")"
|
1998
|
if before_me:
|
1999
|
execute_string += " AND logs.body_id IN " + def_b_ids
|
2000
|
else:
|
2001
|
before_me = True
|
2002
|
execute_string += " logs.body_id IN " + def_b_ids
|
2003
|
elif len(head_devices) > 0 and len(body_devices) == 0:
|
2004
|
h_ids = "("
|
2005
|
for h in head_devices:
|
2006
|
h_ids += str(h.id) + ", "
|
2007
|
def_h_ids = h_ids[:-2] + ")"
|
2008
|
if before_me:
|
2009
|
execute_string += " AND logs.head_id IN " + def_h_ids
|
2010
|
else:
|
2011
|
before_me = True
|
2012
|
execute_string += " logs.head_id IN " + def_h_ids
|
2013
|
else:
|
2014
|
if before_me:
|
2015
|
execute_string += " AND (logs.head_id = -1 OR logs.body_id = -1)"
|
2016
|
else:
|
2017
|
before_me = True
|
2018
|
execute_string += " (logs.head_id = -1 OR logs.body_id = -1)"
|
2019
|
if lic != "all":
|
2020
|
all_all = False
|
2021
|
license = find_license(db, lic)
|
2022
|
if license != None:
|
2023
|
head_devices = find_headdevices_by_license(db, license.id)
|
2024
|
body_devices = find_bodydevices_by_license(db, license.id)
|
2025
|
if len(head_devices) > 0 and len(body_devices) > 0:
|
2026
|
h_ids = "("
|
2027
|
for h in head_devices:
|
2028
|
h_ids += str(h.id) + ", "
|
2029
|
def_h_ids = h_ids[:-2] + ")"
|
2030
|
b_ids = "("
|
2031
|
for b in body_devices:
|
2032
|
b_ids += str(b.id) + ", "
|
2033
|
def_b_ids = b_ids[:-2] + ")"
|
2034
|
if before_me:
|
2035
|
execute_string += " AND (logs.head_id IN " + def_h_ids + " OR logs.body_id IN " + def_b_ids + ")"
|
2036
|
else:
|
2037
|
before_me = True
|
2038
|
execute_string += " (logs.head_id IN " + def_h_ids + " OR logs.body_id IN " + def_b_ids + ")"
|
2039
|
elif len(head_devices) == 0 and len(body_devices) > 0:
|
2040
|
b_ids = "("
|
2041
|
for b in body_devices:
|
2042
|
b_ids += str(b.id) + ", "
|
2043
|
def_b_ids = b_ids[:-2] + ")"
|
2044
|
if before_me:
|
2045
|
execute_string += " AND logs.body_id IN " + def_b_ids
|
2046
|
else:
|
2047
|
before_me = True
|
2048
|
execute_string += " logs.body_id IN " + def_b_ids
|
2049
|
elif len(head_devices) > 0 and len(body_devices) == 0:
|
2050
|
h_ids = "("
|
2051
|
for h in head_devices:
|
2052
|
h_ids += str(h.id) + ", "
|
2053
|
def_h_ids = h_ids[:-2] + ")"
|
2054
|
if before_me:
|
2055
|
execute_string += " AND logs.head_id IN " + def_h_ids
|
2056
|
else:
|
2057
|
before_me = True
|
2058
|
execute_string += " logs.head_id IN " + def_h_ids
|
2059
|
else:
|
2060
|
if before_me:
|
2061
|
execute_string += " AND (logs.head_id = -1 OR logs.body_id = -1)"
|
2062
|
else:
|
2063
|
before_me = True
|
2064
|
execute_string += " (logs.head_id = -1 OR logs.body_id = -1)"
|
2065
|
if all_all:
|
2066
|
before_me = True
|
2067
|
execute_string = "SELECT * FROM ld_logs AS logs"
|
2068
|
|
2069
|
if not before_me:
|
2070
|
execute_string = "SELECT * FROM ld_logs AS logs WHERE logs.id = -1"
|
2071
|
result = db.execute(execute_string)
|
2072
|
return result</code></pre>
|
2073
|
</details>
|
2074
|
</dd>
|
2075
|
<dt id="sql_app.crud.get_filtered_logs"><code class="name flex">
|
2076
|
<span>def <span class="ident">get_filtered_logs</span></span>(<span>db: sqlalchemy.orm.session.Session, pc: str, tema: str, lic: str)</span>
|
2077
|
</code></dt>
|
2078
|
<dd>
|
2079
|
<div class="desc"><p>Function creates query string used for filtering by pc username, team name and license name.
|
2080
|
Depending on selected filters assembles query string for database</p></div>
|
2081
|
<details class="source">
|
2082
|
<summary>
|
2083
|
<span>Expand source code</span>
|
2084
|
</summary>
|
2085
|
<pre><code class="python">def get_filtered_logs(db: Session, pc: str, tema: str, lic: str):
|
2086
|
"""
|
2087
|
Function creates query string used for filtering by pc username, team name and license name.
|
2088
|
Depending on selected filters assembles query string for database
|
2089
|
"""
|
2090
|
execute_string = "SELECT * FROM usb_logs AS logs"
|
2091
|
pcs = find_pc_by_username(db, pc)
|
2092
|
if pc != "all":
|
2093
|
if pcs is not None:
|
2094
|
execute_string += " WHERE logs.pc_id = " + str(pcs.id)
|
2095
|
if tema != "all":
|
2096
|
team = find_team(db, tema)
|
2097
|
if team is not None:
|
2098
|
devs = get_devices_by_team(db, team.id)
|
2099
|
d_ids = "("
|
2100
|
for p in devs:
|
2101
|
d_ids += str(p.id) + ", "
|
2102
|
def_d_ids = d_ids[:-2] + ")"
|
2103
|
if pc != "all" and pcs is not None:
|
2104
|
if len(def_d_ids) > 1:
|
2105
|
execute_string += " AND logs.device_id IN " + def_d_ids
|
2106
|
else:
|
2107
|
if len(def_d_ids) > 1:
|
2108
|
execute_string += " WHERE logs.device_id IN " + def_d_ids
|
2109
|
if lic != "all":
|
2110
|
license = get_licenses_by_name(db, lic)
|
2111
|
if license is not None:
|
2112
|
device_licenses = get_license_devices(db, license.id)
|
2113
|
dev_ids = "("
|
2114
|
for dev in device_licenses:
|
2115
|
dev_ids += str(dev.device_id) + ", "
|
2116
|
defin_ids = dev_ids[:-2] + ")"
|
2117
|
if pc != "all" or tema != "all":
|
2118
|
if len(defin_ids) > 1:
|
2119
|
execute_string += " AND logs.device_id IN " + defin_ids
|
2120
|
else:
|
2121
|
if len(defin_ids) > 1:
|
2122
|
execute_string += " WHERE logs.device_id IN " + defin_ids
|
2123
|
|
2124
|
# executing assembled query string
|
2125
|
result = db.execute(execute_string)
|
2126
|
return result</code></pre>
|
2127
|
</details>
|
2128
|
</dd>
|
2129
|
<dt id="sql_app.crud.get_head_device"><code class="name flex">
|
2130
|
<span>def <span class="ident">get_head_device</span></span>(<span>db: sqlalchemy.orm.session.Session, head_id: int)</span>
|
2131
|
</code></dt>
|
2132
|
<dd>
|
2133
|
<div class="desc"><p>Returns one specific head device by given id</p></div>
|
2134
|
<details class="source">
|
2135
|
<summary>
|
2136
|
<span>Expand source code</span>
|
2137
|
</summary>
|
2138
|
<pre><code class="python">def get_head_device(db: Session, head_id: int):
|
2139
|
"""
|
2140
|
Returns one specific head device by given id
|
2141
|
"""
|
2142
|
return db.query(models.HeadDevice).filter(models.HeadDevice.id == head_id).first()</code></pre>
|
2143
|
</details>
|
2144
|
</dd>
|
2145
|
<dt id="sql_app.crud.get_head_devices"><code class="name flex">
|
2146
|
<span>def <span class="ident">get_head_devices</span></span>(<span>db: sqlalchemy.orm.session.Session, skip: int = 0, limit: int = 100)</span>
|
2147
|
</code></dt>
|
2148
|
<dd>
|
2149
|
<div class="desc"><p>Returns all head devices saved in database</p></div>
|
2150
|
<details class="source">
|
2151
|
<summary>
|
2152
|
<span>Expand source code</span>
|
2153
|
</summary>
|
2154
|
<pre><code class="python">def get_head_devices(db: Session, skip: int = 0, limit: int = 100):
|
2155
|
"""
|
2156
|
Returns all head devices saved in database
|
2157
|
"""
|
2158
|
return db.query(models.HeadDevice).offset(skip).limit(limit).all()</code></pre>
|
2159
|
</details>
|
2160
|
</dd>
|
2161
|
<dt id="sql_app.crud.get_headdevices_with_ids"><code class="name flex">
|
2162
|
<span>def <span class="ident">get_headdevices_with_ids</span></span>(<span>db: sqlalchemy.orm.session.Session, ids: [])</span>
|
2163
|
</code></dt>
|
2164
|
<dd>
|
2165
|
<div class="desc"><p>returns all headdevices with given ids</p></div>
|
2166
|
<details class="source">
|
2167
|
<summary>
|
2168
|
<span>Expand source code</span>
|
2169
|
</summary>
|
2170
|
<pre><code class="python">def get_headdevices_with_ids(db: Session, ids: []):
|
2171
|
"""
|
2172
|
returns all headdevices with given ids
|
2173
|
"""
|
2174
|
return db.query(models.HeadDevice).filter(models.HeadDevice.id.in_(ids)).all()</code></pre>
|
2175
|
</details>
|
2176
|
</dd>
|
2177
|
<dt id="sql_app.crud.get_ld_logs"><code class="name flex">
|
2178
|
<span>def <span class="ident">get_ld_logs</span></span>(<span>db: sqlalchemy.orm.session.Session, skip: int = 0, limit: int = 100)</span>
|
2179
|
</code></dt>
|
2180
|
<dd>
|
2181
|
<div class="desc"><p>Returns all ld debugger logs in database</p></div>
|
2182
|
<details class="source">
|
2183
|
<summary>
|
2184
|
<span>Expand source code</span>
|
2185
|
</summary>
|
2186
|
<pre><code class="python">def get_ld_logs(db: Session, skip: int = 0, limit: int = 100):
|
2187
|
"""
|
2188
|
Returns all ld debugger logs in database
|
2189
|
"""
|
2190
|
return db.query(models.LDLog).order_by(desc(models.LDLog.timestamp)).offset(skip).limit(limit).all()</code></pre>
|
2191
|
</details>
|
2192
|
</dd>
|
2193
|
<dt id="sql_app.crud.get_license"><code class="name flex">
|
2194
|
<span>def <span class="ident">get_license</span></span>(<span>db: sqlalchemy.orm.session.Session, license_id: int)</span>
|
2195
|
</code></dt>
|
2196
|
<dd>
|
2197
|
<div class="desc"><p>returns one specific license by given id</p></div>
|
2198
|
<details class="source">
|
2199
|
<summary>
|
2200
|
<span>Expand source code</span>
|
2201
|
</summary>
|
2202
|
<pre><code class="python">def get_license(db: Session, license_id: int):
|
2203
|
"""
|
2204
|
returns one specific license by given id
|
2205
|
"""
|
2206
|
return db.query(models.License).filter(models.License.id == license_id).first()</code></pre>
|
2207
|
</details>
|
2208
|
</dd>
|
2209
|
<dt id="sql_app.crud.get_license_devices"><code class="name flex">
|
2210
|
<span>def <span class="ident">get_license_devices</span></span>(<span>db: sqlalchemy.orm.session.Session, license_id: int)</span>
|
2211
|
</code></dt>
|
2212
|
<dd>
|
2213
|
<div class="desc"><p>returns all entries in devices_licenses table with given license_id</p></div>
|
2214
|
<details class="source">
|
2215
|
<summary>
|
2216
|
<span>Expand source code</span>
|
2217
|
</summary>
|
2218
|
<pre><code class="python">def get_license_devices(db: Session, license_id: int):
|
2219
|
"""
|
2220
|
returns all entries in devices_licenses table with given license_id
|
2221
|
"""
|
2222
|
return db.query(models.DeviceLicense).filter(models.DeviceLicense.license_id == license_id).all()</code></pre>
|
2223
|
</details>
|
2224
|
</dd>
|
2225
|
<dt id="sql_app.crud.get_licenses"><code class="name flex">
|
2226
|
<span>def <span class="ident">get_licenses</span></span>(<span>db: sqlalchemy.orm.session.Session, skip: int = 0, limit: int = 100)</span>
|
2227
|
</code></dt>
|
2228
|
<dd>
|
2229
|
<div class="desc"><p>returns all licenses in database</p></div>
|
2230
|
<details class="source">
|
2231
|
<summary>
|
2232
|
<span>Expand source code</span>
|
2233
|
</summary>
|
2234
|
<pre><code class="python">def get_licenses(db: Session, skip: int = 0, limit: int = 100):
|
2235
|
"""
|
2236
|
returns all licenses in database
|
2237
|
"""
|
2238
|
return db.query(models.License).offset(skip).limit(limit).all()</code></pre>
|
2239
|
</details>
|
2240
|
</dd>
|
2241
|
<dt id="sql_app.crud.get_licenses_by_name"><code class="name flex">
|
2242
|
<span>def <span class="ident">get_licenses_by_name</span></span>(<span>db: sqlalchemy.orm.session.Session, name: str)</span>
|
2243
|
</code></dt>
|
2244
|
<dd>
|
2245
|
<div class="desc"></div>
|
2246
|
<details class="source">
|
2247
|
<summary>
|
2248
|
<span>Expand source code</span>
|
2249
|
</summary>
|
2250
|
<pre><code class="python">def get_licenses_by_name(db: Session, name: str):
|
2251
|
return db.query(models.License).filter(models.License.name == name).all()</code></pre>
|
2252
|
</details>
|
2253
|
</dd>
|
2254
|
<dt id="sql_app.crud.get_log"><code class="name flex">
|
2255
|
<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>
|
2256
|
</code></dt>
|
2257
|
<dd>
|
2258
|
<div class="desc"><p>Returns all usb logs in database sorted by id</p></div>
|
2259
|
<details class="source">
|
2260
|
<summary>
|
2261
|
<span>Expand source code</span>
|
2262
|
</summary>
|
2263
|
<pre><code class="python">def get_log(db: Session, device_id: int, skip: int = 0, limit: int = 100):
|
2264
|
"""
|
2265
|
Returns all usb logs in database sorted by id
|
2266
|
"""
|
2267
|
return db.query(models.USBLog).filter(models.USBLog.device_id == device_id).offset(skip).limit(limit).all()</code></pre>
|
2268
|
</details>
|
2269
|
</dd>
|
2270
|
<dt id="sql_app.crud.get_logs"><code class="name flex">
|
2271
|
<span>def <span class="ident">get_logs</span></span>(<span>db: sqlalchemy.orm.session.Session, skip: int = 0, limit: int = 100)</span>
|
2272
|
</code></dt>
|
2273
|
<dd>
|
2274
|
<div class="desc"><p>Returns all usb logs in database ordered by timestamp</p></div>
|
2275
|
<details class="source">
|
2276
|
<summary>
|
2277
|
<span>Expand source code</span>
|
2278
|
</summary>
|
2279
|
<pre><code class="python">def get_logs(db: Session, skip: int = 0, limit: int = 100):
|
2280
|
"""
|
2281
|
Returns all usb logs in database ordered by timestamp
|
2282
|
"""
|
2283
|
return db.query(models.USBLog).order_by(desc(models.USBLog.timestamp)).offset(skip).limit(limit).all()</code></pre>
|
2284
|
</details>
|
2285
|
</dd>
|
2286
|
<dt id="sql_app.crud.get_pc"><code class="name flex">
|
2287
|
<span>def <span class="ident">get_pc</span></span>(<span>db: sqlalchemy.orm.session.Session, pc_id: int)</span>
|
2288
|
</code></dt>
|
2289
|
<dd>
|
2290
|
<div class="desc"><p>returns one specific pc by given id</p></div>
|
2291
|
<details class="source">
|
2292
|
<summary>
|
2293
|
<span>Expand source code</span>
|
2294
|
</summary>
|
2295
|
<pre><code class="python">def get_pc(db: Session, pc_id: int):
|
2296
|
"""
|
2297
|
returns one specific pc by given id
|
2298
|
"""
|
2299
|
return db.query(models.PC).filter(models.PC.id == pc_id).first()</code></pre>
|
2300
|
</details>
|
2301
|
</dd>
|
2302
|
<dt id="sql_app.crud.get_pcs"><code class="name flex">
|
2303
|
<span>def <span class="ident">get_pcs</span></span>(<span>db: sqlalchemy.orm.session.Session, skip: int = 0, limit: int = 100)</span>
|
2304
|
</code></dt>
|
2305
|
<dd>
|
2306
|
<div class="desc"><p>returns all pcs in database</p></div>
|
2307
|
<details class="source">
|
2308
|
<summary>
|
2309
|
<span>Expand source code</span>
|
2310
|
</summary>
|
2311
|
<pre><code class="python">def get_pcs(db: Session, skip: int = 0, limit: int = 100):
|
2312
|
"""
|
2313
|
returns all pcs in database
|
2314
|
"""
|
2315
|
return db.query(models.PC).offset(skip).limit(limit).all()</code></pre>
|
2316
|
</details>
|
2317
|
</dd>
|
2318
|
<dt id="sql_app.crud.get_team"><code class="name flex">
|
2319
|
<span>def <span class="ident">get_team</span></span>(<span>db: sqlalchemy.orm.session.Session, team_id: int)</span>
|
2320
|
</code></dt>
|
2321
|
<dd>
|
2322
|
<div class="desc"><p>returns one specific team wit given id</p></div>
|
2323
|
<details class="source">
|
2324
|
<summary>
|
2325
|
<span>Expand source code</span>
|
2326
|
</summary>
|
2327
|
<pre><code class="python">def get_team(db: Session, team_id: int):
|
2328
|
"""
|
2329
|
returns one specific team wit given id
|
2330
|
"""
|
2331
|
return db.query(models.Team).filter(models.Team.id == team_id).first()</code></pre>
|
2332
|
</details>
|
2333
|
</dd>
|
2334
|
<dt id="sql_app.crud.get_teams"><code class="name flex">
|
2335
|
<span>def <span class="ident">get_teams</span></span>(<span>db: sqlalchemy.orm.session.Session, skip: int = 0, limit: int = 100)</span>
|
2336
|
</code></dt>
|
2337
|
<dd>
|
2338
|
<div class="desc"><p>returns all teams currently saved in database</p></div>
|
2339
|
<details class="source">
|
2340
|
<summary>
|
2341
|
<span>Expand source code</span>
|
2342
|
</summary>
|
2343
|
<pre><code class="python">def get_teams(db: Session, skip: int = 0, limit: int = 100):
|
2344
|
"""
|
2345
|
returns all teams currently saved in database
|
2346
|
"""
|
2347
|
return db.query(models.Team).offset(skip).limit(limit).all()</code></pre>
|
2348
|
</details>
|
2349
|
</dd>
|
2350
|
<dt id="sql_app.crud.get_users"><code class="name flex">
|
2351
|
<span>def <span class="ident">get_users</span></span>(<span>db: sqlalchemy.orm.session.Session, skip: int = 0, limit: int = 100)</span>
|
2352
|
</code></dt>
|
2353
|
<dd>
|
2354
|
<div class="desc"><p>Returns all users saved in database</p></div>
|
2355
|
<details class="source">
|
2356
|
<summary>
|
2357
|
<span>Expand source code</span>
|
2358
|
</summary>
|
2359
|
<pre><code class="python">def get_users(db: Session, skip: int = 0, limit: int = 100):
|
2360
|
"""
|
2361
|
Returns all users saved in database
|
2362
|
"""
|
2363
|
return db.query(models.User).offset(skip).limit(limit).all()</code></pre>
|
2364
|
</details>
|
2365
|
</dd>
|
2366
|
<dt id="sql_app.crud.update_bodydevice_comm"><code class="name flex">
|
2367
|
<span>def <span class="ident">update_bodydevice_comm</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, comm: str)</span>
|
2368
|
</code></dt>
|
2369
|
<dd>
|
2370
|
<div class="desc"><p>Updates body devices comment with new one given by user</p></div>
|
2371
|
<details class="source">
|
2372
|
<summary>
|
2373
|
<span>Expand source code</span>
|
2374
|
</summary>
|
2375
|
<pre><code class="python">def update_bodydevice_comm(db: Session, device_id: int, comm: str):
|
2376
|
"""
|
2377
|
Updates body devices comment with new one given by user
|
2378
|
"""
|
2379
|
old_dev = get_body_device(db, device_id)
|
2380
|
new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
|
2381
|
'comment': comm, 'team_id': old_dev.team_id, 'license_id': old_dev.license_id}
|
2382
|
for key, value in new.items():
|
2383
|
setattr(old_dev, key, value)
|
2384
|
db.commit()
|
2385
|
db.refresh(old_dev)
|
2386
|
return old_dev</code></pre>
|
2387
|
</details>
|
2388
|
</dd>
|
2389
|
<dt id="sql_app.crud.update_bodydevice_inv"><code class="name flex">
|
2390
|
<span>def <span class="ident">update_bodydevice_inv</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, dev_inv: str)</span>
|
2391
|
</code></dt>
|
2392
|
<dd>
|
2393
|
<div class="desc"><p>Updates body devices inventory number with new one given by user</p></div>
|
2394
|
<details class="source">
|
2395
|
<summary>
|
2396
|
<span>Expand source code</span>
|
2397
|
</summary>
|
2398
|
<pre><code class="python">def update_bodydevice_inv(db: Session, device_id: int, dev_inv: str):
|
2399
|
"""
|
2400
|
Updates body devices inventory number with new one given by user
|
2401
|
"""
|
2402
|
old_dev = get_body_device(db, device_id)
|
2403
|
new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': dev_inv,
|
2404
|
'comment': old_dev.comment, 'team_id': old_dev.team_id, 'license_id': old_dev.license_id}
|
2405
|
for key, value in new.items():
|
2406
|
setattr(old_dev, key, value)
|
2407
|
db.commit()
|
2408
|
db.refresh(old_dev)
|
2409
|
return old_dev</code></pre>
|
2410
|
</details>
|
2411
|
</dd>
|
2412
|
<dt id="sql_app.crud.update_bodydevice_license"><code class="name flex">
|
2413
|
<span>def <span class="ident">update_bodydevice_license</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, lic_id: int)</span>
|
2414
|
</code></dt>
|
2415
|
<dd>
|
2416
|
<div class="desc"><p>Updates body devices license with one given by user</p></div>
|
2417
|
<details class="source">
|
2418
|
<summary>
|
2419
|
<span>Expand source code</span>
|
2420
|
</summary>
|
2421
|
<pre><code class="python">def update_bodydevice_license(db: Session, device_id: int, lic_id: int):
|
2422
|
"""
|
2423
|
Updates body devices license with one given by user
|
2424
|
"""
|
2425
|
old_dev = get_body_device(db, device_id)
|
2426
|
lic = get_license(db, lic_id)
|
2427
|
new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
|
2428
|
'comment': old_dev.comment, 'team_id': old_dev.team_id, 'license_id': lic.id}
|
2429
|
for key, value in new.items():
|
2430
|
setattr(old_dev, key, value)
|
2431
|
db.commit()
|
2432
|
db.refresh(old_dev)
|
2433
|
return old_dev</code></pre>
|
2434
|
</details>
|
2435
|
</dd>
|
2436
|
<dt id="sql_app.crud.update_bodydevice_team"><code class="name flex">
|
2437
|
<span>def <span class="ident">update_bodydevice_team</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, team_id: int)</span>
|
2438
|
</code></dt>
|
2439
|
<dd>
|
2440
|
<div class="desc"><p>Updates body devices team with one given by user</p></div>
|
2441
|
<details class="source">
|
2442
|
<summary>
|
2443
|
<span>Expand source code</span>
|
2444
|
</summary>
|
2445
|
<pre><code class="python">def update_bodydevice_team(db: Session, device_id: int, team_id: int):
|
2446
|
"""
|
2447
|
Updates body devices team with one given by user
|
2448
|
"""
|
2449
|
old_dev = get_body_device(db, device_id)
|
2450
|
team = get_team(db, team_id)
|
2451
|
new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
|
2452
|
'comment': old_dev.comment, 'team_id': team.id, 'license_id': old_dev.license_id}
|
2453
|
for key, value in new.items():
|
2454
|
setattr(old_dev, key, value)
|
2455
|
db.commit()
|
2456
|
db.refresh(old_dev)
|
2457
|
return old_dev</code></pre>
|
2458
|
</details>
|
2459
|
</dd>
|
2460
|
<dt id="sql_app.crud.update_device"><code class="name flex">
|
2461
|
<span>def <span class="ident">update_device</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, team: str)</span>
|
2462
|
</code></dt>
|
2463
|
<dd>
|
2464
|
<div class="desc"><p>Updates team of one specific pc</p></div>
|
2465
|
<details class="source">
|
2466
|
<summary>
|
2467
|
<span>Expand source code</span>
|
2468
|
</summary>
|
2469
|
<pre><code class="python">def update_device(db: Session, device_id: int, team: str):
|
2470
|
"""
|
2471
|
Updates team of one specific pc
|
2472
|
"""
|
2473
|
old_dev = get_device(db, device_id)
|
2474
|
team = get_team(db, int(team))
|
2475
|
new = {'id': old_dev.id, 'vendor_id': old_dev.vendor_id, 'product_id': old_dev.product_id,
|
2476
|
'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
|
2477
|
'comment': old_dev.comment, 'team_id': team.id}
|
2478
|
for key, value in new.items():
|
2479
|
setattr(old_dev, key, value)
|
2480
|
db.commit()
|
2481
|
db.refresh(old_dev)
|
2482
|
return old_dev</code></pre>
|
2483
|
</details>
|
2484
|
</dd>
|
2485
|
<dt id="sql_app.crud.update_device_com"><code class="name flex">
|
2486
|
<span>def <span class="ident">update_device_com</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, comm: str)</span>
|
2487
|
</code></dt>
|
2488
|
<dd>
|
2489
|
<div class="desc"><p>Updates team of one specific pc</p></div>
|
2490
|
<details class="source">
|
2491
|
<summary>
|
2492
|
<span>Expand source code</span>
|
2493
|
</summary>
|
2494
|
<pre><code class="python">def update_device_com(db: Session, device_id: int, comm: str):
|
2495
|
"""
|
2496
|
Updates team of one specific pc
|
2497
|
"""
|
2498
|
old_dev = get_device(db, device_id)
|
2499
|
if old_dev.team_id != None:
|
2500
|
team = get_team(db, int(old_dev.team_id))
|
2501
|
teamid = team.id
|
2502
|
else:
|
2503
|
teamid = None
|
2504
|
new = {'id': old_dev.id, 'vendor_id': old_dev.vendor_id, 'product_id': old_dev.product_id,
|
2505
|
'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
|
2506
|
'comment': comm, 'team_id': teamid}
|
2507
|
for key, value in new.items():
|
2508
|
setattr(old_dev, key, value)
|
2509
|
db.commit()
|
2510
|
db.refresh(old_dev)
|
2511
|
return old_dev</code></pre>
|
2512
|
</details>
|
2513
|
</dd>
|
2514
|
<dt id="sql_app.crud.update_device_inv"><code class="name flex">
|
2515
|
<span>def <span class="ident">update_device_inv</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, inv: str)</span>
|
2516
|
</code></dt>
|
2517
|
<dd>
|
2518
|
<div class="desc"><p>Updates inventory number of one specific pc</p></div>
|
2519
|
<details class="source">
|
2520
|
<summary>
|
2521
|
<span>Expand source code</span>
|
2522
|
</summary>
|
2523
|
<pre><code class="python">def update_device_inv(db: Session, device_id: int, inv: str):
|
2524
|
"""
|
2525
|
Updates inventory number of one specific pc
|
2526
|
"""
|
2527
|
old_dev = get_device(db, device_id)
|
2528
|
if old_dev.team_id != None:
|
2529
|
team = get_team(db, int(old_dev.team_id))
|
2530
|
teamid = team.id
|
2531
|
else:
|
2532
|
teamid = None
|
2533
|
new = {'id': old_dev.id, 'vendor_id': old_dev.vendor_id, 'product_id': old_dev.product_id,
|
2534
|
'serial_number': old_dev.serial_number, 'inventory_number': inv,
|
2535
|
'comment': old_dev.comment, 'team_id': teamid}
|
2536
|
for key, value in new.items():
|
2537
|
setattr(old_dev, key, value)
|
2538
|
db.commit()
|
2539
|
db.refresh(old_dev)
|
2540
|
return old_dev</code></pre>
|
2541
|
</details>
|
2542
|
</dd>
|
2543
|
<dt id="sql_app.crud.update_headdevice_comm"><code class="name flex">
|
2544
|
<span>def <span class="ident">update_headdevice_comm</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, comm: str)</span>
|
2545
|
</code></dt>
|
2546
|
<dd>
|
2547
|
<div class="desc"><p>Updates head devices comment with new one given by user</p></div>
|
2548
|
<details class="source">
|
2549
|
<summary>
|
2550
|
<span>Expand source code</span>
|
2551
|
</summary>
|
2552
|
<pre><code class="python">def update_headdevice_comm(db: Session, device_id: int, comm: str):
|
2553
|
"""
|
2554
|
Updates head devices comment with new one given by user
|
2555
|
"""
|
2556
|
old_dev = get_head_device(db, device_id)
|
2557
|
new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
|
2558
|
'comment': comm, 'team_id': old_dev.team_id, 'license_id': old_dev.license_id}
|
2559
|
for key, value in new.items():
|
2560
|
setattr(old_dev, key, value)
|
2561
|
db.commit()
|
2562
|
db.refresh(old_dev)
|
2563
|
return old_dev</code></pre>
|
2564
|
</details>
|
2565
|
</dd>
|
2566
|
<dt id="sql_app.crud.update_headdevice_inv"><code class="name flex">
|
2567
|
<span>def <span class="ident">update_headdevice_inv</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, dev_inv: str)</span>
|
2568
|
</code></dt>
|
2569
|
<dd>
|
2570
|
<div class="desc"><p>Updates head devices inventory number with new one given by user</p></div>
|
2571
|
<details class="source">
|
2572
|
<summary>
|
2573
|
<span>Expand source code</span>
|
2574
|
</summary>
|
2575
|
<pre><code class="python">def update_headdevice_inv(db: Session, device_id: int, dev_inv: str):
|
2576
|
"""
|
2577
|
Updates head devices inventory number with new one given by user
|
2578
|
"""
|
2579
|
old_dev = get_head_device(db, device_id)
|
2580
|
new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': dev_inv,
|
2581
|
'comment': old_dev.comment, 'team_id': old_dev.team_id, 'license_id': old_dev.license_id}
|
2582
|
for key, value in new.items():
|
2583
|
setattr(old_dev, key, value)
|
2584
|
db.commit()
|
2585
|
db.refresh(old_dev)
|
2586
|
return old_dev</code></pre>
|
2587
|
</details>
|
2588
|
</dd>
|
2589
|
<dt id="sql_app.crud.update_headdevice_license"><code class="name flex">
|
2590
|
<span>def <span class="ident">update_headdevice_license</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, lic_id: int)</span>
|
2591
|
</code></dt>
|
2592
|
<dd>
|
2593
|
<div class="desc"><p>Updates head devices license with one given by user</p></div>
|
2594
|
<details class="source">
|
2595
|
<summary>
|
2596
|
<span>Expand source code</span>
|
2597
|
</summary>
|
2598
|
<pre><code class="python">def update_headdevice_license(db: Session, device_id: int, lic_id: int):
|
2599
|
"""
|
2600
|
Updates head devices license with one given by user
|
2601
|
"""
|
2602
|
old_dev = get_head_device(db, device_id)
|
2603
|
lic = get_license(db, lic_id)
|
2604
|
new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
|
2605
|
'comment': old_dev.comment, 'team_id': old_dev.team_id, 'license_id': lic.id}
|
2606
|
for key, value in new.items():
|
2607
|
setattr(old_dev, key, value)
|
2608
|
db.commit()
|
2609
|
db.refresh(old_dev)
|
2610
|
return old_dev</code></pre>
|
2611
|
</details>
|
2612
|
</dd>
|
2613
|
<dt id="sql_app.crud.update_headdevice_team"><code class="name flex">
|
2614
|
<span>def <span class="ident">update_headdevice_team</span></span>(<span>db: sqlalchemy.orm.session.Session, device_id: int, team_id: int)</span>
|
2615
|
</code></dt>
|
2616
|
<dd>
|
2617
|
<div class="desc"><p>Updates head devices team with one given by user</p></div>
|
2618
|
<details class="source">
|
2619
|
<summary>
|
2620
|
<span>Expand source code</span>
|
2621
|
</summary>
|
2622
|
<pre><code class="python">def update_headdevice_team(db: Session, device_id: int, team_id: int):
|
2623
|
"""
|
2624
|
Updates head devices team with one given by user
|
2625
|
"""
|
2626
|
old_dev = get_head_device(db, device_id)
|
2627
|
team = get_team(db, team_id)
|
2628
|
new = {'id': old_dev.id, 'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
|
2629
|
'comment': old_dev.comment, 'team_id': team.id, 'license_id': old_dev.license_id}
|
2630
|
for key, value in new.items():
|
2631
|
setattr(old_dev, key, value)
|
2632
|
db.commit()
|
2633
|
db.refresh(old_dev)
|
2634
|
return old_dev</code></pre>
|
2635
|
</details>
|
2636
|
</dd>
|
2637
|
</dl>
|
2638
|
</section>
|
2639
|
<section>
|
2640
|
</section>
|
2641
|
</article>
|
2642
|
<nav id="sidebar">
|
2643
|
<h1>Index</h1>
|
2644
|
<div class="toc">
|
2645
|
<ul></ul>
|
2646
|
</div>
|
2647
|
<ul id="index">
|
2648
|
<li><h3>Super-module</h3>
|
2649
|
<ul>
|
2650
|
<li><code><a title="sql_app" href="index.html">sql_app</a></code></li>
|
2651
|
</ul>
|
2652
|
</li>
|
2653
|
<li><h3><a href="#header-functions">Functions</a></h3>
|
2654
|
<ul class="">
|
2655
|
<li><code><a title="sql_app.crud.change_role" href="#sql_app.crud.change_role">change_role</a></code></li>
|
2656
|
<li><code><a title="sql_app.crud.change_team" href="#sql_app.crud.change_team">change_team</a></code></li>
|
2657
|
<li><code><a title="sql_app.crud.create_body_device" href="#sql_app.crud.create_body_device">create_body_device</a></code></li>
|
2658
|
<li><code><a title="sql_app.crud.create_device" href="#sql_app.crud.create_device">create_device</a></code></li>
|
2659
|
<li><code><a title="sql_app.crud.create_device_license" href="#sql_app.crud.create_device_license">create_device_license</a></code></li>
|
2660
|
<li><code><a title="sql_app.crud.create_device_logs" href="#sql_app.crud.create_device_logs">create_device_logs</a></code></li>
|
2661
|
<li><code><a title="sql_app.crud.create_head_device" href="#sql_app.crud.create_head_device">create_head_device</a></code></li>
|
2662
|
<li><code><a title="sql_app.crud.create_ld_logs" href="#sql_app.crud.create_ld_logs">create_ld_logs</a></code></li>
|
2663
|
<li><code><a title="sql_app.crud.create_license" href="#sql_app.crud.create_license">create_license</a></code></li>
|
2664
|
<li><code><a title="sql_app.crud.create_pc" href="#sql_app.crud.create_pc">create_pc</a></code></li>
|
2665
|
<li><code><a title="sql_app.crud.create_team" href="#sql_app.crud.create_team">create_team</a></code></li>
|
2666
|
<li><code><a title="sql_app.crud.create_user" href="#sql_app.crud.create_user">create_user</a></code></li>
|
2667
|
<li><code><a title="sql_app.crud.delete_device_license" href="#sql_app.crud.delete_device_license">delete_device_license</a></code></li>
|
2668
|
<li><code><a title="sql_app.crud.find_body_device" href="#sql_app.crud.find_body_device">find_body_device</a></code></li>
|
2669
|
<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>
|
2670
|
<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>
|
2671
|
<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>
|
2672
|
<li><code><a title="sql_app.crud.find_device" href="#sql_app.crud.find_device">find_device</a></code></li>
|
2673
|
<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>
|
2674
|
<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>
|
2675
|
<li><code><a title="sql_app.crud.find_filtered_ldlogs" href="#sql_app.crud.find_filtered_ldlogs">find_filtered_ldlogs</a></code></li>
|
2676
|
<li><code><a title="sql_app.crud.find_filtered_logs" href="#sql_app.crud.find_filtered_logs">find_filtered_logs</a></code></li>
|
2677
|
<li><code><a title="sql_app.crud.find_head_device" href="#sql_app.crud.find_head_device">find_head_device</a></code></li>
|
2678
|
<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>
|
2679
|
<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>
|
2680
|
<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>
|
2681
|
<li><code><a title="sql_app.crud.find_license" href="#sql_app.crud.find_license">find_license</a></code></li>
|
2682
|
<li><code><a title="sql_app.crud.find_pc" href="#sql_app.crud.find_pc">find_pc</a></code></li>
|
2683
|
<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>
|
2684
|
<li><code><a title="sql_app.crud.find_pc_by_name_all" href="#sql_app.crud.find_pc_by_name_all">find_pc_by_name_all</a></code></li>
|
2685
|
<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>
|
2686
|
<li><code><a title="sql_app.crud.find_pcs" href="#sql_app.crud.find_pcs">find_pcs</a></code></li>
|
2687
|
<li><code><a title="sql_app.crud.find_team" href="#sql_app.crud.find_team">find_team</a></code></li>
|
2688
|
<li><code><a title="sql_app.crud.find_user" href="#sql_app.crud.find_user">find_user</a></code></li>
|
2689
|
<li><code><a title="sql_app.crud.find_user_byid" href="#sql_app.crud.find_user_byid">find_user_byid</a></code></li>
|
2690
|
<li><code><a title="sql_app.crud.get_body_device" href="#sql_app.crud.get_body_device">get_body_device</a></code></li>
|
2691
|
<li><code><a title="sql_app.crud.get_body_devices" href="#sql_app.crud.get_body_devices">get_body_devices</a></code></li>
|
2692
|
<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>
|
2693
|
<li><code><a title="sql_app.crud.get_device" href="#sql_app.crud.get_device">get_device</a></code></li>
|
2694
|
<li><code><a title="sql_app.crud.get_device_licenses" href="#sql_app.crud.get_device_licenses">get_device_licenses</a></code></li>
|
2695
|
<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>
|
2696
|
<li><code><a title="sql_app.crud.get_devices" href="#sql_app.crud.get_devices">get_devices</a></code></li>
|
2697
|
<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>
|
2698
|
<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>
|
2699
|
<li><code><a title="sql_app.crud.get_filtered_bodydevices" href="#sql_app.crud.get_filtered_bodydevices">get_filtered_bodydevices</a></code></li>
|
2700
|
<li><code><a title="sql_app.crud.get_filtered_devices" href="#sql_app.crud.get_filtered_devices">get_filtered_devices</a></code></li>
|
2701
|
<li><code><a title="sql_app.crud.get_filtered_headdevices" href="#sql_app.crud.get_filtered_headdevices">get_filtered_headdevices</a></code></li>
|
2702
|
<li><code><a title="sql_app.crud.get_filtered_ldlogs" href="#sql_app.crud.get_filtered_ldlogs">get_filtered_ldlogs</a></code></li>
|
2703
|
<li><code><a title="sql_app.crud.get_filtered_logs" href="#sql_app.crud.get_filtered_logs">get_filtered_logs</a></code></li>
|
2704
|
<li><code><a title="sql_app.crud.get_head_device" href="#sql_app.crud.get_head_device">get_head_device</a></code></li>
|
2705
|
<li><code><a title="sql_app.crud.get_head_devices" href="#sql_app.crud.get_head_devices">get_head_devices</a></code></li>
|
2706
|
<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>
|
2707
|
<li><code><a title="sql_app.crud.get_ld_logs" href="#sql_app.crud.get_ld_logs">get_ld_logs</a></code></li>
|
2708
|
<li><code><a title="sql_app.crud.get_license" href="#sql_app.crud.get_license">get_license</a></code></li>
|
2709
|
<li><code><a title="sql_app.crud.get_license_devices" href="#sql_app.crud.get_license_devices">get_license_devices</a></code></li>
|
2710
|
<li><code><a title="sql_app.crud.get_licenses" href="#sql_app.crud.get_licenses">get_licenses</a></code></li>
|
2711
|
<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>
|
2712
|
<li><code><a title="sql_app.crud.get_log" href="#sql_app.crud.get_log">get_log</a></code></li>
|
2713
|
<li><code><a title="sql_app.crud.get_logs" href="#sql_app.crud.get_logs">get_logs</a></code></li>
|
2714
|
<li><code><a title="sql_app.crud.get_pc" href="#sql_app.crud.get_pc">get_pc</a></code></li>
|
2715
|
<li><code><a title="sql_app.crud.get_pcs" href="#sql_app.crud.get_pcs">get_pcs</a></code></li>
|
2716
|
<li><code><a title="sql_app.crud.get_team" href="#sql_app.crud.get_team">get_team</a></code></li>
|
2717
|
<li><code><a title="sql_app.crud.get_teams" href="#sql_app.crud.get_teams">get_teams</a></code></li>
|
2718
|
<li><code><a title="sql_app.crud.get_users" href="#sql_app.crud.get_users">get_users</a></code></li>
|
2719
|
<li><code><a title="sql_app.crud.update_bodydevice_comm" href="#sql_app.crud.update_bodydevice_comm">update_bodydevice_comm</a></code></li>
|
2720
|
<li><code><a title="sql_app.crud.update_bodydevice_inv" href="#sql_app.crud.update_bodydevice_inv">update_bodydevice_inv</a></code></li>
|
2721
|
<li><code><a title="sql_app.crud.update_bodydevice_license" href="#sql_app.crud.update_bodydevice_license">update_bodydevice_license</a></code></li>
|
2722
|
<li><code><a title="sql_app.crud.update_bodydevice_team" href="#sql_app.crud.update_bodydevice_team">update_bodydevice_team</a></code></li>
|
2723
|
<li><code><a title="sql_app.crud.update_device" href="#sql_app.crud.update_device">update_device</a></code></li>
|
2724
|
<li><code><a title="sql_app.crud.update_device_com" href="#sql_app.crud.update_device_com">update_device_com</a></code></li>
|
2725
|
<li><code><a title="sql_app.crud.update_device_inv" href="#sql_app.crud.update_device_inv">update_device_inv</a></code></li>
|
2726
|
<li><code><a title="sql_app.crud.update_headdevice_comm" href="#sql_app.crud.update_headdevice_comm">update_headdevice_comm</a></code></li>
|
2727
|
<li><code><a title="sql_app.crud.update_headdevice_inv" href="#sql_app.crud.update_headdevice_inv">update_headdevice_inv</a></code></li>
|
2728
|
<li><code><a title="sql_app.crud.update_headdevice_license" href="#sql_app.crud.update_headdevice_license">update_headdevice_license</a></code></li>
|
2729
|
<li><code><a title="sql_app.crud.update_headdevice_team" href="#sql_app.crud.update_headdevice_team">update_headdevice_team</a></code></li>
|
2730
|
</ul>
|
2731
|
</li>
|
2732
|
</ul>
|
2733
|
</nav>
|
2734
|
</main>
|
2735
|
<footer id="footer">
|
2736
|
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
|
2737
|
</footer>
|
2738
|
</body>
|
2739
|
</html>
|