Added commands and user password hashing
parent
2cbdadd100
commit
36377d0b50
@ -0,0 +1,15 @@
|
|||||||
|
from apistar import Command
|
||||||
|
from apistar.backends.sqlalchemy_backend import Session
|
||||||
|
|
||||||
|
from models.schema import User
|
||||||
|
|
||||||
|
def create_user(session: Session, email, password):
|
||||||
|
user = User(email, password)
|
||||||
|
session.add(user)
|
||||||
|
session.commit()
|
||||||
|
print('User added')
|
||||||
|
|
||||||
|
|
||||||
|
commands = [
|
||||||
|
Command('create_user', create_user)
|
||||||
|
]
|
@ -1,8 +1,9 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
|
from models.util import alchemyencoder
|
||||||
|
|
||||||
from apistar import http
|
from apistar import http
|
||||||
from apistar.renderers import Renderer
|
from apistar.renderers import Renderer
|
||||||
from models.util import alchemyencoder
|
|
||||||
|
|
||||||
|
|
||||||
class JSONRenderer(Renderer):
|
class JSONRenderer(Renderer):
|
Loading…
Reference in New Issue