Compare commits
5 Commits
fastapi-mi
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d686b26465 | ||
|
|
08e979ecb2 | ||
|
|
72f1d53051 | ||
|
|
b1e0693131 | ||
|
|
f108e013c2 |
28
.gitignore
vendored
28
.gitignore
vendored
@@ -1,11 +1,21 @@
|
||||
*.csv
|
||||
.vscode
|
||||
instance
|
||||
venv/
|
||||
123
|
||||
*.csv
|
||||
*.db
|
||||
c*.txt
|
||||
migrations
|
||||
__pycache__
|
||||
.idea
|
||||
venv/
|
||||
instance/
|
||||
|
||||
# Ignore Python bytecode caches everywhere
|
||||
__pycache__/
|
||||
**/__pycache__/
|
||||
|
||||
# Migrations and DB files
|
||||
migrations/
|
||||
*.db
|
||||
|
||||
# Data and temp files
|
||||
*.csv
|
||||
c*.txt
|
||||
|
||||
# Legacy specific ignores (if present)
|
||||
backend/venv
|
||||
backend/__pycache__
|
||||
backend/routeres/__pycache__
|
||||
|
||||
2
backend/__init__.py
Normal file
2
backend/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
"""Backend package initializer."""
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# backend/main.py
|
||||
from fastapi import FastAPI
|
||||
from fastapi.responses import RedirectResponse
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
from backend.routers.equipment_types import equipment_types
|
||||
@@ -28,6 +29,11 @@ def ping():
|
||||
return {"message": "pong"}
|
||||
|
||||
|
||||
@app.get("/")
|
||||
def root():
|
||||
return RedirectResponse(url="/docs")
|
||||
|
||||
|
||||
# Подключение роутов
|
||||
app.include_router(equipment_types)
|
||||
app.include_router(auditories)
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
|
||||
from sqlalchemy.orm import relationship, declarative_base
|
||||
import datetime
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
db = SQLAlchemy()
|
||||
|
||||
|
||||
|
||||
|
||||
2
backend/routers/__init__.py
Normal file
2
backend/routers/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
"""Routers package initializer."""
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from typing import Optional
|
||||
from sqlalchemy.orm import Session
|
||||
from .. import models, schemas, database
|
||||
|
||||
@@ -13,8 +14,11 @@ def create_oborud(item: schemas.OborudCreate, db: Session = Depends(database.get
|
||||
return obj
|
||||
|
||||
@oboruds.get("/", response_model=list[schemas.OborudRead])
|
||||
def list_oboruds(db: Session = Depends(database.get_db)):
|
||||
return db.query(models.Oboruds).all()
|
||||
def list_oboruds(aud_id: Optional[int] = None, db: Session = Depends(database.get_db)):
|
||||
query = db.query(models.Oboruds)
|
||||
if aud_id is not None:
|
||||
query = query.filter(models.Oboruds.aud_id == aud_id)
|
||||
return query.all()
|
||||
|
||||
@oboruds.get("/{oborud_id}", response_model=schemas.OborudRead)
|
||||
def get_oborud(oborud_id: int, db: Session = Depends(database.get_db)):
|
||||
|
||||
24
requirements.txt
Normal file
24
requirements.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
# FastAPI backend
|
||||
annotated-types==0.7.0
|
||||
anyio==4.9.0
|
||||
click==8.2.1
|
||||
colorama==0.4.6
|
||||
fastapi==0.116.1
|
||||
greenlet==3.2.3
|
||||
h11==0.16.0
|
||||
idna==3.10
|
||||
pydantic==2.11.7
|
||||
pydantic_core==2.33.2
|
||||
sniffio==1.3.1
|
||||
SQLAlchemy==2.0.42
|
||||
starlette==0.47.2
|
||||
typing-inspection==0.4.1
|
||||
typing_extensions==4.14.1
|
||||
uvicorn==0.35.0
|
||||
|
||||
# Flask app
|
||||
Flask==3.0.3
|
||||
Flask-Migrate==4.0.7
|
||||
Flask-SQLAlchemy==3.1.1
|
||||
waitress==3.0.2
|
||||
|
||||
147
templates/all_OLD.html
Normal file
147
templates/all_OLD.html
Normal file
@@ -0,0 +1,147 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="getmodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body" id="textarea">
|
||||
|
||||
<div class="row">
|
||||
<a id="modal_invnom"> </a><a id="modal_matcenn"></a>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
№ из ведомости
|
||||
<input type="text" class="form-control" id ='modal_vednumber' placeholder="Номер из ведомости">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
Количество
|
||||
<input type="text" class="form-control" id ='modal_kolvo' placeholder="Количество">
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
Балансовый счёт
|
||||
<input type="text" class="form-control" id ='modal_balance' placeholder="Балансовый счёт">
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
Расположение
|
||||
<input type="text" class="form-control" id ='modal_rapolog' placeholder="Введите расположение">
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modalclose">Закрыть</button>
|
||||
<button type="button" class="btn btn-primary" id="modalsavetodb" >Сохранить изменения</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Modal2 -->
|
||||
<div class="modal fade" id="addmodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body" id="textarea">
|
||||
|
||||
<div class="row">
|
||||
<a id="modal_invnom"> </a><a id="modal2_matcenn"></a>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
№ из ведомости
|
||||
<input type="text" class="form-control" id ='modal2_vednumber' placeholder="Номер из ведомости">
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
Инвентарный номер
|
||||
<input type="text" class="form-control" id ='modal2_invnom' placeholder="Инвентарный номер">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
Название
|
||||
<input type="text" class="form-control" id ='modal2_nazvanie' placeholder="Название">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
Количество
|
||||
<input type="text" class="form-control" id ='modal2_kolvo' placeholder="Количество">
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
Балансовый счёт
|
||||
<input type="text" class="form-control" id ='modal2_balance' placeholder="Балансовый счёт">
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
Расположение
|
||||
<input type="text" class="form-control" id ='modal2_rapolog' placeholder="Введите расположение">
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modal2close">Закрыть</button>
|
||||
<button type="button" class="btn btn-primary" id="modal2savetodb" >Сохранить изменения</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<h3 id ='123' class=" no-print"> Все мат. ценности </h3>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row col-12">
|
||||
<button class="button" id="printallbutton"> Печать </button>
|
||||
</div>
|
||||
|
||||
<div class="row col-12">
|
||||
<button class="button" id="addoborud"> Добавить </button>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="card col-md-11 table-responsive">
|
||||
<table id="alldatatable" class="alldatable table pagebreak" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">№ <br>п/п <br>АСУ</th>
|
||||
<th scope="col">№ п/п <br>вед</th>
|
||||
<th scope="col">Инв. номер</th>
|
||||
<th scope="col">Название</th>
|
||||
<th scope="col">Кол-во</th>
|
||||
<th scope="col">Счёт</th>
|
||||
<th scope="col">Ауд - я</th>
|
||||
<th scope="col">Расположение</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script src="{{url_for('static', filename='js/allmatc.js') }}"></script>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user