Skip to content

Commit

Permalink
Minor updates, and schema done
Browse files Browse the repository at this point in the history
  • Loading branch information
Stibreant committed Jun 4, 2021
1 parent bfb09cf commit 8ac98e5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
8 changes: 1 addition & 7 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

app = Flask(__name__)
DATABASE = './database.db'
app.secret_key = 'some_secret'
app.secret_key = 'zH2l72&X#Ho^5iWnc7@#nbdmHK63XmG1'

app.config.update(
SESSION_COOKIE_SECURE=True,
Expand Down Expand Up @@ -286,7 +286,6 @@ def serve(userid):
result[i]["updated"] = row[5]
result[i]["description"] = row[6]
result[i]["link"] = row[8]
result[i]["private"] = row[9]

return json.dumps(result)

Expand Down Expand Up @@ -334,7 +333,6 @@ def feed():
result[i]["updated"] = row[5]
result[i]["description"] = row[6]
result[i]["link"] = row[8]
result[i]["private"] = row[9]

return json.dumps(result)

Expand All @@ -354,8 +352,6 @@ def project(projectid):
result["updated"] = row[5]
result["description"] = row[6]
result["link"] = row[8]
result["private"] = row[9]

return json.dumps(result)

row = query_db("SELECT * FROM projects WHERE id = ?;", get_db(), projectid, one=True)
Expand All @@ -370,7 +366,6 @@ def project(projectid):
result["updated"] = row[4]
result["description"] = row[5]
result["link"] = row[7]
result["private"] = row[8]
else:
result["errors"] = ["Permission denied"]
return json.dumps(result)
Expand All @@ -395,7 +390,6 @@ def project(projectid):
project["updated"] = row[4]
project["description"] = row[5]
project["link"] = row[7]
project["private"] = row[8]

result["errors"] = errors
result["project"] = project
Expand Down
4 changes: 2 additions & 2 deletions schema.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
DROP TABLE IF EXISTS posts;
DROP TABLE IF EXISTS follows;
DROP TABLE IF EXISTS projects;
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS follows;
DROP TABLE IF EXISTS posts;

CREATE TABLE users(
id INTEGER,
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def db_update(username):
tmp["description"] = repo["description"]
tmp["website"] = repo["html_url"]
tmp["link"] = repo["html_url"]
tmp["private"] = repo["private"]
tmp["githubid"] = repo["id"]
result_list.append(tmp)
except:
Expand All @@ -66,8 +65,8 @@ def update_insert(repos, userid):
for repo in repos:
if repo["githubid"] not in oldIDs[0]:

sql = f"INSERT INTO projects (userid, githubid ,name, created, updated, description, website, link, private) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?);"
query_db(sql, get_db(), userid, repo["githubid"], repo["name"], repo["created"], repo["updated"], repo["description"] ,repo["website"] ,repo["link"],repo["private"])
sql = f"INSERT INTO projects (userid, githubid ,name, created, updated, description, website, link) VALUES(?, ?, ?, ?, ?, ?, ?, ?);"
query_db(sql, get_db(), userid, repo["githubid"], repo["name"], repo["created"], repo["updated"], repo["description"] ,repo["website"] ,repo["link"])

id = query_db("SELECT MAX(ID) FROM Projects", get_db(), one=True)[0]

Expand Down

0 comments on commit 8ac98e5

Please sign in to comment.