Compare commits
2 commits
9959c7dec2
...
9f58682689
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f58682689 | ||
|
|
e88387453a |
1 changed files with 8 additions and 3 deletions
11
web/api.py
11
web/api.py
|
|
@ -7,6 +7,7 @@ import glob as _glob
|
||||||
import logging
|
import logging
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import shutil
|
import shutil
|
||||||
|
import sqlite3
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
@ -445,9 +446,13 @@ def create_project_link(body: ProjectLinkCreate):
|
||||||
if not models.get_project(conn, body.to_project):
|
if not models.get_project(conn, body.to_project):
|
||||||
conn.close()
|
conn.close()
|
||||||
raise HTTPException(404, f"Project '{body.to_project}' not found")
|
raise HTTPException(404, f"Project '{body.to_project}' not found")
|
||||||
link = models.create_project_link(
|
try:
|
||||||
conn, body.from_project, body.to_project, body.type, body.description
|
link = models.create_project_link(
|
||||||
)
|
conn, body.from_project, body.to_project, body.type, body.description
|
||||||
|
)
|
||||||
|
except sqlite3.IntegrityError:
|
||||||
|
conn.close()
|
||||||
|
raise HTTPException(409, "Link already exists")
|
||||||
conn.close()
|
conn.close()
|
||||||
return link
|
return link
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue