from typing import Any, List, Optional
import subprocess
from fastapi import UploadFile, File, Form
from fastapi.responses import FileResponse
from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from datetime import datetime
import app.crud as crud
import app.models as models
import app.schemas as schemas 
from app.api import deps

from app.core.celery_app import celery_app
from app.core.config import settings
from pathlib import Path

from app.core.celery_app import celery_app

BACKEND_ZIP_STORAGE = Path("/app").joinpath(settings.BACKEND_ZIP_STORAGE)
LOCAL_ZIP_STORAGE = Path("/").joinpath(settings.LOCAL_ZIP_STORAGE)


router = APIRouter()



@router.post("/")
async def post_reputation(
    *,
    db: Session = Depends(deps.get_db),
    current_user: models.User = Depends(deps.get_current_active_user),
    posted_article: schemas.ArticleCreate = Depends(schemas.ArticleCreate.as_form)
) -> Any:
    """
    Create new video.
    """
    
    #print(posted_article)
    article = crud.article.create_with_owner(db=db, obj_in=posted_article, owner_id=current_user.id, posted_datetime=str(datetime.now()))
    if article:
        return {"id":article.id}