Update apps.py

This commit is contained in:
童颖佳 2023-02-22 17:19:27 +08:00 committed by GitHub
parent 5f0d363894
commit 3879c2845a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,22 +3,20 @@ from typing import Optional, List
from fastapi import APIRouter, status, Depends
from pydantic import BaseModel
from starlette.responses import JSONResponse
import os, io, sys, platform, shutil, time, subprocess, json, datetime
from api.model.generic import GenericMessage, GenericExceptionMessage
from api.model.app import App
from api.service import manage
from api.utils import shell_execute
router = APIRouter()
@router.get("", responses={status.HTTP_200_OK: {"model": List[App]}})
def list_my_apps(app_name: Optional[str] = None, status_code: Optional[int] = None,
status: Optional[str] = None):
fields = {}
if app_name:
fields['name'] = app_name
if status_code:
fields['status_code'] = status_code
if status:
fields['status'] = status
@router.get("")
def list_my_apps():
list = manage.get_my_app()
return JSONResponse(content=list)
return manage.get_my_app()
@router.get("/start")
def start_app(app_name: Optional[str] = None):
return {}