Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/Thorfusion/solder.py into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
sebkuip committed Sep 3, 2024
2 parents 6cfdcba + eb33009 commit f6a4290
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 39 deletions.
20 changes: 10 additions & 10 deletions models/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ def new(cls, modpack_id, version, minecraft, is_published, private, min_java, mi
conn.commit()
cls(id, modpack_id, version, now, now, minecraft, "0", is_published, private, min_java, min_memory, "0")

@classmethod
def delete_build(cls, id):
@staticmethod
def delete_build(id):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
cur.execute("DELETE FROM build_modversion WHERE build_id = %s", (id,))
cur.execute("DELETE FROM builds WHERE id=%s", (id,))
conn.commit()
return None

@classmethod
def update(cls, id, version, minecraft, is_published, private, min_java, min_memory):
@staticmethod
def update(id, version, minecraft, is_published, private, min_java, min_memory):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
now = datetime.datetime.now()
Expand All @@ -60,25 +60,25 @@ def update(cls, id, version, minecraft, is_published, private, min_java, min_mem
conn.commit()
return None

@classmethod
def update_checkbox(cls, id, value, column, table):
@staticmethod
def update_checkbox(id, value, column, table):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
cur.execute("UPDATE {} SET {} = %s WHERE id = %s".format(table, column), (value, id))
conn.commit()
return None

@classmethod
def update_checkbox_marked(cls, id, value):
@staticmethod
def update_checkbox_marked(id, value):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
cur.execute("UPDATE builds SET marked = '0'")
cur.execute("UPDATE builds SET marked = %s WHERE id = %s", (value, id))
conn.commit()
return None

@classmethod
def get_modpackname_by_id(cls, id):
@staticmethod
def get_modpackname_by_id(id):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
cur.execute("SELECT modpack_id FROM builds WHERE id = %s", (id,))
Expand Down
8 changes: 4 additions & 4 deletions models/build_modversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ def __init__(self, id, modversion_id, build_id, created_at, updated_at, optional
self.updated_at = updated_at
self.optional = optional

@classmethod
def delete_build_modversion(cls, id):
@staticmethod
def delete_build_modversion(id):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
cur.execute("DELETE FROM build_modversion WHERE id = %s", (id,))
conn.commit()
return None

@classmethod
def update_optional(cls, modversion_id, optional, build_id):
@staticmethod
def update_optional(modversion_id, optional, build_id):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
cur.execute("""UPDATE build_modversion
Expand Down
4 changes: 2 additions & 2 deletions models/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def new(cls, name, uuid):
id = cur.fetchone()["id"]
return cls(id, name, uuid, now, now)

@classmethod
def delete_client(cls, id):
@staticmethod
def delete_client(id):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
cur.execute("DELETE FROM clients WHERE id=%s", (id,))
Expand Down
4 changes: 2 additions & 2 deletions models/client_modpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def new(cls, client_id, modpack_id):
id = cur.fetchone()["id"]
return cls(id, client_id, modpack_id, now, now, "", "")

@classmethod
def delete_client_modpack(cls, id):
@staticmethod
def delete_client_modpack(id):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
cur.execute("DELETE FROM client_modpack WHERE id=%s", (id,))
Expand Down
8 changes: 4 additions & 4 deletions models/mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def new(cls, name, description, author, link, pretty_name, side, modtype, note):
id = cur.fetchone()["id"]
return cls(id, name, description, author, link, now, now, pretty_name, side, modtype, note)

@classmethod
def update(cls, id, name, description, author, link, pretty_name, side, modtype, note):
@staticmethod
def update(id, name, description, author, link, pretty_name, side, modtype, note):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
now = datetime.datetime.now()
Expand All @@ -42,8 +42,8 @@ def update(cls, id, name, description, author, link, pretty_name, side, modtype,
id = cur.fetchone()["id"]
return None

@classmethod
def delete_mod(cls, id):
@staticmethod
def delete_mod(id):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
cur.execute("SELECT * FROM modversions WHERE mod_id = %s", (id,))
Expand Down
16 changes: 8 additions & 8 deletions models/modversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def new(cls, mod_id, version, mcversion, md5, filesize, markedbuild, url="0", ja
Modversion.update_modversion_jarmd5(id, jarmd5)
return cls(id, mod_id, version, mcversion, md5, now, now, filesize)

@classmethod
def add_modversion_to_selected_build(cls, modver_id, mod_id, build_id, marked, optional):
@staticmethod
def add_modversion_to_selected_build(modver_id, mod_id, build_id, marked, optional):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
if marked == "1":
Expand Down Expand Up @@ -71,24 +71,24 @@ def add_modversion_to_selected_build(cls, modver_id, mod_id, build_id, marked, o
conn.commit()
return None

@classmethod
def update_modversion_in_build(cls, oldmodver_id, modver_id, build_id):
@staticmethod
def update_modversion_in_build(oldmodver_id, modver_id, build_id):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
cur.execute("UPDATE build_modversion SET modversion_id = %s WHERE modversion_id = %s AND build_id = %s", (modver_id, oldmodver_id, build_id))
conn.commit()
return None

@classmethod
def update_modversion_jarmd5(cls, id, jarmd5):
@staticmethod
def update_modversion_jarmd5(id, jarmd5):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
cur.execute("UPDATE modversions SET jarmd5 = %s WHERE id = %s", (jarmd5, id))
conn.commit()
return None

@classmethod
def delete_modversion(cls, id):
@staticmethod
def delete_modversion(id):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
cur.execute("DELETE FROM modversions WHERE id=%s", (id,))
Expand Down
12 changes: 6 additions & 6 deletions models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def new(cls, username, email, hash1, ip, creator_id):
conn.commit()
return cls(id, username, email, password, ip, ip, now, now, ip, creator_id, creator_id)

@classmethod
def change(cls, userid, hash1, ip, creator_id):
@staticmethod
def change(userid, hash1, ip, creator_id):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
now = datetime.datetime.now()
Expand All @@ -53,8 +53,8 @@ def change(cls, userid, hash1, ip, creator_id):
conn.commit()
return None

@classmethod
def delete(cls, id):
@staticmethod
def delete(id):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
cur.execute("DELETE FROM users WHERE id=%s", (id,))
Expand Down Expand Up @@ -82,8 +82,8 @@ def get_by_username(cls, username):
return cls(row["id"], row["username"], row["email"], row["password"], row["created_ip"], row["last_ip"], row["created_at"], row["updated_at"], row["updated_by_ip"], row["created_by_user_id"], row["updated_by_user_id"])
return None

@classmethod
def get_userid(cls, username):
@staticmethod
def get_userid(username):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
cur.execute("SELECT id FROM users WHERE username = %s", (username,))
Expand Down
4 changes: 2 additions & 2 deletions models/user_modpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def new(cls, user_id, modpack_id):
id = cur.fetchone()["id"]
return cls(id, user_id, modpack_id, now, now)

@classmethod
def delete_user_modpack(cls, id):
@staticmethod
def delete_user_modpack(id):
conn = Database.get_connection()
cur = conn.cursor(dictionary=True)
cur.execute("DELETE FROM user_modpack WHERE id=%s", (id,))
Expand Down
2 changes: 1 addition & 1 deletion templates/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<form method="post" action="" enctype="multipart/form-data">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="1" id="solder_full" name="solder_full" {% if user_perms.solder_full==1 %}checked{% endif %}>
<label class="form-check-label" for="private">Full solder access</label>
<label class="form-check-label" for="private">Full Solder Access</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="1" id="solder_users" name="solder_users" {% if user_perms.solder_users==1 %}checked{% endif %}>
Expand Down

0 comments on commit f6a4290

Please sign in to comment.