2023-03-09 09:47:33 -08:00
|
|
|
from hatchway import QueryOrBody, api_view
|
2022-12-10 20:03:14 -08:00
|
|
|
|
2022-12-10 23:25:48 -08:00
|
|
|
from .. import schemas
|
2022-12-10 20:03:14 -08:00
|
|
|
from ..models import Application
|
|
|
|
|
|
|
|
|
2023-02-07 11:07:15 -08:00
|
|
|
@api_view.post
|
2023-03-09 09:47:33 -08:00
|
|
|
def add_app(
|
|
|
|
request,
|
|
|
|
client_name: QueryOrBody[str],
|
|
|
|
redirect_uris: QueryOrBody[str],
|
|
|
|
scopes: QueryOrBody[None | str] = None,
|
|
|
|
website: QueryOrBody[None | str] = None,
|
|
|
|
) -> schemas.Application:
|
2023-05-03 21:42:37 -07:00
|
|
|
application = Application.create(
|
|
|
|
client_name=client_name,
|
2023-03-09 09:47:33 -08:00
|
|
|
website=website,
|
|
|
|
redirect_uris=redirect_uris,
|
2023-05-03 21:42:37 -07:00
|
|
|
scopes=scopes,
|
2022-12-10 20:03:14 -08:00
|
|
|
)
|
2023-02-07 11:07:15 -08:00
|
|
|
return schemas.Application.from_orm(application)
|