Work on file uploads and listing event files.

This commit is contained in:
Scott Idem
2021-06-15 18:05:56 -04:00
parent 415e452988
commit 0dc50e4509
12 changed files with 841 additions and 222 deletions

41
app/routers/event_file.py Normal file
View File

@@ -0,0 +1,41 @@
import datetime
from fastapi import APIRouter, Body, Depends, Header, HTTPException, Query, status
from pydantic import BaseModel, EmailStr, Field
from typing import Dict, List, Optional, Set, Union
from app.lib_general import log, logging
from app.config import settings
from app.db_sql import sql_insert, sql_update, sql_insert_or_update, sql_select, sql_delete, redis_lookup_id_random
from app.routers.api_crud import delete_obj_template, get_obj_template, get_obj_li_template, patch_obj_template, post_obj_template
from app.methods.event_file_methods import create_event_file_obj, load_event_file_obj # , update_event_file_obj
from app.models.event_file_models import Event_File_Base
from app.models.response_models import Resp_Body_Base, mk_resp
router = APIRouter()
@router.post('', response_model=Resp_Body_Base)
async def post_event_file_obj(
obj: Event_File_Base,
x_account_id: str = Header(...),
return_obj: Optional[bool] = True,
by_alias: Optional[bool] = True,
exclude_unset: Optional[bool] = True,
):
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
obj_type = 'event_file'
obj_data_dict = obj.dict(by_alias=False, exclude_unset=True)
result = post_obj_template(
obj_type=obj_type,
data=obj_data_dict,
return_obj=True,
by_alias=True,
exclude_unset=True,
)
return result