Revize eaf8ace4
Přidáno uživatelem Matěj Zeman před asi 2 roky(ů)
server/sql_app/api/usb_logs.py | ||
---|---|---|
32 | 32 |
print(crud.create_device_logs(db=db, item=log, dev_id=dev.id, pc_id=pc.id, date=dat)) |
33 | 33 |
|
34 | 34 |
|
35 |
@usblogs.post("/ld-logs", response_model=schemas.LDLog) |
|
36 |
def create_ld_logs(log: schemas.LDTempBase, db: Session = Depends(get_db)): |
|
37 |
head_dev = crud.find_head_device(db, log.head_device) |
|
38 |
body_dev = crud.find_body_device(db, log.body_device) |
|
39 |
if head_dev is None: |
|
40 |
crud.create_head_device(db, log.head_device) |
|
41 |
if body_dev is None: |
|
42 |
crud.create_body_device(db, log.body_device) |
|
43 |
|
|
44 |
pc = crud.find_pc(db, log.username, log.hostname) |
|
45 |
if pc is None: |
|
46 |
pc = crud.create_pc(db=db, user=log.username, host=log.hostname) |
|
47 |
dat = datetime.strptime(log.timestamp, '%Y-%m-%d %H:%M:%S') |
|
48 |
print(crud.create_ld_logs(db=db, item=log, head_id=head_dev.id, body_id=body_dev.id, pc_id=pc.id, date=dat)) |
|
49 |
|
|
50 |
|
|
35 | 51 |
@usblogs.get("/logs", response_model=List[schemas.USBLog]) |
36 | 52 |
def read_logs(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)): |
37 | 53 |
items = crud.get_logs(db, skip=skip, limit=limit) |
Také k dispozici: Unified diff
Added functionality for creating licenses and teams and connecting them to devices a PCs.