Bladeren bron

Merge branch 'master' of http://git.choozmo.com:3000/ai-anchor/video-maker

tomoya 2 jaren geleden
bovenliggende
commit
4e7a38dbea

+ 1 - 1
.env

@@ -50,7 +50,7 @@ PGADMIN_DEFAULT_PASSWORD=password
 
 
 # Initial data
 # Initial data
 MEMBERSHIP_STATUS=["normal", "infinite"]
 MEMBERSHIP_STATUS=["normal", "infinite"]
-PROGRESS_STATE=["waiting", "processing", "completed"]
+PROGRESS_STATE=["waiting", "processing", "completed", "failed"]
 
 
 # local storage
 # local storage
 LOCAL_ZIP_STORAGE=local_storage/zips
 LOCAL_ZIP_STORAGE=local_storage/zips

+ 1 - 2
backend/app/app/api/api_v1/api.py

@@ -1,10 +1,9 @@
 from fastapi import APIRouter
 from fastapi import APIRouter
 
 
-from app.api.api_v1.endpoints import items, login, users, utils, videos
+from app.api.api_v1.endpoints import  login, users, utils, videos
 
 
 api_router = APIRouter()
 api_router = APIRouter()
 api_router.include_router(login.router, tags=["login"])
 api_router.include_router(login.router, tags=["login"])
 api_router.include_router(users.router, prefix="/users", tags=["users"])
 api_router.include_router(users.router, prefix="/users", tags=["users"])
 api_router.include_router(utils.router, prefix="/utils", tags=["utils"])
 api_router.include_router(utils.router, prefix="/utils", tags=["utils"])
-api_router.include_router(items.router, prefix="/items", tags=["items"])
 api_router.include_router(videos.router, prefix="/videos", tags=["videos"])
 api_router.include_router(videos.router, prefix="/videos", tags=["videos"])

+ 0 - 99
backend/app/app/api/api_v1/endpoints/items.py

@@ -1,99 +0,0 @@
-from typing import Any, List
-
-from fastapi import APIRouter, Depends, HTTPException
-from sqlalchemy.orm import Session
-
-from app import crud, models, schemas
-from app.api import deps
-
-router = APIRouter()
-
-
-@router.get("/", response_model=List[schemas.Item])
-def read_items(
-    db: Session = Depends(deps.get_db),
-    skip: int = 0,
-    limit: int = 100,
-    current_user: models.User = Depends(deps.get_current_active_user),
-) -> Any:
-    """
-    Retrieve items.
-    """
-    if crud.user.is_superuser(current_user):
-        items = crud.item.get_multi(db, skip=skip, limit=limit)
-    else:
-        items = crud.item.get_multi_by_owner(
-            db=db, owner_id=current_user.id, skip=skip, limit=limit
-        )
-    return items
-
-
-@router.post("/", response_model=schemas.Item)
-def create_item(
-    *,
-    db: Session = Depends(deps.get_db),
-    item_in: schemas.ItemCreate,
-    current_user: models.User = Depends(deps.get_current_active_user),
-) -> Any:
-    """
-    Create new item.
-    """
-    item = crud.item.create_with_owner(db=db, obj_in=item_in, owner_id=current_user.id)
-    return item
-
-
-@router.put("/{id}", response_model=schemas.Item)
-def update_item(
-    *,
-    db: Session = Depends(deps.get_db),
-    id: int,
-    item_in: schemas.ItemUpdate,
-    current_user: models.User = Depends(deps.get_current_active_user),
-) -> Any:
-    """
-    Update an item.
-    """
-    item = crud.item.get(db=db, id=id)
-    if not item:
-        raise HTTPException(status_code=404, detail="Item not found")
-    if not crud.user.is_superuser(current_user) and (item.owner_id != current_user.id):
-        raise HTTPException(status_code=400, detail="Not enough permissions")
-    item = crud.item.update(db=db, db_obj=item, obj_in=item_in)
-    return item
-
-
-@router.get("/{id}", response_model=schemas.Item)
-def read_item(
-    *,
-    db: Session = Depends(deps.get_db),
-    id: int,
-    current_user: models.User = Depends(deps.get_current_active_user),
-) -> Any:
-    """
-    Get item by ID.
-    """
-    item = crud.item.get(db=db, id=id)
-    if not item:
-        raise HTTPException(status_code=404, detail="Item not found")
-    if not crud.user.is_superuser(current_user) and (item.owner_id != current_user.id):
-        raise HTTPException(status_code=400, detail="Not enough permissions")
-    return item
-
-
-@router.delete("/{id}", response_model=schemas.Item)
-def delete_item(
-    *,
-    db: Session = Depends(deps.get_db),
-    id: int,
-    current_user: models.User = Depends(deps.get_current_active_user),
-) -> Any:
-    """
-    Delete an item.
-    """
-    item = crud.item.get(db=db, id=id)
-    if not item:
-        raise HTTPException(status_code=404, detail="Item not found")
-    if not crud.user.is_superuser(current_user) and (item.owner_id != current_user.id):
-        raise HTTPException(status_code=400, detail="Not enough permissions")
-    item = crud.item.remove(db=db, id=id)
-    return item

+ 2 - 0
backend/app/app/api/api_v1/endpoints/videos.py

@@ -45,6 +45,8 @@ def upload_plot(
     *,
     *,
     db: Session = Depends(deps.get_db),
     db: Session = Depends(deps.get_db),
     title: str=Form(...), 
     title: str=Form(...), 
+    anchor_id: int=Form(...),
+    lang_id: int=Form(...),
     upload_file: UploadFile=File(),
     upload_file: UploadFile=File(),
     current_user: models.User = Depends(deps.get_current_active_user),
     current_user: models.User = Depends(deps.get_current_active_user),
 ) -> Any:
 ) -> Any:

+ 0 - 1
backend/app/app/crud/__init__.py

@@ -1,4 +1,3 @@
-from .crud_item import item
 from .crud_user import user
 from .crud_user import user
 from .crud_video import video
 from .crud_video import video
 
 

+ 6 - 0
backend/app/app/models/character.py

@@ -0,0 +1,6 @@
+from typing import TYPE_CHECKING
+
+from sqlalchemy import Column, ForeignKey, Integer, String
+from sqlalchemy.orm import relationship
+
+from app.db.base_class import Base

+ 6 - 0
backend/app/app/models/lang.py

@@ -0,0 +1,6 @@
+from typing import TYPE_CHECKING
+
+from sqlalchemy import Column, ForeignKey, Integer, String
+from sqlalchemy.orm import relationship
+
+from app.db.base_class import Base

+ 0 - 1
backend/app/app/models/user.py

@@ -6,7 +6,6 @@ from sqlalchemy.orm import relationship
 from app.db.base_class import Base
 from app.db.base_class import Base
 
 
 if TYPE_CHECKING:
 if TYPE_CHECKING:
-    from .item import Item  # noqa: F401
     from .enum import Membership
     from .enum import Membership
 
 
 class User(Base):
 class User(Base):

+ 0 - 2
backend/app/app/schemas/__init__.py

@@ -1,5 +1,3 @@
-from .item import Item, ItemCreate, ItemInDB, ItemUpdate
-from .msg import Msg
 from .token import Token, TokenPayload
 from .token import Token, TokenPayload
 from .user import User, UserCreate, UserInDB, UserUpdate
 from .user import User, UserCreate, UserInDB, UserUpdate
 from .video import Video, VideoCreate, VideoInDB, VideoUpdate
 from .video import Video, VideoCreate, VideoInDB, VideoUpdate

+ 0 - 39
backend/app/app/schemas/item.py

@@ -1,39 +0,0 @@
-from typing import Optional
-
-from pydantic import BaseModel
-
-
-# Shared properties
-class ItemBase(BaseModel):
-    title: Optional[str] = None
-    description: Optional[str] = None
-
-
-# Properties to receive on item creation
-class ItemCreate(ItemBase):
-    title: str
-
-
-# Properties to receive on item update
-class ItemUpdate(ItemBase):
-    pass
-
-
-# Properties shared by models stored in DB
-class ItemInDBBase(ItemBase):
-    id: int
-    title: str
-    owner_id: int
-
-    class Config:
-        orm_mode = True
-
-
-# Properties to return to client
-class Item(ItemInDBBase):
-    pass
-
-
-# Properties properties stored in DB
-class ItemInDB(ItemInDBBase):
-    pass

+ 0 - 5
backend/app/app/schemas/msg.py

@@ -1,5 +0,0 @@
-from pydantic import BaseModel
-
-
-class Msg(BaseModel):
-    msg: str

+ 2 - 2
backend/app/app/utils.py

@@ -3,8 +3,8 @@ from datetime import datetime, timedelta
 from pathlib import Path
 from pathlib import Path
 from typing import Any, Dict, Optional
 from typing import Any, Dict, Optional
 
 
-import emails
-from emails.template import JinjaTemplate
+#import emails
+#from emails.template import JinjaTemplate
 from jose import jwt
 from jose import jwt
 
 
 from app.core.config import settings
 from app.core.config import settings