more, view and edit broken
This commit is contained in:
BIN
main-app.zip
Normal file
BIN
main-app.zip
Normal file
Binary file not shown.
BIN
mainapp.zip
BIN
mainapp.zip
Binary file not shown.
28
migrations/versions/0160d15cf8b2_auto.py
Normal file
28
migrations/versions/0160d15cf8b2_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 0160d15cf8b2
|
||||
Revises: 456e30097502
|
||||
Create Date: 2025-06-11 08:10:55.240327
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0160d15cf8b2'
|
||||
down_revision = '456e30097502'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/04a28922c2d4_auto.py
Normal file
28
migrations/versions/04a28922c2d4_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 04a28922c2d4
|
||||
Revises: 2dc9002530b1
|
||||
Create Date: 2025-06-11 10:17:52.756705
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '04a28922c2d4'
|
||||
down_revision = '2dc9002530b1'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/06a6004b8e7c_auto.py
Normal file
28
migrations/versions/06a6004b8e7c_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 06a6004b8e7c
|
||||
Revises: 0160d15cf8b2
|
||||
Create Date: 2025-06-11 08:21:13.656552
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '06a6004b8e7c'
|
||||
down_revision = '0160d15cf8b2'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/082f6fe2681f_auto.py
Normal file
28
migrations/versions/082f6fe2681f_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 082f6fe2681f
|
||||
Revises: 654c57ccdf3a
|
||||
Create Date: 2025-06-11 09:30:24.460620
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '082f6fe2681f'
|
||||
down_revision = '654c57ccdf3a'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/0f3779c66206_auto.py
Normal file
28
migrations/versions/0f3779c66206_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 0f3779c66206
|
||||
Revises: 9662437c96e7
|
||||
Create Date: 2025-06-11 10:08:51.915028
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0f3779c66206'
|
||||
down_revision = '9662437c96e7'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/0f918f190926_auto.py
Normal file
28
migrations/versions/0f918f190926_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 0f918f190926
|
||||
Revises: 44a1a781ce71
|
||||
Create Date: 2025-06-11 07:59:30.812136
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0f918f190926'
|
||||
down_revision = '44a1a781ce71'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/0fec6c5193b0_auto.py
Normal file
28
migrations/versions/0fec6c5193b0_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 0fec6c5193b0
|
||||
Revises: 0f918f190926
|
||||
Create Date: 2025-06-11 08:04:17.030930
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0fec6c5193b0'
|
||||
down_revision = '0f918f190926'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/10311c25dc8a_auto.py
Normal file
28
migrations/versions/10311c25dc8a_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 10311c25dc8a
|
||||
Revises: 06a6004b8e7c
|
||||
Create Date: 2025-06-11 08:29:26.144020
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '10311c25dc8a'
|
||||
down_revision = '06a6004b8e7c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/2dc9002530b1_auto.py
Normal file
28
migrations/versions/2dc9002530b1_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 2dc9002530b1
|
||||
Revises: d3d8a8deded5
|
||||
Create Date: 2025-06-11 10:17:03.835622
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '2dc9002530b1'
|
||||
down_revision = 'd3d8a8deded5'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/44a1a781ce71_auto.py
Normal file
28
migrations/versions/44a1a781ce71_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 44a1a781ce71
|
||||
Revises: 551167211686
|
||||
Create Date: 2025-06-11 07:55:59.085982
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '44a1a781ce71'
|
||||
down_revision = '551167211686'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/456e30097502_auto.py
Normal file
28
migrations/versions/456e30097502_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 456e30097502
|
||||
Revises: 0fec6c5193b0
|
||||
Create Date: 2025-06-11 08:07:57.156132
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '456e30097502'
|
||||
down_revision = '0fec6c5193b0'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/5ab137c980ef_auto.py
Normal file
28
migrations/versions/5ab137c980ef_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 5ab137c980ef
|
||||
Revises: 04a28922c2d4
|
||||
Create Date: 2025-06-11 10:22:55.390129
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '5ab137c980ef'
|
||||
down_revision = '04a28922c2d4'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/626b3c2d4d79_auto.py
Normal file
28
migrations/versions/626b3c2d4d79_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 626b3c2d4d79
|
||||
Revises: b1efed2fb8ab
|
||||
Create Date: 2025-06-11 09:44:07.989422
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '626b3c2d4d79'
|
||||
down_revision = 'b1efed2fb8ab'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/654c57ccdf3a_auto.py
Normal file
28
migrations/versions/654c57ccdf3a_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 654c57ccdf3a
|
||||
Revises: 718f98ed8e6b
|
||||
Create Date: 2025-06-11 09:29:12.678462
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '654c57ccdf3a'
|
||||
down_revision = '718f98ed8e6b'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/718f98ed8e6b_auto.py
Normal file
28
migrations/versions/718f98ed8e6b_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 718f98ed8e6b
|
||||
Revises: ebabe1d9ab27
|
||||
Create Date: 2025-06-11 08:51:33.323889
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '718f98ed8e6b'
|
||||
down_revision = 'ebabe1d9ab27'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/7f04b183822a_auto.py
Normal file
28
migrations/versions/7f04b183822a_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 7f04b183822a
|
||||
Revises: 626b3c2d4d79
|
||||
Create Date: 2025-06-11 09:49:36.411213
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '7f04b183822a'
|
||||
down_revision = '626b3c2d4d79'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/81e23bd9ad49_auto.py
Normal file
28
migrations/versions/81e23bd9ad49_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 81e23bd9ad49
|
||||
Revises: 0f3779c66206
|
||||
Create Date: 2025-06-11 10:10:33.638269
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '81e23bd9ad49'
|
||||
down_revision = '0f3779c66206'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/9565f14274c5_auto.py
Normal file
28
migrations/versions/9565f14274c5_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 9565f14274c5
|
||||
Revises: f347a4fd8e4f
|
||||
Create Date: 2025-06-11 09:34:30.469466
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '9565f14274c5'
|
||||
down_revision = 'f347a4fd8e4f'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/9662437c96e7_auto.py
Normal file
28
migrations/versions/9662437c96e7_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: 9662437c96e7
|
||||
Revises: 7f04b183822a
|
||||
Create Date: 2025-06-11 09:55:12.179920
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '9662437c96e7'
|
||||
down_revision = '7f04b183822a'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/a3a75017663d_auto.py
Normal file
28
migrations/versions/a3a75017663d_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: a3a75017663d
|
||||
Revises: 10311c25dc8a
|
||||
Create Date: 2025-06-11 08:33:28.489483
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'a3a75017663d'
|
||||
down_revision = '10311c25dc8a'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/b1efed2fb8ab_auto.py
Normal file
28
migrations/versions/b1efed2fb8ab_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: b1efed2fb8ab
|
||||
Revises: 9565f14274c5
|
||||
Create Date: 2025-06-11 09:35:17.286671
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'b1efed2fb8ab'
|
||||
down_revision = '9565f14274c5'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/d3d8a8deded5_auto.py
Normal file
28
migrations/versions/d3d8a8deded5_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: d3d8a8deded5
|
||||
Revises: 81e23bd9ad49
|
||||
Create Date: 2025-06-11 10:14:29.357855
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd3d8a8deded5'
|
||||
down_revision = '81e23bd9ad49'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/df07769fdf4f_auto.py
Normal file
28
migrations/versions/df07769fdf4f_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: df07769fdf4f
|
||||
Revises: a3a75017663d
|
||||
Create Date: 2025-06-11 08:37:53.279883
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'df07769fdf4f'
|
||||
down_revision = 'a3a75017663d'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/ebabe1d9ab27_auto.py
Normal file
28
migrations/versions/ebabe1d9ab27_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: ebabe1d9ab27
|
||||
Revises: df07769fdf4f
|
||||
Create Date: 2025-06-11 08:45:15.834408
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ebabe1d9ab27'
|
||||
down_revision = 'df07769fdf4f'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
28
migrations/versions/f347a4fd8e4f_auto.py
Normal file
28
migrations/versions/f347a4fd8e4f_auto.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""auto
|
||||
|
||||
Revision ID: f347a4fd8e4f
|
||||
Revises: 082f6fe2681f
|
||||
Create Date: 2025-06-11 09:33:30.217742
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'f347a4fd8e4f'
|
||||
down_revision = '082f6fe2681f'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
@ -31,7 +31,7 @@
|
||||
<ul class="navbar-nav me-auto">
|
||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('core_ui.home') }}">Home</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('plant.index') }}">Plants</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('importer.upload') }}">Import</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('utility.upload') }}">Import</a></li>
|
||||
{% if current_user.is_authenticated and current_user.role == 'admin' %}
|
||||
<li class="nav-item"><a class="nav-link text-danger" href="{{ url_for('admin.admin_dashboard') }}">Admin Dashboard</a></li>
|
||||
{% endif %}
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "importer",
|
||||
"version": "1.0.0",
|
||||
"description": "Plant import from stand alone application",
|
||||
"entry_point": null
|
||||
}
|
@ -8,6 +8,7 @@ from flask import (
|
||||
url_for,
|
||||
request,
|
||||
flash,
|
||||
current_app,
|
||||
)
|
||||
from flask_login import login_required, current_user
|
||||
from app import db
|
||||
@ -37,19 +38,44 @@ def inject_image_helper():
|
||||
@bp.route('/', methods=['GET'])
|
||||
@login_required
|
||||
def index():
|
||||
# 1. Compute per-type stats
|
||||
total = Plant.query.filter_by(owner_id=current_user.id).count()
|
||||
raw_types = (
|
||||
db.session
|
||||
.query(Plant.plant_type)
|
||||
.filter_by(owner_id=current_user.id)
|
||||
.distinct()
|
||||
.all()
|
||||
)
|
||||
plant_types = [pt[0] for pt in raw_types]
|
||||
|
||||
stats = {'All': total}
|
||||
for pt in plant_types:
|
||||
stats[pt] = Plant.query.filter_by(
|
||||
owner_id=current_user.id,
|
||||
plant_type=pt
|
||||
).count()
|
||||
|
||||
# 2. Load ALL this user’s plants, ordered by common name
|
||||
plants = (
|
||||
Plant.query
|
||||
.filter_by(owner_id=current_user.id)
|
||||
.order_by(Plant.created_at.desc())
|
||||
.join(PlantCommonName, Plant.common_id == PlantCommonName.id)
|
||||
.order_by(PlantCommonName.name)
|
||||
.options(
|
||||
db.joinedload(Plant.media),
|
||||
db.joinedload(Plant.common_name)
|
||||
)
|
||||
.all()
|
||||
)
|
||||
stats = {
|
||||
'user_plants': Plant.query.filter_by(owner_id=current_user.id).count(),
|
||||
'user_images': Media.query.filter_by(uploader_id=current_user.id).count(),
|
||||
'total_plants': Plant.query.count(),
|
||||
'total_images': Media.query.count(),
|
||||
}
|
||||
return render_template('plant/index.html', plants=plants, stats=stats)
|
||||
|
||||
# 3. Render the template (JS will handle filtering & pagination)
|
||||
return render_template(
|
||||
'plant/index.html',
|
||||
plants=plants,
|
||||
stats=stats,
|
||||
plant_types=plant_types
|
||||
)
|
||||
|
||||
# ─── CREATE ───────────────────────────────────────────────────────────────────
|
||||
@bp.route('/create', methods=['GET', 'POST'])
|
||||
|
@ -1,129 +1,176 @@
|
||||
{# plugins/plant/templates/plant/index.html #}
|
||||
{% extends 'core_ui/base.html' %}
|
||||
|
||||
{% block title %}Plant List – Nature In Pots{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container my-4">
|
||||
<!-- Stats Section (responsive 2-col ↔ 1-col) -->
|
||||
<div class="mb-4 p-3 bg-light border rounded">
|
||||
<h5>Statistics</h5>
|
||||
<div class="row row-cols-1 row-cols-md-2 g-3 mt-3 text-center">
|
||||
<div class="col">
|
||||
<div class="d-flex align-items-center justify-content-center">
|
||||
<i class="bi bi-seedling fs-3 text-success me-3"></i>
|
||||
<div>
|
||||
<div class="small text-muted">Your plants</div>
|
||||
<div class="fw-bold">{{ stats.user_plants }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="d-flex align-items-center justify-content-center">
|
||||
<i class="bi bi-image fs-3 text-primary me-3"></i>
|
||||
<div>
|
||||
<div class="small text-muted">Your images</div>
|
||||
<div class="fw-bold">{{ stats.user_images }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="d-flex align-items-center justify-content-center">
|
||||
<i class="bi bi-tree fs-3 text-success me-3"></i>
|
||||
<div>
|
||||
<div class="small text-muted">Total plants</div>
|
||||
<div class="fw-bold">{{ stats.total_plants }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="d-flex align-items-center justify-content-center">
|
||||
<i class="bi bi-images fs-3 text-primary me-3"></i>
|
||||
<div>
|
||||
<div class="small text-muted">Total images</div>
|
||||
<div class="fw-bold">{{ stats.total_images }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container mt-4">
|
||||
|
||||
<!-- Header + Add button -->
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h1>My Plants</h1>
|
||||
<a href="{{ url_for('plant.create') }}" class="btn btn-primary">
|
||||
+ Add New Plant
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Stats Panel -->
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">
|
||||
<a data-bs-toggle="collapse" href="#statsBox" aria-expanded="false">
|
||||
Stats <i class="bi bi-chevron-down"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="collapse" id="statsBox">
|
||||
<ul class="list-group list-group-flush">
|
||||
{% for label, count in stats.items() %}
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span>{{ label.replace('_',' ').title() }}</span>
|
||||
<span>{{ count }}</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h1 class="mb-4">Plant List</h1>
|
||||
|
||||
<!-- Search & Add -->
|
||||
<div class="mb-3 d-flex flex-column flex-md-row justify-content-between align-items-start align-items-md-center gap-2">
|
||||
<div>
|
||||
<a href="{{ url_for('plant.create') }}" class="btn btn-success">Add New Plant</a>
|
||||
<!-- Import/Export & Filter bar -->
|
||||
<div class="mb-3 d-flex flex-wrap justify-content-between align-items-center">
|
||||
<div class="mb-2 d-flex align-items-center">
|
||||
<a href="{{ url_for('utility.upload') }}" class="btn btn-primary me-2">
|
||||
Import CSV
|
||||
</a>
|
||||
<a href="{{ url_for('utility.export_data') }}" class="btn btn-secondary me-2">
|
||||
Export My Data
|
||||
</a>
|
||||
</div>
|
||||
<div class="input-group" style="max-width:300px; width:100%;">
|
||||
<span class="input-group-text">Search</span>
|
||||
<input id="searchInput" type="text" class="form-control" placeholder="by name…">
|
||||
<div class="d-flex flex-wrap flex-md-nowrap align-items-center">
|
||||
<div class="input-group me-2 mb-2 mb-md-0" style="min-width:200px;">
|
||||
<span class="input-group-text">Search</span>
|
||||
<input id="searchInput" type="text" class="form-control" placeholder="by name…">
|
||||
</div>
|
||||
<select id="typeFilter" class="form-select me-2 mb-2 mb-md-0" style="min-width:140px;">
|
||||
<option value="">All Types</option>
|
||||
{% for t in plant_types %}
|
||||
<option value="{{ t|lower }}">{{ t.replace('_',' ').title() }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<select id="pageSizeSelect" class="form-select mb-2 mb-md-0" style="min-width:140px;">
|
||||
{% for size in [6,12,18,24] %}
|
||||
<option value="{{ size }}" {% if size == 12 %}selected{% endif %}>
|
||||
{{ size }} per page
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if plants %}
|
||||
<div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 g-4" id="plantContainer">
|
||||
{% for plant in plants %}
|
||||
<div class="col plant-card" data-name="{{ plant.common_name.name|lower if plant.common_name else '' }}">
|
||||
<div class="card h-100">
|
||||
{# pick the featured media entry, or fall back to first item #}
|
||||
{% set featured = plant.media
|
||||
|selectattr('id','equalto', plant.featured_media_id)
|
||||
|first %}
|
||||
{% if not featured and plant.media %}
|
||||
{% set featured = plant.media|first %}
|
||||
{% endif %}
|
||||
<!-- Plant Cards Container -->
|
||||
<div class="row row-cols-1 row-cols-md-3 g-4" id="plantContainer">
|
||||
{% for plant in plants %}
|
||||
<div class="col plant-card"
|
||||
data-name="{{ plant.common_name.name|lower }}"
|
||||
data-type="{{ plant.plant_type|lower }}">
|
||||
<div class="card h-100">
|
||||
|
||||
{% if featured %}
|
||||
<a href="{{ url_for('plant.detail', uuid_val=plant.uuid) }}">
|
||||
<img
|
||||
src="{{ generate_image_url(featured.file_url) }}"
|
||||
class="card-img-top"
|
||||
style="height:200px;object-fit:cover;"
|
||||
alt="Image for {{ plant.common_name.name if plant.common_name else 'Plant' }}">
|
||||
</a>
|
||||
{% else %}
|
||||
{% if plant.media %}
|
||||
{% set featured = plant.media|selectattr('featured')|first or plant.media[0] %}
|
||||
<a href="{{ url_for('plant.detail', uuid_val=plant.uuid) }}">
|
||||
<img
|
||||
src="https://placehold.co/300x200"
|
||||
src="{{ url_for('media.media_file', filename=featured.file_url) }}"
|
||||
class="card-img-top"
|
||||
style="height:200px;object-fit:cover;"
|
||||
alt="No image available">
|
||||
{% endif %}
|
||||
style="height:200px; object-fit:cover;"
|
||||
alt="{{ plant.common_name.name }}"
|
||||
>
|
||||
</a>
|
||||
{% else %}
|
||||
<!-- Placeholder when no media -->
|
||||
<a href="{{ url_for('plant.detail', uuid_val=plant.uuid) }}">
|
||||
<img
|
||||
src="{{ generate_image_url(None) }}"
|
||||
class="card-img-top"
|
||||
style="height:200px; object-fit:cover;"
|
||||
alt="Placeholder for {{ plant.common_name.name }}"
|
||||
>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<div class="card-body d-flex flex-column">
|
||||
<h5 class="card-title mb-1">
|
||||
<a href="{{ url_for('plant.detail', uuid_val=plant.uuid) }}">
|
||||
{{ plant.common_name.name if plant.common_name else 'Untitled' }}
|
||||
</a>
|
||||
</h5>
|
||||
<h6 class="text-muted small">{{ plant.uuid }}</h6>
|
||||
<p class="mb-1"><strong>Type:</strong> {{ plant.plant_type }}</p>
|
||||
<p class="mb-2"><strong>Scientific:</strong>
|
||||
{{ plant.scientific_name.name if plant.scientific_name else '–' }}
|
||||
</p>
|
||||
<div class="mt-auto d-flex flex-wrap gap-1">
|
||||
<a href="{{ url_for('plant.detail', uuid_val=plant.uuid) }}"
|
||||
class="btn btn-sm btn-primary">View</a>
|
||||
<a href="{{ url_for('plant.edit', uuid_val=plant.uuid) }}"
|
||||
class="btn btn-sm btn-secondary">Edit</a>
|
||||
</div>
|
||||
<div class="card-body d-flex flex-column">
|
||||
<h5 class="card-title">{{ plant.common_name.name }}</h5>
|
||||
<p class="card-text">{{ plant.plant_type.replace('_',' ').title() }}</p>
|
||||
<div class="mt-auto">
|
||||
<a href="{{ url_for('plant.detail', uuid_val=plant.uuid) }}"
|
||||
class="btn btn-sm btn-outline-primary">View</a>
|
||||
<a href="{{ url_for('plant.edit', uuid_val=plant.uuid) }}"
|
||||
class="btn btn-sm btn-outline-secondary">Edit</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p>No plants found yet. <a href="{{ url_for('plant.create') }}">Add one now.</a></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<!-- Pagination Controls -->
|
||||
<nav aria-label="Page navigation" class="mt-4">
|
||||
<ul class="pagination justify-content-center" id="pagination"></ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<!-- Client-side filtering & pagination script -->
|
||||
<script>
|
||||
// client-side filtering
|
||||
document.getElementById('searchInput').addEventListener('input', function() {
|
||||
const q = this.value.trim().toLowerCase();
|
||||
document.querySelectorAll('#plantContainer .plant-card').forEach(card => {
|
||||
card.style.display = card.dataset.name.includes(q) ? '' : 'none';
|
||||
(function() {
|
||||
const searchInput = document.getElementById('searchInput');
|
||||
const typeFilter = document.getElementById('typeFilter');
|
||||
const pageSizeSelect = document.getElementById('pageSizeSelect');
|
||||
const container = document.getElementById('plantContainer');
|
||||
const pagination = document.getElementById('pagination');
|
||||
const cards = Array.from(container.querySelectorAll('.plant-card'));
|
||||
let currentPage = 1;
|
||||
let pageSize = parseInt(pageSizeSelect.value, 10);
|
||||
|
||||
function filterAndPaginate() {
|
||||
const q = searchInput.value.trim().toLowerCase();
|
||||
const type = typeFilter.value;
|
||||
const filtered = cards.filter(c => {
|
||||
return c.dataset.name.includes(q) &&
|
||||
(!type || c.dataset.type === type);
|
||||
});
|
||||
|
||||
const totalPages = Math.max(1, Math.ceil(filtered.length / pageSize));
|
||||
if (currentPage > totalPages) currentPage = totalPages;
|
||||
|
||||
cards.forEach(c => c.style.display = 'none');
|
||||
const start = (currentPage - 1) * pageSize;
|
||||
filtered.slice(start, start + pageSize).forEach(c => c.style.display = '');
|
||||
|
||||
pagination.innerHTML = '';
|
||||
const makeLi = (label, page, disabled) => {
|
||||
const li = document.createElement('li');
|
||||
li.className = 'page-item' + (disabled ? ' disabled' : '') + (page === currentPage ? ' active' : '');
|
||||
li.innerHTML = `<a class="page-link" href="#">${label}</a>`;
|
||||
if (!disabled) {
|
||||
li.onclick = e => { e.preventDefault(); currentPage = page; filterAndPaginate(); };
|
||||
}
|
||||
return li;
|
||||
};
|
||||
|
||||
pagination.appendChild(makeLi('Prev', Math.max(1, currentPage-1), currentPage===1));
|
||||
for (let i = 1; i <= Math.min(5, totalPages); i++) {
|
||||
pagination.appendChild(makeLi(i, i, false));
|
||||
}
|
||||
if (totalPages > 5) {
|
||||
const ell = document.createElement('li');
|
||||
ell.className = 'page-item disabled';
|
||||
ell.innerHTML = `<span class="page-link">…</span>`;
|
||||
pagination.appendChild(ell);
|
||||
pagination.appendChild(makeLi(totalPages, totalPages, false));
|
||||
}
|
||||
pagination.appendChild(makeLi('Next', Math.min(totalPages, currentPage+1), currentPage===totalPages));
|
||||
}
|
||||
|
||||
[searchInput, typeFilter].forEach(el => el.addEventListener('input', () => { currentPage = 1; filterAndPaginate(); }));
|
||||
pageSizeSelect.addEventListener('change', () => {
|
||||
pageSize = parseInt(pageSizeSelect.value, 10);
|
||||
currentPage = 1;
|
||||
filterAndPaginate();
|
||||
});
|
||||
|
||||
filterAndPaginate();
|
||||
})();
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
6
plugins/utility/plugin.json
Normal file
6
plugins/utility/plugin.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "utility",
|
||||
"version": "1.0.0",
|
||||
"description": "General utilities and such",
|
||||
"entry_point": null
|
||||
}
|
@ -1,18 +1,20 @@
|
||||
# plugins/importer/routes.py
|
||||
# plugins/utility/routes.py
|
||||
|
||||
import csv
|
||||
import io
|
||||
import uuid
|
||||
import difflib
|
||||
import os
|
||||
import re
|
||||
import zipfile
|
||||
import tempfile
|
||||
|
||||
from datetime import datetime
|
||||
from flask import (
|
||||
Blueprint, request, render_template, redirect, flash,
|
||||
session, url_for, current_app
|
||||
session, url_for, send_file, current_app
|
||||
)
|
||||
from werkzeug.utils import secure_filename
|
||||
from flask_login import login_required, current_user
|
||||
from flask_wtf.csrf import generate_csrf
|
||||
|
||||
@ -25,20 +27,20 @@ from plugins.plant.models import (
|
||||
PlantOwnershipLog,
|
||||
)
|
||||
from plugins.media.models import Media
|
||||
from plugins.importer.models import ImportBatch # tracks which exports have been imported
|
||||
from plugins.utility.models import ImportBatch # tracks which exports have been imported
|
||||
|
||||
bp = Blueprint(
|
||||
'importer',
|
||||
'utility',
|
||||
__name__,
|
||||
template_folder='templates',
|
||||
url_prefix='/importer'
|
||||
url_prefix='/utility'
|
||||
)
|
||||
|
||||
@bp.route("/", methods=["GET"])
|
||||
@login_required
|
||||
def index():
|
||||
# When someone hits /importer/, redirect to /importer/upload
|
||||
return redirect(url_for("importer.upload"))
|
||||
# When someone hits /utility/, redirect to /utility/upload
|
||||
return redirect(url_for("utility.upload"))
|
||||
|
||||
# ────────────────────────────────────────────────────────────────────────────────
|
||||
# Required headers for your sub-app export ZIP
|
||||
@ -195,7 +197,6 @@ def upload():
|
||||
if not plant_obj:
|
||||
continue
|
||||
|
||||
# derive subpath inside ZIP by stripping "uploads/"
|
||||
subpath = mrow["Image Path"].split('uploads/', 1)[1]
|
||||
src = os.path.join(tmpdir, "images", subpath)
|
||||
if not os.path.isfile(src):
|
||||
@ -213,7 +214,6 @@ def upload():
|
||||
with open(src, "rb") as sf, open(dst, "wb") as df:
|
||||
df.write(sf.read())
|
||||
|
||||
# 🔧 FIXED: match your Media model exactly
|
||||
media = Media(
|
||||
file_url=f"uploads/{current_user.id}/{plant_obj.id}/{fname}",
|
||||
uploaded_at=datetime.fromisoformat(mrow["Uploaded At"]),
|
||||
@ -285,16 +285,16 @@ def upload():
|
||||
"mother_uuid": mother_uuid
|
||||
}
|
||||
review_list.append(item)
|
||||
session["pending_rows"].append(item)
|
||||
session["pending_rows"].append(item)
|
||||
|
||||
session["review_list"] = review_list
|
||||
return redirect(url_for("importer.review"))
|
||||
return redirect(url_for("utility.review"))
|
||||
|
||||
flash("Unsupported file type. Please upload a ZIP or CSV.", "danger")
|
||||
return redirect(request.url)
|
||||
|
||||
# GET → render the upload form
|
||||
return render_template("importer/upload.html", csrf_token=generate_csrf())
|
||||
return render_template("utility/upload.html", csrf_token=generate_csrf())
|
||||
|
||||
|
||||
@bp.route("/review", methods=["GET", "POST"])
|
||||
@ -373,10 +373,104 @@ def review():
|
||||
flash(f"{added} plants added (MySQL) and Neo4j updated.", "success")
|
||||
session.pop("pending_rows", None)
|
||||
session.pop("review_list", None)
|
||||
return redirect(url_for("importer.upload"))
|
||||
return redirect(url_for("utility.upload"))
|
||||
|
||||
return render_template(
|
||||
"importer/review.html",
|
||||
"utility/review.html",
|
||||
review_list=review_list,
|
||||
csrf_token=generate_csrf()
|
||||
)
|
||||
|
||||
|
||||
@bp.route('/export_data', methods=['GET'])
|
||||
@login_required
|
||||
def export_data():
|
||||
# Unique export identifier
|
||||
export_id = f"{uuid.uuid4()}_{int(datetime.utcnow().timestamp())}"
|
||||
|
||||
# 1) Gather plants
|
||||
plants = (
|
||||
Plant.query
|
||||
.filter_by(owner_id=current_user.id)
|
||||
.order_by(Plant.id)
|
||||
.all()
|
||||
)
|
||||
# Build plants.csv
|
||||
plant_io = io.StringIO()
|
||||
pw = csv.writer(plant_io)
|
||||
pw.writerow([
|
||||
'UUID', 'Type', 'Name', 'Scientific Name',
|
||||
'Vendor Name', 'Price', 'Mother UUID', 'Notes'
|
||||
])
|
||||
for p in plants:
|
||||
pw.writerow([
|
||||
p.uuid,
|
||||
p.plant_type,
|
||||
p.common_name.name if p.common_name else '',
|
||||
p.scientific_name.name if p.scientific_name else '',
|
||||
getattr(p, 'vendor_name', '') or '',
|
||||
getattr(p, 'price', '') or '',
|
||||
p.mother_uuid or '',
|
||||
p.notes or ''
|
||||
])
|
||||
plants_csv = plant_io.getvalue()
|
||||
|
||||
# 2) Gather media
|
||||
media_records = (
|
||||
Media.query
|
||||
.filter_by(uploader_id=current_user.id)
|
||||
.order_by(Media.id)
|
||||
.all()
|
||||
)
|
||||
# Build media.csv
|
||||
media_io = io.StringIO()
|
||||
mw = csv.writer(media_io)
|
||||
mw.writerow([
|
||||
'Plant UUID', 'Image Path', 'Uploaded At', 'Source Type'
|
||||
])
|
||||
for m in media_records:
|
||||
mw.writerow([
|
||||
m.plant.uuid,
|
||||
m.file_url,
|
||||
m.uploaded_at.isoformat() if m.uploaded_at else '',
|
||||
m.caption or ''
|
||||
])
|
||||
media_csv = media_io.getvalue()
|
||||
|
||||
# 3) Assemble ZIP with images from UPLOAD_FOLDER
|
||||
zip_buf = io.BytesIO()
|
||||
with zipfile.ZipFile(zip_buf, 'w', zipfile.ZIP_DEFLATED) as zf:
|
||||
# metadata.txt
|
||||
meta = (
|
||||
f"export_id,{export_id}\n"
|
||||
f"user_id,{current_user.id}\n"
|
||||
f"exported_at,{datetime.utcnow().isoformat()}\n"
|
||||
)
|
||||
zf.writestr('metadata.txt', meta)
|
||||
|
||||
# CSV files
|
||||
zf.writestr('plants.csv', plants_csv)
|
||||
zf.writestr('media.csv', media_csv)
|
||||
|
||||
# real image files under images/
|
||||
media_root = current_app.config['UPLOAD_FOLDER']
|
||||
for m in media_records:
|
||||
# file_url is “uploads/...”
|
||||
rel = m.file_url.split('uploads/', 1)[-1]
|
||||
abs_path = os.path.join(media_root, rel)
|
||||
if os.path.isfile(abs_path):
|
||||
arcname = os.path.join('images', rel)
|
||||
zf.write(abs_path, arcname)
|
||||
|
||||
zip_buf.seek(0)
|
||||
|
||||
# Safe filename
|
||||
safe_email = re.sub(r'\W+', '_', current_user.email)
|
||||
filename = f"{safe_email}_export_{export_id}.zip"
|
||||
|
||||
return send_file(
|
||||
zip_buf,
|
||||
mimetype='application/zip',
|
||||
as_attachment=True,
|
||||
download_name=filename
|
||||
)
|
@ -61,11 +61,11 @@
|
||||
</table>
|
||||
|
||||
<button type="submit" class="btn btn-success">Confirm & Import</button>
|
||||
<a href="{{ url_for('importer.upload') }}" class="btn btn-secondary ms-2">Cancel</a>
|
||||
<a href="{{ url_for('utility.upload') }}" class="btn btn-secondary ms-2">Cancel</a>
|
||||
</form>
|
||||
{% else %}
|
||||
<div class="alert alert-info">
|
||||
No rows to review. <a href="{{ url_for('importer.upload') }}">Upload another CSV?</a>
|
||||
No rows to review. <a href="{{ url_for('utility.upload') }}">Upload another CSV?</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
@ -1,7 +1,7 @@
|
||||
You are ChatGPT, an expert Flask developer. I will upload two ZIP files:
|
||||
|
||||
* **plant-scan-main.zip** (the standalone sub-app)
|
||||
* **natureinpots\_main.zip** (the main app with its importer plugin)
|
||||
* **natureinpots\_main.zip** (the main app with its utility plugin)
|
||||
|
||||
When I upload them, **immediately reply**:
|
||||
|
||||
@ -62,11 +62,11 @@ Then, following the exact file structures in those ZIPs, **implement** all of th
|
||||
|
||||
---
|
||||
|
||||
## 3. MAIN-APP IMPORTER REFACTOR (“Nature in Pots”)
|
||||
## 3. MAIN-APP utility REFACTOR (“Nature in Pots”)
|
||||
|
||||
1. **Web-Based ZIP Upload**
|
||||
|
||||
* Change the importer form to accept a `.zip` file.
|
||||
* Change the utility form to accept a `.zip` file.
|
||||
* On upload, unzip into a temp directory expecting `plants.csv`, `media.csv`, and `images/`.
|
||||
* If only a CSV is uploaded, process it but skip media.
|
||||
|
||||
@ -98,7 +98,7 @@ Then, following the exact file structures in those ZIPs, **implement** all of th
|
||||
* Supply defaults for any non-nullable fields missing from `plants.csv`.
|
||||
* Pass all imported fields (e.g. `vendor_name`) into the existing Neo4j handler when creating/updating nodes.
|
||||
|
||||
6. **Manual Testing (Importer)**
|
||||
6. **Manual Testing (utility)**
|
||||
|
||||
* As a main-app user, upload the `<username>_export.zip`; confirm no duplicates on re-upload.
|
||||
* Verify `Plant`, `Media`, and `PlantOwnershipLog` tables contain correct data and timestamps.
|
||||
|
Reference in New Issue
Block a user