mirror of
https://github.com/norohind/jubilant-system-web.git
synced 2025-07-15 23:51:01 +03:00
Compare commits
2 Commits
236082ba80
...
9dc27157ff
Author | SHA1 | Date | |
---|---|---|---|
9dc27157ff | |||
910d3579df |
@ -99,3 +99,7 @@ class SqliteModel:
|
||||
squad[pretty_key] = squad.pop(key)
|
||||
|
||||
return squads
|
||||
|
||||
def name2tags(self, name: str) -> list[dict]:
|
||||
v = self.get_db().execute(sqlite_sql_requests.name2tags, {'name': name}).fetchall()
|
||||
return v
|
||||
|
@ -43,3 +43,12 @@ from squadrons_current_data
|
||||
where tag like :tag
|
||||
order by platform;
|
||||
"""
|
||||
|
||||
name2tags = """select
|
||||
platform,
|
||||
squad_id,
|
||||
updated as updated_at,
|
||||
name,
|
||||
tag
|
||||
from squadrons_current_data
|
||||
where lower(name) = lower(:name);"""
|
||||
|
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@ -0,0 +1,2 @@
|
||||
falcon
|
||||
loguru
|
16
uwsgi.ini
Normal file
16
uwsgi.ini
Normal file
@ -0,0 +1,16 @@
|
||||
[uwsgi]
|
||||
master = 1
|
||||
vacuum = true
|
||||
socket = 127.0.0.1:8084
|
||||
enable-threads = true
|
||||
die-on-term = true
|
||||
thunder-lock = false
|
||||
threads = 1
|
||||
processes = 4
|
||||
wsgi-file = /home/user2/projects_production/jubilant-system-web/web/__init__.py
|
||||
chdir = /home/user2/projects_production/jubilant-system-web
|
||||
virtualenv = /home/user2/projects_production/jubilant-system-web/venv
|
||||
uid = user2
|
||||
gid = user2
|
||||
need-app = true
|
||||
plugin = python3
|
@ -67,6 +67,11 @@ class SquadsInfoByTag:
|
||||
resp.text = json.dumps(model_answer)
|
||||
|
||||
|
||||
class SquadsName2Tags:
|
||||
def on_get(self, req: falcon.request.Request, resp: falcon.response.Response, name: str):
|
||||
resp.content_type = falcon.MEDIA_JSON
|
||||
resp.text = json.dumps(model.name2tags(name))
|
||||
|
||||
class AppFixedLogging(falcon.App):
|
||||
def _python_error_handler(self, req: falcon.request.Request, resp: falcon.response.Response, error, params):
|
||||
__exception__ = error
|
||||
@ -79,6 +84,7 @@ application.add_route('/squads/now/by-tag/{details_type}/{tag}', SquadsInfoByTag
|
||||
|
||||
application.add_route('/api/squads/now/by-tag/{details_type}/{tag}', SquadsInfoByTag(is_pattern=False))
|
||||
application.add_route('/api/squads/now/search/by-tag/{details_type}/{tag}', SquadsInfoByTag(is_pattern=True))
|
||||
application.add_route('/api/squads/now/by-name/{name}', SquadsName2Tags())
|
||||
|
||||
if __name__ == '__main__':
|
||||
import waitress
|
||||
|
Loading…
x
Reference in New Issue
Block a user