Skip to content

Commit 2cbb98f

Browse files
committed
Remove API 0.2
1 parent 524cce8 commit 2cbb98f

File tree

4 files changed

+1
-153
lines changed

4 files changed

+1
-153
lines changed

apache-site

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
# RewriteCond %{REQUEST_URI} !/maintenance.html$
129129
# RewriteRule !^maintenance.html$ maintenance.html [R=302,L]
130130

131-
RewriteRule "^(/api/0.2/.*)" "/en$1" [PT]
132131
RewriteRule "^/([a-z_]+)(/api/0\.3/.*)" "$2?%{QUERY_STRING}&langs=$1" [PT]
133132
RewriteRule "^/([a-z_]+)/error/(.*)" "/$1/issue/$2?%{QUERY_STRING}" [R,L]
134133
RewriteRule "^/([a-z_]+)/errors/done(.*)" "/$1/issues/done$2" [R,L]

api/app.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
openapi_tags = [
1212
{
13-
"name": "0.2",
14-
"description": "The 0.2 part of the API is deprecated.",
13+
"name": "0.3",
1514
},
1615
]
1716

api/issue.py

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,6 @@
1919
Status = Literal["done", "false"]
2020

2121

22-
async def _remove_bug_err_id(db: Connection, error_id: int, status: Status) -> int:
23-
# find source
24-
source_id = None
25-
sql = "SELECT uuid,source_id,class FROM markers WHERE uuid_to_bigint(uuid) = $1"
26-
for res in await db.fetch(sql, error_id):
27-
uuid = res["uuid"]
28-
source_id = res["source_id"]
29-
class_id = res["class"]
30-
31-
if not source_id:
32-
return -1
33-
34-
async with db.transaction():
35-
await db.execute("DELETE FROM markers_status WHERE uuid=$1", uuid)
36-
37-
await db.execute(
38-
"""INSERT INTO markers_status
39-
(source_id,item,class,elems,date,status,lat,lon,subtitle,uuid)
40-
SELECT source_id,item,class,elems,NOW(),$1,
41-
lat,lon,subtitle,uuid
42-
FROM markers
43-
WHERE uuid = $2
44-
ON CONFLICT DO NOTHING""",
45-
status,
46-
uuid,
47-
)
48-
49-
await db.execute("DELETE FROM markers WHERE uuid = $1", uuid)
50-
await db.execute(
51-
"UPDATE markers_counts SET count = count - 1 WHERE source_id = $1 AND class = $2",
52-
source_id,
53-
class_id,
54-
)
55-
56-
return 0
57-
58-
5922
async def _remove_bug_uuid(db: Connection, uuid: UUID, status: Status) -> int:
6023
# find source
6124
source_id = None
@@ -162,19 +125,6 @@ def expand_tags(tags):
162125
return ret
163126

164127

165-
@router.get("/0.2/error/{err_id}", tags=["0.2"])
166-
async def error_err_id(
167-
err_id: int, db: Connection = Depends(database.db)
168-
) -> Dict[str, Any]:
169-
return _error(
170-
2,
171-
db,
172-
["en"],
173-
None,
174-
await _get(db, err_id=err_id),
175-
)
176-
177-
178128
@router.get("/0.3/issue/{uuid}", tags=["issues"])
179129
async def error_uuid(
180130
uuid: UUID,
@@ -297,19 +247,6 @@ def _error(
297247
}
298248

299249

300-
@router.get("/0.2/error/{err_id}/{status}", tags=["0.2"])
301-
async def status_err_id(
302-
request: Request,
303-
err_id: int,
304-
status: Status,
305-
db: Connection = Depends(database.db_rw),
306-
) -> None:
307-
if await _remove_bug_err_id(db, err_id, status) == 0:
308-
return None
309-
else:
310-
raise HTTPException(status_code=410, detail="FAIL")
311-
312-
313250
@router.get("/0.3/issue/{uuid}/{status}", tags=["issues"])
314251
async def status_uuid(
315252
request: Request,

api/issues.py

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import json
2-
from collections import OrderedDict
32
from itertools import groupby
43
from typing import Any, Dict, List, Literal, Tuple
54

@@ -51,92 +50,6 @@ def render(self, content: Any) -> bytes:
5150
)
5251

5352

54-
@router.get("/0.2/errors", tags=["0.2"])
55-
async def errors(
56-
request: Request,
57-
db: Connection = Depends(database.db),
58-
params=Depends(commons_params.params),
59-
) -> Dict[str, Any]:
60-
results = await query._gets(db, params)
61-
out: Dict[str, Any] = OrderedDict()
62-
63-
if not params.full:
64-
out["description"] = ["lat", "lon", "error_id", "item"]
65-
else:
66-
out["description"] = [
67-
"lat",
68-
"lon",
69-
"error_id",
70-
"item",
71-
"source",
72-
"class",
73-
"elems",
74-
"subclass",
75-
"subtitle",
76-
"title",
77-
"level",
78-
"update",
79-
"username",
80-
]
81-
out["errors"] = []
82-
83-
for res in results:
84-
lat = res["lat"]
85-
lon = res["lon"]
86-
error_id = res["id"]
87-
item = res["item"] or 0
88-
89-
if not params.full:
90-
out["errors"].append([str(lat), str(lon), str(error_id), str(item)])
91-
else:
92-
source = res["source_id"]
93-
classs = res["class"]
94-
elems = "_".join(
95-
map(
96-
lambda elem: {"N": "node", "W": "way", "R": "relation"}[
97-
elem["type"]
98-
]
99-
+ str(elem["id"]),
100-
res["elems"] or [],
101-
)
102-
)
103-
subclass = 0
104-
105-
subtitle_auto = utils.i10n_select(res["subtitle"], ["en"])
106-
subtitle = subtitle_auto and subtitle_auto["auto"] or ""
107-
108-
title_auto = utils.i10n_select(res["title"], ["en"])
109-
title = title_auto and title_auto["auto"] or ""
110-
111-
level = res["level"]
112-
update = res["timestamp"]
113-
username = ",".join(
114-
map(
115-
lambda elem: "username" in elem and elem["username"] or "",
116-
res["elems"] or [],
117-
)
118-
)
119-
out["errors"].append(
120-
[
121-
str(lat),
122-
str(lon),
123-
str(error_id),
124-
str(item),
125-
str(source),
126-
str(classs),
127-
str(elems),
128-
str(subclass),
129-
subtitle,
130-
title,
131-
str(level),
132-
str(update),
133-
username,
134-
]
135-
)
136-
137-
return out
138-
139-
14053
@router.get("/0.3/issues", tags=["issues"])
14154
@router.get("/0.3/issues.json", tags=["issues"])
14255
async def issues(

0 commit comments

Comments
 (0)