Skip to content

Commit 1d8d8bb

Browse files
chore(main): release 1.3.0
1 parent 31da3f7 commit 1d8d8bb

File tree

3 files changed

+105
-87
lines changed

3 files changed

+105
-87
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## [1.3.0](https://github.com/equinor/template-fastapi-react/compare/v1.2.1...v1.3.0) (2022-11-11)
4+
5+
6+
### Features
7+
8+
* allow each user to have their own todos ([9456ab8](https://github.com/equinor/template-fastapi-react/commit/9456ab84f5f5e0b804bd0011037ee72d7da49fbb))
9+
10+
11+
### Bug Fixes
12+
13+
* add missing dependency without causing infinite loop of rerendering ([8f5c01d](https://github.com/equinor/template-fastapi-react/commit/8f5c01d5141c4dbd4ac9b99ebc39ae10f378147f))
14+
* **api:** raise MissingPrivilegeException when relevant ([0c55af3](https://github.com/equinor/template-fastapi-react/commit/0c55af393a4ffc189a068c821545261eb10ef7d4))
15+
* **api:** raise MissingPrivilegeException when relevant ([613cc42](https://github.com/equinor/template-fastapi-react/commit/613cc4257699ddb1c2a772b54f28ccec84f2778b))
16+
* make todo title required, not optional ([bc8dab6](https://github.com/equinor/template-fastapi-react/commit/bc8dab62079ded3e87c1113e81f1cd9911ad1a65))
17+
* only allow users to delete their own todos ([1cf1e7a](https://github.com/equinor/template-fastapi-react/commit/1cf1e7a8eefac27552dcdc9df0a30cf59c042eab))
18+
* test suite ([31da3f7](https://github.com/equinor/template-fastapi-react/commit/31da3f7e720d0838e59e280aa4d873b44e24cecb))
19+
* **tests:** fix up integration tests with per-user todos ([b7cc0ca](https://github.com/equinor/template-fastapi-react/commit/b7cc0caa51535020bb329c7c21cde4b458baa81c))
20+
321
## [1.2.1](https://github.com/equinor/template-fastapi-react/compare/v1.2.0...v1.2.1) (2022-11-09)
422

523

api/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "api"
3-
version = "1.2.1" # x-release-please-version
3+
version = "1.3.0" # x-release-please-version
44
description = "API for Template Fastapi React"
55
authors = []
66
license = ""

api/src/app.py

Lines changed: 86 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,86 @@
1-
import click
2-
from fastapi import APIRouter, FastAPI, Security
3-
from fastapi.exceptions import RequestValidationError
4-
from starlette.middleware import Middleware
5-
6-
from authentication.authentication import auth_with_jwt
7-
from common.exception_handlers import validation_exception_handler
8-
from common.middleware import TimerHeaderMiddleware
9-
from common.responses import responses
10-
from config import config
11-
from features.health_check import health_check_feature
12-
from features.todo import todo_feature
13-
from features.whoami import whoami_feature
14-
15-
description_md = """
16-
### Description
17-
A RESTful API for handling todo items.
18-
19-
Anyone in Equinor are authorized to use the API.
20-
* Click **Authorize** to login and start testing.
21-
22-
### Resources
23-
* [Docs](https://equinor.github.io/template-fastapi-react/)
24-
* [Github](https://github.com/equinor/template-fastapi-react)
25-
26-
For questions about usage or expanding the API, create issue on Github or see docs.
27-
"""
28-
29-
30-
def create_app() -> FastAPI:
31-
public_routes = APIRouter()
32-
public_routes.include_router(health_check_feature.router)
33-
34-
authenticated_routes = APIRouter()
35-
authenticated_routes.include_router(todo_feature.router)
36-
authenticated_routes.include_router(whoami_feature.router)
37-
38-
middleware = [Middleware(TimerHeaderMiddleware)]
39-
40-
exception_handlers = {RequestValidationError: validation_exception_handler}
41-
42-
app = FastAPI(
43-
root_path="/api",
44-
title="Template FastAPI React",
45-
version="1.2.1", # x-release-please-version
46-
description=description_md,
47-
responses=responses,
48-
middleware=middleware,
49-
license_info={"name": "MIT", "url": "https://github.com/equinor/template-fastapi-react/blob/main/LICENSE.md"},
50-
exception_handlers=exception_handlers, # type: ignore
51-
swagger_ui_init_oauth={
52-
"clientId": config.OAUTH_CLIENT_ID,
53-
"appName": "TemplateFastAPIReact",
54-
"usePkceWithAuthorizationCodeGrant": True,
55-
"scopes": config.OAUTH_AUTH_SCOPE,
56-
"useBasicAuthenticationWithAccessCodeGrant": True,
57-
},
58-
)
59-
60-
app.include_router(authenticated_routes, dependencies=[Security(auth_with_jwt)])
61-
app.include_router(public_routes)
62-
63-
return app
64-
65-
66-
@click.group()
67-
def cli():
68-
pass
69-
70-
71-
@cli.command()
72-
def run():
73-
import uvicorn
74-
75-
uvicorn.run(
76-
"app:create_app",
77-
host="0.0.0.0", # nosec
78-
port=5000,
79-
factory=True,
80-
reload=config.ENVIRONMENT == "local",
81-
log_level=config.LOGGER_LEVEL.lower(),
82-
)
83-
84-
85-
if __name__ == "__main__":
86-
cli() # run commands in cli() group
1+
import click
2+
from fastapi import APIRouter, FastAPI, Security
3+
from fastapi.exceptions import RequestValidationError
4+
from starlette.middleware import Middleware
5+
6+
from authentication.authentication import auth_with_jwt
7+
from common.exception_handlers import validation_exception_handler
8+
from common.middleware import TimerHeaderMiddleware
9+
from common.responses import responses
10+
from config import config
11+
from features.health_check import health_check_feature
12+
from features.todo import todo_feature
13+
from features.whoami import whoami_feature
14+
15+
description_md = """
16+
### Description
17+
A RESTful API for handling todo items.
18+
19+
Anyone in Equinor are authorized to use the API.
20+
* Click **Authorize** to login and start testing.
21+
22+
### Resources
23+
* [Docs](https://equinor.github.io/template-fastapi-react/)
24+
* [Github](https://github.com/equinor/template-fastapi-react)
25+
26+
For questions about usage or expanding the API, create issue on Github or see docs.
27+
"""
28+
29+
30+
def create_app() -> FastAPI:
31+
public_routes = APIRouter()
32+
public_routes.include_router(health_check_feature.router)
33+
34+
authenticated_routes = APIRouter()
35+
authenticated_routes.include_router(todo_feature.router)
36+
authenticated_routes.include_router(whoami_feature.router)
37+
38+
middleware = [Middleware(TimerHeaderMiddleware)]
39+
40+
exception_handlers = {RequestValidationError: validation_exception_handler}
41+
42+
app = FastAPI(
43+
root_path="/api",
44+
title="Template FastAPI React",
45+
version="1.3.0", # x-release-please-version
46+
description=description_md,
47+
responses=responses,
48+
middleware=middleware,
49+
license_info={"name": "MIT", "url": "https://github.com/equinor/template-fastapi-react/blob/main/LICENSE.md"},
50+
exception_handlers=exception_handlers, # type: ignore
51+
swagger_ui_init_oauth={
52+
"clientId": config.OAUTH_CLIENT_ID,
53+
"appName": "TemplateFastAPIReact",
54+
"usePkceWithAuthorizationCodeGrant": True,
55+
"scopes": config.OAUTH_AUTH_SCOPE,
56+
"useBasicAuthenticationWithAccessCodeGrant": True,
57+
},
58+
)
59+
60+
app.include_router(authenticated_routes, dependencies=[Security(auth_with_jwt)])
61+
app.include_router(public_routes)
62+
63+
return app
64+
65+
66+
@click.group()
67+
def cli():
68+
pass
69+
70+
71+
@cli.command()
72+
def run():
73+
import uvicorn
74+
75+
uvicorn.run(
76+
"app:create_app",
77+
host="0.0.0.0", # nosec
78+
port=5000,
79+
factory=True,
80+
reload=config.ENVIRONMENT == "local",
81+
log_level=config.LOGGER_LEVEL.lower(),
82+
)
83+
84+
85+
if __name__ == "__main__":
86+
cli() # run commands in cli() group

0 commit comments

Comments
 (0)