Skip to content

Commit fa545be

Browse files
authored
Merge pull request #1 from MaxBakshaev/test-branch
Test branch
2 parents 74dd8f3 + f87b95e commit fa545be

36 files changed

Lines changed: 679 additions & 9 deletions

.github/workflows/run_test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: FastAPI-Microservice
2+
3+
on:
4+
push:
5+
branches: [ test-branch ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.10.11'
21+
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install -r requirements.txt
26+

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.venv
2+
venv
3+
.vscode/
4+
__pycache_/
5+
__pycache_
6+
cache/
7+
.idea
8+
*.pyc
9+
# *.sqlite*
10+
# db.sqlite3
11+
.env
-989 Bytes
Binary file not shown.

__pycache__/main.cpython-310.pyc

-1.65 KB
Binary file not shown.
-2.27 KB
Binary file not shown.

alembic/env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# can be acquired:
2929
# my_important_option = config.get_main_option("my_important_option")
3030
# ... etc.
31-
config.set_main_option("sqlalchemy.url", settings.db_url)
31+
config.set_main_option("sqlalchemy.url", settings.db.url)
3232

3333

3434
def run_migrations_offline() -> None:
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""create orders table
2+
3+
Revision ID: 051df2e34251
4+
Revises: 6ee5474d9a28
5+
Create Date: 2025-07-02 15:25:34.139064
6+
7+
"""
8+
9+
from typing import Sequence, Union
10+
11+
from alembic import op
12+
import sqlalchemy as sa
13+
14+
15+
# revision identifiers, used by Alembic.
16+
revision: str = "051df2e34251"
17+
down_revision: Union[str, Sequence[str], None] = "6ee5474d9a28"
18+
branch_labels: Union[str, Sequence[str], None] = None
19+
depends_on: Union[str, Sequence[str], None] = None
20+
21+
22+
def upgrade() -> None:
23+
"""Upgrade schema."""
24+
# ### commands auto generated by Alembic - please adjust! ###
25+
op.create_table(
26+
"orders",
27+
sa.Column("promocode", sa.String(), nullable=True),
28+
sa.Column(
29+
"created_at",
30+
sa.DateTime(),
31+
server_default=sa.text("(CURRENT_TIMESTAMP)"),
32+
nullable=False,
33+
),
34+
sa.Column("id", sa.Integer(), nullable=False),
35+
sa.PrimaryKeyConstraint("id"),
36+
)
37+
# ### end Alembic commands ###
38+
39+
40+
def downgrade() -> None:
41+
"""Downgrade schema."""
42+
# ### commands auto generated by Alembic - please adjust! ###
43+
op.drop_table("orders")
44+
# ### end Alembic commands ###
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"""create order product association table
2+
3+
Revision ID: 76e5a8b4d1bc
4+
Revises: 051df2e34251
5+
Create Date: 2025-07-02 16:03:15.470194
6+
7+
"""
8+
9+
from typing import Sequence, Union
10+
11+
from alembic import op
12+
import sqlalchemy as sa
13+
14+
15+
# revision identifiers, used by Alembic.
16+
revision: str = "76e5a8b4d1bc"
17+
down_revision: Union[str, Sequence[str], None] = "051df2e34251"
18+
branch_labels: Union[str, Sequence[str], None] = None
19+
depends_on: Union[str, Sequence[str], None] = None
20+
21+
22+
def upgrade() -> None:
23+
"""Upgrade schema."""
24+
# ### commands auto generated by Alembic - please adjust! ###
25+
op.create_table(
26+
"order_product_association",
27+
sa.Column("id", sa.Integer(), nullable=False),
28+
sa.Column("order_id", sa.Integer(), nullable=False),
29+
sa.Column("product_id", sa.Integer(), nullable=False),
30+
sa.ForeignKeyConstraint(
31+
["order_id"],
32+
["orders.id"],
33+
),
34+
sa.ForeignKeyConstraint(
35+
["product_id"],
36+
["products.id"],
37+
),
38+
sa.PrimaryKeyConstraint("id"),
39+
sa.UniqueConstraint(
40+
"order_id", "product_id", name="idx_unique_order_product"
41+
),
42+
)
43+
# ### end Alembic commands ###
44+
45+
46+
def downgrade() -> None:
47+
"""Downgrade schema."""
48+
# ### commands auto generated by Alembic - please adjust! ###
49+
op.drop_table("order_product_association")
50+
# ### end Alembic commands ###
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"""qwerty
2+
3+
Revision ID: 8980aba26f80
4+
Revises: 76e5a8b4d1bc
5+
Create Date: 2025-07-02 16:23:43.528638
6+
7+
"""
8+
9+
from typing import Sequence, Union
10+
11+
from alembic import op
12+
import sqlalchemy as sa
13+
14+
15+
# revision identifiers, used by Alembic.
16+
revision: str = "8980aba26f80"
17+
down_revision: Union[str, Sequence[str], None] = "76e5a8b4d1bc"
18+
branch_labels: Union[str, Sequence[str], None] = None
19+
depends_on: Union[str, Sequence[str], None] = None
20+
21+
22+
def upgrade() -> None:
23+
"""Upgrade schema."""
24+
# ### commands auto generated by Alembic - please adjust! ###
25+
pass
26+
# ### end Alembic commands ###
27+
28+
29+
def downgrade() -> None:
30+
"""Downgrade schema."""
31+
# ### commands auto generated by Alembic - please adjust! ###
32+
pass
33+
# ### end Alembic commands ###
-335 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)