ohmyapi 0.1.13__py3-none-any.whl → 0.1.15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ohmyapi/builtin/auth/models.py +12 -13
- ohmyapi/builtin/auth/routes.py +1 -1
- ohmyapi/core/templates/app/routes.py.j2 +1 -1
- ohmyapi/db/__init__.py +7 -0
- {ohmyapi-0.1.13.dist-info → ohmyapi-0.1.15.dist-info}/METADATA +6 -6
- {ohmyapi-0.1.13.dist-info → ohmyapi-0.1.15.dist-info}/RECORD +8 -8
- {ohmyapi-0.1.13.dist-info → ohmyapi-0.1.15.dist-info}/WHEEL +0 -0
- {ohmyapi-0.1.13.dist-info → ohmyapi-0.1.15.dist-info}/entry_points.txt +0 -0
ohmyapi/builtin/auth/models.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
from functools import wraps
|
1
2
|
from typing import Optional, List
|
2
|
-
from ohmyapi.
|
3
|
+
from ohmyapi.router import HTTPException
|
4
|
+
from ohmyapi.db import Model, field, pre_save, pre_delete
|
3
5
|
from passlib.context import CryptContext
|
4
6
|
from tortoise.contrib.pydantic import pydantic_queryset_creator
|
5
7
|
|
@@ -7,24 +9,22 @@ pwd_context = CryptContext(schemes=["argon2"], deprecated="auto")
|
|
7
9
|
|
8
10
|
|
9
11
|
class Group(Model):
|
10
|
-
id = field.data.UUIDField(pk=True)
|
11
|
-
name = field.CharField(max_length=42, index=True)
|
12
|
+
id: str = field.data.UUIDField(pk=True)
|
13
|
+
name: str = field.CharField(max_length=42, index=True)
|
12
14
|
|
13
15
|
|
14
16
|
class User(Model):
|
15
|
-
id = field.data.UUIDField(pk=True)
|
16
|
-
email = field.CharField(max_length=255, unique=True, index=True)
|
17
|
-
username = field.CharField(max_length=150, unique=True)
|
18
|
-
password_hash = field.CharField(max_length=128)
|
19
|
-
is_admin = field.BooleanField(default=False)
|
20
|
-
is_staff = field.BooleanField(default=False)
|
21
|
-
groups:
|
22
|
-
|
17
|
+
id: str = field.data.UUIDField(pk=True)
|
18
|
+
email: str = field.CharField(max_length=255, unique=True, index=True)
|
19
|
+
username: str = field.CharField(max_length=150, unique=True)
|
20
|
+
password_hash: str = field.CharField(max_length=128)
|
21
|
+
is_admin: bool = field.BooleanField(default=False)
|
22
|
+
is_staff: bool = field.BooleanField(default=False)
|
23
|
+
groups: field.ManyToManyRelation[Group] = field.ManyToManyField("ohmyapi_auth.Group", related_name="users", through='user_groups')
|
23
24
|
|
24
25
|
class Schema:
|
25
26
|
exclude = 'password_hash',
|
26
27
|
|
27
|
-
|
28
28
|
def set_password(self, raw_password: str) -> None:
|
29
29
|
"""Hash and store the password."""
|
30
30
|
self.password_hash = pwd_context.hash(raw_password)
|
@@ -40,4 +40,3 @@ class User(Model):
|
|
40
40
|
if user and user.verify_password(password):
|
41
41
|
return user
|
42
42
|
return None
|
43
|
-
|
ohmyapi/builtin/auth/routes.py
CHANGED
@@ -5,7 +5,7 @@ from . import models
|
|
5
5
|
# Expose your app's routes via `router = fastapi.APIRouter`.
|
6
6
|
# Use prefixes wisely to avoid cross-app namespace-collisions.
|
7
7
|
# Tags improve the UX of the OpenAPI docs at /docs.
|
8
|
-
router = APIRouter(prefix="/{{ app_name }}", tags=[{{ app_name }}])
|
8
|
+
router = APIRouter(prefix="/{{ app_name }}", tags=['{{ app_name }}'])
|
9
9
|
|
10
10
|
|
11
11
|
@router.get("/")
|
ohmyapi/db/__init__.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ohmyapi
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.15
|
4
4
|
Summary: A Django-like but async web-framework based on FastAPI and TortoiseORM.
|
5
5
|
License-Expression: MIT
|
6
6
|
Keywords: fastapi,tortoise,orm,async,web-framework
|
@@ -52,11 +52,11 @@ It is ***blazingly fast***, ***fun to use*** and comes with ***batteries include
|
|
52
52
|
- Highly configurable and customizable
|
53
53
|
- 100% async
|
54
54
|
|
55
|
-
|
55
|
+
**Goals**
|
56
56
|
|
57
57
|
- combine FastAPI, TortoiseORM and Aerich migrations into a high-productivity web-application framework
|
58
|
-
-
|
59
|
-
- while ***AVOIDING***
|
58
|
+
- tie everything neatly together into a concise API
|
59
|
+
- while ***AVOIDING*** any additional abstractions ontop of Tortoise's model-system or FastAPI's routing system
|
60
60
|
|
61
61
|
---
|
62
62
|
|
@@ -173,8 +173,8 @@ async def list():
|
|
173
173
|
@router.get("/:id")
|
174
174
|
async def get(id: str):
|
175
175
|
try:
|
176
|
-
|
177
|
-
return await Tournament.Schema.one(
|
176
|
+
tournament = await Tournament.get(pk=id)
|
177
|
+
return await Tournament.Schema.one.form_orm(tournament)
|
178
178
|
except DoesNotExist:
|
179
179
|
raise HTTPException(status_code=404, detail="item not found")
|
180
180
|
|
@@ -1,25 +1,25 @@
|
|
1
1
|
ohmyapi/__init__.py,sha256=UmLNQImTbKvHEgwQB2Wsyl6fq88X92imL9QZYJpQX4I,18
|
2
2
|
ohmyapi/__main__.py,sha256=wcCrL4PjG51r5wVKqJhcoJPTLfHW0wNbD31DrUN0MWI,28
|
3
3
|
ohmyapi/builtin/auth/__init__.py,sha256=TY1RKgwWmJ6FKz_v4J3m0Ang69qSmtVDLe4rqjLk4-E,69
|
4
|
-
ohmyapi/builtin/auth/models.py,sha256=
|
4
|
+
ohmyapi/builtin/auth/models.py,sha256=ubdDwVKgU8q8K58a_lR93xCveQGcdM8hTyusgVx8rK0,1687
|
5
5
|
ohmyapi/builtin/auth/permissions.py,sha256=jf-I2b9rIOw2EF4Kga-_Bz1ZPPHU0vHNaXGrDQSwhSI,145
|
6
|
-
ohmyapi/builtin/auth/routes.py,sha256=
|
6
|
+
ohmyapi/builtin/auth/routes.py,sha256=re3w7fZ9q9tUXDsQtkFcKizuEmtjxnebVA2lIO7afkM,5545
|
7
7
|
ohmyapi/cli.py,sha256=Mip1eBKYyu1hmUHbNW-1kSMc05EJOTVXqdI0c0r_B4g,4440
|
8
8
|
ohmyapi/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
ohmyapi/core/runtime.py,sha256=l5zffc4VTwQOo7G9mfiYHsPGapMONRX_jtO_z9QaKHU,8577
|
10
10
|
ohmyapi/core/scaffolding.py,sha256=iMymscokJ-YqzB0ZTC-gcc2T71o73577j9tnb2x8lH8,2572
|
11
11
|
ohmyapi/core/templates/app/__init__.py.j2,sha256=QwVIQVUGZVhdH1d4NrvL7NTsK4-T4cihzYs8UVX2dt4,43
|
12
12
|
ohmyapi/core/templates/app/models.py.j2,sha256=_3w-vFJ5fgsmncsCv34k_wyCMF78jufbSSglns4gbb0,119
|
13
|
-
ohmyapi/core/templates/app/routes.py.j2,sha256=
|
13
|
+
ohmyapi/core/templates/app/routes.py.j2,sha256=MoaAgzTkbr0GbuEic_fKn0PkCLERK8bB-mDlssOxYzE,438
|
14
14
|
ohmyapi/core/templates/project/README.md.j2,sha256=SjR4JIrg-8XRE-UntUDwiw8jDpYitD_UjwoKkYJ7GLw,22
|
15
15
|
ohmyapi/core/templates/project/pyproject.toml.j2,sha256=X0VS6YT9aL3vpHFKPTfLFsdpD8423nY57ySQpSTMxmQ,895
|
16
16
|
ohmyapi/core/templates/project/settings.py.j2,sha256=RBKGB8MZWPM3Bp0a57Y1YrSvSXxh502TUnJqbbu48Ig,138
|
17
|
-
ohmyapi/db/__init__.py,sha256=
|
17
|
+
ohmyapi/db/__init__.py,sha256=T7AUWlEXD--WOn01mKPIpkxPVwmgYHZQ4vQo3ejOkgE,204
|
18
18
|
ohmyapi/db/exceptions.py,sha256=I7AubrdqQF_UvAvzKqz2ve08-BkXHzEWXnwG300StHE,35
|
19
19
|
ohmyapi/db/model/__init__.py,sha256=k3StTNuKatpwZo_Z5JBFa-927eJrzibFE8U4SA82asc,32
|
20
20
|
ohmyapi/db/model/model.py,sha256=BajFtLlQ1s0mZ2hj-_JNQhLQmxuVe-Lw2LuW5t2C7Rw,1579
|
21
21
|
ohmyapi/router.py,sha256=hutccsrP9RT8W5O6uBDhOJehwqrkRoPzaUI5zoHPh9A,55
|
22
|
-
ohmyapi-0.1.
|
23
|
-
ohmyapi-0.1.
|
24
|
-
ohmyapi-0.1.
|
25
|
-
ohmyapi-0.1.
|
22
|
+
ohmyapi-0.1.15.dist-info/METADATA,sha256=NgXE-p4HJeL8KPMEqTKjAEICFmKYahEle-VOtq9Xoew,8766
|
23
|
+
ohmyapi-0.1.15.dist-info/WHEEL,sha256=M5asmiAlL6HEcOq52Yi5mmk9KmTVjY2RDPtO4p9DMrc,88
|
24
|
+
ohmyapi-0.1.15.dist-info/entry_points.txt,sha256=wb3lw8-meAlpiv1mqcQ3m25ukL7djagU_w89GkrC37k,43
|
25
|
+
ohmyapi-0.1.15.dist-info/RECORD,,
|
File without changes
|
File without changes
|