- new endpoint to check the token for an org invitation.

- new endpoint to add user to organisation
- new endpoint to return users for an organisation
This commit is contained in:
Rebecca Law
2018-02-20 17:09:16 +00:00
parent 57a174aeb4
commit 13ef2d7bae
11 changed files with 125 additions and 17 deletions

View File

@@ -116,6 +116,10 @@ class User(db.Model):
'Service',
secondary='user_to_service',
backref=db.backref('user_to_service', lazy='dynamic'))
organisations = db.relationship(
'Organisation',
secondary='user_to_organisation',
backref=db.backref('user_to_organisation', lazy='dynamic'))
@property
def password(self):
@@ -245,8 +249,8 @@ class Organisation(db.Model):
users = db.relationship(
'User',
secondary='user_to_organisation',
backref=db.backref('organisations', lazy='dynamic'))
secondary=user_to_organisation,
backref=db.backref('user_to_organisation', lazy='dynamic'))
def serialize(self):
serialized = {
@@ -1447,10 +1451,10 @@ class InvitedOrganisationUser(db.Model):
def serialize(self):
return {
'id': self.id,
'id': str(self.id),
'email_address': self.email_address,
'invited_by': self.invited_by_id,
'organisation': self.organisation_id,
'invited_by': str(self.invited_by_id),
'organisation': str(self.organisation_id),
'created_at': self.created_at.strftime(DATETIME_FORMAT),
'status': self.status
}