-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #283 from Wizarrrr/v3-beta
V3 beta
- Loading branch information
Showing
46 changed files
with
10,216 additions
and
28,543 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
apps/wizarr-backend/wizarr_backend/app/migrator/migrations/2023-10-28_19-21-23.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# | ||
# CREATED ON VERSION: V3.4.2 | ||
# MIGRATION: 2023-10-28_19-21-23 | ||
# CREATED: Sat Oct 28 2023 | ||
# | ||
|
||
from peewee import * | ||
from playhouse.migrate import * | ||
|
||
from app import db | ||
|
||
# Do not change the name of this file, | ||
# migrations are run in order of their filenames date and time | ||
|
||
def run(): | ||
# Use migrator to perform actions on the database | ||
migrator = SqliteMigrator(db) | ||
|
||
# Add columns name server_id to requests table | ||
with db.transaction(): | ||
# Check if the column exists | ||
cursor = db.cursor() | ||
cursor.execute("PRAGMA table_info(requests);") | ||
columns = cursor.fetchall() | ||
column_names = [column[1] for column in columns] | ||
|
||
if 'name' not in column_names: | ||
db.execute_sql("ALTER TABLE requests ADD COLUMN name TEXT") | ||
else: | ||
print("Column name already exists") | ||
|
||
if 'server_id' not in column_names: | ||
db.execute_sql("ALTER TABLE requests ADD COLUMN server_id TEXT DEFAULT 0") | ||
else: | ||
print("Column server_id already exists") | ||
|
||
|
||
print("Migration 2023-10-28_19-21-23 complete") |
32 changes: 32 additions & 0 deletions
32
apps/wizarr-backend/wizarr_backend/app/migrator/migrations/2023-10-29_16-35-41.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# | ||
# CREATED ON VERSION: V3.4.2 | ||
# MIGRATION: 2023-10-29_16-35-41 | ||
# CREATED: Sun Oct 29 2023 | ||
# | ||
|
||
from peewee import * | ||
from playhouse.migrate import * | ||
|
||
from app import db | ||
|
||
# Do not change the name of this file, | ||
# migrations are run in order of their filenames date and time | ||
|
||
def run(): | ||
# Use migrator to perform actions on the database | ||
migrator = SqliteMigrator(db) | ||
|
||
# Add columns auth to users table | ||
with db.transaction(): | ||
# Check if the column exists | ||
cursor = db.cursor() | ||
cursor.execute("PRAGMA table_info(users);") | ||
columns = cursor.fetchall() | ||
column_names = [column[1] for column in columns] | ||
|
||
if 'auth' not in column_names: | ||
db.execute_sql("ALTER TABLE users ADD COLUMN auth TEXT") | ||
else: | ||
print("Column auth already exists") | ||
|
||
print("Migration 2023-10-29_16-35-41 complete") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from app.models.database import Requests | ||
from playhouse.shortcuts import model_to_dict | ||
from json import loads, dumps | ||
|
||
def get_requests(disallowed: list[str] = None): | ||
# Get all requests from the database | ||
requests = list(Requests.select().dicts()) | ||
|
||
# Remove disallowed requests keys | ||
if disallowed is not None: | ||
for request in requests: | ||
for key in disallowed: | ||
del request[key] | ||
|
||
# Return the requests | ||
return loads(dumps(requests, indent=4, sort_keys=True, default=str)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.