Updated courses model and fixed rich text editor tool bar drop down problem
@@ -0,0 +1,51 @@
|
||||
"""update course string max length
|
||||
|
||||
Revision ID: 01b284ceabf9
|
||||
Revises: 71a20fad83f9
|
||||
Create Date: 2024-10-01 12:59:07.159639
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel.sql.sqltypes
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '01b284ceabf9'
|
||||
down_revision = '71a20fad83f9'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('course', 'long_description',
|
||||
existing_type=sa.VARCHAR(length=2048),
|
||||
type_=sqlmodel.sql.sqltypes.AutoString(length=8192),
|
||||
existing_nullable=False)
|
||||
op.alter_column('course', 'information',
|
||||
existing_type=sa.VARCHAR(length=1024),
|
||||
type_=sqlmodel.sql.sqltypes.AutoString(length=8192),
|
||||
existing_nullable=False)
|
||||
op.alter_column('course', 'contant',
|
||||
existing_type=sa.VARCHAR(length=1024),
|
||||
type_=sqlmodel.sql.sqltypes.AutoString(length=8192),
|
||||
existing_nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('course', 'contant',
|
||||
existing_type=sqlmodel.sql.sqltypes.AutoString(length=8192),
|
||||
type_=sa.VARCHAR(length=1024),
|
||||
existing_nullable=False)
|
||||
op.alter_column('course', 'information',
|
||||
existing_type=sqlmodel.sql.sqltypes.AutoString(length=8192),
|
||||
type_=sa.VARCHAR(length=1024),
|
||||
existing_nullable=False)
|
||||
op.alter_column('course', 'long_description',
|
||||
existing_type=sqlmodel.sql.sqltypes.AutoString(length=8192),
|
||||
type_=sa.VARCHAR(length=2048),
|
||||
existing_nullable=False)
|
||||
# ### end Alembic commands ###
|
@@ -0,0 +1,67 @@
|
||||
"""update course string max length
|
||||
|
||||
Revision ID: 8e38378fd2f3
|
||||
Revises: 01b284ceabf9
|
||||
Create Date: 2024-10-01 13:11:16.073772
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel.sql.sqltypes
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '8e38378fd2f3'
|
||||
down_revision = '01b284ceabf9'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('course', 'sort_description',
|
||||
existing_type=sa.VARCHAR(length=1024),
|
||||
type_=sqlmodel.sql.sqltypes.AutoString(length=32768),
|
||||
existing_nullable=False)
|
||||
op.alter_column('course', 'long_description',
|
||||
existing_type=sa.VARCHAR(length=8192),
|
||||
type_=sqlmodel.sql.sqltypes.AutoString(length=32768),
|
||||
existing_nullable=False)
|
||||
op.alter_column('course', 'information',
|
||||
existing_type=sa.VARCHAR(length=8192),
|
||||
type_=sqlmodel.sql.sqltypes.AutoString(length=32768),
|
||||
existing_nullable=False)
|
||||
op.alter_column('course', 'contant',
|
||||
existing_type=sa.VARCHAR(length=8192),
|
||||
type_=sqlmodel.sql.sqltypes.AutoString(length=32768),
|
||||
existing_nullable=False)
|
||||
op.alter_column('course', 'remark',
|
||||
existing_type=sa.VARCHAR(length=512),
|
||||
type_=sqlmodel.sql.sqltypes.AutoString(length=32768),
|
||||
existing_nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('course', 'remark',
|
||||
existing_type=sqlmodel.sql.sqltypes.AutoString(length=32768),
|
||||
type_=sa.VARCHAR(length=512),
|
||||
existing_nullable=False)
|
||||
op.alter_column('course', 'contant',
|
||||
existing_type=sqlmodel.sql.sqltypes.AutoString(length=32768),
|
||||
type_=sa.VARCHAR(length=8192),
|
||||
existing_nullable=False)
|
||||
op.alter_column('course', 'information',
|
||||
existing_type=sqlmodel.sql.sqltypes.AutoString(length=32768),
|
||||
type_=sa.VARCHAR(length=8192),
|
||||
existing_nullable=False)
|
||||
op.alter_column('course', 'long_description',
|
||||
existing_type=sqlmodel.sql.sqltypes.AutoString(length=32768),
|
||||
type_=sa.VARCHAR(length=8192),
|
||||
existing_nullable=False)
|
||||
op.alter_column('course', 'sort_description',
|
||||
existing_type=sqlmodel.sql.sqltypes.AutoString(length=32768),
|
||||
type_=sa.VARCHAR(length=1024),
|
||||
existing_nullable=False)
|
||||
# ### end Alembic commands ###
|
@@ -26,10 +26,11 @@ if settings.BACKEND_CORS_ORIGINS:
|
||||
CORSMiddleware,
|
||||
allow_origins=[
|
||||
str(origin).strip("/") for origin in settings.BACKEND_CORS_ORIGINS
|
||||
],
|
||||
] + ["http://localhost:3000"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
|
||||
)
|
||||
|
||||
app.include_router(api_router, prefix=settings.API_V1_STR)
|
||||
|
@@ -186,11 +186,11 @@ class AboutsListPublic(SQLModel):
|
||||
|
||||
class CourseBase(SQLModel):
|
||||
title: str = Field(max_length=255)
|
||||
sort_description: str = Field(max_length=1024)
|
||||
long_description: str = Field(max_length=2048)
|
||||
information: str = Field(max_length=1024)
|
||||
contant: str = Field(max_length=1024)
|
||||
remark: str = Field(max_length=512)
|
||||
sort_description: str = Field(max_length=32768)
|
||||
long_description: str = Field(max_length=32768)
|
||||
information: str = Field(max_length=32768)
|
||||
contant: str = Field(max_length=32768)
|
||||
remark: str = Field(max_length=32768)
|
||||
|
||||
class CourseCreate(CourseBase):
|
||||
pass
|
||||
@@ -208,6 +208,7 @@ class Course(CourseBase, table=True):
|
||||
class CoursePublic(CourseBase):
|
||||
id: uuid.UUID
|
||||
title: str
|
||||
images: list["Image"]
|
||||
created_at: datetime
|
||||
|
||||
class CoursesPublic(SQLModel):
|
||||
@@ -219,6 +220,10 @@ class CoursesPublic(SQLModel):
|
||||
class ImageBase(SQLModel):
|
||||
image: str = Field(max_length=255)
|
||||
index: int
|
||||
|
||||
|
||||
class ImagePublic(ImageBase):
|
||||
id: uuid.UUID
|
||||
|
||||
class ImageCreate(ImageBase):
|
||||
course_id: uuid.UUID
|
||||
@@ -227,6 +232,7 @@ class Image(ImageBase, table=True):
|
||||
id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
|
||||
course_id: uuid.UUID = Field(foreign_key="course.id", nullable=False, ondelete="CASCADE")
|
||||
course: Course | None = Relationship(back_populates="images")
|
||||
|
||||
|
||||
|
||||
class Info_ImageBase(SQLModel):
|
||||
|
BIN
backend/static/tmp/303c7ae4-4766-403e-9e8f-938a9ccabc1b.jpeg
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
backend/static/tmp/3a47cd2d-d614-42e5-a48d-f62fea9b53b4.jpg
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
backend/static/tmp/493b5d0f-1352-47e5-8457-877a96c9483b.jpeg
Normal file
After Width: | Height: | Size: 154 KiB |
BIN
backend/static/tmp/764ca2cb-2e4c-49f9-bb79-69cee260fc83.jpg
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
backend/static/tmp/7ce1986b-750d-4f3b-b0aa-0e7a503bcf8e.jpg
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
backend/static/tmp/8739cfc9-ce2c-4a12-be08-2a6c7d546fb0.jpg
Normal file
After Width: | Height: | Size: 506 KiB |
BIN
backend/static/tmp/9dd15e70-dd1a-4864-a210-a55f4e7f1c77.jpeg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
backend/static/tmp/bbdc1b9e-8b77-49b7-b27c-7fcbab114383.jpeg
Normal file
After Width: | Height: | Size: 146 KiB |
BIN
backend/static/tmp/c107e597-3935-4adf-9849-98b59e3a020f.png
Normal file
After Width: | Height: | Size: 940 KiB |
BIN
backend/static/tmp/c791f094-3d98-4bfe-9620-c6ecc183798d.jpg
Normal file
After Width: | Height: | Size: 35 KiB |