ohmyapi 0.1.13__tar.gz → 0.1.14__tar.gz
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-0.1.13 → ohmyapi-0.1.14}/PKG-INFO +6 -6
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/README.md +5 -5
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/pyproject.toml +1 -1
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/builtin/auth/models.py +12 -13
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/builtin/auth/routes.py +1 -1
- ohmyapi-0.1.14/src/ohmyapi/db/__init__.py +10 -0
- ohmyapi-0.1.13/src/ohmyapi/db/__init__.py +0 -3
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/__init__.py +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/__main__.py +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/builtin/auth/__init__.py +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/builtin/auth/permissions.py +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/cli.py +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/core/__init__.py +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/core/runtime.py +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/core/scaffolding.py +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/core/templates/app/__init__.py.j2 +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/core/templates/app/models.py.j2 +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/core/templates/app/routes.py.j2 +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/core/templates/project/README.md.j2 +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/core/templates/project/pyproject.toml.j2 +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/core/templates/project/settings.py.j2 +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/db/exceptions.py +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/db/model/__init__.py +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/db/model/model.py +0 -0
- {ohmyapi-0.1.13 → ohmyapi-0.1.14}/src/ohmyapi/router.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ohmyapi
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.14
|
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
|
|
@@ -20,11 +20,11 @@ It is ***blazingly fast***, ***fun to use*** and comes with ***batteries include
|
|
20
20
|
- Highly configurable and customizable
|
21
21
|
- 100% async
|
22
22
|
|
23
|
-
|
23
|
+
**Goals**
|
24
24
|
|
25
25
|
- combine FastAPI, TortoiseORM and Aerich migrations into a high-productivity web-application framework
|
26
|
-
-
|
27
|
-
- while ***AVOIDING***
|
26
|
+
- tie everything neatly together into a concise API
|
27
|
+
- while ***AVOIDING*** any additional abstractions ontop of Tortoise's model-system or FastAPI's routing system
|
28
28
|
|
29
29
|
---
|
30
30
|
|
@@ -141,8 +141,8 @@ async def list():
|
|
141
141
|
@router.get("/:id")
|
142
142
|
async def get(id: str):
|
143
143
|
try:
|
144
|
-
|
145
|
-
return await Tournament.Schema.one(
|
144
|
+
tournament = await Tournament.get(pk=id)
|
145
|
+
return await Tournament.Schema.one.form_orm(tournament)
|
146
146
|
except DoesNotExist:
|
147
147
|
raise HTTPException(status_code=404, detail="item not found")
|
148
148
|
|
@@ -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
|
-
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|