Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The API update #77

Merged
merged 59 commits into from
May 7, 2023
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
ff00d4a
Database model change
Tech-TTGames Apr 21, 2023
a9b0fe5
Missing boilerplate
Tech-TTGames Apr 21, 2023
1bcf2dc
tornado added
Tech-TTGames Apr 21, 2023
f2e09b1
prepped databse access and edits
Tech-TTGames Apr 21, 2023
2cc28f8
TicketType .default()
Tech-TTGames Apr 21, 2023
051eee8
API, derived tikcet creation function
Tech-TTGames Apr 21, 2023
116900a
yapf n fix
Tech-TTGames Apr 21, 2023
432c730
Migration
Tech-TTGames Apr 21, 2023
c2cf618
ssl configs
Tech-TTGames Apr 21, 2023
59cfc87
old code
Tech-TTGames Apr 21, 2023
ab05fcd
API
Tech-TTGames Apr 21, 2023
7e92bdd
lintskip
Tech-TTGames Apr 21, 2023
e0f4255
Docs, packgage mapping
Tech-TTGames Apr 21, 2023
4006e3e
Docs db
Tech-TTGames Apr 21, 2023
4e87421
actually save the user to db
Tech-TTGames Apr 21, 2023
80efc00
annotate better
Tech-TTGames Apr 21, 2023
1600f84
Create .restyled.yml
Tech-TTGames Apr 21, 2023
5d2a217
Update and rename .github/.github/.restyled.yml to .github/.restyled.yml
Tech-TTGames Apr 21, 2023
4f6e233
Update .restyled.yml
Tech-TTGames Apr 21, 2023
37b19ab
Update .restyled.yml
Tech-TTGames Apr 21, 2023
0d8d97f
Rename .restyled.yml to restyled.yml
Tech-TTGames Apr 21, 2023
d526cc3
Update restyled.yml
Tech-TTGames Apr 21, 2023
bf2300e
Update restyled.yml
Tech-TTGames Apr 21, 2023
5ac7409
Update restyled.yml
Tech-TTGames Apr 21, 2023
87c2b92
spacing
Tech-TTGames Apr 21, 2023
7eeef55
Merge branch 'v0.1.1.0' of github.com:Tech-TTGames/Tickets-Plus into …
Tech-TTGames Apr 21, 2023
95bb00e
possibly conflict solve
Tech-TTGames Apr 21, 2023
1c5b699
no comments in the middle of imports
Tech-TTGames Apr 21, 2023
3834525
Bump aiosqlite from 0.18.0 to 0.19.0 (#76)
dependabot[bot] Apr 21, 2023
e895bb1
Merge branch 'main' into v0.1.1.0
Tech-TTGames Apr 21, 2023
c3695f6
Uncycled import
Tech-TTGames Apr 21, 2023
acb567d
Merge branch 'v0.1.1.0' of github.com:Tech-TTGames/Tickets-Plus into …
Tech-TTGames Apr 21, 2023
b5c1eda
cleanup
Tech-TTGames Apr 21, 2023
21a88ad
Update restyled.yml
Tech-TTGames Apr 21, 2023
8d9c6d8
Made some use of the user object when possible.
Tech-TTGames Apr 21, 2023
1e8dfe5
Merge branch 'v0.1.1.0' of github.com:Tech-TTGames/Tickets-Plus into …
Tech-TTGames Apr 21, 2023
7f6f6c0
Restyle The API update (#81)
restyled-io[bot] Apr 21, 2023
87cd9e7
Update alembic setup
Tech-TTGames Apr 23, 2023
681c441
Add AC warning, convert AC-s to intervals
Tech-TTGames Apr 23, 2023
f204e92
Closes #40
Tech-TTGames Apr 23, 2023
7ee2fd0
pep complains
Tech-TTGames Apr 23, 2023
2b3688b
Restyle The API update (#82)
restyled-io[bot] Apr 23, 2023
4026234
Stuff and stuff
Tech-TTGames Apr 23, 2023
555f0a7
formatting..........[
Tech-TTGames Apr 23, 2023
9798234
Don't create ticekt on new channel if integrated
Tech-TTGames Apr 23, 2023
6b2bb13
Poetry ver bump. Cleanup
Tech-TTGames Apr 23, 2023
3915040
Config Consistency
Tech-TTGames May 1, 2023
cb02a16
Admin perms with more specific perms also
Tech-TTGames May 1, 2023
c813385
Restyle The API update (#90)
restyled-io[bot] May 1, 2023
5607449
Better data:tm:
Tech-TTGames May 4, 2023
18e54fd
Togglable API (don't switch around it's just a SKIP)
Tech-TTGames May 4, 2023
9eeeebe
Merge branch 'v0.1.1.0' of github.com:Tech-TTGames/Tickets-Plus into …
Tech-TTGames May 4, 2023
df9df55
*smh* Markdown
Tech-TTGames May 4, 2023
cd63c52
Restyle The API update (#91)
restyled-io[bot] May 4, 2023
af8b17b
Actually run user notifications.
Tech-TTGames May 6, 2023
ff66c8c
Split statvars.py -> config.py and const.py
Tech-TTGames May 6, 2023
a6bf1c5
Merge branches 'v0.1.1.0' and 'v0.1.1.0' of github.com:Tech-TTGames/T…
Tech-TTGames May 6, 2023
ab2def1
Nopep8 on legacy imports
Tech-TTGames May 6, 2023
7a7a040
Restyle The API update (#92)
restyled-io[bot] May 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/restyled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
enabled: true
also_exclude:
- "alembic/**/*"

request_review: author
labels:
- "Type: Style"
- "Priority: 3"

restylers:
- jq:
enabled: false
- reorder-python-imports:
enabled: false
- black:
enabled: false
- isort:
enabled: true
- prettier-json:
enabled: true
- "*"
- yapf:
arguments: ["--style pyproject.toml"]
2 changes: 2 additions & 0 deletions alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def run_migrations_offline() -> None:
dialect_opts={"paramstyle": "named"},
include_schemas=True,
compare_server_default=True,
compare_type=True,
)

with context.begin_transaction():
Expand All @@ -62,6 +63,7 @@ def do_run_migrations(connection: Connection) -> None:
target_metadata=target_metadata,
include_schemas=True,
compare_server_default=True,
compare_type=True,
)

with context.begin_transaction():
Expand Down
50 changes: 50 additions & 0 deletions alembic/versions/242c1f9f1463_v0_1_1_0_part2_notification.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""v0.1.1.0 Part2 Notification

Revision ID: 242c1f9f1463
Revises: 8c4e4c4f3661
Create Date: 2023-04-23 11:26:40.065546+00:00

"""
# pylint: skip-file
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '242c1f9f1463'
down_revision = '8c4e4c4f3661'
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('general_configs', sa.Column('warn_autoclose', sa.Interval(), nullable=True, comment='Time to warn user (via DM) after last response'), schema='tickets_plus')
op.add_column('tickets', sa.Column('notified', sa.Boolean(), nullable=True, comment='Whether the user has been notified about this ticket'), schema='tickets_plus')
op.execute('UPDATE tickets_plus.tickets SET notified = FALSE')
op.alter_column('tickets', 'notified', nullable=False, schema='tickets_plus')
# ### end Alembic commands ###
op.add_column('general_configs', sa.Column('first_autoclose_inter', sa.Interval(), nullable=True, comment='Time since open with no response to autoclose'), schema='tickets_plus')
op.add_column('general_configs', sa.Column('any_autoclose_inter', sa.Interval(), nullable=True, comment='Time since last response to autoclose'), schema='tickets_plus')
op.execute('UPDATE tickets_plus.general_configs SET first_autoclose_inter = INTERVAL \'1 minute\' * first_autoclose')
op.execute('UPDATE tickets_plus.general_configs SET any_autoclose_inter = INTERVAL \'1 minute\' * any_autoclose')
op.drop_column('general_configs', 'first_autoclose', schema='tickets_plus')
op.drop_column('general_configs', 'any_autoclose', schema='tickets_plus')
op.alter_column('general_configs', 'first_autoclose_inter', new_column_name='first_autoclose', schema='tickets_plus')
op.alter_column('general_configs', 'any_autoclose_inter', new_column_name='any_autoclose', schema='tickets_plus')



def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('tickets', 'notified', schema='tickets_plus')
op.drop_column('general_configs', 'warn_autoclose', schema='tickets_plus')
# ### end Alembic commands ###
op.alter_column('general_configs', 'first_autoclose', new_column_name='first_autoclose_inter', schema='tickets_plus')
op.alter_column('general_configs', 'any_autoclose', new_column_name='any_autoclose_inter', schema='tickets_plus')
op.add_column('general_configs', sa.Column('first_autoclose', sa.Integer(), nullable=True, comment='Time since open with no response to autoclose'), schema='tickets_plus')
op.add_column('general_configs', sa.Column('any_autoclose', sa.Integer(), nullable=True, comment='Time since last response to autoclose'), schema='tickets_plus')
op.execute('UPDATE tickets_plus.general_configs SET first_autoclose = EXTRACT(MINUTE FROM first_autoclose_inter)::INTEGER')
op.execute('UPDATE tickets_plus.general_configs SET any_autoclose = EXTRACT(MINUTE FROM any_autoclose_inter)::INTEGER')
op.drop_column('general_configs', 'first_autoclose_inter', schema='tickets_plus')
op.drop_column('general_configs', 'any_autoclose_inter', schema='tickets_plus')
33 changes: 33 additions & 0 deletions alembic/versions/8c4e4c4f3661_v0_1_1_0_integration_upgrade.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""v0.1.1.0 Integration Upgrade

Revision ID: 8c4e4c4f3661
Revises: 8c713ab3df0b
Create Date: 2023-04-21 13:27:35.953542+00:00

"""
# pylint: skip-file
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '8c4e4c4f3661'
down_revision = '8c713ab3df0b'
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('general_configs', sa.Column('integrated', sa.Boolean(), nullable=True, comment='Whether the bot is integrated with the main bot'), schema='tickets_plus')
op.execute('UPDATE tickets_plus.general_configs SET integrated = FALSE')
op.alter_column('general_configs', 'integrated', nullable=False, schema='tickets_plus')
op.add_column('tickets', sa.Column('user_id', sa.BigInteger(), nullable=True, comment='Unique discord-provided user ID'), schema='tickets_plus')
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('tickets', 'user_id', schema='tickets_plus')
op.drop_column('general_configs', 'integrated', schema='tickets_plus')
# ### end Alembic commands ###
36 changes: 21 additions & 15 deletions example_config.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
{
Tech-TTGames marked this conversation as resolved.
Show resolved Hide resolved
"info": "This is the example config file for the bot. All the <name>_info are not used and just comments. The bot will use the info in the <name> field of the config.json. Feel free to remove all the _info values.",
"dbtype": "postgresql+asyncpg",
"info_dbtype": "The type of database to use. Active support for postgresql. Support for SQLite+aiosqlite will be provided on a least-effort basis and may be removed at any time.",
"dbhost": "localhost",
"info_dbhost": "The host of the database.",
"dbport": 5432,
"info_dbport": "The port of the database.",
"dbname": "bot",
"info_dbname": "The name of the database.",
"dbuser": "bot",
"info_dbuser": "The username for the database.",
"dbpass": "bot",
"info_dbpass": "The password for the database.",
"dev_guild_id": 478114566509821953,
"dev_guild_id_info": "The id of a guild where you can use the override commands. This is required for the bot to work."
"info": "This is the example config file for the bot. All the <name>_info are not used and just comments. The bot will use the info in the <name> field of the config.json. Feel free to remove all the _info values.",
Tech-TTGames marked this conversation as resolved.
Show resolved Hide resolved
"dbtype": "postgresql+asyncpg",
"info_dbtype": "The type of database to use. Active support for postgresql. Support for SQLite+aiosqlite will be provided on a least-effort basis and may be removed at any time.",
"dbhost": "localhost",
"info_dbhost": "The host of the database.",
"dbport": 5432,
"info_dbport": "The port of the database.",
"dbname": "bot",
"info_dbname": "The name of the database.",
"dbuser": "bot",
"info_dbuser": "The username for the database.",
"dbpass": "bot",
"info_dbpass": "The password for the database.",
"dev_guild_id": 478114566509821953,
"dev_guild_id_info": "The id of a guild where you can use the override commands. This is required for the bot to work.",
Tech-TTGames marked this conversation as resolved.
Show resolved Hide resolved
"https_port": 443,
"https_port_info": "The port to run the https server on. This is required for the API to work.",
Tech-TTGames marked this conversation as resolved.
Show resolved Hide resolved
"ssl_cert": "/etc/letsencrypt/live/ticketsplus.xyz/fullchain.pem",
"ssl_cert_info": "The path to the ssl certificate. This is required for the API to work.",
Tech-TTGames marked this conversation as resolved.
Show resolved Hide resolved
"auth_token": "thequickbrownfoxjumpedoverthelazydog",
"auth_token_info": "The token to use for the API. Please set this to something else. This is required for the API to work."
Tech-TTGames marked this conversation as resolved.
Show resolved Hide resolved
}
7 changes: 5 additions & 2 deletions example_secret.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
Tech-TTGames marked this conversation as resolved.
Show resolved Hide resolved
"info":"This is a file for the bot's token/secret (used to control the bot). You can get one @ discord.dev Don't share this with anyone or make it public. If you want to you can remove this line. Remember to remove the example_ from the file name!",
"token":"YOUR TOKEN HERE"
"info": "This is a file for the bot's private data. If you want to you can remove this line. Remember to remove the example_ from the file name!",
"token": "YOUR TOKEN HERE",
"token_info": "The token of the bot. You can get one @ discord.dev Don't share this with anyone or make it public. This is required for the bot to work.",
Tech-TTGames marked this conversation as resolved.
Show resolved Hide resolved
"ssl_key": "/etc/letsencrypt/live/ticketsplus.xyz/privkey.pem",
"ssl_key_info": "The path to the ssl key. This is required for the API to work."
Tech-TTGames marked this conversation as resolved.
Show resolved Hide resolved
}
Loading