mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
Work in progress, skeleton of the api created and testing started. Need to fix authentication tests.
This commit is contained in:
20
app/dao/users_dao.py
Normal file
20
app/dao/users_dao.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy.orm import load_only
|
||||
|
||||
from app import db
|
||||
from app.models import User
|
||||
|
||||
|
||||
def create_user(email_address):
|
||||
user = User(email_address=email_address,
|
||||
created_at=datetime.now())
|
||||
db.session.add(user)
|
||||
db.session.commit()
|
||||
return user.id
|
||||
|
||||
|
||||
def get_users(user_id=None):
|
||||
if user_id:
|
||||
return User.query.filter_by(id=user_id).one()
|
||||
return User.query.filter_by().all()
|
||||
Reference in New Issue
Block a user