Skip to content

Commit

Permalink
chore(main): release 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and sebastianvitterso committed Nov 14, 2022
1 parent 31da3f7 commit 1d8d8bb
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 87 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## [1.3.0](https://github.com/equinor/template-fastapi-react/compare/v1.2.1...v1.3.0) (2022-11-11)


### Features

* allow each user to have their own todos ([9456ab8](https://github.com/equinor/template-fastapi-react/commit/9456ab84f5f5e0b804bd0011037ee72d7da49fbb))


### Bug Fixes

* add missing dependency without causing infinite loop of rerendering ([8f5c01d](https://github.com/equinor/template-fastapi-react/commit/8f5c01d5141c4dbd4ac9b99ebc39ae10f378147f))
* **api:** raise MissingPrivilegeException when relevant ([0c55af3](https://github.com/equinor/template-fastapi-react/commit/0c55af393a4ffc189a068c821545261eb10ef7d4))
* **api:** raise MissingPrivilegeException when relevant ([613cc42](https://github.com/equinor/template-fastapi-react/commit/613cc4257699ddb1c2a772b54f28ccec84f2778b))
* make todo title required, not optional ([bc8dab6](https://github.com/equinor/template-fastapi-react/commit/bc8dab62079ded3e87c1113e81f1cd9911ad1a65))
* only allow users to delete their own todos ([1cf1e7a](https://github.com/equinor/template-fastapi-react/commit/1cf1e7a8eefac27552dcdc9df0a30cf59c042eab))
* test suite ([31da3f7](https://github.com/equinor/template-fastapi-react/commit/31da3f7e720d0838e59e280aa4d873b44e24cecb))
* **tests:** fix up integration tests with per-user todos ([b7cc0ca](https://github.com/equinor/template-fastapi-react/commit/b7cc0caa51535020bb329c7c21cde4b458baa81c))

## [1.2.1](https://github.com/equinor/template-fastapi-react/compare/v1.2.0...v1.2.1) (2022-11-09)


Expand Down
2 changes: 1 addition & 1 deletion api/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "api"
version = "1.2.1" # x-release-please-version
version = "1.3.0" # x-release-please-version
description = "API for Template Fastapi React"
authors = []
license = ""
Expand Down
172 changes: 86 additions & 86 deletions api/src/app.py
Original file line number Diff line number Diff line change
@@ -1,86 +1,86 @@
import click
from fastapi import APIRouter, FastAPI, Security
from fastapi.exceptions import RequestValidationError
from starlette.middleware import Middleware

from authentication.authentication import auth_with_jwt
from common.exception_handlers import validation_exception_handler
from common.middleware import TimerHeaderMiddleware
from common.responses import responses
from config import config
from features.health_check import health_check_feature
from features.todo import todo_feature
from features.whoami import whoami_feature

description_md = """
### Description
A RESTful API for handling todo items.
Anyone in Equinor are authorized to use the API.
* Click **Authorize** to login and start testing.
### Resources
* [Docs](https://equinor.github.io/template-fastapi-react/)
* [Github](https://github.com/equinor/template-fastapi-react)
For questions about usage or expanding the API, create issue on Github or see docs.
"""


def create_app() -> FastAPI:
public_routes = APIRouter()
public_routes.include_router(health_check_feature.router)

authenticated_routes = APIRouter()
authenticated_routes.include_router(todo_feature.router)
authenticated_routes.include_router(whoami_feature.router)

middleware = [Middleware(TimerHeaderMiddleware)]

exception_handlers = {RequestValidationError: validation_exception_handler}

app = FastAPI(
root_path="/api",
title="Template FastAPI React",
version="1.2.1", # x-release-please-version
description=description_md,
responses=responses,
middleware=middleware,
license_info={"name": "MIT", "url": "https://github.com/equinor/template-fastapi-react/blob/main/LICENSE.md"},
exception_handlers=exception_handlers, # type: ignore
swagger_ui_init_oauth={
"clientId": config.OAUTH_CLIENT_ID,
"appName": "TemplateFastAPIReact",
"usePkceWithAuthorizationCodeGrant": True,
"scopes": config.OAUTH_AUTH_SCOPE,
"useBasicAuthenticationWithAccessCodeGrant": True,
},
)

app.include_router(authenticated_routes, dependencies=[Security(auth_with_jwt)])
app.include_router(public_routes)

return app


@click.group()
def cli():
pass


@cli.command()
def run():
import uvicorn

uvicorn.run(
"app:create_app",
host="0.0.0.0", # nosec
port=5000,
factory=True,
reload=config.ENVIRONMENT == "local",
log_level=config.LOGGER_LEVEL.lower(),
)


if __name__ == "__main__":
cli() # run commands in cli() group
import click
from fastapi import APIRouter, FastAPI, Security
from fastapi.exceptions import RequestValidationError
from starlette.middleware import Middleware

from authentication.authentication import auth_with_jwt
from common.exception_handlers import validation_exception_handler
from common.middleware import TimerHeaderMiddleware
from common.responses import responses
from config import config
from features.health_check import health_check_feature
from features.todo import todo_feature
from features.whoami import whoami_feature

description_md = """
### Description
A RESTful API for handling todo items.
Anyone in Equinor are authorized to use the API.
* Click **Authorize** to login and start testing.
### Resources
* [Docs](https://equinor.github.io/template-fastapi-react/)
* [Github](https://github.com/equinor/template-fastapi-react)
For questions about usage or expanding the API, create issue on Github or see docs.
"""


def create_app() -> FastAPI:
public_routes = APIRouter()
public_routes.include_router(health_check_feature.router)

authenticated_routes = APIRouter()
authenticated_routes.include_router(todo_feature.router)
authenticated_routes.include_router(whoami_feature.router)

middleware = [Middleware(TimerHeaderMiddleware)]

exception_handlers = {RequestValidationError: validation_exception_handler}

app = FastAPI(
root_path="/api",
title="Template FastAPI React",
version="1.3.0", # x-release-please-version
description=description_md,
responses=responses,
middleware=middleware,
license_info={"name": "MIT", "url": "https://github.com/equinor/template-fastapi-react/blob/main/LICENSE.md"},
exception_handlers=exception_handlers, # type: ignore
swagger_ui_init_oauth={
"clientId": config.OAUTH_CLIENT_ID,
"appName": "TemplateFastAPIReact",
"usePkceWithAuthorizationCodeGrant": True,
"scopes": config.OAUTH_AUTH_SCOPE,
"useBasicAuthenticationWithAccessCodeGrant": True,
},
)

app.include_router(authenticated_routes, dependencies=[Security(auth_with_jwt)])
app.include_router(public_routes)

return app


@click.group()
def cli():
pass


@cli.command()
def run():
import uvicorn

uvicorn.run(
"app:create_app",
host="0.0.0.0", # nosec
port=5000,
factory=True,
reload=config.ENVIRONMENT == "local",
log_level=config.LOGGER_LEVEL.lower(),
)


if __name__ == "__main__":
cli() # run commands in cli() group

0 comments on commit 1d8d8bb

Please sign in to comment.